Team Ai
Datasetpublic

WrittenWithRust/Magicoder-OSS-Instruct-Rust-cleaned-3.9K

🦀 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… See the full description on the dataset page: https://huggingface.co/datasets/WrittenWithRust/Magicoder-OSS-Instruct-Rust-cleaned-3.9K.

sourceHugging Facemitupdated 1mo agoView on Hugging Face
1likes232downloads
Dataset Card

🦀 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 (`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.
  • —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:

  1. 1.Non-Rust programming languages were filtered out.
  2. 2.Incomplete snippets or entries failing rustc syntax checks were removed.
  3. 3.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

FieldTypeDescription
idint64Original dataset index
task_categorystringTask category identifier (oss_instruct)
messageslistConversation history containing role and content (system, user, assistant)

💡 Example Entry

json
{
  "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

python
from datasets import load_dataset

dataset = load_dataset("WrittenWithRust/Magicoder-OSS-Instruct-Rust-3.9K")
print(dataset["train"][0])

📜 Citation

bibtex
@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}
}