Views
No views yet
spark-code-C-reg2-3b extends the regularized co-evolve recipe (spark-code-C-reg-3b) to the full 311-problem MBPP pool and a 6-iteration schedule, with slightly stronger KL regularization (kl_coeff=0.03) and a smaller auxiliary loss (aux_loss_scale=0.02, pairwise weight dropped to 0.05). Unlike the shorter 3-iteration C-reg run — which matched the exec-only baseline within noise — this longer run drifts: HumanEval pass@1 falls from 0.796 to 0.774 (−2.2 pp), GRPO KL climbs steadily to ~0.096, and mean completion length contracts ~54%. The held-out MBPP pass@5 peaks early (0.71 at iter 3) and decays back to baseline by iter 6. The published weights are the completed iteration-6 state. This card documents a negative/cautionary result: more iterations are not better for the co-evolve recipe; the sweet spot here was ~iteration 3.Qwen/Qwen2.5-Coder-3B-Instructreflection_target_mode=correct_or_canonical)syntax_penalty=-0.2, runtime_penalty=-0.1, timeout_penalty=-0.3.r=16, alpha=32, dropout=0.05, targets q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj.lr=5e-6, grad_accum=4, clip_ratio=0.2, max_grad_norm=1.0.kl_coeff=0.03 against the frozen reference policy.aux_loss_scale=0.02, aux_weight_pointwise=0.0, aux_weight_pairwise=0.05, aux_weight_reflection=1.0, aux_epochs=1, aux_max_len=1024.run_experiment_with_mbpp_heldout.py in the GitHub repo.temperature=0.2, top_p=0.95. Held-out MBPP uses 100 problems disjoint from the training pool. "Reflection fix rate" is measured on the HumanEval held-out problems: for each failed first-pass generation the model is asked to repair its own code, and the fix is re-executed.| Iter | HumanEval pass@1 | HumanEval pass@5 | MBPP-held pass@1 | MBPP-held pass@5 | Train pass rate | GRPO KL | Refl. fix rate |
|---|---|---|---|---|---|---|---|
| 0 | 0.796 | 0.854 | 0.634 | 0.680 | — | — | 0.118 |
| 1 | 0.799 | 0.848 | 0.638 | 0.700 | 0.593 | 0.0003 | 0.061 |
| 2 | 0.788 | 0.829 | 0.634 | 0.690 | 0.603 | 0.0157 | 0.057 |
| 3 | 0.796 | 0.829 | 0.644 | 0.710 | 0.628 | 0.0485 | 0.061 |
| 4 | 0.788 | 0.817 | 0.626 | 0.660 | 0.646 | 0.0592 | 0.059 |
| 5 | 0.771 | 0.823 | 0.628 | 0.670 | 0.657 | 0.0822 | 0.081 |
| 6 | 0.774 | 0.823 | 0.632 | 0.680 | 0.696 | 0.0957 | 0.083 |
kl_coeff=0.03 term only partly contains.1from peft import PeftModel
2from transformers import AutoModelForCausalLM, AutoTokenizer
3import torch
4
5base = AutoModelForCausalLM.from_pretrained(
6 "Qwen/Qwen2.5-Coder-3B-Instruct",
7 torch_dtype=torch.bfloat16,
8 device_map="auto",
9)
10model = PeftModel.from_pretrained(base, "amarsaikhan/spark-code-C-reg2-3b")
11tok = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-Coder-3B-Instruct")
12
13prompt = tok.apply_chat_template(
14 [{"role": "system", "content": "You are an expert Python programmer. Return only correct Python code."},
15 {"role": "user", "content": "Write a Python function is_palindrome(s) that returns True if s reads the same forwards and backwards."}],
16 tokenize=False, add_generation_prompt=True,
17)
18inputs = tok(prompt, return_tensors="pt").to(model.device)
19out = model.generate(**inputs, max_new_tokens=512, temperature=0.2, do_sample=True, top_p=0.95)
20print(tok.decode(out[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))-v2/2 adapters use the full 311-problem pool over 6 iterations. Each row reports that adapter's published checkpoint.| Condition | Pool / iters | aux_loss_scale | kl_coeff | HumanEval pass@1 | MBPP-held pass@5 |
|---|---|---|---|---|---|
| C-reg2 (regularized, full) — this card | 311 / it 6 | 0.02 | 0.03 | 0.774 | 0.680 |
| A-v2 (exec-only, full) | 311 / it 4 | 0.00 | 0.02 | 0.816 | 0.710 |
| A (exec-only) | 200 / it 3 | 0.00 | 0.01 | 0.805 | 0.690 |
| C-reg (regularized) | 200 / it 3 | 0.03 | 0.02 | 0.800 | 0.710 |
| C-light (naive) | 200 / it 3 | 0.10 | 0.01 | 0.773 | 0.680 |
condition_C/eval/ in the repository1@misc{batjargal2026sparkcode,
2 title = {SPARK-Code: Co-Evolving Policy and Reward for Code Generation},
3 author = {Amarsaikhan Batjargal},
4 year = {2026},
5}Qwen/Qwen2.5-Coder-3B-Instruct, is distributed under the Tongyi Qianwen LICENSE; any downstream use must comply with its terms.