Compiler-Diagnostic-to-Git Unified Diff Patch LoRA
Engineered by Deep Das • Part of the AntCoder Multi-Agent Coding Suite
Overview
AntCoder-Fixer-7B is a specialized LoRA adapter fine-tuned on Qwen/Qwen2.5-Coder-7B-Instruct. It solves the single hardest problem in autonomous coding agents: hallucinatory patching and compile loops.
Unlike generalist models that attempt to rewrite entire 500-line source files (frequently breaking unrelated functions or losing imports), AntCoder-Fixer acts as a surgical precision tool:
1. It ingests the exact TypeScript compiler diagnostic (e.g. TS2339: Property 'user' does not exist on type 'Session').
2. It ingests the local 20-line source context window.
3. It emits a minimal, standard Git Unified Diff patch (--- a/file.ts\n+++ b/file.ts\n@@ ... @@) that applies cleanly via git apply and resolves the compiler error in a single pass.
100% Ground-Truth Synthetic Methodology
The training dataset for AntCoder-Fixer contains zero hallucinated errors. Every sample was generated using an automated AST mutation and compiler verification pipeline:
- Codebases like hono, trpc, and zod were systematically mutated (e.g. Broken Imports, Type Swaps, Missing Awaits, Parameter Mismatches).
- Every error was confirmed by the official TypeScript compiler (tsc).
- The ground-truth patch was verified by executing git apply followed by re-running tsc until exit code 0 was achieved.
Benchmark Evaluation (Held-Out Test Set)
The model is evaluated against the held-out AntCoder Compiler Diagnostic Benchmark (500 unseen production compiler diagnostics from fixer_test.jsonl).
Evaluation Metrics:
- Single-Pass Compiler Fix Rate (
tsc Exit 0): Percentage of live compiler diagnostics resolved in a single patch generation pass.
- Clean
git apply Patch Rate: Strict compliance with Git Unified Diff syntax without syntax artifacts.
- Patch Minimality & Surgical Accuracy: Minimizing changed lines to avoid destructive whole-file rewrites.
(Empirical evaluation across the held-out test split is actively running; verified numbers will be published upon completion).
Quickstart with Transformers & PEFT
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model_id = "Qwen/Qwen2.5-Coder-7B-Instruct"
adapter_id = "Tornado9991/antcoder-fixer-7b"
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
base_model = AutoModelForCausalLM.from_pretrained(
base_model_id,
torch_dtype=torch.bfloat16,
device_map="auto"
)
# Load ApexCoder Fixer Adapter
model = PeftModel.from_pretrained(base_model, adapter_id)
prompt = """A compiler diagnostic was caught during verification:
File: src/server.ts
Line: 42
Diagnostic: TS2339: Property 'userId' does not exist on type 'RequestSession'. Did you mean 'accountId'?
Source context:
40: export async function handleAuth(req: Request) {
41: const session = await getSession(req);
42: return session.userId;
43: }
Generate a minimal git unified diff to fix this error.
"""
messages = [
{"role": "system", "content": "You are ApexFixer. Generate minimal, syntactically correct git unified diffs that resolve compiler diagnostics."},
{"role": "user", "content": prompt}
]
inputs = tokenizer(tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True), return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.1)
print(tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
Training Details
- Base Model:
Qwen/Qwen2.5-Coder-7B-Instruct
- LoRA Rank ($r$): 16, Alpha ($\alpha$): 32
- Target Modules:
q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
- Dataset: 5,000 AST-mutated, compiler-verified Unified Diff pairs.
- Context Length: 2,048 tokens.
Citation & Author
Developed by Deep Das as part of the ApexCoder Autonomous Engineering project.
@misc{das2026apexcoderfixer,
author = {Das, Deep},
title = {ApexCoder-Fixer: Compiler-Grounded Unified Diff Synthesis for Sub-8B Models},
year = {2026},
publisher = {Hugging Face},
journal = {Hugging Face Model Hub}
}