Magicoder: Source Code Is All You Need
Paper β’ 2312.02120 β’ Published β’ 83
id int64 0 5k | task_category stringclasses 1
value | messages listlengths 3 3 |
|---|---|---|
1,601 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with creating a Rust module system for a 2D game engine. The game engine consists of several modules, each serving a speci... |
2,725 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a function to determine whether a given unsigned 16-bit number represents a negative number or not. The ... |
4,310 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a module in Rust that provides common utility functions for various purposes. Your goal is to create a m... |
499 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a thread OOM (Out of Memory) handler in Rust. The OOM handler is a function that is called when a thread... |
2,590 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a custom error handling mechanism in a Rust program. The given code snippet shows a custom error type `E... |
670 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are working on a cryptographic verification system that involves committing to certain values and then performing operations on these... |
3,351 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a simple tablist management system for a multiplayer game server. The tablist is a list of players displ... |
1,339 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a generic graph traversal algorithm using Rust. The algorithm should be able to traverse a graph and yie... |
2,684 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a simplified version of a 3D graphics rendering engine in Rust. The code snippet provided is part of the... |
4,224 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a custom debug formatter for a transaction type in a blockchain application. The transaction type, `TxMa... |
4,554 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with creating a Rust function that compresses a given source data using the Zstandard (Zstd) compression algorithm. The pr... |
2,492 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a trait for a network parameter struct in Rust. The trait, `NetworkParams`, will define a method to calc... |
1,974 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are given a code snippet that appears to be part of a larger program. Your task is to identify the missing part of the code and compl... |
4,198 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a search algorithm for a custom data structure called `Ebb`. The `Ebb` data structure represents a value... |
1,785 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with creating a program that simulates a simple game of dice. The game involves rolling a six-sided die and performing dif... |
3,161 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a simplified version of a command execution system in Rust. The system will involve defining a struct, i... |
2,564 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a macro in Rust that generates a function to calculate the nth Fibonacci number using dynamic programmin... |
4,161 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a simple HTTP redirect system using the provided code snippet as a starting point. Your goal is to creat... |
1,758 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a one-dimensional dynamics simulation and comparing it with an analytic solution. The dynamics are gover... |
393 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a function to fill a collection in a database with a specified number of elements. The database is repre... |
3,844 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with creating a program that simulates a simple game of \"Reaction Time Test\". In this game, the player is required to pr... |
890 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a custom error type and handling errors in a Rust application. Your goal is to create a custom error typ... |
4,531 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a simple bit manipulation function in Rust. Your goal is to create a method that clears a specific bit i... |
4,848 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a simple configuration builder in Rust. The builder should allow users to set input configuration, outpu... |
3,523 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with creating a Rust function to verify a transaction for a blockchain application. The function should take in transactio... |
2,141 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a smart contract for a messaging system on the NEAR blockchain. The smart contract includes a function `... |
2,618 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are given a Rust code snippet that defines a set of functions to access and manipulate control bits for enabling/disabling various pe... |
4,961 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with creating a program that processes and writes data to a file. The program should read input from a given file, perform... |
1,069 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with creating a Rust function that loads Gitlab configuration from environment variables and returns a `GitlabConfig` stru... |
122 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with creating a custom styling system for a user interface library. The library provides a trait `StyleSheet` and a struct... |
3,251 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are given a program that processes input related to caves and tunnels. The input consists of a list of caves and a series of tunnel c... |
117 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with creating a Rust function that renames variants in an enum and then testing the functionality using snapshot testing. ... |
581 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a function that parses and prints a given input string based on certain rules. The input string consists... |
2,831 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a Rust module that provides utility functions for working with hashmaps and unwinding results. The modul... |
2,108 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a simple mock module for a TerraSwap protocol in Rust. The TerraSwap protocol is a decentralized exchang... |
2,926 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a function that simulates the behavior of the `run_test` function used in the given code snippet. The `r... |
2,101 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with creating a simplified version of a procedural macro in Rust. Procedural macros are a powerful feature in Rust that al... |
68 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with creating a program that processes user agent strings using regular expressions. A user agent string is a piece of dat... |
261 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a simple ownership system for entities in a game. The provided code snippet is a part of a Rust program ... |
2,013 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are given a Rust code snippet that initializes an empty vector `new_pixels` and iterates over a range of values for `col` from 0 to `... |
4,032 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a simple keyboard input handling system for a 2D game using the Rust programming language. The provided ... |
3,114 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with creating a program that simulates a simple multi-threading scenario. Your program should spawn a specified number of ... |
1,886 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with creating a simple web application using the Perseus framework. The Perseus framework is a Rust library for building w... |
3,744 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a simple module system in Rust. The given code snippet is a part of a Rust program that uses modules and... |
74 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a custom data type in Rust that represents a tagged value. The tag is an enum variant, and the value is ... |
1,750 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a function to process time entries and generate a report based on the time spans. The time entries are r... |
19 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with creating a simple FPS (frames per second) tracking system for a game. Your goal is to implement a function that calcu... |
2,670 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a simple curry function in Rust. Currying is the technique of converting a function that takes multiple ... |
6 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a message broadcasting system using the provided `Mouthpiece` struct. The `Mouthpiece` struct has a fiel... |
3,457 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with creating a Rust function that converts a given JSON object into a pretty-printed string. The function should take a J... |
4,576 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with creating a test case for a cryptocurrency lending platform. The platform uses a price oracle to determine the value o... |
2,801 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a sorting and parsing algorithm for a custom data structure. The data structure consists of a sequence o... |
3,092 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a macro in Rust that will generate a custom print statement for a markdown template. The macro should ta... |
1,134 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with creating a program that manipulates file paths using the `PathBuf` struct from the Rust standard library. The program... |
1,834 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are given a Rust code snippet that contains an incomplete function named `subtract`. Your task is to complete the `subtract` function... |
1,656 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a function that calculates the number of set bits (bits with value 1) in a given 32-bit unsigned integer... |
4,510 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a custom error type for a Rust application. Your error type should be able to represent two distinct err... |
73 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are working on a web application that utilizes Rust and WebAssembly (Wasm) for high-performance computing. Your task is to implement ... |
2,468 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a language translation feature for a cryptocurrency wallet application. The application currently suppor... |
230 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a module system for a software project. The module system should allow clients to access and utilize var... |
295 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with creating a program that manages a directory structure for a file system. The program should be able to create a new d... |
3,104 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a simple game logic for a grid-based game. The game consists of a grid of colored cells, and the player ... |
3,383 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a function that takes a string as input and returns a modified version of the string based on specific r... |
2,917 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with creating a Rust program that simulates a simple currency exchange rate service. The program should use asynchronous p... |
4,202 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a simple calculator using the provided code snippet as a starting point. The code snippet includes a mat... |
1,728 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a parser for a custom data format. The parser needs to handle offsets within the data and provide a meth... |
4,182 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a function that converts a given weight in pounds to its equivalent in slugs. The slug is a unit of mass... |
1,912 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a simple inflector library in Rust. An inflector library is used to convert words between their singular... |
1,095 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a function that processes a given input and returns a specific output based on the provided requirements... |
1,910 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with creating a Rust macro that generates a custom implementation for a trait based on the input struct. The macro should ... |
3,179 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a reverse Polish notation (RPN) calculator. Reverse Polish notation is a mathematical notation in which ... |
2,438 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a function to manipulate C strings in a Rust library. The function `haystack_value_get_xstr_type` takes ... |
744 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with creating a Rust function that serializes a given struct into a JSON string using the `serde_json` crate. Your functio... |
2,770 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a file management system for a software project. The system should provide functionality to read and man... |
4,619 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a function that processes a stream of CSS tokens and returns the number of comments found in the input. ... |
2,352 | oss_instruct | [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with implementing a function that performs a specific string manipulation. Given a string `hello` and another string `worl... |
Magicoder-OSS-Instruct-Rust is a high-quality, syntax-verified dataset of 3,909 Rust coding instructions derived from real-world open-source GitHub projects.
This dataset is extracted from ise-uiuc/Magicoder-OSS-Instruct-75K, filtered specifically for Rust, and validated via in-memory compiler checks. No language translation was applied; the dataset remains in its original English format.
The dataset was processed using the following technical pipeline:
lang: rust, removing all other programming languages.rustc RAM Check): All code snippets were evaluated on-the-fly via rustc --crate-type=lib through standard input (stdin). Entries with broken syntax, unclosed braces, or invalid AST structures were automatically discarded.messages) format for direct compatibility with SFT and Fine-Tuning frameworks (LoRA / QLoRA).Out of the original 75,000 multi-language samples:
rustc syntax checks were removed.The dataset follows the ChatML (messages) format:
system: System prompt assigning the expert Rust developer role.user: Rust programming task, module design requirement, or algorithmic problem.assistant: Corresponding idiomatic Rust solution.| Field | Type | Description |
|---|---|---|
id |
int64 |
Original dataset index |
task_category |
string |
Task category identifier (oss_instruct) |
messages |
list |
Conversation history containing role and content (system, user, assistant) |
{
"id": 1601,
"task_category": "oss_instruct",
"messages": [
{
"role": "system",
"content": "You are an expert assistant who solves Rust programming problems and generates correct code."
},
{
"role": "user",
"content": "You are tasked with creating a Rust module system for a 2D game engine..."
},
{
"role": "assistant",
"content": "```rust\n// input_handler.rs\npub mod input_handler {\n pub struct InputHandler {\n // Implementation details\n }\n}\n\n// input.rs\npub mod input {\n pub use input_handler::InputHandler;\n pub use keyboard::Keyboard;\n pub use mouse::Mouse;\n pub use gamepad::Gamepad;\n}\n```\n\nIn this solution, we have created the input modules..."
}
]
}
from datasets import load_dataset
dataset = load_dataset("WrittenWithRust/Magicoder-OSS-Instruct-Rust-3.9K")
print(dataset["train"][0])
@article{wei2023magicoder,
title={Magicoder: Source Code Is All You Need},
author={Wei, Yuxiang and Wang, Zhe and Liu, Jiawei and Ding, Yuhang and Zhang, Lingming},
journal={arXiv preprint arXiv:2312.02120},
year={2023}
}