Run this model with HF Jobs

Run Codeseys/composer-replication-framework on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/Codeseys/composer-replication-framework. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/Codeseys/composer-replication-framework on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Baladithya Balamurugan Claude Opus 4.8 (1M context) commited on
Commit
41289bf
·
1 Parent(s): bd37412

Wave 20: Tier-0 fidelity fixes — k1-in-reward KL + Composer-2 behavior rewards

Browse files

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 regime).
- composer_trainer.py: opt-in kl_in_reward=True / kl_estimator=. Keeps
beta>0 (TRL needs it to compute ref logps) but suppresses TRL's in-loss
k3 per step (beta→0 across the parent _compute_loss) and folds the k1
penalty into advantages at scoring time. validate_kl_in_reward_config
(extracted, unit-tested) guards beta>0 + scale_rewards∈{none,false}.
OFF by default → byte-for-byte legacy. getattr-guarded so __new__-built
test stubs default to legacy.

(2) Composer-2 behavior rewards (F5 #2, Rubric A h+i).
- datagen/behavior_rewards.py: c_length (the exact nonlinear length/effort
penalty ((1+kx)^(1-q)-1)/(k(1-q)) + q→1 log-limit), EffortWeights (the
weighted {thinking/tool-call/tool-output/final-msg tokens, #calls,
#turns} combination), LengthEffortPenalty, and the aux scalar shapers
UnfinishedTodoPenalty / LeftoverCoTPenalty / CommunicationReward — the
exact emergent behaviors §4.2 names. All TRL RewardFuncs composable with
env.reward_fn via reward_weights. default_behavior_rewards() = the
starter array. test_behavior_rewards.py pins the math + contract.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

7 files changed +1028 -9
Files changed (7)
composer_replication/datagen/behavior_rewards.pyAdded+282
composer_replication/datagen/tests/test_behavior_rewards.pyAdded+166
composer_replication/trainer/composer_trainer.py+213-3
composer_replication/trainer/kl_in_reward.pyAdded+182
composer_replication/trainer/tests/test_dr_grpo_config_and_alignment.py+33
composer_replication/trainer/tests/test_kl_in_reward.pyAdded+146
research/design-F5-fidelity-audit.md+6-6