Instructions to use YOON1v/Apex-1-DPO with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use YOON1v/Apex-1-DPO with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="YOON1v/Apex-1-DPO") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("YOON1v/Apex-1-DPO") model = AutoModelForCausalLM.from_pretrained("YOON1v/Apex-1-DPO", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use YOON1v/Apex-1-DPO with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "YOON1v/Apex-1-DPO" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "YOON1v/Apex-1-DPO", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/YOON1v/Apex-1-DPO
- SGLang
How to use YOON1v/Apex-1-DPO with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "YOON1v/Apex-1-DPO" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "YOON1v/Apex-1-DPO", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "YOON1v/Apex-1-DPO" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "YOON1v/Apex-1-DPO", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use YOON1v/Apex-1-DPO with Docker Model Runner:
docker model run hf.co/YOON1v/Apex-1-DPO
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
| Architecture | Decoder-only Transformer, GQA (16Q/4KV) + RoPE (ΞΈ=500K) + SwiGLU + RMSNorm + QK-Norm, weight tying |
| Parameters | 1,119.5M (measured) |
| Layers Β· d_model | 24 Β· 2048 |
| Context length | 4096 (trained at 2048) |
| Vocab | 32,000 (byte-level BPE, English-only) |
| Weights | stored as float32 (~4.48GB); load with dtype=torch.bfloat16 to halve memory |
| Pretrain | 51K steps Β· ~20B tokens Β· v3-en corpus (English web + code + math) |
| Post-training | SFT (8.4K steps) β RLVR attempted and abandoned (no learning signal at this scale β see BENCHMARK-v2.md Β§6) β DPO (60K preference pairs) |
| HF conversion | Weights 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 SFT | Apex-1 DPO | TinyLlama-1.1B (3T tok) | Pythia-1.0B (300B tok) | |
|---|---|---|---|---|
| Commonsense avg, 7 tasks (0-shot) | 49.54 | 49.65 | 52.99 | 48.30 |
| MMLU (5-shot) | 24.83 | 24.90 | 25.34 | 25.70 |
| GSM8K (5-shot, strict) | 1.44 | 1.90 | β | β |
| HumanEval (pass@1) | 8.54 | 8.54 | 9.15 | 1.83 |
| MBPP (pass@1) | 4.80 | 5.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.
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.mdfor 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.
- Downloads last month
- 30
Evaluation results
- acc_norm (0-shot) on HellaSwagself-reported46.910
- acc (0-shot) on BoolQself-reported62.200
- pass@1 on HumanEvalself-reported8.540
- acc (5-shot, strict) on GSM8Kself-reported1.900