metadata
license: mit
language:
- en
tags:
- rust
- code
- instruction-tuning
- magicoder
- oss-instruct
pretty_name: Magicoder OSS Instruct Rust (3.9K Cleaned)
size_categories:
- 1K<n<10K
task_categories:
- text-generation
๐ฆ Magicoder-OSS-Instruct-Rust (3.9K Cleaned)
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.
โ๏ธ Filtering and Verification Methodology
The dataset was processed using the following technical pipeline:
- Language Filtering: Extracted entries strictly where
lang: rust, removing all other programming languages. - In-Memory Syntax Validation (
rustcRAM Check): All code snippets were evaluated on-the-fly viarustc --crate-type=libthrough standard input (stdin). Entries with broken syntax, unclosed braces, or invalid AST structures were automatically discarded. - Format Standardization: Converted raw problem/solution pairs into standard ChatML (
messages) format for direct compatibility with SFT and Fine-Tuning frameworks (LoRA / QLoRA).
โ ๏ธ Filtering Summary (75K -> 3.9K)
Out of the original 75,000 multi-language samples:
- Non-Rust programming languages were filtered out.
- Incomplete snippets or entries failing
rustcsyntax checks were removed. - A clean, verified set of 3,909 high-quality Rust instructions was produced.
๐ Dataset Structure
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.
Schema Details
| 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) |
๐ก Example Entry
{
"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..."
}
]
}
๐ป Usage
from datasets import load_dataset
dataset = load_dataset("WrittenWithRust/Magicoder-OSS-Instruct-Rust-3.9K")
print(dataset["train"][0])
๐ Citation
@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}
}