Views
No views yet
spark-code-A-3b-v2 is the scaled-up rerun of the exec-only GRPO baseline: same recipe as spark-code-A-3b but on the full 311-problem MBPP training pool and a longer 6-iteration schedule (kl_coeff=0.02). HumanEval pass@1 peaks at 0.816 at iteration 4 — the best score across all five adapters in the study — with the KL to the frozen reference staying below 2.4e-3 the whole way. The run terminated at iteration 6 with a CUDA out-of-memory error (GPU contention, not a code fault), so no final/ adapter was auto-saved; the published weights are the iteration-4 checkpoint, chosen as the peak of the eval trajectory.Qwen/Qwen2.5-Coder-3B-Instructsyntax_penalty=-0.2, runtime_penalty=-0.1, timeout_penalty=-0.3, wrong_answer_floor=0.0.r=16, alpha=32, dropout=0.05, target modules 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.02 against a frozen-reference policy (k=3 estimator, log-probs cached at rollout time).condition_A/checkpoints/iter4 (the run crashed before a final/ was written; see Limitations).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 with the same sampling settings. GRPO KL is the mean per-token KL from the frozen reference policy on training rollouts. Iterations 0–5 completed; iteration 6 crashed during the GRPO step before its eval.| Iter | HumanEval pass@1 | HumanEval pass@5 | MBPP-held pass@1 | MBPP-held pass@5 | Train pass rate | GRPO KL |
|---|---|---|---|---|---|---|
| 0 | 0.796 | 0.854 | 0.634 | 0.680 | — | — |
| 1 | 0.806 | 0.872 | 0.628 | 0.680 | 0.593 | 0.0003 |
| 2 | 0.801 | 0.860 | 0.642 | 0.690 | 0.620 | 0.0007 |
| 3 | 0.793 | 0.872 | 0.618 | 0.680 | 0.633 | 0.0013 |
| 4 | 0.816 | 0.872 | 0.638 | 0.710 | 0.649 | 0.0023 |
| 5 | 0.796 | 0.854 | 0.636 | 0.690 | 0.672 | 0.0024 |
| 6 | n/a | n/a | n/a | n/a | 0.696 | n/a |
torch.OutOfMemoryError during iteration 6's GRPO backward pass — the GPU was shared with another large process at the time, so this was resource contention rather than a fault in the recipe. No final/ adapter was written. The weights published here are the iteration-4 checkpoint, selected because it is both the eval peak and a fully-consistent post-iteration snapshot. Iteration 5 (pass@1 0.796) is also available in the source repo if a more-trained-but-lower checkpoint is preferred. Iteration 6 has no eval (the crash preceded it).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-A-3b-v2")
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 |
|---|---|---|---|---|---|
| A-v2 (exec-only, full) — this card | 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.720 |
| C-light (naive) | 200 / it 3 | 0.10 | 0.01 | 0.773 | 0.680 |
| C-reg2 (regularized, full) | 311 / it 6 | 0.02 | 0.03 | 0.774 | 0.680 |
condition_A/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.