| | --- |
| | license: other |
| | task_categories: |
| | - text-generation |
| | language: |
| | - en |
| | tags: |
| | - code |
| | - kernel |
| | - osdev |
| | - linux |
| | - freebsd |
| | - openbsd |
| | - netbsd |
| | - rust |
| | - systems-programming |
| | pretty_name: KernelLLM-2 |
| | size_categories: |
| | - 100K<n<1M |
| | --- |
| | |
| | # KernelLLM-2 Dataset |
| |
|
| | A high-quality raw dataset for training and fine-tuning LLMs on Operating System Development, significantly expanded for the second version. |
| |
|
| | ## Overview |
| |
|
| | This dataset combines raw source code from a variety of mature and hobbyist operating system kernels with thousands of expert-level technical discussions and critiques from the Linux Kernel Mailing List, plus unique Git logic-diff traces. |
| |
|
| | > [!NOTE] |
| | > The source code included in this dataset represents the latest stable versions of the respective repositories as of **February 27th 2026**. |
| |
|
| | ## Dataset Structure |
| |
|
| | The dataset is provided in **Parquet** format for optimal compression and integration with the `datasets` library. |
| |
|
| | ### 1. `kernelllm_dataset_v2.parquet` (~1.8 GB) |
| | **Unified Knowledge Base:** |
| | - **Files/Entries:** 367,769 |
| | - **Size:** ~1.8 GB (Parquet), ~6.1 GB (Raw JSONL) |
| | - **Sources:** 20+ Kernel and System Projects. |
| | - **Cleaning:** |
| | - Preserved `SPDX-License-Identifier` and `Copyright` lines while removing generic licensing boilerplate headers to prioritize logic. |
| | - Exact and "smart" deduplication across repositories. |
| | - Excluded files < 100 characters to remove boilerplate headers. |
| |
|
| | #### Repository Distribution: |
| | | Repository | Entry Count | |
| | |------------|------------| |
| | | NetBSD | 83,959 | |
| | | Linux | 69,197 | |
| | | FreeBSD | 50,127 | |
| | | OpenBSD | 27,522 | |
| | | illumos | 24,703 | |
| | | Zephyr | 19,066 | |
| | | ReactOS | 17,688 | |
| | | Haiku | 15,472 | |
| | | U-Boot | 12,674 | |
| | | Coreboot | 12,082 | |
| | | SerenityOS | 9,159 | |
| | | QEMU | 7,029 | |
| | | EDK2 | 5,869 | |
| | | Xen Hypervisor | 2,311 | |
| | | musl libc | 1,875 | |
| | | GRUB | 1,706 | |
| | | Asterinas | 1,417 | |
| | | seL4 | 641 | |
| | | Limine | 151 | |
| | | Redox OS | 34 | |
| |
|
| | ### 2. Specialized Data Types |
| | - **`git_logdiff`:** (234 entries) Pairs commit messages with filtered logic-diffs to show how code evolves. |
| | - **`lkml_critique`:** (~26,600 pairs) Contentious technical discussions pairing code snippets with maintainer feedback. |
| |
|
| | ### 3. Dataset Schema |
| |
|
| | The unified dataset contains three primary data types, each with a specific schema: |
| |
|
| | #### Source Code (`data_type: "source"`) |
| | ```json |
| | { |
| | "data_type": "source", |
| | "source": "repository_name", |
| | "filepath": "relative/path/to/file.c", |
| | "code": "cleaned_source_code_content" |
| | } |
| | ``` |
| | |
| | #### Git Commit Diffs (`data_type: "git_logdiff"`) |
| | ```json |
| | { |
| | "data_type": "git_logdiff", |
| | "commit": "commit_sha_hash", |
| | "source": "repository_name", |
| | "message": "commit_message", |
| | "code": "git_diff_output" |
| | } |
| | ``` |
| | |
| | #### LKML Critiques (`data_type: "lkml_critique"`) |
| | ```json |
| | { |
| | "data_type": "lkml_critique", |
| | "source": "mailing_list_name", |
| | "subject": "[PATCH] subject_line", |
| | "code": "patch_content", |
| | "critique": "maintainer_feedback", |
| | "metadata": { |
| | "author": "reviewer_email", |
| | "date": "email_date", |
| | "thread_id": "thread_identifier", |
| | "is_openbsd": boolean |
| | } |
| | } |
| | ``` |
| | |
| | #### Data Processing Features |
| | - **Deduplication:** Content-based hashing with normalized whitespace |
| | - **License Header Cleaning:** Preserves SPDX identifiers and copyright lines while removing generic boilerplate |
| | - **Size Filtering:** Excludes files under 100 characters |
| | - **Git-specific:** Deduplicates by commit SHA when available |
| | - **Critique-specific:** Deduplicates based on code + critique content pairs |
| |
|
| | ## Dataset Release Strategy |
| |
|
| | This is the **Raw** version of the dataset. It is intended for: |
| | 1. **Intermediate Training:** Pre-training on high-quality systems code. |
| | 2. **Fine-Tuning:** Instruction-tuning models to act as "Kernel Maintainers". |
| | 3. **Research:** Analyzing developer communication patterns in low-level systems. |
| |
|
| | ## Licensing and Usage |
| |
|
| | This dataset is a collection of publicly available open-source code and mailing list archives. It contains content governed by multiple licenses. For full details, see the [LICENSE](LICENSE) file. |
| |
|
| | * **GNU General Public License (GPL) v2/v3** (Linux, seL4, Xen, QEMU, coreboot, GRUB, U-Boot, ReactOS) |
| | * **Common Development and Distribution License (CDDL)** (illumos) |
| | * **BSD 2-Clause / 3-Clause / 4-Clause & ISC** (FreeBSD, NetBSD, OpenBSD, SerenityOS, Limine) |
| | * **MIT License** (Redox, Haiku, musl) |
| | * **Apache License 2.0** (Zephyr) |
| | * **Mozilla Public License (MPL) 2.0** (Asterinas) |
| | * **BSD-2-Clause-Patent** (EDK2) |
| |
|
| | ### Disclaimer |
| |
|
| | 1. **Original Licenses Apply:** The individual source code files and mailing list archives contained in this dataset remain governed by their original respective licenses. |
| | 2. **Attribution:** The `source` and `author` fields (where available) facilitate attribution. |
| | 3. **Research & Ethics:** This dataset is provided primarily for research and educational purposes in the field of LLM training and systems programming analysis. |
| | 4. **License Compliance:** Users of this dataset are responsible for ensuring that their use of the data complies with all applicable licenses. |
| |
|
| | ### Opt-out |
| |
|
| | If you are a maintainer of one of the included repositories and would like your data removed from future versions of this dataset, please open an issue on the Hugging Face dataset page. |
| |
|