aligntune 0.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 (185) hide show
  1. aligntune-0.2.0/LICENSE +21 -0
  2. aligntune-0.2.0/PKG-INFO +306 -0
  3. aligntune-0.2.0/README.md +230 -0
  4. aligntune-0.2.0/pyproject.toml +361 -0
  5. aligntune-0.2.0/setup.cfg +4 -0
  6. aligntune-0.2.0/setup.py +10 -0
  7. aligntune-0.2.0/src/aligntune/__init__.py +368 -0
  8. aligntune-0.2.0/src/aligntune/__main__.py +11 -0
  9. aligntune-0.2.0/src/aligntune/_fallbacks.py +132 -0
  10. aligntune-0.2.0/src/aligntune/_imports.py +598 -0
  11. aligntune-0.2.0/src/aligntune/backends/__init__.py +64 -0
  12. aligntune-0.2.0/src/aligntune/backends/trl/__init__.py +55 -0
  13. aligntune-0.2.0/src/aligntune/backends/trl/eval/__init__.py +0 -0
  14. aligntune-0.2.0/src/aligntune/backends/trl/rewards/__init__.py +27 -0
  15. aligntune-0.2.0/src/aligntune/backends/trl/rewards/training.py +838 -0
  16. aligntune-0.2.0/src/aligntune/backends/trl/rl/__init__.py +53 -0
  17. aligntune-0.2.0/src/aligntune/backends/trl/rl/counterfact_grpo/__init__.py +11 -0
  18. aligntune-0.2.0/src/aligntune/backends/trl/rl/counterfact_grpo/counterfact_grpo.py +1283 -0
  19. aligntune-0.2.0/src/aligntune/backends/trl/rl/counterfact_grpo/custom_trainer.py +2101 -0
  20. aligntune-0.2.0/src/aligntune/backends/trl/rl/dapo/__init__.py +11 -0
  21. aligntune-0.2.0/src/aligntune/backends/trl/rl/dapo/dapo.py +1003 -0
  22. aligntune-0.2.0/src/aligntune/backends/trl/rl/dpo/__init__.py +11 -0
  23. aligntune-0.2.0/src/aligntune/backends/trl/rl/dpo/dpo.py +668 -0
  24. aligntune-0.2.0/src/aligntune/backends/trl/rl/dr_grpo/__init__.py +11 -0
  25. aligntune-0.2.0/src/aligntune/backends/trl/rl/dr_grpo/drgrpo.py +939 -0
  26. aligntune-0.2.0/src/aligntune/backends/trl/rl/gbmpo/__init__.py +3 -0
  27. aligntune-0.2.0/src/aligntune/backends/trl/rl/gbmpo/gbmpo.py +1116 -0
  28. aligntune-0.2.0/src/aligntune/backends/trl/rl/gbmpo/gbmpo_trainer.py +1826 -0
  29. aligntune-0.2.0/src/aligntune/backends/trl/rl/grpo/__init__.py +11 -0
  30. aligntune-0.2.0/src/aligntune/backends/trl/rl/grpo/grpo.py +1105 -0
  31. aligntune-0.2.0/src/aligntune/backends/trl/rl/gspo/__init__.py +11 -0
  32. aligntune-0.2.0/src/aligntune/backends/trl/rl/gspo/gspo.py +1381 -0
  33. aligntune-0.2.0/src/aligntune/backends/trl/rl/meta_es/es_utils.py +446 -0
  34. aligntune-0.2.0/src/aligntune/backends/trl/rl/meta_es/logging_config.py +70 -0
  35. aligntune-0.2.0/src/aligntune/backends/trl/rl/meta_es/meta_es_trainer.py +172 -0
  36. aligntune-0.2.0/src/aligntune/backends/trl/rl/meta_es/meta_es_trainer_utils.py +673 -0
  37. aligntune-0.2.0/src/aligntune/backends/trl/rl/meta_es/neural_mirror_grpo.py +726 -0
  38. aligntune-0.2.0/src/aligntune/backends/trl/rl/meta_es/train_nmdrgrpo_code.py +1523 -0
  39. aligntune-0.2.0/src/aligntune/backends/trl/rl/meta_es/train_nmdrgrpo_es_math.py +635 -0
  40. aligntune-0.2.0/src/aligntune/backends/trl/rl/meta_es/vllm_evaluator.py +674 -0
  41. aligntune-0.2.0/src/aligntune/backends/trl/rl/meta_es/vllm_evaluator_math.py +489 -0
  42. aligntune-0.2.0/src/aligntune/backends/trl/rl/neural_mirror_grpo/NMGrpo.py +941 -0
  43. aligntune-0.2.0/src/aligntune/backends/trl/rl/neural_mirror_grpo/neural_mirror_grpo.py +726 -0
  44. aligntune-0.2.0/src/aligntune/backends/trl/rl/pace/__init__.py +49 -0
  45. aligntune-0.2.0/src/aligntune/backends/trl/rl/pace/baseline.py +549 -0
  46. aligntune-0.2.0/src/aligntune/backends/trl/rl/pace/curriculum.py +467 -0
  47. aligntune-0.2.0/src/aligntune/backends/trl/rl/pace/pace.py +981 -0
  48. aligntune-0.2.0/src/aligntune/backends/trl/rl/ppo/__init__.py +11 -0
  49. aligntune-0.2.0/src/aligntune/backends/trl/rl/ppo/ppo.py +1235 -0
  50. aligntune-0.2.0/src/aligntune/backends/trl/sft/Classification_trainer.py +787 -0
  51. aligntune-0.2.0/src/aligntune/backends/trl/sft/__init__.py +11 -0
  52. aligntune-0.2.0/src/aligntune/backends/trl/sft/sft.py +1659 -0
  53. aligntune-0.2.0/src/aligntune/backends/unsloth/__init__.py +44 -0
  54. aligntune-0.2.0/src/aligntune/backends/unsloth/eval/__init__.py +0 -0
  55. aligntune-0.2.0/src/aligntune/backends/unsloth/rl/__init__.py +36 -0
  56. aligntune-0.2.0/src/aligntune/backends/unsloth/rl/bolt/__init__.py +18 -0
  57. aligntune-0.2.0/src/aligntune/backends/unsloth/rl/bolt/bolt.py +695 -0
  58. aligntune-0.2.0/src/aligntune/backends/unsloth/rl/counterfact_grpo/__init__.py +11 -0
  59. aligntune-0.2.0/src/aligntune/backends/unsloth/rl/counterfact_grpo/counterfact_grpo.py +960 -0
  60. aligntune-0.2.0/src/aligntune/backends/unsloth/rl/dapo/__init__.py +9 -0
  61. aligntune-0.2.0/src/aligntune/backends/unsloth/rl/dapo/dapo.py +1060 -0
  62. aligntune-0.2.0/src/aligntune/backends/unsloth/rl/dpo/__init__.py +9 -0
  63. aligntune-0.2.0/src/aligntune/backends/unsloth/rl/dpo/dpo.py +712 -0
  64. aligntune-0.2.0/src/aligntune/backends/unsloth/rl/dr_grpo/__init__.py +9 -0
  65. aligntune-0.2.0/src/aligntune/backends/unsloth/rl/dr_grpo/drgrpo.py +963 -0
  66. aligntune-0.2.0/src/aligntune/backends/unsloth/rl/gbmpo/__init__.py +3 -0
  67. aligntune-0.2.0/src/aligntune/backends/unsloth/rl/gbmpo/gbmpo.py +1216 -0
  68. aligntune-0.2.0/src/aligntune/backends/unsloth/rl/gbmpo/gbmpo_trainer.py +1826 -0
  69. aligntune-0.2.0/src/aligntune/backends/unsloth/rl/grpo/__init__.py +9 -0
  70. aligntune-0.2.0/src/aligntune/backends/unsloth/rl/grpo/grpo.py +1108 -0
  71. aligntune-0.2.0/src/aligntune/backends/unsloth/rl/gspo/__init__.py +9 -0
  72. aligntune-0.2.0/src/aligntune/backends/unsloth/rl/gspo/gspo.py +1279 -0
  73. aligntune-0.2.0/src/aligntune/backends/unsloth/rl/neural_mirror_grpo/NMGrpo.py +1140 -0
  74. aligntune-0.2.0/src/aligntune/backends/unsloth/rl/neural_mirror_grpo/neural_mirror_grpo.py +726 -0
  75. aligntune-0.2.0/src/aligntune/backends/unsloth/rl/ppo/__init__.py +76 -0
  76. aligntune-0.2.0/src/aligntune/backends/unsloth/rl/ppo/ppo.py +2345 -0
  77. aligntune-0.2.0/src/aligntune/backends/unsloth/rl/ppo/unsloth_patches.py +355 -0
  78. aligntune-0.2.0/src/aligntune/backends/unsloth/sft/__init__.py +9 -0
  79. aligntune-0.2.0/src/aligntune/backends/unsloth/sft/sft.py +1203 -0
  80. aligntune-0.2.0/src/aligntune/cli/__init__.py +95 -0
  81. aligntune-0.2.0/src/aligntune/cli/__main__.py +10 -0
  82. aligntune-0.2.0/src/aligntune/cli/arg_parser.py +442 -0
  83. aligntune-0.2.0/src/aligntune/cli/config_builders.py +469 -0
  84. aligntune-0.2.0/src/aligntune/cli/diagnose.py +367 -0
  85. aligntune-0.2.0/src/aligntune/cli/finetune.py +508 -0
  86. aligntune-0.2.0/src/aligntune/cli/recipes.py +320 -0
  87. aligntune-0.2.0/src/aligntune/cli/unified-old.py +1135 -0
  88. aligntune-0.2.0/src/aligntune/cli/unified.py +1679 -0
  89. aligntune-0.2.0/src/aligntune/cli/validate.py +511 -0
  90. aligntune-0.2.0/src/aligntune/core/backend_factory.py +1320 -0
  91. aligntune-0.2.0/src/aligntune/core/callbacks/__init__.py +7 -0
  92. aligntune-0.2.0/src/aligntune/core/callbacks/base.py +165 -0
  93. aligntune-0.2.0/src/aligntune/core/dataset_adapters.py +361 -0
  94. aligntune-0.2.0/src/aligntune/core/optimization.py +424 -0
  95. aligntune-0.2.0/src/aligntune/core/precision_handler.py +207 -0
  96. aligntune-0.2.0/src/aligntune/core/rl/__init__.py +65 -0
  97. aligntune-0.2.0/src/aligntune/core/rl/caching.py +324 -0
  98. aligntune-0.2.0/src/aligntune/core/rl/config.py +729 -0
  99. aligntune-0.2.0/src/aligntune/core/rl/config_loader.py +307 -0
  100. aligntune-0.2.0/src/aligntune/core/rl/distributed.py +319 -0
  101. aligntune-0.2.0/src/aligntune/core/rl/evaluator.py +1053 -0
  102. aligntune-0.2.0/src/aligntune/core/rl/function_based_reward_model.py +276 -0
  103. aligntune-0.2.0/src/aligntune/core/rl/logging.py +327 -0
  104. aligntune-0.2.0/src/aligntune/core/rl/models.py +371 -0
  105. aligntune-0.2.0/src/aligntune/core/rl/registries.py +631 -0
  106. aligntune-0.2.0/src/aligntune/core/rl/reward_model_wrapper.py +212 -0
  107. aligntune-0.2.0/src/aligntune/core/rl/rollout.py +412 -0
  108. aligntune-0.2.0/src/aligntune/core/rl/sample_logger.py +135 -0
  109. aligntune-0.2.0/src/aligntune/core/rl/trainer_base.py +920 -0
  110. aligntune-0.2.0/src/aligntune/core/rl/trainer_factory.py +152 -0
  111. aligntune-0.2.0/src/aligntune/core/sft/__init__.py +44 -0
  112. aligntune-0.2.0/src/aligntune/core/sft/config.py +762 -0
  113. aligntune-0.2.0/src/aligntune/core/sft/config_loader.py +174 -0
  114. aligntune-0.2.0/src/aligntune/core/sft/evaluator.py +1017 -0
  115. aligntune-0.2.0/src/aligntune/core/sft/logging.py +117 -0
  116. aligntune-0.2.0/src/aligntune/core/sft/trainer_base.py +601 -0
  117. aligntune-0.2.0/src/aligntune/core/sft/trainer_factory.py +78 -0
  118. aligntune-0.2.0/src/aligntune/data/__init__.py +0 -0
  119. aligntune-0.2.0/src/aligntune/data/full_requirements_test.py +201 -0
  120. aligntune-0.2.0/src/aligntune/data/loaders/__init__.py +0 -0
  121. aligntune-0.2.0/src/aligntune/data/loaders/base.py +7 -0
  122. aligntune-0.2.0/src/aligntune/data/loaders/csv_loader.py +20 -0
  123. aligntune-0.2.0/src/aligntune/data/loaders/directory_loader.py +27 -0
  124. aligntune-0.2.0/src/aligntune/data/loaders/hf_loader.py +45 -0
  125. aligntune-0.2.0/src/aligntune/data/loaders/json_loader.py +12 -0
  126. aligntune-0.2.0/src/aligntune/data/loaders/parquet_loader.py +9 -0
  127. aligntune-0.2.0/src/aligntune/data/loaders/resolver.py +33 -0
  128. aligntune-0.2.0/src/aligntune/data/manager.py +214 -0
  129. aligntune-0.2.0/src/aligntune/data/processors.py +675 -0
  130. aligntune-0.2.0/src/aligntune/data/schemas.py +90 -0
  131. aligntune-0.2.0/src/aligntune/eval/__init__.py +113 -0
  132. aligntune-0.2.0/src/aligntune/eval/caching.py +40 -0
  133. aligntune-0.2.0/src/aligntune/eval/cli.py +248 -0
  134. aligntune-0.2.0/src/aligntune/eval/core.py +419 -0
  135. aligntune-0.2.0/src/aligntune/eval/evaluator.py +492 -0
  136. aligntune-0.2.0/src/aligntune/eval/full_evaluation_test.py +228 -0
  137. aligntune-0.2.0/src/aligntune/eval/lm_eval_integration.py +443 -0
  138. aligntune-0.2.0/src/aligntune/eval/metrics/__init__.py +22 -0
  139. aligntune-0.2.0/src/aligntune/eval/metrics/base.py +45 -0
  140. aligntune-0.2.0/src/aligntune/eval/metrics/code.py +249 -0
  141. aligntune-0.2.0/src/aligntune/eval/metrics/dpo.py +372 -0
  142. aligntune-0.2.0/src/aligntune/eval/metrics/generic.py +52 -0
  143. aligntune-0.2.0/src/aligntune/eval/metrics/math.py +139 -0
  144. aligntune-0.2.0/src/aligntune/eval/metrics/rl.py +57 -0
  145. aligntune-0.2.0/src/aligntune/eval/metrics/text.py +128 -0
  146. aligntune-0.2.0/src/aligntune/eval/registry.py +56 -0
  147. aligntune-0.2.0/src/aligntune/eval/rl_evaluator.py +573 -0
  148. aligntune-0.2.0/src/aligntune/eval/runner.py +751 -0
  149. aligntune-0.2.0/src/aligntune/eval/safe_executor.py +509 -0
  150. aligntune-0.2.0/src/aligntune/main.py +1024 -0
  151. aligntune-0.2.0/src/aligntune/py.typed +0 -0
  152. aligntune-0.2.0/src/aligntune/recipes/__init__.py +538 -0
  153. aligntune-0.2.0/src/aligntune/recipes/config.py +22 -0
  154. aligntune-0.2.0/src/aligntune/rewards/__init__.py +69 -0
  155. aligntune-0.2.0/src/aligntune/rewards/core.py +3161 -0
  156. aligntune-0.2.0/src/aligntune/rewards/factory.py +162 -0
  157. aligntune-0.2.0/src/aligntune/rewards/registry.py +528 -0
  158. aligntune-0.2.0/src/aligntune/rewards/training.py +804 -0
  159. aligntune-0.2.0/src/aligntune/rl/__init__.py +10 -0
  160. aligntune-0.2.0/src/aligntune/rl/core/__init__.py +10 -0
  161. aligntune-0.2.0/src/aligntune/scripts/__init__.py +3 -0
  162. aligntune-0.2.0/src/aligntune/scripts/precompute_baseline.py +1937 -0
  163. aligntune-0.2.0/src/aligntune/sft/__init__.py +10 -0
  164. aligntune-0.2.0/src/aligntune/sft/core/__init__.py +10 -0
  165. aligntune-0.2.0/src/aligntune/utils/__init__.py +132 -0
  166. aligntune-0.2.0/src/aligntune/utils/auth.py +239 -0
  167. aligntune-0.2.0/src/aligntune/utils/checkpointing.py +439 -0
  168. aligntune-0.2.0/src/aligntune/utils/colored_logging.py +259 -0
  169. aligntune-0.2.0/src/aligntune/utils/config_extractor.py +346 -0
  170. aligntune-0.2.0/src/aligntune/utils/config_utils.py +501 -0
  171. aligntune-0.2.0/src/aligntune/utils/device.py +425 -0
  172. aligntune-0.2.0/src/aligntune/utils/diagnostics.py +454 -0
  173. aligntune-0.2.0/src/aligntune/utils/environment.py +278 -0
  174. aligntune-0.2.0/src/aligntune/utils/errors.py +429 -0
  175. aligntune-0.2.0/src/aligntune/utils/inference_utils.py +40 -0
  176. aligntune-0.2.0/src/aligntune/utils/logging.py +301 -0
  177. aligntune-0.2.0/src/aligntune/utils/math_grading.py +758 -0
  178. aligntune-0.2.0/src/aligntune/utils/model_loader.py +577 -0
  179. aligntune-0.2.0/src/aligntune/utils/validation.py +514 -0
  180. aligntune-0.2.0/src/aligntune.egg-info/PKG-INFO +306 -0
  181. aligntune-0.2.0/src/aligntune.egg-info/SOURCES.txt +183 -0
  182. aligntune-0.2.0/src/aligntune.egg-info/dependency_links.txt +1 -0
  183. aligntune-0.2.0/src/aligntune.egg-info/entry_points.txt +25 -0
  184. aligntune-0.2.0/src/aligntune.egg-info/requires.txt +47 -0
  185. aligntune-0.2.0/src/aligntune.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Lexsi.ai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,306 @@
1
+ Metadata-Version: 2.4
2
+ Name: aligntune
3
+ Version: 0.2.0
4
+ Summary: AlignTune: Multi-backend alignment and fine-tuning library (formerly FinetuneHub). Features TRL and Unsloth backends with complete RL coverage (DPO, PPO, GRPO, BOLT), 27+ reward functions, production-ready evaluation system, and unified configuration interface for LLM alignment.
5
+ Author-email: Chirag Chawla <chirag@lexsi.ai>, Zera Lyngkhoi <zera@lexsi.ai>, Pratinav Seth <pratinav@lexsi.ai>, Utsav Avaiya <utsav@lexsi.ai>, Soham Bhattacharjee <soham@lexsi.ai>, Mykola Khandoga <mykola@lexsi.ai>, Rui Yuan <rui@lexsi.ai>, Vinay Kumar Sankarapu <vinay@lexsi.ai>
6
+ License: AlignTune Source Available License (ASAL) v1.0
7
+ Project-URL: Homepage, https://github.com/Lexsi-Labs/aligntune
8
+ Project-URL: Repository, https://github.com/Lexsi-Labs/aligntune
9
+ Project-URL: Documentation, https://aligntune.readthedocs.io
10
+ Project-URL: Bug Tracker, https://github.com/Lexsi-Labs/aligntune/issues
11
+ Project-URL: Changelog, https://github.com/Lexsi-Labs/aligntune/blob/main/CHANGELOG.md
12
+ Project-URL: Discussions, https://github.com/Lexsi-Labs/aligntune/discussions
13
+ Keywords: alignment,rlhf,fine-tuning,llm,machine learning,SFT,RL,DPO,GRPO,PPO,GSPO,BOLT,transformers,trl,unsloth,multi-backend,reward-functions,evaluation,lm-eval,wandb,tensorboard,checkpointing,device-management,unified-config,cli
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: License :: Other/Proprietary License
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
25
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
+ Classifier: Operating System :: OS Independent
27
+ Requires-Python: >=3.8
28
+ Description-Content-Type: text/markdown
29
+ License-File: LICENSE
30
+ Requires-Dist: transformers>=4.35.0
31
+ Requires-Dist: datasets>=2.14.0
32
+ Requires-Dist: accelerate>=0.24.0
33
+ Requires-Dist: peft>=0.6.0
34
+ Requires-Dist: bitsandbytes>=0.41.0
35
+ Requires-Dist: numpy>=1.21.0
36
+ Requires-Dist: pyyaml>=6.0
37
+ Requires-Dist: huggingface-hub>=0.17.0
38
+ Requires-Dist: tqdm>=4.64.0
39
+ Requires-Dist: psutil>=5.9.0
40
+ Requires-Dist: pandas>=1.3.0
41
+ Requires-Dist: scikit-learn>=1.0.0
42
+ Requires-Dist: click>=8.0.0
43
+ Requires-Dist: rich>=12.0.0
44
+ Requires-Dist: typer>=0.7.0
45
+ Requires-Dist: trl==0.23.0
46
+ Requires-Dist: unsloth==2025.11.1
47
+ Requires-Dist: unsloth_zoo==2025.11.2
48
+ Requires-Dist: wandb>=0.15.0
49
+ Requires-Dist: tensorboard>=2.12.0
50
+ Requires-Dist: matplotlib>=3.5.0
51
+ Requires-Dist: seaborn>=0.11.0
52
+ Requires-Dist: evaluate>=0.4.0
53
+ Requires-Dist: rouge-score>=0.1.2
54
+ Requires-Dist: sacrebleu>=2.3.0
55
+ Requires-Dist: lm-eval>=0.4.0
56
+ Requires-Dist: nltk>=3.8.0
57
+ Requires-Dist: nvitop>=1.1.0; platform_system != "Darwin"
58
+ Requires-Dist: nvidia-ml-py>=11.495.46; platform_system != "Darwin"
59
+ Requires-Dist: gpustat>=1.1.1
60
+ Requires-Dist: pytest>=7.0.0
61
+ Requires-Dist: pytest-cov>=4.0.0
62
+ Requires-Dist: pytest-xdist>=3.0.0
63
+ Requires-Dist: pytest-mock>=3.10.0
64
+ Requires-Dist: pytest-timeout>=2.1.0
65
+ Requires-Dist: hypothesis>=6.70.0
66
+ Requires-Dist: black>=23.0.0
67
+ Requires-Dist: isort>=5.12.0
68
+ Requires-Dist: flake8>=6.0.0
69
+ Requires-Dist: mypy>=1.5.0
70
+ Requires-Dist: pre-commit>=3.0.0
71
+ Requires-Dist: sphinx>=5.0.0
72
+ Requires-Dist: sphinx-rtd-theme>=1.2.0
73
+ Requires-Dist: myst-parser>=0.18.0
74
+ Requires-Dist: sphinx-autodoc-typehints>=1.19.0
75
+ Dynamic: license-file
76
+
77
+
78
+ <p align="center">
79
+ <img src="docs/assets/aligntune-banner.png" alt="AlignTune Banner" width="1000px"/>
80
+ </p>
81
+
82
+ <div align="center">
83
+ <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.8+-blue.svg"/></a>
84
+ <a href="https://github.com/Lexsi-Labs/aligntune/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg"/></a>
85
+ <a href="https://badge.fury.io/py/aligntune"><img src="https://badge.fury.io/py/aligntune.svg"/></a>
86
+ </div>
87
+
88
+ ---
89
+
90
+ **AlignTune** is a production-ready fine-tuning library designed to simplify training and fine-tuning of Large Language Models (LLMs) with both Supervised Fine-Tuning (SFT) and Reinforcement Learning (RL) methods. It provides a high-level, unified API that abstracts away the complexities of backend selection, algorithm configuration, and training loops, letting you focus on delivering results.
91
+
92
+ ## Core Features
93
+
94
+ **Multi-Backend Architecture**: Choose between TRL (reliable, battle-tested) and Unsloth (faster) backends with intelligent auto-selection.
95
+
96
+ **Complete RLHF Coverage**: 12+ RL algorithms including DPO, PPO, GRPO, GSPO, DAPO, Dr. GRPO, GBMPO, Counterfactual GRPO, and PACE.
97
+
98
+ **Production-Ready**: No mock code, comprehensive error handling, extensive testing, and robust validation.
99
+
100
+ ## Quick Start
101
+
102
+ ### Supervised Fine-Tuning (SFT)
103
+
104
+ ```python
105
+ from aligntune.core.backend_factory import create_sft_trainer
106
+
107
+ # Create and train SFT model
108
+ trainer = create_sft_trainer(
109
+ model_name="microsoft/DialoGPT-small",
110
+ dataset_name="tatsu-lab/alpaca",
111
+ backend="trl",
112
+ num_epochs=3,
113
+ max_steps = -1,
114
+ batch_size=4,
115
+ learning_rate=5e-5
116
+ )
117
+
118
+ # Train the model
119
+ trainer.train()
120
+
121
+ # Evaluate
122
+ metrics = trainer.evaluate()
123
+ print(metrics)
124
+ ```
125
+
126
+ ### Reinforcement Learning (DPO)
127
+
128
+ ```python
129
+ from aligntune.core.backend_factory import create_rl_trainer
130
+
131
+ # Create and train DPO model
132
+ trainer = create_rl_trainer(
133
+ model_name="Qwen/Qwen3-0.6B",
134
+ dataset_name="Anthropic/hh-rlhf",
135
+ algorithm="dpo",
136
+ backend="trl",
137
+ num_epochs=1,
138
+ batch_size=4,
139
+ learning_rate=5e-5
140
+ )
141
+
142
+ # Train the model
143
+ trainer.train()
144
+ ```
145
+
146
+ ## Supported Algorithms
147
+
148
+ | Algorithm | TRL Backend | Unsloth Backend | Description |
149
+ |-----------|-------------|-----------------|-------------|
150
+ | **SFT** | Yes | Yes | Supervised Fine-Tuning |
151
+ | **DPO** | Yes | Yes | Direct Preference Optimization |
152
+ | **PPO** | Yes | Yes | Proximal Policy Optimization |
153
+ | **GRPO** | Yes | Yes | Group Relative Policy Optimization |
154
+ | **GSPO** | Yes | Yes | Group Sequential Policy Optimization |
155
+ | **DAPO** | Yes | Yes | Decouple Clip and Dynamic sAmpling Policy Optimization |
156
+ | **Dr. GRPO** | Yes | Yes | GRPO Done Right (unbiased variant) |
157
+ | **GBMPO** | Yes | No | Group-Based Mirror Policy Optimization |
158
+ | **Counterfactual GRPO** | Yes | Yes | Counterfactual GRPO variant |
159
+ | **PACE** | Yes | Yes | Baseline-Optimized Learning Technique |
160
+
161
+ ## Installation
162
+
163
+ ```bash
164
+ # Or install from source
165
+ git clone https://github.com/Lexsi-Labs/aligntune.git
166
+ cd aligntune
167
+ pip install -e .
168
+ ```
169
+
170
+ ### Requirements
171
+
172
+ - Python 3.8+
173
+ - PyTorch 2.0+
174
+ - CUDA-compatible GPU (recommended for faster training)
175
+
176
+ ## Demo Notebooks
177
+
178
+ Interactive Colab notebooks demonstrating various AlignTune workflows:
179
+ Here are the organized tables containing the Colab links, models, and datasets provided in your text.
180
+
181
+ ### Supervised Fine-Tuning (SFT)
182
+
183
+ | Backend| Model | Dataset | Link |
184
+ | --- | --- | --- | --- |
185
+ | TRL | **Qwen/Qwen3-4B-Instruct-2507** | sohamb37lexsi/bitext-wealth-management-llm-chatbot-splits | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1okAnfMlkch-G5Dy2dmj_dfR07rtxmYoq?usp=sharing) |
186
+ | TRL | **Qwen3-4B-Instruct** | sohamb37lexsi/bitext-retail-banking-llm-chatbot-splits | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1JnFvEWZ6PDqrDAyWznCdOA9oNn8aqN2v?usp=sharing) |
187
+ | Unsloth| **Qwen/Qwen2.5-0.5B-Instruct** | bebechien/MobileGameNPC | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/15R3JOrzAUuMagCamDHsqe0wNyb44rw2j?usp=sharing) |
188
+ | TRL | **google/txgemma-2b-predict** | trialbench_adverse-event-rate-prediction | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1r91SS7Lb5LjkjzWXp7uzkpR3vlWZ6gwD?usp=sharing) |
189
+ | Unsloth| **Qwen/Qwen2.5-0.5B-Instruct** | bebechien/MobileGameNP |[![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/11DrRbG30MUCegZTDXwR9nxEdvKaLfWCb?usp=sharing) |
190
+
191
+ ### Reinforcement Learning (RL)
192
+
193
+ | Backend| Algorithm | Model | Dataset | Link |
194
+ | --- | --- | --- | --- | --- |
195
+ | Unsloth| **DPO** | microsoft/phi-2 | argilla/distilabel-intel-orca-dpo-pairs | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1aKdQzT7KGs0PEr7pO9rOXFkwQK6LzyRZ#scrollTo=dOnIJIAMxP9J) |
196
+ | TRL | **DPO** | google/gemma-2-2b-it | Anthropic/hh-rlhf | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1WQhek61Z0v1zHFWT4mQwVX7n10ln-j3d?usp=sharing) |
197
+ | TRL | **DPO** | sohamb37lexsi/wealth_management_Qwen3-4B-Instruct-2507 | sohamb37lexsi/bitext_wealth_management_preference_data | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1LR3KWcjQAFjSHf0MR9271ShchjPUVSpS?usp=sharing) |
198
+ | Unsloth| **PPO** | Qwen/Qwen2.5-0.5B-Instruct | HuggingFaceH4/ultrachat_200k | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1G4fdtO4DhBNwjOYhuaGmvIrBU_lc159H?usp=sharing) |
199
+ | TRL | **PPO** | EleutherAI/pythia-1.4b | CarperAI/openai_summarize_tldr | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1wlbSvQAJv8ZFM2qGD4XlUOKPzZHXstQo?usp=sharing) |
200
+ | TRL | **GRPO** (Coding) | Qwen/Qwen3-4B | google-research-datasets/mbpp | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/13HYZ-EkLC3-6wxJG_1NyWXPEuN9bIeM4?usp=sharing) |
201
+ | Unsloth| **GRPO** (Math) | meta-llama/Llama-3.2-3B-Instruct | openai/gsm8k | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/11tj2odJa7v55VvQkpOlm7_WBclqFdaVi?usp=sharing) |
202
+ | TRL | **GRPO** | meta-llama/Llama-3.2-3B-Instruct | openai/gsm8k | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/14b2dt0_iSVL8Z_8mlOx--f-d_rDCqVOP?usp=sharing) |
203
+ | Unsloth | **DRGRPO** | Qwen/Qwen2.5-3B-Instruct | yahma/alpaca-cleaned | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1IzDtjONyL6CZ038faTTp8AvLfhzkqSpb?usp=sharing) |
204
+ | TRL | **DRGRPO** | Qwen/Qwen2-0.5B-Instruct | AI-MO/NuminaMath-TIR | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1KfrMzuGRPrZwyRuNTGep1ZL6C6h2aVjk?usp=sharing) |
205
+ | Unsloth | **GSPO** | Qwen/Qwen3-1.7B | CyberNative/Code_Vulnerability_Security_DPO | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/120FjMEAZRXUoOMRsWHCn5tmpGfLTAY4g?usp=sharing) |
206
+ | TRL | **GSPO** | meta-llama/Llama-3.2-3B-Instruct | HuggingFaceH4/ultrachat_200k | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1vDP7ukBHWwSiD7KVSgSekCvk-x_MkWdC?usp=sharing) |
207
+ | Unsloth| **DAPO** | microsoft/Phi-3.5-mini-instruct | HuggingFaceH4/ultrachat_200k | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1gAa6EPc5345XRfog1nzQIFTmp_OJqNvk?usp=sharing) |
208
+ |TRL | **DAPO** | meta-llama/Llama-3.2-3B-Instruct | google-research-datasets/mbpp | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1aF3LxEMmLl0fCyA5yVBAkU_Rgsy3dsh5?usp=sharing) |
209
+ ## Documentation
210
+
211
+ - **[Getting Started](docs/getting-started/installation.md)**: Installation, setup, and basic usage
212
+ - **[User Guide](docs/user-guide/overview.md)**: In-depth tutorials for SFT and RL training
213
+ - **[API Reference](docs/api-reference/overview.md)**: Complete Python API and class/method details
214
+ - **[Examples](docs/examples/overview.md)**: End-to-end code examples
215
+ - **[Advanced Topics](docs/advanced/architecture.md)**: Architecture, custom backends, and performance optimization
216
+ - **[Notebooks](docs/notebooks/index.md)**: Interactive Colab notebooks and local Jupyter notebooks
217
+
218
+ ## Key Capabilities
219
+
220
+ - **Multiple Training Paradigms**: Supports SFT, DPO, PPO, GRPO, and advanced RL algorithms
221
+ - **Backend Flexibility**: TRL and Unsloth backends with automatic fallback
222
+ - **Reward Model Training**: Train custom reward models from rule-based functions
223
+ - **Comprehensive Evaluation**: Multi-level evaluation with lm-eval integration
224
+ - **Production Ready**: Model serialization, reproducible training, and deployment-ready pipelines
225
+ - **Extensible Architecture**: Modular design for easy integration of custom algorithms and backends
226
+
227
+ ## Architecture
228
+
229
+ AlignTune uses a flexible backend architecture:
230
+
231
+ ```mermaid
232
+ flowchart TD
233
+ Factory[Backend Factory] --> TRL[TRL Backend]
234
+ Factory --> Unsloth[Unsloth Backend]
235
+ TRL --> TRL_Algos[TRL Algorithms]
236
+ Unsloth --> Unsloth_Algos[Unsloth Algorithms]
237
+ ```
238
+
239
+ **TRL Backend:** SFT, DPO, PPO, GRPO, GSPO, DAPO, Dr. GRPO, GBMPO, Counterfactual GRPO, PACE
240
+
241
+ **Unsloth Backend:** SFT, DPO, PPO, GRPO, DAPO, Dr. GRPO, Counterfactual GRPO, PACE
242
+
243
+ See [Architecture](docs/advanced/architecture.md) for details.
244
+
245
+ ## Contributing
246
+
247
+ We welcome contributions! See our [Contributing Guide](docs/contributing/guide.md) for details.
248
+
249
+ ## License
250
+
251
+ This project is released under the MIT License. Please cite appropriately if used in academic or production projects.
252
+ See the [LICENSE](LICENSE) file for details.
253
+
254
+ **Key Points:**
255
+ - **Free for Research & Learning**: Use, modify, and study for personal, academic, or research purposes
256
+ - **Source Available**: Full access to source code
257
+ - **Commercial Use Restricted**: Requires separate commercial license
258
+ - **Contact**: For commercial licensing, partnership, or redistribution rights, contact [support@lexsi.ai](mailto:support@lexsi.ai)
259
+
260
+ This is **not** an open-source license as defined by OSI, but provides broad access for non-commercial use.
261
+
262
+ ## Citation
263
+
264
+ If you use AlignTune in your research, please cite:
265
+
266
+ **BibTeX:**
267
+ ```bibtex
268
+ @software{alignTune2025,
269
+ title = {{AlignTune}: Modular Toolkit for Post-Training Alignment of Large Language Models},
270
+ author = {Lyngkhoi, R E Zera Marveen and Chawla, Chirag and Seth, Pratinav and Avaiya, Utsav and Bhattacharjee, Soham and Khandoga, Mykola and Yuan, Rui and Sankarapu, Vinay Kumar},
271
+ year = {2025},
272
+ note = {Equal contribution: R E Zera Marveen Lyngkhoi, Chirag Chawla, Pratinav Seth},
273
+ organization = {Lexsi Labs},
274
+ url = {https://github.com/Lexsi-Labs/aligntune},
275
+ version = {0.0.0}
276
+ }
277
+ ```
278
+
279
+ **Plain Text:**
280
+ ```
281
+ Lyngkhoi, R. E. Z. M., Chawla, C., Seth, P., Avaiya, U., Bhattacharjee, S., Khandoga, M.,
282
+ Yuan, R., & Sankarapu, V. K. (2025). AlignTune: Modular Toolkit for Post-Training Alignment
283
+ of Large Language Models. Lexsi Labs. https://github.com/Lexsi-Labs/aligntune
284
+
285
+ *Equal contribution: R E Zera Marveen Lyngkhoi, Chirag Chawla, Pratinav Seth
286
+ ```
287
+
288
+ ## Acknowledgments
289
+
290
+ AlignTune is built upon the excellent work of the following projects:
291
+
292
+ - **[HuggingFace Transformers](https://github.com/huggingface/transformers)** - Model architectures and tokenizers
293
+ - **[TRL](https://github.com/huggingface/trl)** - Transformer Reinforcement Learning library
294
+ - **[Unsloth](https://github.com/unslothai/unsloth)** - Fast and memory-efficient training
295
+ - **[HuggingFace Datasets](https://github.com/huggingface/datasets)** - Dataset loading and processing
296
+
297
+ ## Support
298
+
299
+ - **Documentation**: [aligntune.lexsi.ai/](https://aligntune.lexsi.ai/)
300
+ - **GitHub Issues**: [github.com/Lexsi-Labs/aligntune/issues](https://github.com/Lexsi-Labs/aligntune/issues)
301
+ - **Discussions**: [github.com/Lexsi-Labs/aligntune/discussions](https://github.com/Lexsi-Labs/aligntune/discussions)
302
+ - **Email**: [support@lexsi.ai](mailto:support@lexsi.ai)
303
+
304
+ ---
305
+
306
+ **Get started with AlignTune and accelerate your LLM fine-tuning workflows today!**
@@ -0,0 +1,230 @@
1
+
2
+ <p align="center">
3
+ <img src="docs/assets/aligntune-banner.png" alt="AlignTune Banner" width="1000px"/>
4
+ </p>
5
+
6
+ <div align="center">
7
+ <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.8+-blue.svg"/></a>
8
+ <a href="https://github.com/Lexsi-Labs/aligntune/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg"/></a>
9
+ <a href="https://badge.fury.io/py/aligntune"><img src="https://badge.fury.io/py/aligntune.svg"/></a>
10
+ </div>
11
+
12
+ ---
13
+
14
+ **AlignTune** is a production-ready fine-tuning library designed to simplify training and fine-tuning of Large Language Models (LLMs) with both Supervised Fine-Tuning (SFT) and Reinforcement Learning (RL) methods. It provides a high-level, unified API that abstracts away the complexities of backend selection, algorithm configuration, and training loops, letting you focus on delivering results.
15
+
16
+ ## Core Features
17
+
18
+ **Multi-Backend Architecture**: Choose between TRL (reliable, battle-tested) and Unsloth (faster) backends with intelligent auto-selection.
19
+
20
+ **Complete RLHF Coverage**: 12+ RL algorithms including DPO, PPO, GRPO, GSPO, DAPO, Dr. GRPO, GBMPO, Counterfactual GRPO, and PACE.
21
+
22
+ **Production-Ready**: No mock code, comprehensive error handling, extensive testing, and robust validation.
23
+
24
+ ## Quick Start
25
+
26
+ ### Supervised Fine-Tuning (SFT)
27
+
28
+ ```python
29
+ from aligntune.core.backend_factory import create_sft_trainer
30
+
31
+ # Create and train SFT model
32
+ trainer = create_sft_trainer(
33
+ model_name="microsoft/DialoGPT-small",
34
+ dataset_name="tatsu-lab/alpaca",
35
+ backend="trl",
36
+ num_epochs=3,
37
+ max_steps = -1,
38
+ batch_size=4,
39
+ learning_rate=5e-5
40
+ )
41
+
42
+ # Train the model
43
+ trainer.train()
44
+
45
+ # Evaluate
46
+ metrics = trainer.evaluate()
47
+ print(metrics)
48
+ ```
49
+
50
+ ### Reinforcement Learning (DPO)
51
+
52
+ ```python
53
+ from aligntune.core.backend_factory import create_rl_trainer
54
+
55
+ # Create and train DPO model
56
+ trainer = create_rl_trainer(
57
+ model_name="Qwen/Qwen3-0.6B",
58
+ dataset_name="Anthropic/hh-rlhf",
59
+ algorithm="dpo",
60
+ backend="trl",
61
+ num_epochs=1,
62
+ batch_size=4,
63
+ learning_rate=5e-5
64
+ )
65
+
66
+ # Train the model
67
+ trainer.train()
68
+ ```
69
+
70
+ ## Supported Algorithms
71
+
72
+ | Algorithm | TRL Backend | Unsloth Backend | Description |
73
+ |-----------|-------------|-----------------|-------------|
74
+ | **SFT** | Yes | Yes | Supervised Fine-Tuning |
75
+ | **DPO** | Yes | Yes | Direct Preference Optimization |
76
+ | **PPO** | Yes | Yes | Proximal Policy Optimization |
77
+ | **GRPO** | Yes | Yes | Group Relative Policy Optimization |
78
+ | **GSPO** | Yes | Yes | Group Sequential Policy Optimization |
79
+ | **DAPO** | Yes | Yes | Decouple Clip and Dynamic sAmpling Policy Optimization |
80
+ | **Dr. GRPO** | Yes | Yes | GRPO Done Right (unbiased variant) |
81
+ | **GBMPO** | Yes | No | Group-Based Mirror Policy Optimization |
82
+ | **Counterfactual GRPO** | Yes | Yes | Counterfactual GRPO variant |
83
+ | **PACE** | Yes | Yes | Baseline-Optimized Learning Technique |
84
+
85
+ ## Installation
86
+
87
+ ```bash
88
+ # Or install from source
89
+ git clone https://github.com/Lexsi-Labs/aligntune.git
90
+ cd aligntune
91
+ pip install -e .
92
+ ```
93
+
94
+ ### Requirements
95
+
96
+ - Python 3.8+
97
+ - PyTorch 2.0+
98
+ - CUDA-compatible GPU (recommended for faster training)
99
+
100
+ ## Demo Notebooks
101
+
102
+ Interactive Colab notebooks demonstrating various AlignTune workflows:
103
+ Here are the organized tables containing the Colab links, models, and datasets provided in your text.
104
+
105
+ ### Supervised Fine-Tuning (SFT)
106
+
107
+ | Backend| Model | Dataset | Link |
108
+ | --- | --- | --- | --- |
109
+ | TRL | **Qwen/Qwen3-4B-Instruct-2507** | sohamb37lexsi/bitext-wealth-management-llm-chatbot-splits | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1okAnfMlkch-G5Dy2dmj_dfR07rtxmYoq?usp=sharing) |
110
+ | TRL | **Qwen3-4B-Instruct** | sohamb37lexsi/bitext-retail-banking-llm-chatbot-splits | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1JnFvEWZ6PDqrDAyWznCdOA9oNn8aqN2v?usp=sharing) |
111
+ | Unsloth| **Qwen/Qwen2.5-0.5B-Instruct** | bebechien/MobileGameNPC | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/15R3JOrzAUuMagCamDHsqe0wNyb44rw2j?usp=sharing) |
112
+ | TRL | **google/txgemma-2b-predict** | trialbench_adverse-event-rate-prediction | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1r91SS7Lb5LjkjzWXp7uzkpR3vlWZ6gwD?usp=sharing) |
113
+ | Unsloth| **Qwen/Qwen2.5-0.5B-Instruct** | bebechien/MobileGameNP |[![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/11DrRbG30MUCegZTDXwR9nxEdvKaLfWCb?usp=sharing) |
114
+
115
+ ### Reinforcement Learning (RL)
116
+
117
+ | Backend| Algorithm | Model | Dataset | Link |
118
+ | --- | --- | --- | --- | --- |
119
+ | Unsloth| **DPO** | microsoft/phi-2 | argilla/distilabel-intel-orca-dpo-pairs | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1aKdQzT7KGs0PEr7pO9rOXFkwQK6LzyRZ#scrollTo=dOnIJIAMxP9J) |
120
+ | TRL | **DPO** | google/gemma-2-2b-it | Anthropic/hh-rlhf | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1WQhek61Z0v1zHFWT4mQwVX7n10ln-j3d?usp=sharing) |
121
+ | TRL | **DPO** | sohamb37lexsi/wealth_management_Qwen3-4B-Instruct-2507 | sohamb37lexsi/bitext_wealth_management_preference_data | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1LR3KWcjQAFjSHf0MR9271ShchjPUVSpS?usp=sharing) |
122
+ | Unsloth| **PPO** | Qwen/Qwen2.5-0.5B-Instruct | HuggingFaceH4/ultrachat_200k | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1G4fdtO4DhBNwjOYhuaGmvIrBU_lc159H?usp=sharing) |
123
+ | TRL | **PPO** | EleutherAI/pythia-1.4b | CarperAI/openai_summarize_tldr | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1wlbSvQAJv8ZFM2qGD4XlUOKPzZHXstQo?usp=sharing) |
124
+ | TRL | **GRPO** (Coding) | Qwen/Qwen3-4B | google-research-datasets/mbpp | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/13HYZ-EkLC3-6wxJG_1NyWXPEuN9bIeM4?usp=sharing) |
125
+ | Unsloth| **GRPO** (Math) | meta-llama/Llama-3.2-3B-Instruct | openai/gsm8k | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/11tj2odJa7v55VvQkpOlm7_WBclqFdaVi?usp=sharing) |
126
+ | TRL | **GRPO** | meta-llama/Llama-3.2-3B-Instruct | openai/gsm8k | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/14b2dt0_iSVL8Z_8mlOx--f-d_rDCqVOP?usp=sharing) |
127
+ | Unsloth | **DRGRPO** | Qwen/Qwen2.5-3B-Instruct | yahma/alpaca-cleaned | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1IzDtjONyL6CZ038faTTp8AvLfhzkqSpb?usp=sharing) |
128
+ | TRL | **DRGRPO** | Qwen/Qwen2-0.5B-Instruct | AI-MO/NuminaMath-TIR | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1KfrMzuGRPrZwyRuNTGep1ZL6C6h2aVjk?usp=sharing) |
129
+ | Unsloth | **GSPO** | Qwen/Qwen3-1.7B | CyberNative/Code_Vulnerability_Security_DPO | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/120FjMEAZRXUoOMRsWHCn5tmpGfLTAY4g?usp=sharing) |
130
+ | TRL | **GSPO** | meta-llama/Llama-3.2-3B-Instruct | HuggingFaceH4/ultrachat_200k | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1vDP7ukBHWwSiD7KVSgSekCvk-x_MkWdC?usp=sharing) |
131
+ | Unsloth| **DAPO** | microsoft/Phi-3.5-mini-instruct | HuggingFaceH4/ultrachat_200k | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1gAa6EPc5345XRfog1nzQIFTmp_OJqNvk?usp=sharing) |
132
+ |TRL | **DAPO** | meta-llama/Llama-3.2-3B-Instruct | google-research-datasets/mbpp | [![Open In Colab](https://img.shields.io/badge/Open%20in%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)](https://colab.research.google.com/drive/1aF3LxEMmLl0fCyA5yVBAkU_Rgsy3dsh5?usp=sharing) |
133
+ ## Documentation
134
+
135
+ - **[Getting Started](docs/getting-started/installation.md)**: Installation, setup, and basic usage
136
+ - **[User Guide](docs/user-guide/overview.md)**: In-depth tutorials for SFT and RL training
137
+ - **[API Reference](docs/api-reference/overview.md)**: Complete Python API and class/method details
138
+ - **[Examples](docs/examples/overview.md)**: End-to-end code examples
139
+ - **[Advanced Topics](docs/advanced/architecture.md)**: Architecture, custom backends, and performance optimization
140
+ - **[Notebooks](docs/notebooks/index.md)**: Interactive Colab notebooks and local Jupyter notebooks
141
+
142
+ ## Key Capabilities
143
+
144
+ - **Multiple Training Paradigms**: Supports SFT, DPO, PPO, GRPO, and advanced RL algorithms
145
+ - **Backend Flexibility**: TRL and Unsloth backends with automatic fallback
146
+ - **Reward Model Training**: Train custom reward models from rule-based functions
147
+ - **Comprehensive Evaluation**: Multi-level evaluation with lm-eval integration
148
+ - **Production Ready**: Model serialization, reproducible training, and deployment-ready pipelines
149
+ - **Extensible Architecture**: Modular design for easy integration of custom algorithms and backends
150
+
151
+ ## Architecture
152
+
153
+ AlignTune uses a flexible backend architecture:
154
+
155
+ ```mermaid
156
+ flowchart TD
157
+ Factory[Backend Factory] --> TRL[TRL Backend]
158
+ Factory --> Unsloth[Unsloth Backend]
159
+ TRL --> TRL_Algos[TRL Algorithms]
160
+ Unsloth --> Unsloth_Algos[Unsloth Algorithms]
161
+ ```
162
+
163
+ **TRL Backend:** SFT, DPO, PPO, GRPO, GSPO, DAPO, Dr. GRPO, GBMPO, Counterfactual GRPO, PACE
164
+
165
+ **Unsloth Backend:** SFT, DPO, PPO, GRPO, DAPO, Dr. GRPO, Counterfactual GRPO, PACE
166
+
167
+ See [Architecture](docs/advanced/architecture.md) for details.
168
+
169
+ ## Contributing
170
+
171
+ We welcome contributions! See our [Contributing Guide](docs/contributing/guide.md) for details.
172
+
173
+ ## License
174
+
175
+ This project is released under the MIT License. Please cite appropriately if used in academic or production projects.
176
+ See the [LICENSE](LICENSE) file for details.
177
+
178
+ **Key Points:**
179
+ - **Free for Research & Learning**: Use, modify, and study for personal, academic, or research purposes
180
+ - **Source Available**: Full access to source code
181
+ - **Commercial Use Restricted**: Requires separate commercial license
182
+ - **Contact**: For commercial licensing, partnership, or redistribution rights, contact [support@lexsi.ai](mailto:support@lexsi.ai)
183
+
184
+ This is **not** an open-source license as defined by OSI, but provides broad access for non-commercial use.
185
+
186
+ ## Citation
187
+
188
+ If you use AlignTune in your research, please cite:
189
+
190
+ **BibTeX:**
191
+ ```bibtex
192
+ @software{alignTune2025,
193
+ title = {{AlignTune}: Modular Toolkit for Post-Training Alignment of Large Language Models},
194
+ author = {Lyngkhoi, R E Zera Marveen and Chawla, Chirag and Seth, Pratinav and Avaiya, Utsav and Bhattacharjee, Soham and Khandoga, Mykola and Yuan, Rui and Sankarapu, Vinay Kumar},
195
+ year = {2025},
196
+ note = {Equal contribution: R E Zera Marveen Lyngkhoi, Chirag Chawla, Pratinav Seth},
197
+ organization = {Lexsi Labs},
198
+ url = {https://github.com/Lexsi-Labs/aligntune},
199
+ version = {0.0.0}
200
+ }
201
+ ```
202
+
203
+ **Plain Text:**
204
+ ```
205
+ Lyngkhoi, R. E. Z. M., Chawla, C., Seth, P., Avaiya, U., Bhattacharjee, S., Khandoga, M.,
206
+ Yuan, R., & Sankarapu, V. K. (2025). AlignTune: Modular Toolkit for Post-Training Alignment
207
+ of Large Language Models. Lexsi Labs. https://github.com/Lexsi-Labs/aligntune
208
+
209
+ *Equal contribution: R E Zera Marveen Lyngkhoi, Chirag Chawla, Pratinav Seth
210
+ ```
211
+
212
+ ## Acknowledgments
213
+
214
+ AlignTune is built upon the excellent work of the following projects:
215
+
216
+ - **[HuggingFace Transformers](https://github.com/huggingface/transformers)** - Model architectures and tokenizers
217
+ - **[TRL](https://github.com/huggingface/trl)** - Transformer Reinforcement Learning library
218
+ - **[Unsloth](https://github.com/unslothai/unsloth)** - Fast and memory-efficient training
219
+ - **[HuggingFace Datasets](https://github.com/huggingface/datasets)** - Dataset loading and processing
220
+
221
+ ## Support
222
+
223
+ - **Documentation**: [aligntune.lexsi.ai/](https://aligntune.lexsi.ai/)
224
+ - **GitHub Issues**: [github.com/Lexsi-Labs/aligntune/issues](https://github.com/Lexsi-Labs/aligntune/issues)
225
+ - **Discussions**: [github.com/Lexsi-Labs/aligntune/discussions](https://github.com/Lexsi-Labs/aligntune/discussions)
226
+ - **Email**: [support@lexsi.ai](mailto:support@lexsi.ai)
227
+
228
+ ---
229
+
230
+ **Get started with AlignTune and accelerate your LLM fine-tuning workflows today!**