Kureiwa/x86_64-freestanding-corpus
x86_64-freestanding-corpus 94,546 compilable and executable x86_64 code samples for freestanding, no-libc systems programming. Every row has a natural language prompt, difficulty level, and tag-based filtering. 93,986 rows (99.4%) are verified to compile with -Werror and exit cleanly when executed. ~10,017,133 tokens total. What this dataset is (and isn't) This is a domain-adaptation + SFT corpus for an existing code model, not a from-scratch pretraining set. At… See the full description on the dataset page: https://huggingface.co/datasets/Kureiwa/x86_64-freestanding-corpus.
x86_64-freestanding-corpus
94,546 compilable and executable x86_64 code samples for freestanding, no-libc systems programming. Every row has a natural language prompt, difficulty level, and tag-based filtering. 93,986 rows (99.4%) are verified to compile with -Werror and exit cleanly when executed. ~10,017,133 tokens total.
What this dataset is (and isn't)
This is a domain-adaptation + SFT corpus for an existing code model, not a from-scratch pretraining set. At ~10017K tokens it is far too small for pretraining. Use it to:
- Continued pretraining: mix at 5-15% weight with a general code corpus (The Stack v2, etc.) when continuing pretraining of a base model like Qwen2.5-Coder, DeepSeek-Coder, or CodeLlama.
- Instruction tuning (SFT): the
promptcolumn provides natural language instructions paired with verified code. Use directly for SFT. - Evaluation: hold out a subset and check pass@k against
expected_stdoutandassertions.
Verification
Build verification: every row compiled with gcc 14.2.0, g++ 14.2.0, nasm 2.16.01, ld 2.44. Run verification: every runnable row was executed as a static binary and exited cleanly.
The only rows with verified_run=False are UEFI scenarios (runtime=uefi) which need UEFI firmware to execute. These are build-verified and correct code.
Subsets
kernel_bypass (5,850 rows)
Ring-3-safe code that bypasses the kernel using userspace-accessible CPU instructions (rdtsc, cpuid, rdpmc, wrpkru, atomics, fences, fxsave, sse).
syscall (20,619 rows)
Raw syscall instruction with the x86_64 Linux ABI. No libc.
fundamentals (58,014 rows)
Basic programming constructs (print, arithmetic, math, loops, sorting, strings, bit ops, recursion) implemented freestanding.
advanced (4,600 rows)
Barriers, fault handlers, spectre mitigation, SIMD, UEFI, PIC, cpuid power.
quirks (5,463 rows)
C/C++/ASM language quirks: RAII, version-specific features, ISA instructions.
Schema
Usage
Load with the datasets library
from datasets import load_dataset
# Load a single subset
ds = load_dataset("Kureiwa/x86_64-freestanding-corpus", "fundamentals")
for row in ds["train"]:
print(row["prompt"])
print(row["code"][:200])
break
# Load all subsets
for subset in ["kernel_bypass", "syscall", "fundamentals", "advanced", "quirks"]:
ds = load_dataset("Kureiwa/x86_64-freestanding-corpus", subset)
print(f"{subset}: {len(ds['train'])} rows")Load with pyarrow
import pyarrow.parquet as pq
t = pq.read_table("data/fundamentals.parquet")
df = t.to_pandas()
print(df[["id", "lang", "scenario", "difficulty", "verified_run"]].head())Filter for training
# Only run-verified rows
df = df[df["verified_run"] == True]
# Only easy difficulty
df = df[df["difficulty"] == "easy"]
# Only C99
df = df[df["lang"] == "c99"]
# Only scenarios with assertions
df = df[df["assertions"] != ""]Compile and run a sample
echo '<code from the code column>' > file.c
gcc -std=c99 -m64 -nostdlib -ffreestanding -static -no-pie -Werror file.c -o file
./file; echo "exit: $?"Languages
Build commands
- C:
gcc -std=cNN -m64 -nostdlib -ffreestanding -static -no-pie -Werror file.c -o file - C++:
g++ -std=c++NN -m64 -nostdlib -ffreestanding -static -no-pie -fno-exceptions -fno-rtti -Werror file.cpp -o file - ASM:
nasm -f elf64 file.s -o file.o && ld -nostdlib -static file.o -o file
Limitations
- No composition examples yet: every row is a single isolated scenario. A composition subset (multi-scenario programs, 100+ lines) is planned.
- Output verification is partial:
expected_stdoutis empty for most rows. Runtimeassertionsare present for ~5% of rows. Full correctness verification is planned. - Entry point boilerplate: most rows use
void _start(void). Variation in entry patterns is planned to prevent memorization. - No multi-file examples: every row is a single file. Multi-file support is planned.
Generation method
12 GLM-5.2 sub-agents wrote hand-curated seed templates. A deterministic expander produced variants. After generation, every row was build-verified and run-verified. Failing rows were fixed or filtered out.
The kernel_bypass subset was inspired by EoSD by rui-727, which demonstrates that "kernel bypass" means using ring-3-safe userspace instructions, not ring-0 privileged instructions.
Toolchain
- gcc 14.2.0, g++ 14.2.0, ld 2.44
- nasm 2.16.01
- Linux x86_64
License
MIT. Generated by GLM-5.2 (Z.ai).
