dataflex 1.1.0__tar.gz → 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. {dataflex-1.1.0/src/dataflex.egg-info → dataflex-1.2.0}/PKG-INFO +14 -8
  2. {dataflex-1.1.0 → dataflex-1.2.0}/README.md +9 -7
  3. {dataflex-1.1.0 → dataflex-1.2.0}/pyproject.toml +2 -1
  4. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/cli.py +9 -2
  5. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/configs/components.yaml +389 -15
  6. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/launcher.py +5 -3
  7. dataflex-1.2.0/src/dataflex/offline_selector/offline_presel_selector.py +824 -0
  8. dataflex-1.2.0/src/dataflex/offline_selector/prepare_dynamic_presel.py +173 -0
  9. dataflex-1.2.0/src/dataflex/offline_selector/record_presel_pipeline.py +218 -0
  10. dataflex-1.2.0/src/dataflex/offline_selector/record_presel_selector.py +264 -0
  11. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/data/loader.py +119 -24
  12. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/hooks.py +66 -1
  13. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/hparams/dynamic_params.py +15 -2
  14. dataflex-1.2.0/src/dataflex/train/lego/checkpoint.py +191 -0
  15. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/lego/context.py +43 -0
  16. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/lego/pipeline.py +224 -21
  17. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/lego/scoreboard.py +203 -63
  18. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/lego/stages.py +196 -57
  19. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/mixer/doremi_mixer.py +128 -74
  20. dataflex-1.2.0/src/dataflex/train/mixer/odm_mixer.py +476 -0
  21. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/reorder/__init__.py +2 -0
  22. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/reorder/base_reorder.py +29 -2
  23. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/reorder/dynamic_reorder.py +45 -2
  24. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/reorder/score_provider.py +222 -55
  25. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/selector/__init__.py +6 -1
  26. dataflex-1.2.0/src/dataflex/train/selector/adapt_inf_selector.py +699 -0
  27. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/selector/base_selector.py +11 -1
  28. dataflex-1.2.0/src/dataflex/train/selector/cluster_base_selector.py +413 -0
  29. dataflex-1.2.0/src/dataflex/train/selector/cluster_less_selector.py +287 -0
  30. dataflex-1.2.0/src/dataflex/train/selector/cluster_loss_selector.py +181 -0
  31. dataflex-1.2.0/src/dataflex/train/selector/cluster_tracin_selector.py +247 -0
  32. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/selector/delta_loss_selector.py +85 -116
  33. dataflex-1.2.0/src/dataflex/train/selector/dynamic_presel_selector.py +232 -0
  34. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/selector/icons_selector.py +165 -40
  35. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/selector/loss_selector.py +9 -1
  36. dataflex-1.2.0/src/dataflex/train/selector/tracin_selector.py +210 -0
  37. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/trainer/lego_trainer.py +215 -38
  38. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/trainer/mix_trainer.py +68 -21
  39. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/trainer/reorder_trainer.py +14 -1
  40. dataflex-1.2.0/src/dataflex/train/trainer/select_trainer.py +458 -0
  41. dataflex-1.1.0/src/dataflex/train/trainer/select_trainer.py → dataflex-1.2.0/src/dataflex/train/trainer/weight_trainer.py +101 -97
  42. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/weighter/__init__.py +3 -0
  43. dataflex-1.2.0/src/dataflex/train/weighter/base_weighter.py +477 -0
  44. dataflex-1.2.0/src/dataflex/train/weighter/multimodal_adapt_weighter.py +356 -0
  45. dataflex-1.2.0/src/dataflex/train/weighter/multimodal_deltaloss_weighter.py +252 -0
  46. dataflex-1.2.0/src/dataflex/train/weighter/multimodal_loss_weighter.py +203 -0
  47. dataflex-1.2.0/src/dataflex/utils/llava_v1d5_ckpt_merge.py +441 -0
  48. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/utils/loss_utils.py +15 -0
  49. dataflex-1.2.0/src/dataflex/utils/multimodal_scoring.py +119 -0
  50. dataflex-1.2.0/src/dataflex/utils/multimodal_selection.py +104 -0
  51. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/version.py +1 -1
  52. {dataflex-1.1.0 → dataflex-1.2.0/src/dataflex.egg-info}/PKG-INFO +14 -8
  53. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex.egg-info/SOURCES.txt +17 -0
  54. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex.egg-info/requires.txt +5 -0
  55. dataflex-1.1.0/src/dataflex/train/mixer/odm_mixer.py +0 -278
  56. dataflex-1.1.0/src/dataflex/train/selector/cluster_less_selector.py +0 -666
  57. dataflex-1.1.0/src/dataflex/train/trainer/weight_trainer.py +0 -66
  58. dataflex-1.1.0/src/dataflex/train/weighter/base_weighter.py +0 -169
  59. {dataflex-1.1.0 → dataflex-1.2.0}/LICENSE +0 -0
  60. {dataflex-1.1.0 → dataflex-1.2.0}/MANIFEST.in +0 -0
  61. {dataflex-1.1.0 → dataflex-1.2.0}/requirements.txt +0 -0
  62. {dataflex-1.1.0 → dataflex-1.2.0}/setup.cfg +0 -0
  63. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/__init__.py +0 -0
  64. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/core/__init__.py +0 -0
  65. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/core/registry.py +0 -0
  66. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/offline_selector/offline_near_selector.py +0 -0
  67. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/offline_selector/offline_tsds_selector.py +0 -0
  68. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/__init__.py +0 -0
  69. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/data/__init__.py +0 -0
  70. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/dataset/__init__.py +0 -0
  71. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/dataset/mixed_proportion_manager.py +0 -0
  72. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/hparams/__init__.py +0 -0
  73. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/hparams/dynamic_data_params.py +0 -0
  74. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/lego/__init__.py +0 -0
  75. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/lego/domain_view.py +0 -0
  76. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/lego/plan.py +0 -0
  77. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/mixer/__init__.py +0 -0
  78. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/mixer/base_mixer.py +0 -0
  79. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/mixer/dynamic_moe_mixer.py +0 -0
  80. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/mixer/random_mixer.py +0 -0
  81. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/mixer/static_mixer.py +0 -0
  82. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/reorder/patterns.py +0 -0
  83. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/reorder/static_reorder.py +0 -0
  84. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/selector/coincide_selector.py +0 -0
  85. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/selector/custom_selector.py +0 -0
  86. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/selector/less_selector.py +0 -0
  87. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/selector/near_selector.py +0 -0
  88. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/selector/nice_selector.py +0 -0
  89. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/selector/random_selector.py +0 -0
  90. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/selector/tsds_selector.py +0 -0
  91. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/trainer/__init__.py +0 -0
  92. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/weighter/adapt_weighter.py +0 -0
  93. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/weighter/custom_weighter.py +0 -0
  94. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/weighter/joint_update_aware_weighter.py +0 -0
  95. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/train/weighter/loss_weighter.py +0 -0
  96. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/utils/__init__.py +0 -0
  97. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/utils/load_component.py +0 -0
  98. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/utils/logging.py +0 -0
  99. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex/utils/selector_io.py +0 -0
  100. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex.egg-info/dependency_links.txt +0 -0
  101. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex.egg-info/entry_points.txt +0 -0
  102. {dataflex-1.1.0 → dataflex-1.2.0}/src/dataflex.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dataflex
3
- Version: 1.1.0
3
+ Version: 1.2.0
4
4
  Summary: A data-centric training system for Large Language Models
5
5
  Author-email: Hao Liang <hao.liang@stu.pku.edu.cn>, Mingrui Chen <charmier2003@gmail.com>
6
6
  License: Apache-2.0
@@ -60,6 +60,10 @@ Provides-Extra: deepspeed
60
60
  Requires-Dist: deepspeed<0.17.0,>=0.15.0; extra == "deepspeed"
61
61
  Provides-Extra: less
62
62
  Requires-Dist: traker; extra == "less"
63
+ Provides-Extra: multimodal-selection
64
+ Requires-Dist: scikit-learn>=1.3; extra == "multimodal-selection"
65
+ Requires-Dist: faiss-cpu>=1.8; extra == "multimodal-selection"
66
+ Requires-Dist: traker; extra == "multimodal-selection"
63
67
  Provides-Extra: metrics
64
68
  Requires-Dist: nltk; extra == "metrics"
65
69
  Requires-Dist: jieba; extra == "metrics"
@@ -371,18 +375,20 @@ The two projects are independent with no code dependency, connected only by stan
371
375
 
372
376
  ## 🤝 6. Acknowledgements
373
377
  We thank [LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory) for offering an efficient and user-friendly framework for large model fine-tuning, which greatly facilitated rapid iteration in our training and experimentation workflows.
374
- We thank Zhongguancun Academy for their API and GPU support.
378
+ We thank Zhongguancun Academy for their API and GPU support [![中关村学院 GitHub 组织](https://img.shields.io/badge/Linked%20to-bjzgcai%20Org-blue?logo=github)](https://github.com/bjzgcai).
375
379
  Our gratitude extends to all contributors in the open-source community—their efforts collectively drive the development of DataFlex.
376
380
 
377
381
  ## 📜 7. Citation
378
382
 
379
- The DataFlex paper has been accepted to the **NeurIPS 2026 Evaluation & Dataset Track**. Until the official proceedings citation is available, please cite the arXiv version:
383
+ The DataFlex paper has been accepted to the **NeurIPS 2026 Evaluation & Dataset Track**. If you find DataFlex useful in your research, please consider citing our papers:
380
384
  ```bibtex
381
- @article{liang2026dataflex,
382
- title={DataFlex: A Unified Framework for Data-Centric Dynamic Training of Large Language Models},
383
- author={Liang, Hao and Zhao, Zhengyang and Qiang, Meiyi and Chen, Mingrui and Ma, Lu and Yu, Rongyi and Feng, Hengyi and Sun, Shixuan and Meng, Zimo and Ma, Xiaochen and others},
384
- journal={arXiv preprint arXiv:2603.26164},
385
- year={2026}
385
+ @inproceedings{
386
+ liang2026dataflex,
387
+ title={DataFlex: A Unified Benchmark and Evaluation Platform for Data-Centric Training of Large Language Models},
388
+ author={Hao Liang and Zhengyang Zhao and Mingrui Chen and Meiyi Qiang and Lu Ma and Rongyi Yu and Hengyi Feng and Shixuan Sun and Zimo Meng and Xiaochen Ma and Xuanlin Yang and Qifeng Cai and Ruichuan An and Bohan Zeng and Zhen Hao Wong and Chengyu Shen and Runming He and Zhaoyang Han and Yaowei Zheng and Fangcheng Fu and Conghui He and Bin Cui and Zhiyu Li and Weinan E and Wentao Zhang},
389
+ booktitle={The Fortieth Annual Conference on Neural Information Processing Systems Evaluations and Datasets Track},
390
+ year={2026},
391
+ url={https://openreview.net/forum?id=Uaf41CPesH}
386
392
  }
387
393
 
388
394
  @article{liang2026towards,
@@ -267,18 +267,20 @@ The two projects are independent with no code dependency, connected only by stan
267
267
 
268
268
  ## 🤝 6. Acknowledgements
269
269
  We thank [LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory) for offering an efficient and user-friendly framework for large model fine-tuning, which greatly facilitated rapid iteration in our training and experimentation workflows.
270
- We thank Zhongguancun Academy for their API and GPU support.
270
+ We thank Zhongguancun Academy for their API and GPU support [![中关村学院 GitHub 组织](https://img.shields.io/badge/Linked%20to-bjzgcai%20Org-blue?logo=github)](https://github.com/bjzgcai).
271
271
  Our gratitude extends to all contributors in the open-source community—their efforts collectively drive the development of DataFlex.
272
272
 
273
273
  ## 📜 7. Citation
274
274
 
275
- The DataFlex paper has been accepted to the **NeurIPS 2026 Evaluation & Dataset Track**. Until the official proceedings citation is available, please cite the arXiv version:
275
+ The DataFlex paper has been accepted to the **NeurIPS 2026 Evaluation & Dataset Track**. If you find DataFlex useful in your research, please consider citing our papers:
276
276
  ```bibtex
277
- @article{liang2026dataflex,
278
- title={DataFlex: A Unified Framework for Data-Centric Dynamic Training of Large Language Models},
279
- author={Liang, Hao and Zhao, Zhengyang and Qiang, Meiyi and Chen, Mingrui and Ma, Lu and Yu, Rongyi and Feng, Hengyi and Sun, Shixuan and Meng, Zimo and Ma, Xiaochen and others},
280
- journal={arXiv preprint arXiv:2603.26164},
281
- year={2026}
277
+ @inproceedings{
278
+ liang2026dataflex,
279
+ title={DataFlex: A Unified Benchmark and Evaluation Platform for Data-Centric Training of Large Language Models},
280
+ author={Hao Liang and Zhengyang Zhao and Mingrui Chen and Meiyi Qiang and Lu Ma and Rongyi Yu and Hengyi Feng and Shixuan Sun and Zimo Meng and Xiaochen Ma and Xuanlin Yang and Qifeng Cai and Ruichuan An and Bohan Zeng and Zhen Hao Wong and Chengyu Shen and Runming He and Zhaoyang Han and Yaowei Zheng and Fangcheng Fu and Conghui He and Bin Cui and Zhiyu Li and Weinan E and Wentao Zhang},
281
+ booktitle={The Fortieth Annual Conference on Neural Information Processing Systems Evaluations and Datasets Track},
282
+ year={2026},
283
+ url={https://openreview.net/forum?id=Uaf41CPesH}
282
284
  }
283
285
 
284
286
  @article{liang2026towards,
@@ -41,8 +41,9 @@ torch = ["torch>=2.4.0,<=2.10.0", "torchvision>=0.19.0,<=0.21.0", "torchaudio>=2
41
41
  torch-npu = ["torch==2.4.0", "torch-npu==2.4.0.post2", "decorator"]
42
42
  # Needed by every examples/deepspeed config; 0.17+ cannot import on the torch 2.6 the README pins.
43
43
  deepspeed = ["deepspeed>=0.15.0,<0.17.0"]
44
- # Only the LESS selector needs TRAK, and it is a heavy build.
44
+ # TRAK is used by LESS and Adapt-inf; install it only with those extras.
45
45
  less = ["traker"]
46
+ multimodal-selection = ["scikit-learn>=1.3", "faiss-cpu>=1.8", "traker"]
46
47
  metrics = ["nltk", "jieba", "rouge-chinese"]
47
48
  flash-attn = ["flash-attn>=2.5.0"]
48
49
  liger-kernel = ["liger-kernel>=0.5.5"]
@@ -241,6 +241,11 @@ def main():
241
241
  # Only print version and welcome
242
242
  print_welcome()
243
243
  return
244
+ elif command == "presel":
245
+ from dataflex.offline_selector.offline_presel_selector import main as presel_main
246
+
247
+ presel_main(sys.argv[1:])
248
+ return
244
249
  elif command != 'train':
245
250
  raise ValueError(f'Unknown command: {command}')
246
251
  cfg = read_args()
@@ -251,7 +256,9 @@ def main():
251
256
  patch_get_dataset()
252
257
  elif train_type == 'dynamic_reorder':
253
258
  patch_reorder_get_dataset(cfg)
254
- elif train_type == 'dynamic_lego':
259
+ elif train_type == 'dynamic_lego' or (
260
+ train_type == 'dynamic_select' and cfg.get('component_name') == 'dynamic_presel'
261
+ ):
255
262
  patch_lego_get_dataset()
256
263
 
257
264
  from llamafactory.train.tuner import run_exp
@@ -285,4 +292,4 @@ def main():
285
292
  )
286
293
  sys.exit(process.returncode)
287
294
  else:
288
- run_exp()
295
+ run_exp(cfg)
@@ -1,5 +1,17 @@
1
1
  # configs/components.yaml
2
2
  selectors:
3
+ adapt_inf:
4
+ name: adapt_inf
5
+ params:
6
+ cache_dir: ../dataflex_saves/adapt_inf
7
+ num_clusters: 10 # explicit choice; inspect the saved WSS grid for the actual dataset
8
+ cluster_grid: [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]
9
+ proj_dim: 8192
10
+ projection_seed: 0 # author TRAK projection seed
11
+ parameter_pattern: '\.layers\.16\..*lora_'
12
+ seed: 42
13
+ histogram_bins: 50
14
+ dataset_revision: null
3
15
  # Dynamic selectors
4
16
  nice:
5
17
  name: nice
@@ -45,10 +57,23 @@ selectors:
45
57
  params:
46
58
  cache_dir: ../dataflex_saves/icons_output
47
59
  gradient_type: adam
48
- proj_dim: 4096
49
- seed: 123
60
+ # proj_dim 5120 / seed 0 match the reference implementation
61
+ # (github.com/princetonvisualai/icons, dim5120, collect_grads.py).
62
+ proj_dim: 5120
63
+ seed: 0
50
64
  save_interval: 16
65
+ # Sizes of the task validation sets concatenated into eval_dataset, in order.
66
+ # With a single entry (or null) there is only one task and the consensus
67
+ # degenerates to plain top-p influence selection.
51
68
  task_boundaries: null
69
+ # Slices that must share one vote, max-pooled like the reference code does for
70
+ # the 13 MME subtasks (icons/generalist.py). Entries index task_boundaries,
71
+ # e.g. [[3, 4, 5]] pools the 4th-6th slices into a single "MME" task.
72
+ pool_groups: null
73
+ # The paper's selection ratio p, which puts each task's vote threshold at the
74
+ # (1 - p) percentile. null derives p from the schedule as
75
+ # num_samples / len(dataset) instead.
76
+ vote_percentile: null
52
77
 
53
78
  cluster_less:
54
79
  name: cluster_less
@@ -72,6 +97,64 @@ selectors:
72
97
  embedding_model_dtype: auto
73
98
  embedding_layer: -1
74
99
 
100
+ # ClusterTracIn: cluster + TracIn gradient scoring + softmax sampling
101
+ cluster_tracin:
102
+ name: cluster_tracin
103
+ params:
104
+ cache_dir: ../dataflex_saves/cluster_tracin_output
105
+ gradient_type: sgd
106
+ proj_dim: 8192 # TRAK projection dim for scoring
107
+ seed: 3
108
+ learning_rate: 1.0 # TracIn eta_k, multiplied on dot product
109
+ accumulate_checkpoints: true # TracInCP: accumulate cluster scores across checkpoints
110
+ cluster_feature: gradient # embedding or gradient
111
+ gradient_target_modules: [q_proj, k_proj, v_proj, o_proj]
112
+ gradient_proj_dim: 2048 # TRAK projection dim for clustering (separate from scoring)
113
+ cluster_size: 64 # approx samples per cluster
114
+ samples_per_cluster: 6
115
+ clustering_max_iter: 300
116
+ kmeans_n_init: 5
117
+ embedding_model_name_or_path: null
118
+ embedding_model_dtype: bf16
119
+ embedding_layer: -1
120
+ temperature: 0.01 # softmax temperature, smaller = sharper
121
+
122
+ # ClusterLoss: cluster + forward loss scoring, no gradients needed
123
+ cluster_loss:
124
+ name: cluster_loss
125
+ params:
126
+ cache_dir: ../dataflex_saves/cluster_loss_output
127
+ cluster_feature: gradient
128
+ gradient_target_modules: [q_proj, k_proj, v_proj, o_proj]
129
+ gradient_proj_dim: 2048
130
+ cluster_size: 64
131
+ samples_per_cluster: 6
132
+ clustering_max_iter: 300
133
+ kmeans_n_init: 5
134
+ embedding_model_name_or_path: null
135
+ embedding_model_dtype: bf16
136
+ embedding_layer: -1
137
+ temperature: 1.0
138
+ standardize: true # z-score normalize cluster losses before sampling
139
+ score_clip: 3.0 # z-score clipping threshold
140
+
141
+ # TracIn: full-dataset SGD gradients, no clustering
142
+ tracin:
143
+ name: tracin
144
+ params:
145
+ cache_dir: ../dataflex_saves/tracin_output
146
+ gradient_type: sgd
147
+ proj_dim: 8192
148
+ seed: 3
149
+ learning_rate: 1.0
150
+ accumulate_checkpoints: true
151
+ normalize_scores: false # true: cosine; false: raw dot product
152
+ cluster_feature: embedding
153
+ cluster_size: 64
154
+ embedding_model_name_or_path: null
155
+ embedding_model_dtype: bf16
156
+ embedding_layer: -1
157
+
75
158
  coincide:
76
159
  name: coincide
77
160
  params:
@@ -99,9 +182,19 @@ selectors:
99
182
  params:
100
183
  cache_dir: ../dataflex_saves/loss_output
101
184
  focus: "medium"
185
+ score_ascending: true # Medium focus has no inherent ordering direction.
102
186
  # Scoring is batch-invariant, so this only trades memory for speed.
103
187
  score_batch_size: 8
104
188
 
189
+ dynamic_presel:
190
+ name: dynamic_presel
191
+ params:
192
+ artifacts: data/dynamic_presel # Directory produced by prepare_dynamic_presel.
193
+ allow_cross_round_overlap: false
194
+ diagnostic_step: null # null = start active selection right at warmup_step (5 updates).
195
+ cutoff_len: 2048
196
+ seed: 42
197
+
105
198
  delta_loss:
106
199
  name: delta_loss
107
200
  params:
@@ -170,15 +263,17 @@ mixers:
170
263
  # Lower alpha = more responsive to recent rewards, faster adaptation but more volatile
171
264
  alpha: 0.9
172
265
 
173
- # Warmup steps: number of steps to use initial proportions before starting ODM
174
- # Typically 1% of total training steps
175
- warmup_steps: 2000
176
- # warmup_steps: 10 # debug
266
+ # Warmup steps: null automatically inherits the trainer/stage warmup_step (e.g. 22),
267
+ # so step == warmup_step immediately performs the 1st active ODM update.
268
+ warmup_steps: null
177
269
  # reward_scale: Amplify loss signal for better domain differentiation
178
270
  reward_scale: 15.0
179
271
 
180
272
  # min_exploration_rate: Minimum exploration rate (annealing floor)
181
273
  min_exploration_rate: 0.03
274
+ # reward_update_mode: per_step_domain (every step updates all observed domains from
275
+ # detached per-sample losses) | legacy_last_batch (single scalar batch at mix())
276
+ reward_update_mode: per_step_domain
182
277
  # Initial proportions for warmup period and ODM initialization
183
278
  # If not specified, uses uniform distribution
184
279
  initial_proportions: [0.5, 0.5] # debug
@@ -232,13 +327,52 @@ weighters:
232
327
  params:
233
328
  strategy: uniform
234
329
 
330
+ # Multimodal DeltaLoss: s = L(R|Q) - L(R|Q,I), two forwards per refresh
331
+ multimodal_deltaloss:
332
+ name: multimodal_deltaloss
333
+ params:
334
+ refresh_interval: 142 # aligned with update_step = (732 - 22) / 5 = 142
335
+ delta: 1.0 # weight strength, controls max/min ratio (delta=1 ~ 2.7x)
336
+ score_batch_size: 8
337
+ loss_reduction: token # sample or token
338
+ norm_scope: interval # interval (upcoming 3% slice) | pool (100%) | batch | none
339
+ cache_dir: ../dataflex_saves/multimodal_deltaloss_output
340
+
341
+ # Multimodal Loss: s = L(R|Q,I), single forward per refresh
342
+ multimodal_loss:
343
+ name: multimodal_loss
344
+ params:
345
+ refresh_interval: 142
346
+ delta: 1.0
347
+ score_batch_size: 8
348
+ loss_reduction: token
349
+ norm_scope: interval # interval (upcoming 3% slice) | pool (100%) | batch | none
350
+ cache_dir: ../dataflex_saves/multimodal_loss_output
351
+
352
+ # Multimodal ADAPT: cosine similarity between training samples and anchor set (eval_dataset)
353
+ # - unified : refresh anchors & normalize over upcoming 3% interval every 142 steps
354
+ # - reproduce : paper/prior online setting (refresh_interval=50, per-batch normalization or raw sigmoid)
355
+ # - custom : honor explicit norm_scope & refresh_interval
356
+ multimodal_adapt:
357
+ name: multimodal_adapt
358
+ params:
359
+ mode: unified # choices: [unified, reproduce, custom]
360
+ tau: 1.0 # sigmoid temperature, smaller = sharper
361
+ anchor_batch_size: 8
362
+ score_batch_size: 8
363
+ clip: null # weight upper bound, null = no limit
364
+ pool: all # all / text / answer
365
+ weight_norm: mean1 # mean1 or none (raw paper sigmoid)
366
+ # refresh_interval: 142 # optional override (auto: 142 in unified, 50 in reproduce)
367
+ # norm_scope: interval # used when mode=custom: interval | pool | batch | none
368
+
235
369
  reorders:
236
370
  # Data reorders change sample order only; the number of samples is untouched.
237
371
  #
238
372
  # Every reorder is defined along three axes:
239
373
  # pattern : one of seven orderings, covering the four guidances of the paper
240
374
  # [shuffle, sorting, folding, zigzag, segment, stair, saw]
241
- # score_source : where the scores come from [precomputed, cached_selection, model_loss]
375
+ # score_source : where the scores come from [precomputed, cached_selection, model_loss, model_perplexity]
242
376
  # apply_at : the level the permutation is applied to [raw, index]
243
377
  # raw = permute the raw rows before preprocessing. Required for
244
378
  # precomputed scores, because align_dataset drops the score
@@ -377,8 +511,81 @@ reorders:
377
511
 
378
512
  # ---------- Dynamic: score with the current model ----------
379
513
 
380
- # Every update interval, score the remaining samples with the current model and reorder.
381
- # Note the semantic: the scores here are loss, representing "how difficult" currently, not "how high the quality". So this is a difficulty course (higher_later = high loss at the tail), not a replication of the paper's numbers - the paper uses quality scores. To align with the paper, please use the static presets above with real quality scores.
514
+ # Every update interval, score the upcoming interval slice (`pool_scope: interval`, e.g. 3%)
515
+ # with the current model (text LLM or multimodal VLM) and apply the curriculum pattern.
516
+ dynamic_sorting:
517
+ name: dynamic_sorting
518
+ params:
519
+ kind: dynamic
520
+ pattern: sorting
521
+ polarity: higher_later
522
+ ascending: true
523
+ window_size: 0
524
+ seed: 42
525
+ score_source: model_loss
526
+ score_params:
527
+ batch_size: 8
528
+ num_workers: 2
529
+ reorder_every: 1
530
+ consume_once: true
531
+
532
+ dynamic_segment:
533
+ name: dynamic_segment
534
+ params:
535
+ kind: dynamic
536
+ pattern: segment
537
+ polarity: higher_later
538
+ seed: 42
539
+ pattern_params:
540
+ x_pct: 10
541
+ y_pct: 10
542
+ front_is_high: false
543
+ back_is_high: true
544
+ score_source: model_loss
545
+ score_params:
546
+ batch_size: 8
547
+ num_workers: 2
548
+ reorder_every: 1
549
+ consume_once: true
550
+
551
+ dynamic_zigzag:
552
+ name: dynamic_zigzag
553
+ params:
554
+ kind: dynamic
555
+ pattern: zigzag
556
+ polarity: higher_later
557
+ ascending: true
558
+ window_size: 0
559
+ seed: 42
560
+ pattern_params:
561
+ layers: 2
562
+ score_source: model_loss
563
+ score_params:
564
+ batch_size: 8
565
+ num_workers: 2
566
+ reorder_every: 1
567
+ consume_once: true
568
+
569
+ dynamic_stair:
570
+ name: dynamic_stair
571
+ params:
572
+ kind: dynamic
573
+ pattern: stair
574
+ polarity: higher_later
575
+ ascending: true
576
+ window_size: 0
577
+ seed: 42
578
+ pattern_params:
579
+ num_sections: 2
580
+ folding_ratio: 0.225
581
+ layers: 2
582
+ score_source: model_loss
583
+ score_params:
584
+ batch_size: 8
585
+ num_workers: 2
586
+ reorder_every: 1
587
+ consume_once: true
588
+
382
589
  dynamic_saw:
383
590
  name: dynamic_saw
384
591
  params:
@@ -396,10 +603,143 @@ reorders:
396
603
  score_params:
397
604
  batch_size: 8 # LossSelector uses 1, here we score more samples in batch for faster computation
398
605
  num_workers: 2
399
- max_samples: 20000 # only score this many samples, to control the forward overhead per round
400
606
  reorder_every: 1 # re-score every k update intervals
401
607
  consume_once: true # remove the samples sent out to ensure single-round semantic
402
608
 
609
+ # Exact-loss LEGO presets: reuse upstream loss/delta_loss selector scores when present,
610
+ # and automatically fall back to shared ScoreBoard(loss_full) on the 3% interval for
611
+ # dynamic_presel or no-selector pipelines (works seamlessly on both text and multimodal).
612
+ lego_selector_sorting:
613
+ name: lego_selector_sorting
614
+ params:
615
+ kind: dynamic
616
+ apply_at: index
617
+ pattern: sorting
618
+ polarity: higher_later
619
+ ascending: true
620
+ score_source: selector_score
621
+ score_params:
622
+ fallback: model_loss
623
+ reorder_every: 1
624
+ consume_once: true
625
+ seed: 42
626
+ window_size: 0
627
+
628
+ lego_selector_segment:
629
+ name: lego_selector_segment
630
+ params:
631
+ kind: dynamic
632
+ apply_at: index
633
+ pattern: segment
634
+ polarity: higher_later
635
+ pattern_params:
636
+ x_pct: 10
637
+ y_pct: 10
638
+ front_is_high: false
639
+ back_is_high: true
640
+ score_source: selector_score
641
+ score_params:
642
+ fallback: model_loss
643
+ reorder_every: 1
644
+ consume_once: true
645
+ seed: 42
646
+ window_size: 0
647
+
648
+ lego_selector_folding:
649
+ name: lego_selector_folding
650
+ params:
651
+ kind: dynamic
652
+ apply_at: index
653
+ pattern: folding
654
+ polarity: higher_later
655
+ ascending: true
656
+ pattern_params:
657
+ layers: 2
658
+ score_source: selector_score
659
+ score_params:
660
+ fallback: model_loss # Used for dynamic_presel, no-selector runs, random, or first DeltaLoss step.
661
+ reorder_every: 1
662
+ consume_once: true
663
+ seed: 42
664
+ window_size: 0
665
+
666
+ lego_selector_zigzag:
667
+ name: lego_selector_zigzag
668
+ params:
669
+ kind: dynamic
670
+ apply_at: index
671
+ pattern: zigzag
672
+ polarity: higher_later
673
+ ascending: true
674
+ pattern_params:
675
+ layers: 2
676
+ score_source: selector_score
677
+ score_params:
678
+ fallback: model_loss
679
+ reorder_every: 1
680
+ consume_once: true
681
+ seed: 42
682
+ window_size: 0
683
+
684
+ lego_selector_stair:
685
+ name: lego_selector_stair
686
+ params:
687
+ kind: dynamic
688
+ apply_at: index
689
+ pattern: stair
690
+ polarity: higher_later
691
+ ascending: true
692
+ pattern_params:
693
+ num_sections: 2
694
+ folding_ratio: 0.225
695
+ layers: 2
696
+ score_source: selector_score
697
+ score_params:
698
+ fallback: model_loss
699
+ reorder_every: 1
700
+ consume_once: true
701
+ seed: 42
702
+ window_size: 0
703
+
704
+ lego_selector_saw:
705
+ name: lego_selector_saw
706
+ params:
707
+ kind: dynamic
708
+ apply_at: index
709
+ pattern: saw
710
+ polarity: higher_later
711
+ ascending: true
712
+ pattern_params:
713
+ num_sections: 3
714
+ folding_ratio: 0.075
715
+ layers: 2
716
+ score_source: selector_score
717
+ score_params:
718
+ fallback: model_loss
719
+ reorder_every: 1
720
+ consume_once: true
721
+ seed: 42
722
+ window_size: 0
723
+
724
+ lego_dynamic_saw:
725
+ name: lego_dynamic_saw
726
+ params:
727
+ kind: dynamic
728
+ pattern: saw
729
+ apply_at: index
730
+ polarity: higher_later
731
+ ascending: true
732
+ window_size: 0
733
+ seed: 42
734
+ pattern_params:
735
+ num_sections: 3
736
+ folding_ratio: 0.075
737
+ layers: 2
738
+ score_source: model_loss
739
+ score_params: {} # Batch/workers come from the pipeline; no max_samples.
740
+ reorder_every: 1
741
+ consume_once: true
742
+
403
743
  dynamic_folding:
404
744
  name: dynamic_folding
405
745
  params:
@@ -409,11 +749,11 @@ reorders:
409
749
  ascending: true
410
750
  seed: 42
411
751
  pattern_params:
412
- layers: 3
752
+ layers: 2
413
753
  score_source: model_loss
414
754
  score_params:
415
755
  batch_size: 8
416
- max_samples: 20000
756
+ num_workers: 2
417
757
  reorder_every: 1
418
758
  consume_once: true
419
759
 
@@ -447,6 +787,11 @@ pipelines:
447
787
  # every : how many optimizer steps to recalculate
448
788
  # enabled : false skips a stage, i.e. "leave that brick out"
449
789
  #
790
+ # params.score_sharing: shared (default) | independent
791
+ # Both use exact current-step answer loss and pipeline-level score_batch_size /
792
+ # score_num_workers. independent isolates each component's score cache.
793
+ # Do not set score_max_age > 0 or score_params.max_samples in loss consumers.
794
+ #
450
795
  # Two hard rules (pipeline checks them, not relying on YAML):
451
796
  # 1. The order of index space is semantically fixed as select -> mix -> reorder.
452
797
  # Writing it in another order is corrected automatically, with a warning.
@@ -466,6 +811,7 @@ pipelines:
466
811
  params:
467
812
  cache_dir: ../dataflex_saves/lego_output
468
813
  score_batch_size: 8 # shared scoring batch size
814
+ score_sharing: shared # independent disables cross-component reuse
469
815
  save_plans: false # true will save the scoreboard for each round
470
816
  stages:
471
817
  # Step 1: coarse-grained filter, remove redundant data and reduce the scoring overhead of subsequent stages
@@ -481,7 +827,7 @@ pipelines:
481
827
  every: 50
482
828
  # Step 2.5: domain-internal/overall order
483
829
  - family: reorder
484
- component: dynamic_saw
830
+ component: lego_dynamic_saw
485
831
  every: 50
486
832
  # Step 3: sample-level reweighting
487
833
  - family: weighter
@@ -493,6 +839,7 @@ pipelines:
493
839
  name: select_then_reorder
494
840
  params:
495
841
  cache_dir: ../dataflex_saves/lego_output
842
+ score_sharing: shared
496
843
  stages:
497
844
  - family: selector
498
845
  component: loss
@@ -501,9 +848,36 @@ pipelines:
501
848
  warmup_step: 10
502
849
  every: 100
503
850
  - family: reorder
504
- component: dynamic_saw
851
+ component: lego_dynamic_saw
505
852
  every: 20
506
853
 
854
+ # Online image-text composition (Selection + Mixture + Reorder + Reweight).
855
+ # Toggle any of the 15 C(4,k) combinations via CLI `lego_enabled_stages=selector,mixer,...`.
856
+ multimodal_lego:
857
+ name: multimodal_lego
858
+ params:
859
+ score_sharing: shared
860
+ score_batch_size: 8
861
+ score_num_workers: 2
862
+ seed: 42
863
+ stages:
864
+ - family: selector
865
+ component: dynamic_presel # alternatives: delta_loss, loss, adapt_inf
866
+ mode: draw # draw 3% per 142-step interval (cumulative 15% over 732 steps)
867
+ warmup_step: 22
868
+ every: 142
869
+ - family: mixer
870
+ component: odm # alternatives: static, random
871
+ warmup_step: 22
872
+ every: 142
873
+ - family: reorder
874
+ component: lego_selector_folding
875
+ warmup_step: 22
876
+ every: 142
877
+ - family: weighter
878
+ component: multimodal_adapt # alternatives: multimodal_loss, multimodal_deltaloss
879
+ warmup_step: 22
880
+
507
881
  # Domain-level proportions + sample-level reweighting: two different levels of weighting stacked together.
508
882
  # If the mixer is doremi, it will also register as a contributor to the loss space, so here it is "domain weight x sample weight" multiplication, not mutually exclusive.
509
883
  mix_then_weight:
@@ -529,4 +903,4 @@ pipelines:
529
903
  component: loss
530
904
  mode: draw # when used alone, it takes the budget for the entire round
531
905
  warmup_step: 10
532
- every: 1
906
+ every: 1
@@ -222,12 +222,14 @@ def launch():
222
222
  patch_get_dataset()
223
223
  elif train_type == 'dynamic_reorder':
224
224
  patch_reorder_get_dataset(cfg)
225
- elif train_type == 'dynamic_lego':
225
+ elif train_type == 'dynamic_lego' or (
226
+ train_type == 'dynamic_select' and cfg.get('component_name') == 'dynamic_presel'
227
+ ):
226
228
  patch_lego_get_dataset()
227
229
 
228
230
  from llamafactory.train.tuner import run_exp
229
- run_exp()
231
+ run_exp(cfg)
230
232
 
231
233
 
232
234
  if __name__ == "__main__":
233
- launch()
235
+ launch()