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 20: close F4 s3:// gap — live-S3 DiLoCo allreduce smoke (AWS_SMOKE-gated)
Baladithya Balamurugan +1: Claude Opus 4.8 (1M context)ObjectStoreAllReduce's S3 branches (_init_fsspec/_put/_exists/_get over s3fs) previously had only mock coverage; F4 flagged "s3:// never exercised against real S3" as the highest-value unproven gap. Adds test_s3_rendezvous_allreduce_across_replicas to test_serverless_local.py (torchft-free, so it runs on Apple Silicon CI too): 2 OS processes call ObjectStoreAllReduce.allreduce() over an s3:// rendezvous, every rank must end with the cross-rank mean. Reuses the existing spawn-importable _replica_compute_and_sync. Gated on AWS_SMOKE=1; skips cleanly otherwise. Verified live 2026-06-09 against s3://amazon-sagemaker-386931836011-us-west-2-7597bf4d9a3d/diloco-rdv/: both ranks converged to identical weights (max|diff|=0.00e+00), both round_000000/rank_000{0,1}.pt objects present in S3 — proving the PUT->poll->GET->mean path and S3 strong read-after-write consistency hold cross-process. Full file: 10 passed, 1 skipped. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>bd37412 -
Wave 3 cleanup: close deferred-LOW review items R5/R6/R11
Baladithya Balamurugan +1: Claude Opus 4.8 (1M context)- R5: EKSExecutor.cancel + SageMakerExecutor.cancel now re-raise genuinely unexpected errors instead of swallowing ALL exceptions; only already-terminated signals are idempotent no-ops (EKS: 404/409; SM: ResourceNotFound + already-terminal ValidationException via new _is_already_terminal). + a test that an AccessDenied-class error propagates. - R6: EKSExecutor.collect() result dicts include a 'result' key (the S3 rendezvous URI, or None) for cross-backend shape uniformity with Local/Modal/SageMaker. - R11: seed torch.manual_seed(0) in spike-006 test_alternating_batches_loss_ decreases so the loss-trend assertion is reproducible and no longer flaky under CPU contention (it failed only in the contended full suite, passed in isolation). Root cause was unseeded nondeterminism, not a real regression. All Wave-3 review findings (R1-R11) now closed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>7d9dbbc -
Wave 3: close the HIGH review findings (kill-switch wiring, HeldoutSplit, EKS entrypoint bug)
Baladithya Balamurugan +1: Claude Opus 4.8 (1M context)Phase-7 reconciliation of the concurrent review team's findings (research/review-*.json). HIGH: - R1: wire HeldOutGuard into ComposerReplicationTrainer — OPTIONAL + OFF by default (no heldout_guard => byte-identical legacy behavior). When configured, _maybe_update_killswitch folds in-loop reward + injected heldout_eval_fn() + token-mean KL into the guard at the logging cadence; fires a hard (CollapseStopError) or soft (control.should_training_stop) halt. The #2 collapse safeguard now actually fires instead of being dead code. + test_killswitch_integration.py. - R2: build composer_replication/safety/holdout.py — HeldoutSplit disjointness enforcer (id-set + optional content-hash; .split()/.validate()/.assert_disjoint; raises HeldoutOverlapError listing the leak). The un-built second half of C1 that keeps the guard's proxy-real gap signal meaningful. +10 tests. Re-exported from safety/__init__ (resolves the dangling refs). - R3: EKS entrypoint contract bug — replica_e…bd0c358 -
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
-
Wave 20: ModalSpawnExecutor — finish the Modal-backed serverless executor
Wave 17 shipped a NotImplementedError skeleton for ModalExecutor pinned by test_skeleton_executors.py. Wave 18 hardened the skeleton contract to be strict per-code-path. This wave adds the real Modal-backed executor as ModalSpawnExecutor (sibling class), preserving the skeleton contract for backward compat while making DiLoCo across Modal containers actually runnable. Design choices vs the v0 skeleton's docstring: 1. **User-provided modal.Function instead of internal app construction.** The skeleton showed a pattern where the executor builds its own modal.App and registers run_replica internally. That couples the executor to image/GPU/Volume choices the user actually wants to own. ModalSpawnExecutor takes a *pre-decorated* modal.Function from the caller. The user defines: @app.function(gpu="H100:4", image=img, volumes={"/vol": vol}, secrets=[...], timeout=4*3600) def diloco_replica(rank: int, rendezvous_uri: str, world_size: int, **k…a384097
-
Wave 18: 14 backlog items closed + 3-reviewer cross-family review
Polish wave grinding down 14 P0/P1/P2 items from Wave 7 audit + Wave 11/12 self-critique + Wave 16/17 deferrals. Two passes of 3-reviewer cross-family review (Gemini 3.1 Pro / Grok 4.3 / Sonnet 4.6) caught 6 real issues in round 1; round 2 verified all fixed plus 2 new flagged items addressed. Doc honesty (P0): - README.md scoping change at line 29: dropped "any HuggingFace base model" for the more honest "any HF causal LM with a chat template (Qwen, Llama, Mistral, DeepSeek, Phi, Gemma families)". Added qualifier that Spike 006 zeroed the SDPO channel due to shape misalignment, so SDPO is verified via the integration test suite + end-to-end examples, not Spike 006. - spikes/005-integrated-trainer-skeleton/verl_path/README.md NEW — explicit STATUS: design-only marker per Wave 7 audit Objection 3. Documents what to do before relying on the VeRL path (install Ray, run parity test against trl_path). Test honesty (P1): - spikes/006-real-hf-model-smoke/verdict.md numerical c…54efac8 -
Wave 17: close all 5 audit FLAGs + SDPO context alignment + serverless re-exports
Three-track follow-up to Wave 16, with cross-model review (gemini-3.1-pro APPROVED, grok-4.3 surfaced one BLOCKER that verified false-positive empirically, deepseek-v4-pro burned all max_tokens on hidden reasoning producing no visible output): Wave 17a — serverless package re-exports (real code bug) composer_replication/diloco/serverless/__init__.py now re-exports ModalExecutor and HFJobsExecutor alongside LocalProcessExecutor. The package docstring already documented `from composer_replication.diloco.serverless import ModalExecutor` as the public API but the import would have failed because the names weren't in __init__.py's import list or __all__. Both modal.py and hf_jobs.py import-safely (they don't import the optional `modal` / `huggingface_hub` packages at module level — those are deferred to class method calls), so adding the re-exports doesn't introduce a new dependency. Pinned by a regression test (test_public_reexports_include_all_executors in test_s…a84c060 -
Wave 14: close every Wave 13 review finding + 4 documentation files; Wave 14b: real PRIME-RL parity + multi-process DiLoCo convergence
PHASE A: 4 parallel impl subagents closed every Wave 13 cross-model review item. T1 \u2014 compose_loss integration (closes W13 BLOCKER 2): - Added `dpo_variant: 'dpo'|'simpo'`, `sdpo_wrapper: 'none'|'taid'|'entropy_opd'`, `taid_schedule_step`, `taid_total_steps` plus 5 tuning kwargs - 11 new integration tests in composer_replication/tests/test_compose_loss_integration.py - Bit-exact reproduction of legacy compose_loss output when defaults preserved - All 38 spike-005 tests still pass T2 \u2014 replaysim DJ adapter reshape (closes W13 Suggestion 3): - _dpo_pair_to_dj_record now emits BOTH flat strings AND chat-messages for dual-shape compatibility with data-juicer's text ops - _dj_record_to_normalized round-trips both shapes - default.yaml fixed: text_keys plural \u2192 text_key singular (caught a related bug in the same op set) - Real data-juicer e2e test runs DefaultExecutor on a 3-record fixture - 15 tests (was 9) T3 \u2014 MockManager DiLoCo integration (closes W13 Suggest…d9dd3a5 -
Wave 13: serverless DiLoCo + replaysim normalization + 3 distillation losses + PRIME-RL + Monarch
Expanded the brief mid-deep-work-loop to address the user's request for serverless training-system support, replaysim dataset normalization, deeper self-distillation paper coverage, and Meta's PyTorch agentic stack tie-ins. NEW MODULES (35 tests passing): - composer_replication.distillation: SimPO (arXiv:2405.14734), TAID (arXiv:2501.16937), Entropy-Aware OPD (ICLR 2026 spotlight). 17 unit tests covering scalar/differentiable/scheduler-monotonicity and boundary-condition correctness against paper formulas. - composer_replication.diloco.serverless: ServerlessExecutor Protocol + ObjectStoreAllReduce (fsspec-backed; works with file:// + s3:// + hf:// + gs:// + az://) + LocalProcessExecutor (working) + ModalExecutor / HFJobsExecutor (skeletons, raise NotImplementedError). 9 tests including 3 multi-process tests pinning the allreduce barrier with mean-of-{0,1,2}=1 + mean-of-{0,100,200}=100 across two consecutive rounds. - composer_replication.replaysim: data-juicer adapte…b266c31