| --- |
| language: |
| - en |
| license: apache-2.0 |
| size_categories: |
| - 100K<n<1M |
| task_categories: |
| - text-generation |
| pretty_name: Code Explanation SFT (100K) |
| tags: |
| - code-explanation |
| - programming |
| - software-engineering |
| - developer-tools |
| - documentation |
| - education |
| - sft |
| - supervised-fine-tuning |
| - synthetic |
| configs: |
| - config_name: default |
| data_files: |
| - split: train |
| path: code-explanation-sft-100k.jsonl |
| --- |
| |
| # Code Explanation SFT (100K) |
|
|
| 100,000 ShareGPT conversations demonstrating high-quality code explanation across 10 programming languages and 22 technical concepts. Each example explains real code clearly — with line-by-line breakdowns, analogies for unfamiliar concepts, practical examples, and audience-appropriate vocabulary. |
|
|
| ## Motivation |
|
|
| Code explanation is one of the most common developer tool use cases — and models routinely fail at it: |
|
|
| - **Superficial explanations**: "This function adds two numbers" instead of explaining why the code is structured the way it is |
| - **No audience calibration**: Explaining Python decorators to a senior developer the same way as to a beginner |
| - **Missing the "why"**: Describing what the code does without explaining the design decision or the problem it solves |
| - **Wall of text**: Long prose explanations when a table or annotated example would be clearer |
| - **Ignoring the language context**: Explaining Go syntax to a Python developer without Python analogues, or explaining Rust lifetimes without context on what problem they solve |
|
|
| This dataset trains models to explain code at the right level for the reader, with appropriate analogies, examples, and structure. |
|
|
| ## Dataset Description |
|
|
| **100,000 conversations** across 10 languages and 22 concepts: |
|
|
| ### Language Distribution |
|
|
| | Language | Count | % | |
| |---|---|---| |
| | Python | ~45,000 | 45% | |
| | JavaScript/TypeScript | ~13,500 | 13.5% | |
| | SQL | ~9,000 | 9% | |
| | YAML (Docker, Kubernetes) | ~9,000 | 9% | |
| | Rust | ~4,500 | 4.5% | |
| | Go | ~4,500 | 4.5% | |
| | Bash | ~4,500 | 4.5% | |
| | CSS | ~4,500 | 4.5% | |
| | GraphQL | ~4,500 | 4.5% | |
|
|
| ### Concepts Covered |
|
|
| Binary search, array methods, window functions, React hooks, Fibonacci algorithms, Python decorators, generics and interfaces (TypeScript, Java comparison), Rust lifetimes, shell scripting, async/await, dataclasses and ABC, Docker Compose, closures, Kubernetes deployments, tree traversal, database indexes, generators, GraphQL schemas, context managers, Redis caching, CSS Flexbox, JWT authentication, and more. |
|
|
| ## Format |
|
|
| ```json |
| { |
| "conversations": [ |
| { |
| "from": "human", |
| "value": "Explain what this Python function does and how it works:\n\n```python\ndef binary_search(arr, target):\n ...\n```" |
| }, |
| { |
| "from": "gpt", |
| "value": "This function finds the position of a `target` value in a sorted array using binary search...\n\n**How it works:**\n..." |
| } |
| ], |
| "metadata": { |
| "language": "python", |
| "concept": "binary_search", |
| "explanation_level": "intermediate" |
| }, |
| "id": "abc123" |
| } |
| ``` |
| |
| ## Key Properties of Responses |
|
|
| **1. Audience awareness**: Explanations reference what the asker already knows. A Java developer learning Go gets Java analogues. A beginner gets analogies; an intermediate developer gets implementation details. |
|
|
| **2. Line-by-line breakdown when appropriate**: Complex code is annotated line by line rather than described in aggregate. The reader can follow along. |
|
|
| **3. Why, not just what**: Every explanation answers both "what does this do" and "why is it written this way." Design decisions are surfaced, not glossed over. |
|
|
| **4. Practical examples**: Abstract concepts are grounded with concrete, runnable examples showing input/output. |
|
|
| **5. Gotchas and caveats**: Common mistakes and limitations are flagged — the things that burn developers who don't know about them (Python's mutable default arguments, JWT statelessness, SQL N+1 problem, etc.). |
|
|
| **6. Comparison to known concepts**: Unfamiliar concepts are anchored to familiar ones (Rust's `?` is like Java's checked exceptions, GraphQL resolvers work like REST endpoints, etc.). |
|
|
| ## Use Cases |
|
|
| - SFT fine-tuning for coding AI assistants (GitHub Copilot, Cursor, Replit) |
| - Training AI code documentation generators |
| - Building AI tutors for programming education platforms |
| - Improving model performance on code comprehension tasks |
| - Training models for developer onboarding tools |
| - Building AI for code review and explanation in IDE extensions |
|
|
| ## License |
|
|
| Apache 2.0 |
|
|