qwen2.5-coder-7b-specforge

Model Description

Fine-tuned Qwen2.5-Coder-7B-Instruct using LoRA adapters on the Spec-Forge training corpus.

The model converts natural-language feature requests into validated YAML specifications that conform to the COMMAND_RUNWAY methodology. Each spec contains:

  • task_id, summary, depends_on, local_goals, global_goals_refs, context
  • Every local_goal has an Inspect → Create/Modify → Verify verification flow
  • Specs pass a hardened validator (canonical vocabulary, near-duplicate detection, YAML safety)
  • Specs are scored against runbook-readiness criteria (hard gate: missing Inspect/Create/Verify stages = 0.0)

Training Details

Parameter Value
Base model unsloth/Qwen2.5-Coder-7B-Instruct
LoRA rank 16
LoRA alpha 32
LoRA dropout 0.1
Target modules q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
Epochs 3
Learning rate 2e-4
Batch size 1 (effective: 4 via gradient accumulation)
Max sequence length 2048
Quantization 4-bit NF4
Optimizer adamw_8bit
LR scheduler cosine
Warmup ratio 0.1

Training Data

  • Source: 475 seed prompts across 21 feature categories
  • Generation: Ollama (qwen2.5-coder:7b-instruct) at temperature 0.2
  • Validation: Hardened YAML spec validator (78 test cases)
  • Scoring: Runbook scorer with hard gate (0.75 threshold)
  • Format: Chat format (system + user + assistant turns)

Evaluation

See data/eval_results.json after running make eval-model.

Metrics:

  • Validation rate: percentage of specs that pass the hardened validator
  • Score pass rate: percentage of specs scoring >= 0.75 on the runbook scorer
  • Target: >80% score pass rate (held-out prompts)

Usage

Ollama (GGUF)

# Download GGUF from this repo's models/ directory
ollama create specforge -f models/qwen2.5-coder-7b-specforge-gguf/Modelfile
ollama run specforge

HuggingFace Transformers

from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

# Load base model
base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-Coder-7B-Instruct", torch_dtype="auto")
model = PeftModel.from_pretrained(base, "githeri/qwen2.5-coder-7b-specforge")
tokenizer = AutoTokenizer.from_pretrained("githeri/qwen2.5-coder-7b-specforge")

messages = [
    {"role": "system", "content": "You are a precise specification generator. Output ONLY a YAML document."},
    {"role": "user", "content": "Add a POST /health endpoint that returns 200 OK"},
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.2)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

Limitations

  • Trained on a synthetic corpus generated by the base model itself — quality is bounded by the base model's spec-generation ability
  • Specs are scoped to a single-file, single-feature granularity (not multi-stage epics)
  • Context is fixed to TypeScript/Express/Prisma/Vitest stack
  • GGUF quantization (q4_k_m) introduces minor quality degradation vs the 16-bit merge

Ethical Considerations

  • This model generates structured specifications, not executable code
  • All generated specs must pass the hardened validator before use
  • Human review is required before feeding specs into a COMMAND_RUNWAY executor

Citation

@misc{githeri-specforge,
  title={Spec-Forge: From Natural Language to Runbook-Ready YAML Specifications},
  author={Githeri},
  year={2026},
  url={https://github.com/nickrotich/githeri}
}

License

Apache 2.0 — same as the base Qwen2.5-Coder-7B-Instruct model.

Downloads last month
37
Safetensors
Model size
3B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for moinonin/defiqwen25coder

Base model

Qwen/Qwen2.5-7B
Adapter
(731)
this model