Views
No views yet
math_accuracy + 0.05 × length_penalty, where length_penalty ∈ [-1, 0]
is -tokens / max_completion_length. The model is rewarded for solving the
problem and lightly penalised for using more tokens.<think>…</think>)DigitalLearningGmbH/MATH-lighteval, train split (~7.5K problems)trl vllm-serve
on a second H100q,k,v,o,gate,up,down| metric | start | end | Δ |
|---|---|---|---|
| mean completion length | 3423 | 2627 | −23% |
| terminated length (when not clipped) | 2265 | 2057 | −9% |
| clipped@4096 ratio | 0.44 | 0.22 | halved |
| math_accuracy (in-batch) | 0.70 | 0.83 | +13 pp |
1from transformers import AutoModelForCausalLM, AutoTokenizer
2from peft import PeftModel
3
4base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-14B", torch_dtype="bfloat16", device_map="auto")
5tok = AutoTokenizer.from_pretrained("Qwen/Qwen3-14B")
6model = PeftModel.from_pretrained(base, "japhba/qwen3-14b-compact-cot-lora")
7
8msgs = [{"role": "user", "content": "Find all real x with x^4 - 5x^2 + 4 = 0."}]
9inputs = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt").to(model.device)
10out = model.generate(inputs, max_new_tokens=4096, temperature=0.6, top_p=0.95)
11print(tok.decode(out[0], skip_special_tokens=True))configs/grpo_qwen3_14b.yaml and --lambda_ 0.05 --run_name qwen3_14b_l005_v2.
Wandb: https://wandb.ai/japhba-personal/rl-cot-length/runs/oyzcjith