aligntune 0.1.7__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 (186) hide show
  1. aligntune-0.1.7/LICENSE +21 -0
  2. aligntune-0.1.7/PKG-INFO +316 -0
  3. aligntune-0.1.7/README.md +244 -0
  4. aligntune-0.1.7/pyproject.toml +352 -0
  5. aligntune-0.1.7/setup.cfg +4 -0
  6. aligntune-0.1.7/setup.py +10 -0
  7. aligntune-0.1.7/src/aligntune/__init__.py +368 -0
  8. aligntune-0.1.7/src/aligntune/__main__.py +11 -0
  9. aligntune-0.1.7/src/aligntune/_fallbacks.py +132 -0
  10. aligntune-0.1.7/src/aligntune/_imports.py +598 -0
  11. aligntune-0.1.7/src/aligntune/backends/__init__.py +64 -0
  12. aligntune-0.1.7/src/aligntune/backends/trl/__init__.py +55 -0
  13. aligntune-0.1.7/src/aligntune/backends/trl/eval/__init__.py +0 -0
  14. aligntune-0.1.7/src/aligntune/backends/trl/rewards/__init__.py +27 -0
  15. aligntune-0.1.7/src/aligntune/backends/trl/rewards/training.py +838 -0
  16. aligntune-0.1.7/src/aligntune/backends/trl/rl/__init__.py +53 -0
  17. aligntune-0.1.7/src/aligntune/backends/trl/rl/counterfact_grpo/__init__.py +11 -0
  18. aligntune-0.1.7/src/aligntune/backends/trl/rl/counterfact_grpo/counterfact_grpo.py +1711 -0
  19. aligntune-0.1.7/src/aligntune/backends/trl/rl/counterfact_grpo/custom_trainer.py +2106 -0
  20. aligntune-0.1.7/src/aligntune/backends/trl/rl/dapo/__init__.py +11 -0
  21. aligntune-0.1.7/src/aligntune/backends/trl/rl/dapo/dapo.py +1003 -0
  22. aligntune-0.1.7/src/aligntune/backends/trl/rl/dpo/__init__.py +11 -0
  23. aligntune-0.1.7/src/aligntune/backends/trl/rl/dpo/dpo.py +668 -0
  24. aligntune-0.1.7/src/aligntune/backends/trl/rl/dr_grpo/__init__.py +11 -0
  25. aligntune-0.1.7/src/aligntune/backends/trl/rl/dr_grpo/drgrpo.py +939 -0
  26. aligntune-0.1.7/src/aligntune/backends/trl/rl/gbmpo/__init__.py +3 -0
  27. aligntune-0.1.7/src/aligntune/backends/trl/rl/gbmpo/gbmpo.py +1116 -0
  28. aligntune-0.1.7/src/aligntune/backends/trl/rl/gbmpo/gbmpo_trainer.py +1826 -0
  29. aligntune-0.1.7/src/aligntune/backends/trl/rl/grpo/__init__.py +11 -0
  30. aligntune-0.1.7/src/aligntune/backends/trl/rl/grpo/grpo.py +1105 -0
  31. aligntune-0.1.7/src/aligntune/backends/trl/rl/gspo/__init__.py +11 -0
  32. aligntune-0.1.7/src/aligntune/backends/trl/rl/gspo/gspo.py +1381 -0
  33. aligntune-0.1.7/src/aligntune/backends/trl/rl/meta_es/es_utils.py +446 -0
  34. aligntune-0.1.7/src/aligntune/backends/trl/rl/meta_es/logging_config.py +70 -0
  35. aligntune-0.1.7/src/aligntune/backends/trl/rl/meta_es/meta_es_trainer.py +172 -0
  36. aligntune-0.1.7/src/aligntune/backends/trl/rl/meta_es/meta_es_trainer_utils.py +673 -0
  37. aligntune-0.1.7/src/aligntune/backends/trl/rl/meta_es/neural_mirror_grpo.py +726 -0
  38. aligntune-0.1.7/src/aligntune/backends/trl/rl/meta_es/train_nmdrgrpo_code.py +1523 -0
  39. aligntune-0.1.7/src/aligntune/backends/trl/rl/meta_es/train_nmdrgrpo_es_math.py +635 -0
  40. aligntune-0.1.7/src/aligntune/backends/trl/rl/meta_es/vllm_evaluator.py +674 -0
  41. aligntune-0.1.7/src/aligntune/backends/trl/rl/meta_es/vllm_evaluator_math.py +489 -0
  42. aligntune-0.1.7/src/aligntune/backends/trl/rl/neural_mirror_grpo/NMGrpo.py +941 -0
  43. aligntune-0.1.7/src/aligntune/backends/trl/rl/neural_mirror_grpo/neural_mirror_grpo.py +726 -0
  44. aligntune-0.1.7/src/aligntune/backends/trl/rl/pace/__init__.py +49 -0
  45. aligntune-0.1.7/src/aligntune/backends/trl/rl/pace/baseline.py +549 -0
  46. aligntune-0.1.7/src/aligntune/backends/trl/rl/pace/curriculum.py +467 -0
  47. aligntune-0.1.7/src/aligntune/backends/trl/rl/pace/pace.py +981 -0
  48. aligntune-0.1.7/src/aligntune/backends/trl/rl/ppo/__init__.py +11 -0
  49. aligntune-0.1.7/src/aligntune/backends/trl/rl/ppo/ppo.py +1235 -0
  50. aligntune-0.1.7/src/aligntune/backends/trl/sft/Classification_trainer.py +787 -0
  51. aligntune-0.1.7/src/aligntune/backends/trl/sft/__init__.py +11 -0
  52. aligntune-0.1.7/src/aligntune/backends/trl/sft/sft.py +1659 -0
  53. aligntune-0.1.7/src/aligntune/backends/unsloth/__init__.py +44 -0
  54. aligntune-0.1.7/src/aligntune/backends/unsloth/eval/__init__.py +0 -0
  55. aligntune-0.1.7/src/aligntune/backends/unsloth/rl/__init__.py +36 -0
  56. aligntune-0.1.7/src/aligntune/backends/unsloth/rl/counterfact_grpo/__init__.py +11 -0
  57. aligntune-0.1.7/src/aligntune/backends/unsloth/rl/counterfact_grpo/counterfact_grpo.py +960 -0
  58. aligntune-0.1.7/src/aligntune/backends/unsloth/rl/dapo/__init__.py +9 -0
  59. aligntune-0.1.7/src/aligntune/backends/unsloth/rl/dapo/dapo.py +1060 -0
  60. aligntune-0.1.7/src/aligntune/backends/unsloth/rl/dpo/__init__.py +9 -0
  61. aligntune-0.1.7/src/aligntune/backends/unsloth/rl/dpo/dpo.py +712 -0
  62. aligntune-0.1.7/src/aligntune/backends/unsloth/rl/dr_grpo/__init__.py +9 -0
  63. aligntune-0.1.7/src/aligntune/backends/unsloth/rl/dr_grpo/drgrpo.py +963 -0
  64. aligntune-0.1.7/src/aligntune/backends/unsloth/rl/gbmpo/__init__.py +3 -0
  65. aligntune-0.1.7/src/aligntune/backends/unsloth/rl/gbmpo/gbmpo.py +1216 -0
  66. aligntune-0.1.7/src/aligntune/backends/unsloth/rl/gbmpo/gbmpo_trainer.py +1826 -0
  67. aligntune-0.1.7/src/aligntune/backends/unsloth/rl/grpo/__init__.py +9 -0
  68. aligntune-0.1.7/src/aligntune/backends/unsloth/rl/grpo/grpo.py +1108 -0
  69. aligntune-0.1.7/src/aligntune/backends/unsloth/rl/gspo/__init__.py +9 -0
  70. aligntune-0.1.7/src/aligntune/backends/unsloth/rl/gspo/gspo.py +1279 -0
  71. aligntune-0.1.7/src/aligntune/backends/unsloth/rl/neural_mirror_grpo/NMGrpo.py +1140 -0
  72. aligntune-0.1.7/src/aligntune/backends/unsloth/rl/neural_mirror_grpo/neural_mirror_grpo.py +726 -0
  73. aligntune-0.1.7/src/aligntune/backends/unsloth/rl/pace/__init__.py +18 -0
  74. aligntune-0.1.7/src/aligntune/backends/unsloth/rl/pace/pace.py +695 -0
  75. aligntune-0.1.7/src/aligntune/backends/unsloth/rl/ppo/__init__.py +76 -0
  76. aligntune-0.1.7/src/aligntune/backends/unsloth/rl/ppo/ppo.py +2345 -0
  77. aligntune-0.1.7/src/aligntune/backends/unsloth/rl/ppo/unsloth_patches.py +355 -0
  78. aligntune-0.1.7/src/aligntune/backends/unsloth/sft/__init__.py +9 -0
  79. aligntune-0.1.7/src/aligntune/backends/unsloth/sft/sft.py +1203 -0
  80. aligntune-0.1.7/src/aligntune/cli/__init__.py +95 -0
  81. aligntune-0.1.7/src/aligntune/cli/__main__.py +10 -0
  82. aligntune-0.1.7/src/aligntune/cli/arg_parser.py +442 -0
  83. aligntune-0.1.7/src/aligntune/cli/config_builders.py +469 -0
  84. aligntune-0.1.7/src/aligntune/cli/diagnose.py +367 -0
  85. aligntune-0.1.7/src/aligntune/cli/finetune.py +508 -0
  86. aligntune-0.1.7/src/aligntune/cli/recipes.py +320 -0
  87. aligntune-0.1.7/src/aligntune/cli/unified-old.py +1135 -0
  88. aligntune-0.1.7/src/aligntune/cli/unified.py +1679 -0
  89. aligntune-0.1.7/src/aligntune/cli/validate.py +511 -0
  90. aligntune-0.1.7/src/aligntune/core/backend_factory.py +1341 -0
  91. aligntune-0.1.7/src/aligntune/core/callbacks/__init__.py +7 -0
  92. aligntune-0.1.7/src/aligntune/core/callbacks/base.py +165 -0
  93. aligntune-0.1.7/src/aligntune/core/dataset_adapters.py +361 -0
  94. aligntune-0.1.7/src/aligntune/core/optimization.py +424 -0
  95. aligntune-0.1.7/src/aligntune/core/precision_handler.py +207 -0
  96. aligntune-0.1.7/src/aligntune/core/rl/__init__.py +65 -0
  97. aligntune-0.1.7/src/aligntune/core/rl/caching.py +324 -0
  98. aligntune-0.1.7/src/aligntune/core/rl/config.py +729 -0
  99. aligntune-0.1.7/src/aligntune/core/rl/config_loader.py +307 -0
  100. aligntune-0.1.7/src/aligntune/core/rl/distributed.py +319 -0
  101. aligntune-0.1.7/src/aligntune/core/rl/evaluator.py +1053 -0
  102. aligntune-0.1.7/src/aligntune/core/rl/function_based_reward_model.py +276 -0
  103. aligntune-0.1.7/src/aligntune/core/rl/logging.py +327 -0
  104. aligntune-0.1.7/src/aligntune/core/rl/models.py +371 -0
  105. aligntune-0.1.7/src/aligntune/core/rl/registries.py +631 -0
  106. aligntune-0.1.7/src/aligntune/core/rl/reward_model_wrapper.py +212 -0
  107. aligntune-0.1.7/src/aligntune/core/rl/rollout.py +412 -0
  108. aligntune-0.1.7/src/aligntune/core/rl/sample_logger.py +135 -0
  109. aligntune-0.1.7/src/aligntune/core/rl/trainer_base.py +920 -0
  110. aligntune-0.1.7/src/aligntune/core/rl/trainer_factory.py +154 -0
  111. aligntune-0.1.7/src/aligntune/core/sft/__init__.py +44 -0
  112. aligntune-0.1.7/src/aligntune/core/sft/config.py +770 -0
  113. aligntune-0.1.7/src/aligntune/core/sft/config_loader.py +174 -0
  114. aligntune-0.1.7/src/aligntune/core/sft/evaluator.py +1017 -0
  115. aligntune-0.1.7/src/aligntune/core/sft/logging.py +117 -0
  116. aligntune-0.1.7/src/aligntune/core/sft/trainer_base.py +601 -0
  117. aligntune-0.1.7/src/aligntune/core/sft/trainer_factory.py +81 -0
  118. aligntune-0.1.7/src/aligntune/data/__init__.py +0 -0
  119. aligntune-0.1.7/src/aligntune/data/full_requirements_test.py +201 -0
  120. aligntune-0.1.7/src/aligntune/data/loaders/__init__.py +0 -0
  121. aligntune-0.1.7/src/aligntune/data/loaders/base.py +7 -0
  122. aligntune-0.1.7/src/aligntune/data/loaders/csv_loader.py +20 -0
  123. aligntune-0.1.7/src/aligntune/data/loaders/directory_loader.py +27 -0
  124. aligntune-0.1.7/src/aligntune/data/loaders/hf_loader.py +45 -0
  125. aligntune-0.1.7/src/aligntune/data/loaders/json_loader.py +12 -0
  126. aligntune-0.1.7/src/aligntune/data/loaders/parquet_loader.py +9 -0
  127. aligntune-0.1.7/src/aligntune/data/loaders/resolver.py +33 -0
  128. aligntune-0.1.7/src/aligntune/data/manager.py +214 -0
  129. aligntune-0.1.7/src/aligntune/data/processors.py +675 -0
  130. aligntune-0.1.7/src/aligntune/data/schemas.py +90 -0
  131. aligntune-0.1.7/src/aligntune/eval/__init__.py +113 -0
  132. aligntune-0.1.7/src/aligntune/eval/caching.py +40 -0
  133. aligntune-0.1.7/src/aligntune/eval/cli.py +248 -0
  134. aligntune-0.1.7/src/aligntune/eval/core.py +419 -0
  135. aligntune-0.1.7/src/aligntune/eval/eval_gsm8k.py +241 -0
  136. aligntune-0.1.7/src/aligntune/eval/evaluator.py +492 -0
  137. aligntune-0.1.7/src/aligntune/eval/full_evaluation_test.py +228 -0
  138. aligntune-0.1.7/src/aligntune/eval/lm_eval_integration.py +443 -0
  139. aligntune-0.1.7/src/aligntune/eval/metrics/__init__.py +22 -0
  140. aligntune-0.1.7/src/aligntune/eval/metrics/base.py +45 -0
  141. aligntune-0.1.7/src/aligntune/eval/metrics/code.py +249 -0
  142. aligntune-0.1.7/src/aligntune/eval/metrics/dpo.py +372 -0
  143. aligntune-0.1.7/src/aligntune/eval/metrics/generic.py +52 -0
  144. aligntune-0.1.7/src/aligntune/eval/metrics/math.py +139 -0
  145. aligntune-0.1.7/src/aligntune/eval/metrics/rl.py +57 -0
  146. aligntune-0.1.7/src/aligntune/eval/metrics/text.py +128 -0
  147. aligntune-0.1.7/src/aligntune/eval/registry.py +56 -0
  148. aligntune-0.1.7/src/aligntune/eval/rl_evaluator.py +573 -0
  149. aligntune-0.1.7/src/aligntune/eval/runner.py +751 -0
  150. aligntune-0.1.7/src/aligntune/eval/safe_executor.py +509 -0
  151. aligntune-0.1.7/src/aligntune/main.py +1024 -0
  152. aligntune-0.1.7/src/aligntune/py.typed +0 -0
  153. aligntune-0.1.7/src/aligntune/recipes/__init__.py +538 -0
  154. aligntune-0.1.7/src/aligntune/recipes/config.py +22 -0
  155. aligntune-0.1.7/src/aligntune/rewards/__init__.py +69 -0
  156. aligntune-0.1.7/src/aligntune/rewards/core.py +3161 -0
  157. aligntune-0.1.7/src/aligntune/rewards/factory.py +162 -0
  158. aligntune-0.1.7/src/aligntune/rewards/registry.py +528 -0
  159. aligntune-0.1.7/src/aligntune/rewards/training.py +804 -0
  160. aligntune-0.1.7/src/aligntune/rl/__init__.py +10 -0
  161. aligntune-0.1.7/src/aligntune/rl/core/__init__.py +10 -0
  162. aligntune-0.1.7/src/aligntune/scripts/__init__.py +3 -0
  163. aligntune-0.1.7/src/aligntune/scripts/precompute_baseline.py +1937 -0
  164. aligntune-0.1.7/src/aligntune/sft/__init__.py +10 -0
  165. aligntune-0.1.7/src/aligntune/sft/core/__init__.py +10 -0
  166. aligntune-0.1.7/src/aligntune/utils/__init__.py +132 -0
  167. aligntune-0.1.7/src/aligntune/utils/auth.py +239 -0
  168. aligntune-0.1.7/src/aligntune/utils/checkpointing.py +439 -0
  169. aligntune-0.1.7/src/aligntune/utils/colored_logging.py +259 -0
  170. aligntune-0.1.7/src/aligntune/utils/config_extractor.py +346 -0
  171. aligntune-0.1.7/src/aligntune/utils/config_utils.py +501 -0
  172. aligntune-0.1.7/src/aligntune/utils/device.py +425 -0
  173. aligntune-0.1.7/src/aligntune/utils/diagnostics.py +454 -0
  174. aligntune-0.1.7/src/aligntune/utils/environment.py +309 -0
  175. aligntune-0.1.7/src/aligntune/utils/errors.py +429 -0
  176. aligntune-0.1.7/src/aligntune/utils/inference_utils.py +40 -0
  177. aligntune-0.1.7/src/aligntune/utils/logging.py +301 -0
  178. aligntune-0.1.7/src/aligntune/utils/math_grading.py +758 -0
  179. aligntune-0.1.7/src/aligntune/utils/model_loader.py +577 -0
  180. aligntune-0.1.7/src/aligntune/utils/validation.py +514 -0
  181. aligntune-0.1.7/src/aligntune.egg-info/PKG-INFO +316 -0
  182. aligntune-0.1.7/src/aligntune.egg-info/SOURCES.txt +184 -0
  183. aligntune-0.1.7/src/aligntune.egg-info/dependency_links.txt +1 -0
  184. aligntune-0.1.7/src/aligntune.egg-info/entry_points.txt +25 -0
  185. aligntune-0.1.7/src/aligntune.egg-info/requires.txt +50 -0
  186. aligntune-0.1.7/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,316 @@
1
+ Metadata-Version: 2.4
2
+ Name: aligntune
3
+ Version: 0.1.7
4
+ Summary: AlignTune: Multi-backend alignment and fine-tuning library. 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: Zera Lyngkhoi <zera.lyngkhoi@lexsi.ai>, Chirag Chawla <chirag.chawla@lexsi.ai>, Pratinav Seth <pratinav.seth@lexsi.ai>, Utsav Avaiya <utsav.avaiya@lexsi.ai>, Soham Bhattacharjee <soham.bhattacharjee@lexsi.ai>, Mykola Khandoga <mykola.khandoga@lexsi.ai>, Rui Yuan <rui.yuan@lexsi.ai>, Vinay Kumar Sankarapu <v.k@lexsi.ai>
6
+ License: MIT
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.12
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Operating System :: OS Independent
22
+ Requires-Python: >=3.12
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: transformers>=4.35.0
26
+ Requires-Dist: datasets>=2.14.0
27
+ Requires-Dist: accelerate>=0.24.0
28
+ Requires-Dist: peft>=0.6.0
29
+ Requires-Dist: bitsandbytes>=0.41.0
30
+ Requires-Dist: numpy>=1.21.0
31
+ Requires-Dist: pyyaml>=6.0
32
+ Requires-Dist: huggingface-hub>=0.17.0
33
+ Requires-Dist: tqdm>=4.64.0
34
+ Requires-Dist: psutil>=5.9.0
35
+ Requires-Dist: pandas>=1.3.0
36
+ Requires-Dist: scikit-learn>=1.0.0
37
+ Requires-Dist: click>=8.0.0
38
+ Requires-Dist: rich>=12.0.0
39
+ Requires-Dist: typer>=0.7.0
40
+ Requires-Dist: trl==0.23.0
41
+ Requires-Dist: unsloth==2025.11.1
42
+ Requires-Dist: unsloth_zoo==2025.11.2
43
+ Requires-Dist: wandb>=0.15.0
44
+ Requires-Dist: tensorboard>=2.12.0
45
+ Requires-Dist: matplotlib>=3.5.0
46
+ Requires-Dist: seaborn>=0.11.0
47
+ Requires-Dist: evaluate>=0.4.0
48
+ Requires-Dist: rouge-score>=0.1.2
49
+ Requires-Dist: sacrebleu>=2.3.0
50
+ Requires-Dist: lm-eval>=0.4.0
51
+ Requires-Dist: nltk>=3.8.0
52
+ Requires-Dist: nvitop>=1.1.0; platform_system != "Darwin"
53
+ Requires-Dist: nvidia-ml-py>=11.495.46; platform_system != "Darwin"
54
+ Provides-Extra: dev
55
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
56
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
57
+ Requires-Dist: pytest-xdist>=3.0.0; extra == "dev"
58
+ Requires-Dist: pytest-mock>=3.10.0; extra == "dev"
59
+ Requires-Dist: pytest-timeout>=2.1.0; extra == "dev"
60
+ Requires-Dist: hypothesis>=6.70.0; extra == "dev"
61
+ Requires-Dist: black>=23.0.0; extra == "dev"
62
+ Requires-Dist: isort>=5.12.0; extra == "dev"
63
+ Requires-Dist: flake8>=6.0.0; extra == "dev"
64
+ Requires-Dist: mypy>=1.5.0; extra == "dev"
65
+ Requires-Dist: pre-commit>=3.0.0; extra == "dev"
66
+ Provides-Extra: docs
67
+ Requires-Dist: sphinx>=5.0.0; extra == "docs"
68
+ Requires-Dist: sphinx-rtd-theme>=1.2.0; extra == "docs"
69
+ Requires-Dist: myst-parser>=0.18.0; extra == "docs"
70
+ Requires-Dist: sphinx-autodoc-typehints>=1.19.0; extra == "docs"
71
+ Dynamic: license-file
72
+
73
+
74
+ <p align="center">
75
+ <img src="https://raw.githubusercontent.com/Lexsi-Labs/aligntune/refs/heads/docs/assets/banner_aligntune.png" alt="AlignTune Banner" width="1000px"/>
76
+ </p>
77
+
78
+ <div align="center">
79
+ <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.12+-blue.svg"/></a>
80
+ <a href="https://github.com/Lexsi-Labs/aligntune/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg"/></a>
81
+ <a href="https://badge.fury.io/py/aligntune"><img src="https://badge.fury.io/py/aligntune.svg"/></a>
82
+ </div>
83
+
84
+ ---
85
+
86
+ **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.
87
+
88
+ ## Core Features
89
+
90
+ **Multi-Backend Architecture**: Choose between TRL (reliable, battle-tested) and Unsloth (faster) backends with intelligent auto-selection.
91
+
92
+ **Complete RLHF Coverage**: 12+ RL algorithms including DPO, PPO, GRPO, GSPO, DAPO, Dr. GRPO, GBMPO, Counterfactual GRPO, and PACE.
93
+
94
+ **Production-Ready**: No mock code, comprehensive error handling, extensive testing, and robust validation.
95
+
96
+ ## Quick Start
97
+
98
+ ### Supervised Fine-Tuning (SFT)
99
+
100
+ ```python
101
+ from aligntune.core.backend_factory import create_sft_trainer
102
+
103
+ # Create and train SFT model
104
+ trainer = create_sft_trainer(
105
+ model_name="microsoft/DialoGPT-small",
106
+ dataset_name="tatsu-lab/alpaca",
107
+ backend="trl",
108
+ num_epochs=3,
109
+ max_steps = -1,
110
+ batch_size=4,
111
+ learning_rate=5e-5
112
+ )
113
+
114
+ # Train the model
115
+ trainer.train()
116
+
117
+ # Evaluate
118
+ metrics = trainer.evaluate()
119
+ print(metrics)
120
+ ```
121
+
122
+ ### Reinforcement Learning (DPO)
123
+
124
+ ```python
125
+ from aligntune.core.backend_factory import create_rl_trainer
126
+
127
+ # Create and train DPO model
128
+ trainer = create_rl_trainer(
129
+ model_name="Qwen/Qwen3-0.6B",
130
+ dataset_name="Anthropic/hh-rlhf",
131
+ algorithm="dpo",
132
+ backend="trl",
133
+ num_epochs=1,
134
+ batch_size=4,
135
+ learning_rate=5e-5
136
+ )
137
+
138
+ # Train the model
139
+ trainer.train()
140
+ ```
141
+
142
+ ## Supported Algorithms
143
+
144
+ | Algorithm | TRL Backend | Unsloth Backend | Description |
145
+ |-----------|-------------|-----------------|-------------|
146
+ | **SFT** | Yes | Yes | Supervised Fine-Tuning |
147
+ | **DPO** | Yes | Yes | Direct Preference Optimization |
148
+ | **PPO** | Yes | Yes | Proximal Policy Optimization |
149
+ | **GRPO** | Yes | Yes | Group Relative Policy Optimization |
150
+ | **GSPO** | Yes | Yes | Group Sequential Policy Optimization |
151
+ | **DAPO** | Yes | Yes | Decouple Clip and Dynamic sAmpling Policy Optimization |
152
+ | **Dr. GRPO** | Yes | Yes | GRPO Done Right (unbiased variant) |
153
+ | **GBMPO** | Yes | No | Group-Based Mirror Policy Optimization |
154
+ | **Counterfactual GRPO** | Yes | Yes | Counterfactual GRPO variant |
155
+ | **PACE** | Yes | Yes | Baseline-Optimized Learning Technique |
156
+
157
+ ## Installation
158
+
159
+ ```bash
160
+ # Or install from source
161
+ git clone https://github.com/Lexsi-Labs/aligntune.git
162
+ cd aligntune
163
+ pip install -e .
164
+ ```
165
+
166
+ ### Requirements
167
+
168
+ - Python 3.12+
169
+ - PyTorch 2.0+
170
+ - CUDA-compatible GPU (recommended for faster training)
171
+
172
+ ## Demo Notebooks
173
+
174
+ Interactive Colab notebooks demonstrating various AlignTune workflows:
175
+ Here are the organized tables containing the Colab links, models, and datasets provided in your text.
176
+
177
+ ### Supervised Fine-Tuning (SFT)
178
+
179
+ | Backend| Model | Dataset | Link |
180
+ | --- | --- | --- | --- |
181
+ | 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) |
182
+ | 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) |
183
+ | 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) |
184
+ | 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) |
185
+ | 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) |
186
+
187
+ ### Reinforcement Learning (RL)
188
+
189
+ | Backend| Algorithm | Model | Dataset | Link |
190
+ | --- | --- | --- | --- | --- |
191
+ | 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) |
192
+ | 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) |
193
+ | 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) |
194
+ | 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) |
195
+ | 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) |
196
+ | 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) |
197
+ | 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) |
198
+ | 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) |
199
+ | 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) |
200
+ | 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) |
201
+ | 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) |
202
+ | 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) |
203
+ | 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) |
204
+ |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) |
205
+ ## Documentation
206
+
207
+ - **[Getting Started](docs/getting-started/installation.md)**: Installation, setup, and basic usage
208
+ - **[User Guide](docs/user-guide/overview.md)**: In-depth tutorials for SFT and RL training
209
+ - **[API Reference](docs/api-reference/overview.md)**: Complete Python API and class/method details
210
+ - **[Examples](docs/examples/overview.md)**: End-to-end code examples
211
+ - **[Advanced Topics](docs/advanced/architecture.md)**: Architecture, custom backends, and performance optimization
212
+ - **[Notebooks](docs/notebooks/index.md)**: Interactive Colab notebooks and local Jupyter notebooks
213
+
214
+ ## Key Capabilities
215
+
216
+ - **Multiple Training Paradigms**: Supports SFT, DPO, PPO, GRPO, and advanced RL algorithms
217
+ - **Backend Flexibility**: TRL and Unsloth backends with automatic fallback
218
+ - **Reward Model Training**: Train custom reward models from rule-based functions
219
+ - **Comprehensive Evaluation**: Multi-level evaluation with lm-eval integration
220
+ - **Production Ready**: Model serialization, reproducible training, and deployment-ready pipelines
221
+ - **Extensible Architecture**: Modular design for easy integration of custom algorithms and backends
222
+
223
+ ## Architecture
224
+
225
+ AlignTune uses a flexible backend architecture:
226
+
227
+ ```mermaid
228
+ flowchart TD
229
+ Factory[Backend Factory] --> TRL[TRL Backend]
230
+ Factory --> Unsloth[Unsloth Backend]
231
+ TRL --> TRL_Algos[TRL Algorithms]
232
+ Unsloth --> Unsloth_Algos[Unsloth Algorithms]
233
+ ```
234
+
235
+ **TRL Backend:** SFT, DPO, PPO, GRPO, GSPO, DAPO, Dr. GRPO, GBMPO, Counterfactual GRPO, PACE
236
+
237
+ **Unsloth Backend:** SFT, DPO, PPO, GRPO, DAPO, Dr. GRPO, Counterfactual GRPO, PACE
238
+
239
+ See [Architecture](docs/advanced/architecture.md) for details.
240
+
241
+ ## Contributing
242
+
243
+ We welcome contributions! See our [Contributing Guide](docs/contributing/guide.md) for details.
244
+
245
+ ## License
246
+
247
+ This project is released under the MIT License. Please cite appropriately if used in academic or production projects.
248
+ See the [LICENSE](LICENSE) file for details.
249
+
250
+ **Key Points:**
251
+ - **Free for Research & Learning**: Use, modify, and study for personal, academic, or research purposes
252
+ - **Source Available**: Full access to source code
253
+ - **Commercial Use Restricted**: Requires separate commercial license
254
+ - **Contact**: For commercial licensing, partnership, or redistribution rights, contact [support@lexsi.ai](mailto:support@lexsi.ai)
255
+
256
+ This is **not** an open-source license as defined by OSI, but provides broad access for non-commercial use.
257
+
258
+ ## Citation
259
+
260
+ If you use AlignTune in your research, please cite:
261
+
262
+ **BibTeX:**
263
+ ```bibtex
264
+ @software{alignTune2025,
265
+ title = {{AlignTune}: Modular Toolkit for Post-Training Alignment of Large Language Models},
266
+ 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},
267
+ year = {2025},
268
+ note = {Equal contribution: R E Zera Marveen Lyngkhoi, Chirag Chawla, Pratinav Seth},
269
+ organization = {Lexsi Labs},
270
+ url = {https://github.com/Lexsi-Labs/aligntune},
271
+ version = {0.0.0}
272
+ }
273
+ ```
274
+
275
+ **Plain Text:**
276
+ ```
277
+ Lyngkhoi, R. E. Z. M., Chawla, C., Seth, P., Avaiya, U., Bhattacharjee, S., Khandoga, M.,
278
+ Yuan, R., & Sankarapu, V. K. (2025). AlignTune: Modular Toolkit for Post-Training Alignment
279
+ of Large Language Models. Lexsi Labs. https://github.com/Lexsi-Labs/aligntune
280
+
281
+ *Equal contribution: R E Zera Marveen Lyngkhoi, Chirag Chawla, Pratinav Seth
282
+ ```
283
+
284
+ ## Acknowledgments
285
+
286
+ AlignTune is built upon the excellent work of the following projects:
287
+
288
+ - **[HuggingFace Transformers](https://github.com/huggingface/transformers)** - Model architectures and tokenizers
289
+ - **[TRL](https://github.com/huggingface/trl)** - Transformer Reinforcement Learning library
290
+ - **[Unsloth](https://github.com/unslothai/unsloth)** - Fast and memory-efficient training
291
+ - **[HuggingFace Datasets](https://github.com/huggingface/datasets)** - Dataset loading and processing
292
+
293
+ ## Support
294
+
295
+ - **Documentation**: [aligntune.lexsi.ai/](https://aligntune.lexsi.ai/)
296
+ - **GitHub Issues**: [github.com/Lexsi-Labs/aligntune/issues](https://github.com/Lexsi-Labs/aligntune/issues)
297
+ - **Discussions**: [github.com/Lexsi-Labs/aligntune/discussions](https://github.com/Lexsi-Labs/aligntune/discussions)
298
+ - **Email**: [hello@lexsi.ai](mailto:hello@lexsi.ai)
299
+ - **Discord**: [Discord Lexsi Labs](https://discord.gg/ckVbEJGW)
300
+
301
+ ---
302
+
303
+ **Get started with AlignTune and accelerate your LLM fine-tuning workflows today!**
304
+
305
+ ## Contact
306
+
307
+ <div align="center">
308
+ <a href="https://lexsi.ai/">
309
+ <img src="https://raw.githubusercontent.com/Lexsi-Labs/TabTune/refs/heads/docs/assets/lexsilogowhite.png" width="300">
310
+ </a>
311
+ <br>
312
+ <a href="https://lexsi.ai/">https://www.lexsi.ai</a>
313
+ <br><br>
314
+ Paris 🇫🇷 · Mumbai 🇮🇳 · London 🇬🇧
315
+ <br><br>
316
+ </div>
@@ -0,0 +1,244 @@
1
+
2
+ <p align="center">
3
+ <img src="https://raw.githubusercontent.com/Lexsi-Labs/aligntune/refs/heads/docs/assets/banner_aligntune.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.12+-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.12+
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**: [hello@lexsi.ai](mailto:hello@lexsi.ai)
227
+ - **Discord**: [Discord Lexsi Labs](https://discord.gg/ckVbEJGW)
228
+
229
+ ---
230
+
231
+ **Get started with AlignTune and accelerate your LLM fine-tuning workflows today!**
232
+
233
+ ## Contact
234
+
235
+ <div align="center">
236
+ <a href="https://lexsi.ai/">
237
+ <img src="https://raw.githubusercontent.com/Lexsi-Labs/TabTune/refs/heads/docs/assets/lexsilogowhite.png" width="300">
238
+ </a>
239
+ <br>
240
+ <a href="https://lexsi.ai/">https://www.lexsi.ai</a>
241
+ <br><br>
242
+ Paris 🇫🇷 · Mumbai 🇮🇳 · London 🇬🇧
243
+ <br><br>
244
+ </div>