YOON1v/Apex-1-DPO

Model

APEX-1 (DPO)

1

3 commits

2 linked in READMEs

updated Jul 23, 2026

See the code

README

APEX-1 (DPO)

A from-scratch 1.12B decoder-only LLM, pretrained on ~20B tokens and aligned with DPO.

Full code, architecture writeup, and training diary: github.com/DW-dev-UE/LLM-from-scratch β€” see BENCHMARK v2 for the full benchmark writeup this card summarizes.

This checkpoint is the DPO-aligned release (pretrain β†’ SFT β†’ DPO).

Model details

ArchitectureDecoder-only Transformer, GQA (16Q/4KV) + RoPE (ΞΈ=500K) + SwiGLU + RMSNorm + QK-Norm, weight tying
Parameters1,119.5M (measured)
Layers Β· d_model24 Β· 2048
Context length4096 (trained at 2048)
Vocab32,000 (byte-level BPE, English-only)
Weightsstored as float32 (~4.48GB); load with dtype=torch.bfloat16 to halve memory
Pretrain51K steps Β· ~20B tokens Β· v3-en corpus (English web + code + math)
Post-trainingSFT (8.4K steps) β†’ RLVR attempted and abandoned (no learning signal at this scale β€” see BENCHMARK-v2.md Β§6) β†’ DPO (60K preference pairs)
HF conversionWeights map 1:1 onto Qwen3ForCausalLM (GQA+RoPE+SwiGLU+RMSNorm+QK-norm matches the Qwen3 block exactly). Verified by teacher-forced next-token argmax agreement against this model's own recorded benchmark generations, plus an A/B check confirming QK-norm is applied before RoPE (the Qwen3 convention)

Usage

This checkpoint expects the chat template below (system prompt + optional <THINKING> block) β€” see chat_template.jinja / ARCHITECTURE.md Β§7.1 in the repo for the exact format.

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained("YOON1v/Apex-1-DPO", dtype=torch.bfloat16).cuda()
tokenizer = AutoTokenizer.from_pretrained("YOON1v/Apex-1-DPO")

messages = [{"role": "user", "content": "Write a Python function that checks if a number is prime."}]
prompt = tokenizer.apply_chat_template(
    messages, tokenize=False, add_generation_prompt=True, enable_thinking=False)
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
out = model.generate(**inputs, max_new_tokens=256, do_sample=True, temperature=0.7, top_p=0.9)
print(tokenizer.decode(out[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))

Set enable_thinking=True to have the model reason inside <THINKING>...</THINKING> before answering. Per this model's own benchmark (see below), no-thinking mode currently scores higher β€” thinking mode tends to run long and cut into the answer budget.

Benchmarks

Standard suite (lm-evaluation-harness 0.4.12, bf16), compared against models trained on a similar token budget:

Apex-1 SFTApex-1 DPOTinyLlama-1.1B (3T tok)Pythia-1.0B (300B tok)
Commonsense avg, 7 tasks (0-shot)49.5449.6552.9948.30
MMLU (5-shot)24.8324.9025.3425.70
GSM8K (5-shot, strict)1.441.90β€”β€”
HumanEval (pass@1)8.548.549.151.83
MBPP (pass@1)4.805.20β€”β€”

DPO β‰₯ SFT on every metric above β€” no alignment tax. BoolQ 62.20 ranks 1st among TinyLlama-1.1B / Pythia-1.0B / OPT-1.3B. Apex-1 matches the 15Γ—-more-trained Pythia-1.0B on commonsense average and beats it on ARC β€” the most token-efficient entry among same-budget peers, and its HumanEval score is 4.7Γ— Pythia's despite the token gap.

Against the wider 2024–2025 small-model landscape (Llama-3.2-1B/9T, Qwen2.5-1.5B/18T, SmolLM2-1.7B/11T, OLMo-1B/2T), Apex-1 trails β€” expected given 450–900Γ— less training data, not an architecture gap. Full comparison table, benchmark provenance, and citations: see BENCHMARK-v2.md Β§5.4 in the repo.

[!NOTE] GSM8K/MBPP train splits partially overlap this model's SFT data (evaluation used the held-out test split); HumanEval is fully uncontaminated. See the repo's ckpt/lm_eval_Apex-1_COMPARISON.md for the raw numbers this card summarizes.

Known limitations

  • English-only (no multilingual pretraining data)
  • GSM8K / multi-step arithmetic reasoning is very weak (~2%) β€” this is why the project moved to DPO instead of RLVR for alignment (RLVR needs a non-trivial number of correct samples per group to produce a gradient; this model has too few)
  • MMLU sits at random-guess level (~25%), consistent with other 1B-scale models
  • Not instruction-tuned for multi-turn conversation beyond what the SFT/DPO mix covers

Training data

  • Pretrain: v3-en corpus (fineweb_edu, dclm, finemath4, cosmopedia2, code [python/js/java/c/cpp/sql/shell], finepdfs, wikipedia_en) β€” 80.8GB, ~20.3B tokens
  • SFT: HuggingFaceTB/smoltalk2 English subset, 538K examples (think:no-think β‰ˆ 1:2)
  • DPO: 60K preference pairs

License

Apache 2.0.

causal-lm
conversational
endpoints_compatible
from-scratch
model-index
qwen3
safetensors
text-generation
text-generation-inference
transformers

YOON1v/Apex-1-DPO

Model

APEX-1 (DPO)

1

3 commits

2 linked in READMEs

updated Jul 23, 2026

See the code

README

APEX-1 (DPO)

A from-scratch 1.12B decoder-only LLM, pretrained on ~20B tokens and aligned with DPO.

Full code, architecture writeup, and training diary: github.com/DW-dev-UE/LLM-from-scratch β€” see BENCHMARK v2 for the full benchmark writeup this card summarizes.

This checkpoint is the DPO-aligned release (pretrain β†’ SFT β†’ DPO).

Model details

ArchitectureDecoder-only Transformer, GQA (16Q/4KV) + RoPE (ΞΈ=500K) + SwiGLU + RMSNorm + QK-Norm, weight tying
Parameters1,119.5M (measured)
Layers Β· d_model24 Β· 2048
Context length4096 (trained at 2048)
Vocab32,000 (byte-level BPE, English-only)
Weightsstored as float32 (~4.48GB); load with dtype=torch.bfloat16 to halve memory
Pretrain51K steps Β· ~20B tokens Β· v3-en corpus (English web + code + math)
Post-trainingSFT (8.4K steps) β†’ RLVR attempted and abandoned (no learning signal at this scale β€” see BENCHMARK-v2.md Β§6) β†’ DPO (60K preference pairs)
HF conversionWeights map 1:1 onto Qwen3ForCausalLM (GQA+RoPE+SwiGLU+RMSNorm+QK-norm matches the Qwen3 block exactly). Verified by teacher-forced next-token argmax agreement against this model's own recorded benchmark generations, plus an A/B check confirming QK-norm is applied before RoPE (the Qwen3 convention)

Usage

This checkpoint expects the chat template below (system prompt + optional <THINKING> block) β€” see chat_template.jinja / ARCHITECTURE.md Β§7.1 in the repo for the exact format.

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained("YOON1v/Apex-1-DPO", dtype=torch.bfloat16).cuda()
tokenizer = AutoTokenizer.from_pretrained("YOON1v/Apex-1-DPO")

messages = [{"role": "user", "content": "Write a Python function that checks if a number is prime."}]
prompt = tokenizer.apply_chat_template(
    messages, tokenize=False, add_generation_prompt=True, enable_thinking=False)
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
out = model.generate(**inputs, max_new_tokens=256, do_sample=True, temperature=0.7, top_p=0.9)
print(tokenizer.decode(out[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))

Set enable_thinking=True to have the model reason inside <THINKING>...</THINKING> before answering. Per this model's own benchmark (see below), no-thinking mode currently scores higher β€” thinking mode tends to run long and cut into the answer budget.

Benchmarks

Standard suite (lm-evaluation-harness 0.4.12, bf16), compared against models trained on a similar token budget:

Apex-1 SFTApex-1 DPOTinyLlama-1.1B (3T tok)Pythia-1.0B (300B tok)
Commonsense avg, 7 tasks (0-shot)49.5449.6552.9948.30
MMLU (5-shot)24.8324.9025.3425.70
GSM8K (5-shot, strict)1.441.90β€”β€”
HumanEval (pass@1)8.548.549.151.83
MBPP (pass@1)4.805.20β€”β€”

DPO β‰₯ SFT on every metric above β€” no alignment tax. BoolQ 62.20 ranks 1st among TinyLlama-1.1B / Pythia-1.0B / OPT-1.3B. Apex-1 matches the 15Γ—-more-trained Pythia-1.0B on commonsense average and beats it on ARC β€” the most token-efficient entry among same-budget peers, and its HumanEval score is 4.7Γ— Pythia's despite the token gap.

Against the wider 2024–2025 small-model landscape (Llama-3.2-1B/9T, Qwen2.5-1.5B/18T, SmolLM2-1.7B/11T, OLMo-1B/2T), Apex-1 trails β€” expected given 450–900Γ— less training data, not an architecture gap. Full comparison table, benchmark provenance, and citations: see BENCHMARK-v2.md Β§5.4 in the repo.

[!NOTE] GSM8K/MBPP train splits partially overlap this model's SFT data (evaluation used the held-out test split); HumanEval is fully uncontaminated. See the repo's ckpt/lm_eval_Apex-1_COMPARISON.md for the raw numbers this card summarizes.

Known limitations

  • English-only (no multilingual pretraining data)
  • GSM8K / multi-step arithmetic reasoning is very weak (~2%) β€” this is why the project moved to DPO instead of RLVR for alignment (RLVR needs a non-trivial number of correct samples per group to produce a gradient; this model has too few)
  • MMLU sits at random-guess level (~25%), consistent with other 1B-scale models
  • Not instruction-tuned for multi-turn conversation beyond what the SFT/DPO mix covers

Training data

  • Pretrain: v3-en corpus (fineweb_edu, dclm, finemath4, cosmopedia2, code [python/js/java/c/cpp/sql/shell], finepdfs, wikipedia_en) β€” 80.8GB, ~20.3B tokens
  • SFT: HuggingFaceTB/smoltalk2 English subset, 538K examples (think:no-think β‰ˆ 1:2)
  • DPO: 60K preference pairs

License

Apache 2.0.

causal-lm
conversational
endpoints_compatible
from-scratch
model-index
qwen3
safetensors
text-generation
text-generation-inference
transformers