feat: add ADAPT online reweighting weighter - #54
Merged
Conversation
haolpku
added a commit
that referenced
this pull request
Aug 9, 2026
Behaviour-preserving fixes plus the docs #58 left out. Default hyper-parameters and the solver math are deliberately untouched. - Use eval mode when extracting embeddings: _extract_embeddings forced model.train() before a no_grad forward, turning dropout on and adding noise to S and s. _compute_eval_target already used eval mode; this makes the two consistent and restores the original mode afterwards. No effect at the default lora_dropout 0.0. - Make the anchor direction u averageable: _compute_eval_target pulled a single eval batch, so at the default target_batch_size 1 u was one sample's embedding, not the 'eval set mean' its docstring claimed. Adds target_num_batches (default 1, unchanged); set 0 to average the whole eval set. The mean is sample-weighted so a short trailing batch no longer overcounts. - Drop the unused seed parameter: stored and exposed in components.yaml but never read, implying controllable randomness. - Document the method in skills/how_to_use.md (choices, algorithm table, examples tree, run command) and the Data Reweighting tables in both READMEs, mirroring what #54 did for ADAPT. - Add the missing train_step to the example config, matching loss.yaml and adapt.yaml. Verified: solver returns bit-identical weights at shipped defaults, target_num_batches=1 reproduces the previous single-batch u, model is left in train mode after embedding extraction, component still builds through the registry from the shipped components.yaml. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
This PR add ADAPT, an online, similarity-based sample reweighting method (ICLR 2026) - as a new
weighter.Changes
weighter/adapt_weighter.py-AdaptWeighter(@register_weighter('adapt'))weighter/init.py- register the weighterconfigs/components.yaml-adaptpresetexamples/train_lora/weighters/adapt.yaml- example configUsage