Skip to content

feat: add ADAPT online reweighting weighter - #54

Merged
haolpku merged 1 commit into
OpenDCAI:mainfrom
tongruiliu:main
Jun 17, 2026
Merged

feat: add ADAPT online reweighting weighter#54
haolpku merged 1 commit into
OpenDCAI:mainfrom
tongruiliu:main

Conversation

@tongruiliu

Copy link
Copy Markdown
Contributor

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 weighter
  • configs/components.yaml - adapt preset
  • examples/train_lora/weighters/adapt.yaml - example config
  • skills/how_to_use.md - docs

Usage

dataflex-cli train examples/train_lora/weighters/adapt.yaml

@haolpku
haolpku merged commit 1e14db6 into OpenDCAI:main Jun 17, 2026
9 checks passed
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants