| --- |
| license: apache-2.0 |
| tags: |
| - code |
| - agent |
| - merged |
| - fine-tuned |
| --- |
| |
| # Primus |
|
|
| **A coding model that fixes what developers actually complain about.** |
|
|
| Primus is a 295B-parameter coding model fine-tuned using the APEX method stack. Unlike frontier models optimized for benchmark scores, Primus is optimized for the five complaints developers have about AI coding assistants: |
|
|
| 1. **Regression-free repair** — fixes the bug without breaking adjacent functionality |
| 2. **Scope discipline** — changes only what you asked for, not 47 files |
| 3. **Ask-vs-guess** — asks clarifying questions instead of guessing wrong |
| 4. **API honesty** — never invents functions or libraries that don't exist |
| 5. **Terseness** — minimal diffs, no essays |
|
|
| ## Method |
|
|
| - **Training:** LoRA SFT → TIDE-DPO → RLVR sprint |
| - **Data:** 31,453 decontaminated samples (priors, CAT units, behavior demonstrations, TIDE pairs) |
| - **Hardware:** 8× RTX PRO 6000 (764GB VRAM) |
|
|
| ## The APEX Stack |
|
|
| - **CAT** (Consequence-Augmented Training): Predicts blast radius before acting |
| - **TIDE** (Step-Anchored DPO): Assigns credit/blame at the exact causal step |
| - **SENTINEL**: Anti-reward-hacking verifier |
| - **AEGIS**: Adaptive best-of-N at inference (safest effective option) |
| - **SONAR**: External memory for long-horizon tasks |
|
|
| ## Usage |
|
|
| ```python |
| from transformers import AutoModelForCausalLM, AutoTokenizer |
| |
| model = AutoModelForCausalLM.from_pretrained( |
| "kovacreations/primus", |
| trust_remote_code=True, |
| device_map="auto", |
| torch_dtype="bfloat16" |
| ) |
| tok = AutoTokenizer.from_pretrained("kovacreations/primus", trust_remote_code=True) |
| |
| messages = [ |
| {"role": "system", "content": "You are Primus, a coding assistant. Write clean, minimal code."}, |
| {"role": "user", "content": "Fix the null pointer in auth.py"} |
| ] |
| prompt = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) |
| inputs = tok(prompt, return_tensors="pt").to(model.device) |
| out = model.generate(**inputs, max_new_tokens=2048) |
| print(tok.decode(out[0], skip_special_tokens=True)) |
| ``` |
|
|
| ## Scorecard |
|
|
| Pre-registered 15-axis scorecard with all results published (wins and losses): |
|
|
| - 10 public benchmarks (Terminal-Bench, SWE-bench, etc.) |
| - 5 DevPain axes (regression, scope, ask, API honesty, terseness) |
|
|
| ## Research Paper |
|
|
| See [PRIMUS_PAPER.md](PRIMUS_PAPER.md) for the full method description, training details, |
|
|
| ## License |
|
|
| Apache 2.0. Decontaminated training data. All losses published. |
|
|
| --- |
|
|
| *Primus: first, do no harm to the codebase.* |
|
|