Reinforcement Learning
Transformers
English
post-training
distillation
agentic-coding
composer-2.5
cursor
kimi-k2
grpo
dapo
diloco
openenv
trl
verl
research
methodology
Instructions to use Codeseys/composer-replication-framework with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Codeseys/composer-replication-framework with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Codeseys/composer-replication-framework", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Commit History
-
Wave 21: adversarial-review fixes — all 9 verified findings closed
Baladithya Balamurugan +1: Claude Fable 53 reviewers (correctness/security/fidelity) + independent verifier over the Stage-0 pipeline commit; every P0/P1 empirically confirmed before fixing. P0: reverse_unified_diff silently corrupted file-add/delete patches (git apply rc 128: naive +/- swap inverts the ---/+++ order and leaves a stale `new file mode` header). Fix: route them to the UNREVERSED_MARKER fallback; regression test with a /dev/null patch. P1: DECONTAMINATION_LIST omitted SWE-Gym's 11 eval repos (the architecture named both families) — added; V3 now fully closed; regression test. P1: COMPOSER_RECIPE_MAPPING.md:20 still asserted KL(teacher||student) as blog-stated — corrected to direction-unverified per F-12. P1: build_corpus budget was a soft ceiling (check-then-spend overshot by one rollout) — now a pre-charge hard ceiling; test asserts cost <= budget. P2: dedup stats double-counted rows that were both within-run and cross-gen dups (disjoint partition now); run_id path-traversal guard o…3bbcf21 -
Wave 21: Stage-0 dataset pipeline — swesmith engine, rollout harness, gates, contract
Baladithya Balamurugan +1: Claude Fable 5Implements research/deepread/13-synthesis-architecture.md (ADR-016): the "point at a repo -> dataset" pipeline the critical review architected, closing every verified P0 from research/deepread/12-verified-findings.md. New modules (+96 tests, full suite 511 passed / 66 skipped): - datagen/repo_gate.py: SPDX-ish license detection -> 3 tiers (fail-closed) + benchmark DECONTAMINATION vs the SWE-bench eval-repo list (closes V3 — zero decontamination existed anywhere). - datagen/swesmith_adapter.py + [swesmith] extra: SWE-smith as the synthesis engine (closes V4 buy-vs-build). Handles the patch-semantics INVERSION (SWE-smith's patch INTRODUCES the bug; golden_diff = reverse_unified_diff) + strategy provenance sidecar + difficulty priors. - datagen/trajectory.py: canonical trajectory IR (closes D-11). ToolCall canonical_form = v1 divergence-gate action algebra (replaces the whitespace stub, D-3); to_policy_row = THE policy-visible serializer, sentinel-tested to never leak gol…9a2ce20
-
Wave 20: Tier-0 fidelity fixes — k1-in-reward KL + Composer-2 behavior rewards
Baladithya Balamurugan +1: Claude Opus 4.8 (1M context)Closes the two cheapest "next-level" gaps from the F5 fidelity audit (Rubric A items c2, h, i). Both reproduce Composer-2 §4.1/§4.2 exactly, without the hint mystery. 33 new tests; full suite 415 passed / 66 skipped. (1) k1-in-reward KL (F5 #1, the highest-fidelity-leverage single change). Composer-2 §4.1 chooses the k1 estimator IN THE REWARD (-log r); TRL uses k3 IN THE LOSS. The 2025/26 evidence (arXiv:2512.21852, verl k1-only, TRL #4967) says k1-in-reward improves OOD generalization where k3-in-reward can collapse — exactly the "take any model to the next level" axis. - trainer/kl_in_reward.py: pure, tested math. k1/k3 per-sequence estimators + apply_kl_in_reward, which adjusts GRPO advantages by -coef·(KL - group_mean(KL)). test_kl_in_reward.py PROVES this exactly equals folding -coef·KL into the reward then re-running GRPO's group-mean baseline (9 group/gen combos) — the justification for not forking TRL's scoring code. Exact only without std-norm (Dr.GRPO …41289bf -
R14: harden live-Docker tests against transient daemon contention
Baladithya Balamurugan +1: Claude Opus 4.8 (1M context)The Phase-8 verifiers flagged 2 live-Docker DockerSandbox tests as flaky under concurrent container resource pressure (full suite + review agents spawning containers) — passing in isolation. Added _retry_docker(): bounded retry (3x, backoff) on transient daemon errors (timeout/resource/conflict/500/connection), re-raising genuine repeatable failures. Wired into the 4-gate inversion test and the network-disabled test. 27 passed / 1 skipped, lint-clean. Closes the last addressable Phase-8 verification finding; backlog now fully resolved on this host (remainder is user-gated GPU/token only). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>c647fe9 -
Wave 2: 4 new modules (kill-switch, EKS/SageMaker executors, DockerSandbox) + B4/B7 completion
Baladithya Balamurugan +1: Claude Opus 4.8 (1M context)Built by the parallel execution team (worktree-isolated), integrated + tested here. New modules (all CPU-testable via mock/lazy-import; optional deps gated): - composer_replication/safety/ — HeldOutGuard run-level collapse kill-switch (held-out-declines-while-reward-rises streak + KL-to-init hard-stop 0.08 + proxy-real hacking-gap; EMA-denoised, latched-fire, CollapseStopError). The documented #2 safeguard for the self-evolving flywheel. 23 tests. - composer_replication/diloco/serverless/eks.py — EKSExecutor satisfying the ServerlessExecutor Protocol via a SINGLE Kubernetes Indexed Job → N rank-ordered ReplicaHandles, gang-cancel (Background propagation), REPLICA_RANK via the downward API, S3 rendezvous (IRSA). 28 tests (mock BatchV1/CoreV1). - composer_replication/diloco/serverless/sagemaker.py — SageMakerExecutor (boto3 create_training_job, same S3 rendezvous, status mapping). +13-test module written during integration (the build agent shipped it test-less). - compos…7a55e1e
-
fix(phase-8): close all 5 cross-family final-verify findings + regression tests
The deep-work-loop exit gate (2 independent confirmations). A final 3-family scatter of the session diff found and we fixed: - [P0 latent] SDPO sentinel-mask used only student_response_valid; now requires BOTH valid masks AND non-sentinel indices (a future divergent teacher tail could have distilled against clamped position 0). - [P1 convergent, GPT-5.5+Gemini] curriculum shared one n_effort denominator for turns+think_tokens; split into independent n_turns/n_think counters. - [P1] docker E2E test ran pip-install under --network none (would fail when the gate activates); replaced with stdlib python -c expression runner, no network. - [P1] MMLU reward: Answer: A or B hedge scored full credit; _HEDGE_RE now penalizes it as multiple-answers. - [P1] HackMonitor read-markers matched import in important / cat in concatenate and scanned the agent patch as read-evidence; whole-word regex + exclude patch/diff payloads from BOTH layers (a legit patch can no longer self-incriminate…678d10b -
feat(b4-gpu+b6): GPU train-proof on A10G + docker-gated substrate E2E test
B4-GPU: modal_b4_gpu_smoke.py ran real Qwen2.5-0.5B-Instruct on a Modal A10G in bf16, 30 steps of the real 3-channel composition. PASS: all-finite, SDPO channel fired nonzero (max JSD 0.1855), loss converged 4.7262 -> 0.0050 monotone. This is the genuine "it trains on GPU" proof the CPU smoke could not give. Result + curve in gpu_smoke_result.json; README documents both CPU and GPU proofs. B6: test_docker_substrate_e2e.py — the docker-gated 4-gate substrate-inversion E2E now EXISTS (was only referenced). Runs the gates against a real python:3.11-slim container + real subprocess pytest on a minimal synthetic feature-deletion task, plus a cache-scrub-in-container test. Skips cleanly with no Docker (2 skipped here), runs the moment a Docker host executes the suite. ADR-010 [~] gate updated: mechanics gate is now ready-to-close, not just wired. Cost: ~1-3 USD A10G. No LMA budget touched.c009712 -
feat(wave-a): close ADR-011 (SDPO alignment indices) + ADR-012 (review findings)
B1/ADR-011: collator emits student/teacher_response_idx + valid masks via _mask_to_padded_indices; loss sentinel-masks padding. Strict SDPO no longer raises against the real collator (the regression my review-fix introduced). B2/ADR-012: - k1-KL: found TRL 1.5.0 uses k3 not k1; corrected docstring honestly + documenting test. - hint routing: style/communication/effort sites now reach the judge (error-kind aware). - HackMonitor: added patch-provenance layer defeating string-concat obfuscation; ADR-010 language corrected AST->signature+patch-provenance. - curriculum: optional turns/think_tokens effort signals, backward-compatible. 210 passed / 16 skipped (was 192). Two Opus-4.8 workers in parallel.d02d724 -
review+fix: cross-family adversarial ADR review (owed item) + remediation
Ran the owed 5-family adversarial review of ADR-008/009/010 (unblocked once OpenRouter credits were restored). 4/5 clean reviews (GPT-5.5, Gemini 3.1 Pro, DeepSeek V4 Pro, Grok 4.3; Kimi starved its token budget). Verdicts: ADR-008 3-REJECT/1-fix, ADR-009 unanimous-fix, ADR-010 3-REJECT/1-fix — all REJECTs were "accepted-status outran the evidence," not "design wrong." The review caught a real policy-corrupting P0 the solo pre-mortem missed: the SDPO alignment guard was a shape-check, so hint-shifted teacher tokens could silently misalign and distill garbage into the policy. Verified every convergent finding against code, then fixed (192 pass/16 skip, was 187): - SDPO alignment (composer_trainer.py): require collator-emitted student_response_idx/teacher_response_idx; gather aligned post-hint logits before JSD; strict-mode raises on missing/mismatched indices. Tests rewritten to the corrected contract (different-length sequences now exercised). - Sandbox scrub (sandbox.py): boo…185cce2 -
feat(datagen): ADR-010 FeatureDeletionEnv synthetic-data subsystem; accepted
Track A of the deep-work-loop — Composer 2.5's named synthetic-data generator (Feature Deletion) as a reusable subsystem. New composer_replication.datagen: - schema.py: FeatureDeletionTask (broken_repo + FAIL_TO_PASS reward target + PASS_TO_PASS functional guard; golden_diff HELD OUT of repr/observation). - sandbox.py: Sandbox Protocol + FakeSandbox (unit tests) + LocalSubprocessSandbox (real); SANDBOX_DENYLIST blocks find/strings/unzip/decompilers/git (the tools Composer's reported reward-hacks used to recover deleted signatures). - monitor.py: HackMonitor — flags cache/bytecode-provenance hacks so the grader masks reward (defense-in-depth behind the sandbox lockdown). - curriculum.py: DifficultyCurriculum — online pass-rate gate; up-weights the ~0.5 frontier (w ∝ p(1-p)), retires aced tasks, quarantines all-fail tasks (raw rate, not smoothed). Implements the blog's "select for harder tasks dynamically". - validator.py: 4-gate solvability validator (baseline-green / del…9336af3