cmndcntrlcyber/code-trainer-v8-mixed
Viewer β’ Updated β’ 37.9k β’ 61
How to use cmndcntrlcyber/qwen14b-code-trainer-v8_mixed with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-Coder-14B-Instruct")
model = PeftModel.from_pretrained(base_model, "cmndcntrlcyber/qwen14b-code-trainer-v8_mixed")LoRA adapter for Qwen/Qwen2.5-Coder-14B-Instruct, fine-tuned on the
code-trainer-v8-mixed
dataset. This is the V8 release β a corrective iteration over V7 that
fixes multilingual hallucination and aligns tool-call formatting with Qwen2.5's
native template.
Part of the Code-Trainer / RTPI pipeline (GitHub).
Status: the current Phase 5 GGUF conversion source. Superseded for training by V9, which improves
<tool_call>tag emission fidelity.
tokenizer.apply_chat_template(tools=...) to produce the
exact token sequence the model expects natively. V7 used Hermes-style
<tool_call> tags tokenized as regular text, which the model learned
inconsistently.< 5% non-ASCII threshold on all slices
eliminates the multilingual garbage tokens V7 emitted at sequence boundaries.NousResearch/hermes-function-calling-v1
(Hermes format) to glaiveai/glaive-function-calling-v2 (cleaner,
single-source, easier to reformat into native Qwen2.5 template).cmndcntrlcyber/code-trainer-v8-mixed| Slice | Source | Rows (train) | Purpose |
|---|---|---|---|
| A β Code generation | cmndcntrlcyber/code-trainer-offsec-dataset (8K subsample) |
7,118 | Preserve code-gen quality |
| B β Tool calling | glaiveai/glaive-function-calling-v2 (12K cap) |
10,789 | Native-format tool calling |
| C β Agentic multi-turn | greghavens/fable-5-coding-and-debugging-traces (10K cap) |
9,015 | Multi-step agent behaviour |
| D β English instruction | teknium/OpenHermes-2.5 (8K cap) |
7,182 | Language anchor |
apply_chat_template(tools=...)| Knob | Value |
|---|---|
| Base model | Qwen/Qwen2.5-Coder-14B-Instruct |
| Adapter | LoRA (PEFT), r = 32, alpha = 64, dropout = 0.05 |
| Learning rate | 1.0e-4 (cosine decay, warmup ratio 0.03) |
| Batch size Γ grad accum | 1 Γ 16 (effective batch = 16) |
| Epochs | 1 |
| Sequence length | 4,096 |
| Precision | bfloat16 + gradient checkpointing |
| Hardware | HF Skills a100-large (1Γ A100 80 GB) |
| Frameworks | transformers, peft, trl (SFTTrainer) |
Key changes from V7:
learning_rate: 1.0e-4 (was 1.5e-4) β even gentler to preserve base capabilitiesmax_seq_length: 4096 (was 8192) β reduced to fix A100 OOM; agent prompts
fit at 4K after truncationbatch_size: 1 (was 2) β compensated by gradient accumulation 16| Metric | Value |
|---|---|
| eval_loss | 0.4837 |
6a73e7e66b79c09949c23c7e
(status: CANCELED β adapter was pushed to Hub before the job was killed by
HF Skills timeout enforcement)| Version | Dataset rows | eval_loss | Key fix |
|---|---|---|---|
V6 aggressive |
26,126 | 0.4724 | Baseline (code-only) |
V7 v7_mixed |
28,862 | β | Restore tool-calling + agent |
V8 v8_mixed (this) |
34,104 | 0.4837 | Fix multilingual + native format |
V9 v9_mixed |
40,401 | β | Fix tag emission + curriculum |
<tool_call> tag omission β the model outputs correct tool name and
JSON arguments but sometimes omits the <tool_call> / </tool_call>
wrapper tags that Ollama needs to parse structured tool_calls.</tool_call>, weakening the stop signal.ls instead of LS.Root cause: <tool_call> tags are tokenized as multi-token sequences; Q4_K_M
quantization loses some fidelity on these. The JSON payload pattern is learned
strongly, the XML wrapper weakly.
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base_id = "Qwen/Qwen2.5-Coder-14B-Instruct"
adapter_id = "cmndcntrlcyber/qwen14b-code-trainer-v8_mixed"
tokenizer = AutoTokenizer.from_pretrained(base_id)
model = AutoModelForCausalLM.from_pretrained(
base_id, dtype=torch.bfloat16, device_map="auto",
)
model = PeftModel.from_pretrained(model, adapter_id)
model.eval()
messages = [
{"role": "system", "content": "You are a coding assistant with tool access."},
{"role": "user", "content": "Read the file main.py and summarise its structure."},
]
inputs = tokenizer.apply_chat_template(
messages, return_tensors="pt", add_generation_prompt=True,
).to(model.device)
out = model.generate(inputs, max_new_tokens=512, do_sample=False)
print(tokenizer.decode(out[0][inputs.shape[1]:], skip_special_tokens=True))
python -m src.phase2_preprocessing.scripts.build_v8_mixed_dataset \
--config src/config/config.yaml
python -m src.phase4_qwen_finetuning.scripts.launch_validation_sweep \
--config src/config/config.yaml --only v8_mixed --wait
rtpi-phase4-qwen14bBase model
Qwen/Qwen2.5-14B