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
-
Tidy .gitignore (de-dup *.jsonl, restore section blank lines)
d52e126 -
Spike 007: include synthetic_session.jsonl fixture in repo
The .gitignore whitelists spike fixture files but missed spikes/007-real-trace-ingestion/fixtures/synthetic_session.jsonl. Without it, anyone pulling the repo cannot run the Spike 007 tests because the fixture they reference is missing. Adds !spikes/**/fixtures/*.jsonl to the .gitignore whitelist.a35a8d7 -
Wave 7+8+9: spikes 006/007/008 — close vision-validation gaps V2/V5/V8
Three CPU-only gap-closer spikes from the deep work loop's BACKLOG.md, each with its own README, implementation, tests, and verdict. Spike 006 — Real HF model smoke (closes V8) - Promotes the framework from "mock 4-layer toy LM" to "real Qwen2.5-0.5B-Instruct via AutoModelForCausalLM with real tokenizer". - New free `compose_loss(model, inputs, alpha, beta)` function decouples the 3-channel loss composition from TRL's GRPOTrainer machinery for verification. Production path stays in ComposerReplicationTrainer._compute_loss. - 5 backward steps on CPU, loss 0.7390 → 0.0031, all grads finite. - 9 unit tests + run_smoke.py CLI + results/loss_curve.csv + verdict.md. - Wall-clock: 4 minutes (CPU forward pass on 0.5B model). Spike 007 — Real trace ingestion (closes V5) - Maps real Claude Code session JSONL → TraceState records. - Per ADR-002: 1,015 local sessions on this machine, zero acquisition cost, schema validated by 4 independent community projects + JSON Schema. - Design: one …57af35d -
Wave 7: Phase 2-4 of deep work loop — backlog, parallel research, three ADRs
Imports the gap-closer wave from VISION_VALIDATION.md as a structured backlog, records the deep work loop log, and locks three architecture decisions backed by primary-source research from three subagent recons. Backlog items (CPU-only, no GPU budget): - Spike 006 — real HF model smoke (Wave 7 next) - Spike 007 — real trace ingestion (Wave 8) - Spike 008 — Streaming DiLoCo smoke (Wave 9) - Wave 10 — packaging (pyproject.toml + examples/) - Spike 002a-mini — Modal-gated GPU smoke (Phase 10) Research (docs/research/, 1168 lines total): - MODAL_RECONNAISSANCE.md — Modal pricing + setup, primary-sourced from modal.com/pricing and modal.com/docs. Verdict: Modal L4 is $0.08-0.13 per smoke run but loses to local 5090 by 10x on iteration cycle (3-5min vs 25-40s). Modal becomes correct for parallel sweeps, 7B+ models, multi-node training, or CI repro — none of which apply to gap-closer wave. - DILOCO_RECONNAISSANCE.md — audited 5 candidates. meta-pytorch/torchft wins: BSD-3, 312 com…ac4bfb4 -
Wave 6: vision validation self-audit (5/10 to 9/10 in 5 days, no GPU)
baladithyabSelf-audit of whether the framework actually encapsulates the original brief. Recovered the brief verbatim from the originating session, decomposed into 8 atomic clauses (V1-V8), built a traceability matrix to current deliverables, and ran adversarial self-review. Honest scorecard: 5/10 pass, 4/10 fail, 1/10 partial. Strengths verified: V1 Composer 2.5 understanding (audited) V3 Five-component stack (TRL+VeRL coded; OpenEnv default; Forge paused; Monarch design-aligned) V6 N-teacher distillation economic feasibility V7 Rigorous research process Real gaps found: V2 DiLoCo: deferred to v0.2 but brief said "combine with diloco" - drift V4 "framework" vs "skeleton": no installable package, no examples dir V5 "real llm-application traces" - we used synthetic 50-state fixture V8 "any HF model" - architecture generic, never tested on real HF model Three CPU-only gap-closer spikes proposed: Spike 006 (real-HF-model smoke, half day) - closes V8 Spike 007 (real-trace inge…040eff8 -
Wave 5: full publication-materials drafts (pre-experimental release set)
baladithyabUser asked: draft all publication materials until we can do proper experimentation to back up our ideas. Drafted a complete pre-experimental publication wave: methodology paper, blog post, repo Discussion announcement, X/LinkedIn threads, CITATION.cff + .bib at repo root, plus a RELEASE_CHECKLIST coordinating sequencing, embargo, and risk register. None of this is posted publicly yet — that's a separate decision when ready to ship. Honest framing reused throughout: this is methodology + economic-feasibility + integration architecture, not training results. Spike 002-004 produce the empirical training validation in a v0.1 follow-up. Added: publications/PAPER_v0.md (33KB, ~6500 words) Longform methodology paper: 10 sections covering Composer 2.5 audit, integration architecture, novel TR-DPO channel, spike 001 + 005 results, honest "what's NOT proven" section, reward-hacking proposals, full citation list with primary sources. publications/BLOG_POST.md (16KB, ~2400 words) Hu…639a760
-
Wave 4: data collator + loss composition smoke (38/38 tests pass)
baladithyabSpike 005's biggest engineering gap was: composer_trainer.py described the inputs it expected (ctx_teacher_input_ids, sdpo_loss_mask, dpo_chosen_input_ids, etc.) but nothing constructed them from raw traces. This wave fills that gap and adds an end-to-end gradient-step smoke test on a real model. Added: 1. trl_path/data_collator.py - ComposerDataCollator turns raw TraceExample into the exact dict shape ComposerReplicationTrainer._compute_loss expects. Channel 1: input_ids, attention_mask, response_mask, rewards. Channel 2: ctx_teacher_input_ids, sdpo_loss_mask (post-hint = 1, else -100). Channel 3: dpo_chosen_input_ids, dpo_rejected_input_ids, response_masks. Hint injection, error-site detection, multi-turn DPO tokenization, padding. 2. tests/test_data_collator.py (15 tests, all pass): verifies SDPO is skipped when no error sites or no hint generator, post-hint mask correctly marks 1 vs ignore_index, DPO response masks zero prompt tokens, padding handles mixe…157cdba -
Wave 3: integration architecture + spike-005 trainer skeleton (16 tests pass)
baladithyabUser asked: can RLVR + Composer-SDPO + N-teacher-replay all integrate complementarily with the PyTorch agentic-RL stack (Monarch / TorchForge / OpenEnv / VeRL / TRL)? Answer (verified, not extrapolated): YES, with concrete extension points: 1. Verified ground-truth integration surfaces via DeepWiki audits: - TRL: subclass GRPOTrainer, override _compute_loss(model, inputs); plug OpenEnv via environment_factory= kwarg. - VeRL: register a new advantage estimator via @register_adv_est(name); attach extra fields to DataProto.batch / non_tensor_batch (precedent exists — distillation already uses 'teacher_log_probs' the same way). - OPSD: generalized_jsd_loss is a self-contained static method, MIT, directly liftable. FlashAttention-2 compatible, standard PyTorch. 2. NEW docs/INTEGRATION_ARCHITECTURE.md (30KB): - Per-framework integration matrix (TRL / VeRL / TorchForge / Monarch / OpenEnv) × per-channel (RLVR / SDPO / N-teacher-replay). - Sequence di…fd77f74 -
Integrate Cursor blog directly + audit research note + add SDPO/OPSD link
baladithyabUser flagged a real gap: I had dispatched a subagent to research Composer 2.5 but never personally read the Cursor blog. Audit findings: 1. The targeted-textual-feedback method = published SDPO (Hubotter et al., arXiv:2601.20802, ICLR 2026 Workshop) + OPSD (Zhao et al., arXiv:2601.18734, code at github.com/siyan-zhao/OPSD, MIT). Cursor cites these directly in footnote 1 of the blog. The subagent's research note never mentioned them. This is huge: there's published, MIT-licensed code for Composer's secret sauce. 2. Several claims in research/01-composer-2.5.md are NOT in the Cursor blog and were extrapolated from secondary sources ("85% post-training compute", "Anyrun" environment name, specific benchmark scores, "PPO or GRPO variant"). Likely correct via community consensus but not blog-verified. 3. Composer hint-distill (single model, hint-conditioned context) and trace-replay-distill (N external teachers) are TWO genuinely different mechanisms, not compe…1cede23 -
Spike v0.0 laydown + spike 001 VALIDATED
Decompose v0.0 into 4 risk-ordered sub-spikes: - 001 teacher-replay-cost (kill-switch, ✅ EXECUTED + VALIDATED in this commit) - 002a trace-collection-trl (planned) - 002b trace-collection-prime-rl (comparison-spike) - 003 dpo-pairs-from-disagreement (planned) - 004 ab-train-grpo-vs-trace-replay-dpo (terminal experiment) Spike 001 result (real, not scaffolding): - 150 teacher API calls (Opus 4.7 + GPT-5 + DeepSeek V4 Pro via OpenRouter) - 50 synthesized agentic-coding states as fixture - 0 errors, total spend $0.98 - Mean per-trace cost: $0.98 (target: <$5) ✅ — 5x headroom - p95 step latency: 20.5s (target: <30s) ✅ - p99 step latency: 23.2s (target: <60s) ✅ - Cost composition: Opus dominates ($0.81 of $0.98); DeepSeek + GPT-5 essentially free This validates the framework's central economic claim. Even ungated (no VOI, no tiered teachers), cost is ~$1/trace not $64/trace. With VOI gating in v0.1 we project ~$0.30/trace. Trace-replay-distillation is economically viable. Files: - spikes…35581fd -
Initial commit: Composer 2.5 Replication Framework — research synthesis
Methodology repo (model type) for an open replication of Cursor's Composer 2.5 (post-trained Kimi K2.5) on any HuggingFace base model. Contents: - README.md (HF model card with frontmatter) - framework/composer-replication-framework.md (master synthesis, 18KB) - research/ (5 deep-dives by 5 different LLM families, ~107KB total) - 01-composer-2.5.md (Gemini 3.1 Pro) - 02-diloco-family.md (DeepSeek V4 Pro) - 03-monarch-torchforge-openenv.md (GPT-5) - 04-verl-trl.md (Sonnet 4.6) - 05-trace-replay-distillation.md (Kimi K2-Thinking) - docs/METHODOLOGY.md (how the synthesis was produced) - docs/HF_REPO_LAYOUT.md (planned multi-repo split) - LICENSE (MIT) Status: pre-spike. No code, no weights, no datasets yet. Trained variants and trace datasets will live in separate repos linked via HF Collection.7165832