Codeseys/composer-replication-framework
0
1"""composer_replication.distillation — pluggable self-distillation losses.2 3Per ADR-007, three losses additive to the framework's existing4SDPO/OPSD (`generalized_jsd_loss`):5 6- SimPO: reference-free DPO replacement (channel 3 alternative)7- TAID: annealed teacher interpolation (wraps generalized_jsd_loss for channel 2)8- Entropy-Aware OPD: token-wise gated forward/reverse KL (alternative9 channel-2 wrapper, per ICLR 2026 Spotlight)10 11All three are pure PyTorch — no external deps — so they ship in the core12package without optional extras.13 14Usage in `compose_loss`:15 16 >>> from composer_replication import compose_loss17 >>> components = compose_loss(18 ... model, batch,19 ... dpo_variant="simpo", # channel 3: DPO -> SimPO20 ... sdpo_wrapper="taid", # channel 2: SDPO -> TAID21 ... taid_t=0.4, # current TAID interpolation coeff22 ... )23"""24from __future__ import annotations25 26from composer_replication.distillation.simpo import simpo_loss27from composer_replication.distillation.taid import TAIDScheduler, taid_loss28from composer_replication.distillation.entropy_aware_opd import entropy_aware_opd_loss29 30__all__ = [31 "simpo_loss",32 "taid_loss",33 "TAIDScheduler",34 "entropy_aware_opd_loss",35]36 