@r1z4x/tezgah 1.0.0

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 (582) hide show
  1. package/CHANGELOG.md +738 -0
  2. package/LICENSE +21 -0
  3. package/MANIFEST +753 -0
  4. package/README.de.md +169 -0
  5. package/README.es.md +168 -0
  6. package/README.fr.md +166 -0
  7. package/README.md +161 -0
  8. package/README.tr.md +163 -0
  9. package/agents/tezgah-reviewer.md +70 -0
  10. package/bin/codegen +337 -0
  11. package/bin/consult +797 -0
  12. package/bin/tezgah-adhd +50 -0
  13. package/bin/tezgah-agents +45 -0
  14. package/bin/tezgah-capture +66 -0
  15. package/bin/tezgah-context +96 -0
  16. package/bin/tezgah-decisions +213 -0
  17. package/bin/tezgah-design +953 -0
  18. package/bin/tezgah-docs +1199 -0
  19. package/bin/tezgah-doctor +497 -0
  20. package/bin/tezgah-dsh +37 -0
  21. package/bin/tezgah-dsh.cmd +70 -0
  22. package/bin/tezgah-gate +75 -0
  23. package/bin/tezgah-import-ai-research +439 -0
  24. package/bin/tezgah-index +32 -0
  25. package/bin/tezgah-lessons +148 -0
  26. package/bin/tezgah-mcp +322 -0
  27. package/bin/tezgah-migrate +324 -0
  28. package/bin/tezgah-pony +50 -0
  29. package/bin/tezgah-research +772 -0
  30. package/bin/tezgah-rollback +93 -0
  31. package/bin/tezgah-route +124 -0
  32. package/bin/tezgah-setup +5798 -0
  33. package/bin/tezgah-status +383 -0
  34. package/bin/tezgah-task +607 -0
  35. package/bin/tezgah-taste +423 -0
  36. package/bin/tezgah-triage +485 -0
  37. package/bin/tezgah.js +36 -0
  38. package/commands/adhd.md +21 -0
  39. package/commands/ponytail.md +21 -0
  40. package/docs/README.md +112 -0
  41. package/docs/architecture.md +226 -0
  42. package/docs/citations-baseline.json +59 -0
  43. package/docs/clarity-baseline.json +116 -0
  44. package/docs/contract.md +416 -0
  45. package/docs/environment.md +141 -0
  46. package/docs/evidence.md +831 -0
  47. package/docs/feature-audit.md +139 -0
  48. package/docs/gate.md +407 -0
  49. package/docs/glossary.md +201 -0
  50. package/docs/hosts.md +400 -0
  51. package/docs/index.json +471 -0
  52. package/docs/judge.md +193 -0
  53. package/docs/layers.md +189 -0
  54. package/docs/models.md +160 -0
  55. package/docs/operations.md +666 -0
  56. package/docs/research.md +809 -0
  57. package/docs/results/paired-outcome-2026-10.jsonl +254 -0
  58. package/docs/results/paired-outcome-2026-10.md +204 -0
  59. package/docs/skills.md +236 -0
  60. package/docs/status-line.md +315 -0
  61. package/docs/testing.md +287 -0
  62. package/docs/vision.md +117 -0
  63. package/hooks/hooks.json +33 -0
  64. package/hooks/projects-auto-init.py +98 -0
  65. package/hooks/projects-posttooluse.py +149 -0
  66. package/hooks/projects-pretooluse.py +40 -0
  67. package/hooks/projects-stop.py +60 -0
  68. package/hooks/tezgah_agents.py +817 -0
  69. package/hooks/tezgah_apps.py +266 -0
  70. package/hooks/tezgah_attest.py +255 -0
  71. package/hooks/tezgah_clarity.py +171 -0
  72. package/hooks/tezgah_components.py +140 -0
  73. package/hooks/tezgah_context.py +2953 -0
  74. package/hooks/tezgah_embed.py +765 -0
  75. package/hooks/tezgah_gate.py +2736 -0
  76. package/hooks/tezgah_guard.py +177 -0
  77. package/hooks/tezgah_index.py +124 -0
  78. package/hooks/tezgah_integrity.py +5141 -0
  79. package/hooks/tezgah_judge.py +487 -0
  80. package/hooks/tezgah_lang.py +230 -0
  81. package/hooks/tezgah_lessons.py +210 -0
  82. package/hooks/tezgah_models.py +855 -0
  83. package/hooks/tezgah_paths.py +1132 -0
  84. package/hooks/tezgah_policy.py +1039 -0
  85. package/hooks/tezgah_rank.py +77 -0
  86. package/hooks/tezgah_replay.py +1109 -0
  87. package/hooks/tezgah_research.py +5176 -0
  88. package/hooks/tezgah_shapes.py +305 -0
  89. package/hooks/tezgah_skill_pick.py +227 -0
  90. package/hooks/tezgah_snapshot.py +490 -0
  91. package/hooks/tezgah_stopspec.py +320 -0
  92. package/hooks/tezgah_task.py +458 -0
  93. package/hooks/tezgah_taste.py +201 -0
  94. package/hooks/tezgah_untrusted.py +112 -0
  95. package/hooks/tezgah_update.py +430 -0
  96. package/hosts/codex/hook.py +268 -0
  97. package/hosts/codex/hooks.json +26 -0
  98. package/hosts/cursor/hook.py +461 -0
  99. package/hosts/cursor/hooks.json +44 -0
  100. package/hosts/dsh/hooks.json +21 -0
  101. package/hosts/dsh/statusline/lib/client.js +138 -0
  102. package/hosts/dsh/statusline/lib/index.js +104 -0
  103. package/hosts/dsh/statusline/package.json +28 -0
  104. package/hosts/omp/hook.py +277 -0
  105. package/hosts/omp/tezgah-hook.ts.in +701 -0
  106. package/hosts/opencode/plugins/tezgah.js +2742 -0
  107. package/hosts/opencode/tui/tezgah-tui.tsx +151 -0
  108. package/output-styles/tezgah.md +142 -0
  109. package/package.json +32 -0
  110. package/packaging/build.sh +342 -0
  111. package/packaging/install.ps1 +166 -0
  112. package/packaging/install.sh +56 -0
  113. package/packaging/upgrade.sh +142 -0
  114. package/skills/ai-research/0-autoresearch-skill/SKILL.md +411 -0
  115. package/skills/ai-research/0-autoresearch-skill/references/agent-continuity.md +95 -0
  116. package/skills/ai-research/0-autoresearch-skill/references/progress-reporting.md +166 -0
  117. package/skills/ai-research/0-autoresearch-skill/references/skill-routing.md +219 -0
  118. package/skills/ai-research/0-autoresearch-skill/templates/findings.md +44 -0
  119. package/skills/ai-research/0-autoresearch-skill/templates/research-log.md +41 -0
  120. package/skills/ai-research/01-model-architecture/litgpt/SKILL.md +469 -0
  121. package/skills/ai-research/01-model-architecture/litgpt/references/custom-models.md +569 -0
  122. package/skills/ai-research/01-model-architecture/litgpt/references/distributed-training.md +452 -0
  123. package/skills/ai-research/01-model-architecture/litgpt/references/supported-models.md +337 -0
  124. package/skills/ai-research/01-model-architecture/litgpt/references/training-recipes.md +620 -0
  125. package/skills/ai-research/01-model-architecture/mamba/SKILL.md +260 -0
  126. package/skills/ai-research/01-model-architecture/mamba/references/architecture-details.md +207 -0
  127. package/skills/ai-research/01-model-architecture/mamba/references/benchmarks.md +256 -0
  128. package/skills/ai-research/01-model-architecture/mamba/references/training-guide.md +389 -0
  129. package/skills/ai-research/01-model-architecture/nanogpt/SKILL.md +290 -0
  130. package/skills/ai-research/01-model-architecture/nanogpt/references/architecture.md +383 -0
  131. package/skills/ai-research/01-model-architecture/nanogpt/references/data.md +477 -0
  132. package/skills/ai-research/01-model-architecture/nanogpt/references/training.md +565 -0
  133. package/skills/ai-research/01-model-architecture/rwkv/SKILL.md +260 -0
  134. package/skills/ai-research/01-model-architecture/rwkv/references/architecture-details.md +345 -0
  135. package/skills/ai-research/01-model-architecture/rwkv/references/rwkv7.md +387 -0
  136. package/skills/ai-research/01-model-architecture/rwkv/references/state-management.md +370 -0
  137. package/skills/ai-research/01-model-architecture/torchtitan/SKILL.md +358 -0
  138. package/skills/ai-research/01-model-architecture/torchtitan/references/checkpoint.md +182 -0
  139. package/skills/ai-research/01-model-architecture/torchtitan/references/custom-models.md +259 -0
  140. package/skills/ai-research/01-model-architecture/torchtitan/references/float8.md +134 -0
  141. package/skills/ai-research/01-model-architecture/torchtitan/references/fsdp.md +127 -0
  142. package/skills/ai-research/02-tokenization/huggingface-tokenizers/SKILL.md +516 -0
  143. package/skills/ai-research/02-tokenization/huggingface-tokenizers/references/algorithms.md +654 -0
  144. package/skills/ai-research/02-tokenization/huggingface-tokenizers/references/integration.md +638 -0
  145. package/skills/ai-research/02-tokenization/huggingface-tokenizers/references/pipeline.md +724 -0
  146. package/skills/ai-research/02-tokenization/huggingface-tokenizers/references/training.md +566 -0
  147. package/skills/ai-research/02-tokenization/sentencepiece/SKILL.md +235 -0
  148. package/skills/ai-research/02-tokenization/sentencepiece/references/algorithms.md +201 -0
  149. package/skills/ai-research/02-tokenization/sentencepiece/references/training.md +305 -0
  150. package/skills/ai-research/03-fine-tuning/axolotl/SKILL.md +158 -0
  151. package/skills/ai-research/03-fine-tuning/axolotl/references/api.md +5549 -0
  152. package/skills/ai-research/03-fine-tuning/axolotl/references/dataset-formats.md +1030 -0
  153. package/skills/ai-research/03-fine-tuning/axolotl/references/index.md +16 -0
  154. package/skills/ai-research/03-fine-tuning/axolotl/references/other.md +3564 -0
  155. package/skills/ai-research/03-fine-tuning/llama-factory/SKILL.md +80 -0
  156. package/skills/ai-research/03-fine-tuning/llama-factory/references/_images.md +24 -0
  157. package/skills/ai-research/03-fine-tuning/llama-factory/references/advanced.md +1056 -0
  158. package/skills/ai-research/03-fine-tuning/llama-factory/references/getting_started.md +350 -0
  159. package/skills/ai-research/03-fine-tuning/llama-factory/references/index.md +20 -0
  160. package/skills/ai-research/03-fine-tuning/llama-factory/references/other.md +32 -0
  161. package/skills/ai-research/03-fine-tuning/peft/SKILL.md +431 -0
  162. package/skills/ai-research/03-fine-tuning/peft/references/advanced-usage.md +515 -0
  163. package/skills/ai-research/03-fine-tuning/peft/references/troubleshooting.md +481 -0
  164. package/skills/ai-research/03-fine-tuning/unsloth/SKILL.md +80 -0
  165. package/skills/ai-research/03-fine-tuning/unsloth/references/index.md +8 -0
  166. package/skills/ai-research/03-fine-tuning/unsloth/references/llms.md +83 -0
  167. package/skills/ai-research/04-mechanistic-interpretability/nnsight/SKILL.md +436 -0
  168. package/skills/ai-research/04-mechanistic-interpretability/nnsight/references/README.md +79 -0
  169. package/skills/ai-research/04-mechanistic-interpretability/nnsight/references/api.md +345 -0
  170. package/skills/ai-research/04-mechanistic-interpretability/nnsight/references/tutorials.md +301 -0
  171. package/skills/ai-research/04-mechanistic-interpretability/pyvene/SKILL.md +473 -0
  172. package/skills/ai-research/04-mechanistic-interpretability/pyvene/references/README.md +74 -0
  173. package/skills/ai-research/04-mechanistic-interpretability/pyvene/references/api.md +384 -0
  174. package/skills/ai-research/04-mechanistic-interpretability/pyvene/references/tutorials.md +377 -0
  175. package/skills/ai-research/04-mechanistic-interpretability/saelens/SKILL.md +386 -0
  176. package/skills/ai-research/04-mechanistic-interpretability/saelens/references/README.md +71 -0
  177. package/skills/ai-research/04-mechanistic-interpretability/saelens/references/api.md +334 -0
  178. package/skills/ai-research/04-mechanistic-interpretability/saelens/references/tutorials.md +319 -0
  179. package/skills/ai-research/04-mechanistic-interpretability/transformer-lens/SKILL.md +346 -0
  180. package/skills/ai-research/04-mechanistic-interpretability/transformer-lens/references/README.md +55 -0
  181. package/skills/ai-research/04-mechanistic-interpretability/transformer-lens/references/api.md +363 -0
  182. package/skills/ai-research/04-mechanistic-interpretability/transformer-lens/references/tutorials.md +340 -0
  183. package/skills/ai-research/05-data-processing/nemo-curator/SKILL.md +383 -0
  184. package/skills/ai-research/05-data-processing/nemo-curator/references/deduplication.md +88 -0
  185. package/skills/ai-research/05-data-processing/nemo-curator/references/filtering.md +103 -0
  186. package/skills/ai-research/05-data-processing/ray-data/SKILL.md +326 -0
  187. package/skills/ai-research/05-data-processing/ray-data/references/integration.md +83 -0
  188. package/skills/ai-research/05-data-processing/ray-data/references/transformations.md +84 -0
  189. package/skills/ai-research/06-post-training/grpo-rl-training/README.md +98 -0
  190. package/skills/ai-research/06-post-training/grpo-rl-training/SKILL.md +572 -0
  191. package/skills/ai-research/06-post-training/miles/SKILL.md +315 -0
  192. package/skills/ai-research/06-post-training/miles/references/api-reference.md +142 -0
  193. package/skills/ai-research/06-post-training/miles/references/troubleshooting.md +353 -0
  194. package/skills/ai-research/06-post-training/openrlhf/SKILL.md +249 -0
  195. package/skills/ai-research/06-post-training/openrlhf/references/algorithm-comparison.md +405 -0
  196. package/skills/ai-research/06-post-training/openrlhf/references/custom-rewards.md +531 -0
  197. package/skills/ai-research/06-post-training/openrlhf/references/hybrid-engine.md +288 -0
  198. package/skills/ai-research/06-post-training/openrlhf/references/multi-node-training.md +455 -0
  199. package/skills/ai-research/06-post-training/simpo/SKILL.md +219 -0
  200. package/skills/ai-research/06-post-training/simpo/references/datasets.md +479 -0
  201. package/skills/ai-research/06-post-training/simpo/references/hyperparameters.md +453 -0
  202. package/skills/ai-research/06-post-training/simpo/references/loss-functions.md +351 -0
  203. package/skills/ai-research/06-post-training/slime/SKILL.md +464 -0
  204. package/skills/ai-research/06-post-training/slime/references/api-reference.md +393 -0
  205. package/skills/ai-research/06-post-training/slime/references/troubleshooting.md +387 -0
  206. package/skills/ai-research/06-post-training/torchforge/SKILL.md +433 -0
  207. package/skills/ai-research/06-post-training/torchforge/references/api-reference.md +328 -0
  208. package/skills/ai-research/06-post-training/torchforge/references/troubleshooting.md +410 -0
  209. package/skills/ai-research/06-post-training/trl-fine-tuning/SKILL.md +455 -0
  210. package/skills/ai-research/06-post-training/trl-fine-tuning/references/dpo-variants.md +228 -0
  211. package/skills/ai-research/06-post-training/trl-fine-tuning/references/online-rl.md +83 -0
  212. package/skills/ai-research/06-post-training/trl-fine-tuning/references/reward-modeling.md +123 -0
  213. package/skills/ai-research/06-post-training/trl-fine-tuning/references/sft-training.md +169 -0
  214. package/skills/ai-research/06-post-training/verl/SKILL.md +391 -0
  215. package/skills/ai-research/06-post-training/verl/references/api-reference.md +302 -0
  216. package/skills/ai-research/06-post-training/verl/references/troubleshooting.md +392 -0
  217. package/skills/ai-research/07-safety-alignment/constitutional-ai/SKILL.md +290 -0
  218. package/skills/ai-research/07-safety-alignment/llamaguard/SKILL.md +337 -0
  219. package/skills/ai-research/07-safety-alignment/nemo-guardrails/SKILL.md +297 -0
  220. package/skills/ai-research/07-safety-alignment/prompt-guard/SKILL.md +312 -0
  221. package/skills/ai-research/08-distributed-training/accelerate/SKILL.md +332 -0
  222. package/skills/ai-research/08-distributed-training/accelerate/references/custom-plugins.md +454 -0
  223. package/skills/ai-research/08-distributed-training/accelerate/references/megatron-integration.md +490 -0
  224. package/skills/ai-research/08-distributed-training/accelerate/references/performance.md +526 -0
  225. package/skills/ai-research/08-distributed-training/deepspeed/SKILL.md +141 -0
  226. package/skills/ai-research/08-distributed-training/deepspeed/references/08.md +18 -0
  227. package/skills/ai-research/08-distributed-training/deepspeed/references/09.md +174 -0
  228. package/skills/ai-research/08-distributed-training/deepspeed/references/2020.md +379 -0
  229. package/skills/ai-research/08-distributed-training/deepspeed/references/2023.md +280 -0
  230. package/skills/ai-research/08-distributed-training/deepspeed/references/assets.md +180 -0
  231. package/skills/ai-research/08-distributed-training/deepspeed/references/index.md +36 -0
  232. package/skills/ai-research/08-distributed-training/deepspeed/references/mii.md +119 -0
  233. package/skills/ai-research/08-distributed-training/deepspeed/references/other.md +1192 -0
  234. package/skills/ai-research/08-distributed-training/megatron-core/SKILL.md +366 -0
  235. package/skills/ai-research/08-distributed-training/megatron-core/references/benchmarks.md +250 -0
  236. package/skills/ai-research/08-distributed-training/megatron-core/references/parallelism-guide.md +405 -0
  237. package/skills/ai-research/08-distributed-training/megatron-core/references/production-examples.md +474 -0
  238. package/skills/ai-research/08-distributed-training/megatron-core/references/training-recipes.md +548 -0
  239. package/skills/ai-research/08-distributed-training/pytorch-fsdp2/SKILL.md +231 -0
  240. package/skills/ai-research/08-distributed-training/pytorch-fsdp2/references/pytorch_dcp_async_recipe.md +14 -0
  241. package/skills/ai-research/08-distributed-training/pytorch-fsdp2/references/pytorch_dcp_overview.md +19 -0
  242. package/skills/ai-research/08-distributed-training/pytorch-fsdp2/references/pytorch_dcp_recipe.md +18 -0
  243. package/skills/ai-research/08-distributed-training/pytorch-fsdp2/references/pytorch_ddp_notes.md +10 -0
  244. package/skills/ai-research/08-distributed-training/pytorch-fsdp2/references/pytorch_device_mesh_tutorial.md +22 -0
  245. package/skills/ai-research/08-distributed-training/pytorch-fsdp2/references/pytorch_examples_fsdp2.md +15 -0
  246. package/skills/ai-research/08-distributed-training/pytorch-fsdp2/references/pytorch_fsdp1_api.md +9 -0
  247. package/skills/ai-research/08-distributed-training/pytorch-fsdp2/references/pytorch_fsdp2_tutorial.md +45 -0
  248. package/skills/ai-research/08-distributed-training/pytorch-fsdp2/references/pytorch_fully_shard_api.md +49 -0
  249. package/skills/ai-research/08-distributed-training/pytorch-fsdp2/references/pytorch_tp_tutorial.md +22 -0
  250. package/skills/ai-research/08-distributed-training/pytorch-fsdp2/references/ray_train_fsdp2_example.md +13 -0
  251. package/skills/ai-research/08-distributed-training/pytorch-fsdp2/references/torchtitan_fsdp_notes.md +14 -0
  252. package/skills/ai-research/08-distributed-training/pytorch-lightning/SKILL.md +346 -0
  253. package/skills/ai-research/08-distributed-training/pytorch-lightning/references/callbacks.md +437 -0
  254. package/skills/ai-research/08-distributed-training/pytorch-lightning/references/distributed.md +491 -0
  255. package/skills/ai-research/08-distributed-training/pytorch-lightning/references/hyperparameter-tuning.md +557 -0
  256. package/skills/ai-research/08-distributed-training/ray-train/SKILL.md +406 -0
  257. package/skills/ai-research/08-distributed-training/ray-train/references/multi-node.md +629 -0
  258. package/skills/ai-research/09-infrastructure/lambda-labs/SKILL.md +545 -0
  259. package/skills/ai-research/09-infrastructure/lambda-labs/references/advanced-usage.md +612 -0
  260. package/skills/ai-research/09-infrastructure/lambda-labs/references/troubleshooting.md +531 -0
  261. package/skills/ai-research/09-infrastructure/modal/SKILL.md +341 -0
  262. package/skills/ai-research/09-infrastructure/modal/references/advanced-usage.md +504 -0
  263. package/skills/ai-research/09-infrastructure/modal/references/troubleshooting.md +495 -0
  264. package/skills/ai-research/09-infrastructure/skypilot/SKILL.md +509 -0
  265. package/skills/ai-research/09-infrastructure/skypilot/references/advanced-usage.md +492 -0
  266. package/skills/ai-research/09-infrastructure/skypilot/references/troubleshooting.md +571 -0
  267. package/skills/ai-research/10-optimization/awq/SKILL.md +310 -0
  268. package/skills/ai-research/10-optimization/awq/references/advanced-usage.md +325 -0
  269. package/skills/ai-research/10-optimization/awq/references/troubleshooting.md +345 -0
  270. package/skills/ai-research/10-optimization/bitsandbytes/SKILL.md +411 -0
  271. package/skills/ai-research/10-optimization/bitsandbytes/references/memory-optimization.md +522 -0
  272. package/skills/ai-research/10-optimization/bitsandbytes/references/qlora-training.md +522 -0
  273. package/skills/ai-research/10-optimization/bitsandbytes/references/quantization-formats.md +448 -0
  274. package/skills/ai-research/10-optimization/flash-attention/SKILL.md +367 -0
  275. package/skills/ai-research/10-optimization/flash-attention/references/benchmarks.md +216 -0
  276. package/skills/ai-research/10-optimization/flash-attention/references/transformers-integration.md +294 -0
  277. package/skills/ai-research/10-optimization/gguf/SKILL.md +427 -0
  278. package/skills/ai-research/10-optimization/gguf/references/advanced-usage.md +505 -0
  279. package/skills/ai-research/10-optimization/gguf/references/troubleshooting.md +443 -0
  280. package/skills/ai-research/10-optimization/gptq/SKILL.md +450 -0
  281. package/skills/ai-research/10-optimization/gptq/references/calibration.md +338 -0
  282. package/skills/ai-research/10-optimization/gptq/references/integration.md +130 -0
  283. package/skills/ai-research/10-optimization/gptq/references/troubleshooting.md +96 -0
  284. package/skills/ai-research/10-optimization/hqq/SKILL.md +445 -0
  285. package/skills/ai-research/10-optimization/hqq/references/advanced-usage.md +529 -0
  286. package/skills/ai-research/10-optimization/hqq/references/troubleshooting.md +504 -0
  287. package/skills/ai-research/10-optimization/ml-training-recipes/SKILL.md +319 -0
  288. package/skills/ai-research/10-optimization/ml-training-recipes/references/architecture.md +320 -0
  289. package/skills/ai-research/10-optimization/ml-training-recipes/references/biomedical.md +498 -0
  290. package/skills/ai-research/10-optimization/ml-training-recipes/references/domain-specific.md +626 -0
  291. package/skills/ai-research/10-optimization/ml-training-recipes/references/experiment-loop.md +129 -0
  292. package/skills/ai-research/10-optimization/ml-training-recipes/references/optimizers.md +330 -0
  293. package/skills/ai-research/10-optimization/ml-training-recipes/references/scaling-and-selection.md +428 -0
  294. package/skills/ai-research/11-evaluation/bigcode-evaluation-harness/SKILL.md +405 -0
  295. package/skills/ai-research/11-evaluation/bigcode-evaluation-harness/references/benchmarks.md +394 -0
  296. package/skills/ai-research/11-evaluation/bigcode-evaluation-harness/references/custom-tasks.md +425 -0
  297. package/skills/ai-research/11-evaluation/bigcode-evaluation-harness/references/issues.md +395 -0
  298. package/skills/ai-research/11-evaluation/lm-evaluation-harness/SKILL.md +490 -0
  299. package/skills/ai-research/11-evaluation/lm-evaluation-harness/references/api-evaluation.md +491 -0
  300. package/skills/ai-research/11-evaluation/lm-evaluation-harness/references/benchmark-guide.md +489 -0
  301. package/skills/ai-research/11-evaluation/lm-evaluation-harness/references/custom-tasks.md +603 -0
  302. package/skills/ai-research/11-evaluation/lm-evaluation-harness/references/distributed-eval.md +520 -0
  303. package/skills/ai-research/11-evaluation/nemo-evaluator/SKILL.md +494 -0
  304. package/skills/ai-research/11-evaluation/nemo-evaluator/references/adapter-system.md +341 -0
  305. package/skills/ai-research/11-evaluation/nemo-evaluator/references/configuration.md +448 -0
  306. package/skills/ai-research/11-evaluation/nemo-evaluator/references/custom-benchmarks.md +316 -0
  307. package/skills/ai-research/11-evaluation/nemo-evaluator/references/execution-backends.md +362 -0
  308. package/skills/ai-research/12-inference-serving/llama-cpp/SKILL.md +258 -0
  309. package/skills/ai-research/12-inference-serving/llama-cpp/references/optimization.md +90 -0
  310. package/skills/ai-research/12-inference-serving/llama-cpp/references/quantization.md +214 -0
  311. package/skills/ai-research/12-inference-serving/llama-cpp/references/server.md +126 -0
  312. package/skills/ai-research/12-inference-serving/sglang/SKILL.md +442 -0
  313. package/skills/ai-research/12-inference-serving/sglang/references/deployment.md +491 -0
  314. package/skills/ai-research/12-inference-serving/sglang/references/radix-attention.md +414 -0
  315. package/skills/ai-research/12-inference-serving/sglang/references/structured-generation.md +542 -0
  316. package/skills/ai-research/12-inference-serving/tensorrt-llm/SKILL.md +187 -0
  317. package/skills/ai-research/12-inference-serving/tensorrt-llm/references/multi-gpu.md +299 -0
  318. package/skills/ai-research/12-inference-serving/tensorrt-llm/references/optimization.md +243 -0
  319. package/skills/ai-research/12-inference-serving/tensorrt-llm/references/serving.md +471 -0
  320. package/skills/ai-research/12-inference-serving/vllm/SKILL.md +364 -0
  321. package/skills/ai-research/12-inference-serving/vllm/references/optimization.md +227 -0
  322. package/skills/ai-research/12-inference-serving/vllm/references/quantization.md +285 -0
  323. package/skills/ai-research/12-inference-serving/vllm/references/server-deployment.md +256 -0
  324. package/skills/ai-research/12-inference-serving/vllm/references/troubleshooting.md +448 -0
  325. package/skills/ai-research/13-mlops/mlflow/SKILL.md +704 -0
  326. package/skills/ai-research/13-mlops/mlflow/references/deployment.md +745 -0
  327. package/skills/ai-research/13-mlops/mlflow/references/model-registry.md +771 -0
  328. package/skills/ai-research/13-mlops/mlflow/references/tracking.md +681 -0
  329. package/skills/ai-research/13-mlops/swanlab/SKILL.md +406 -0
  330. package/skills/ai-research/13-mlops/swanlab/references/integrations.md +305 -0
  331. package/skills/ai-research/13-mlops/swanlab/references/visualization.md +234 -0
  332. package/skills/ai-research/13-mlops/tensorboard/SKILL.md +629 -0
  333. package/skills/ai-research/13-mlops/tensorboard/references/integrations.md +639 -0
  334. package/skills/ai-research/13-mlops/tensorboard/references/profiling.md +546 -0
  335. package/skills/ai-research/13-mlops/tensorboard/references/visualization.md +621 -0
  336. package/skills/ai-research/13-mlops/weights-and-biases/SKILL.md +590 -0
  337. package/skills/ai-research/13-mlops/weights-and-biases/references/artifacts.md +585 -0
  338. package/skills/ai-research/13-mlops/weights-and-biases/references/integrations.md +701 -0
  339. package/skills/ai-research/13-mlops/weights-and-biases/references/sweeps.md +848 -0
  340. package/skills/ai-research/14-agents/a-evolve/SKILL.md +383 -0
  341. package/skills/ai-research/14-agents/a-evolve/references/README.md +831 -0
  342. package/skills/ai-research/14-agents/a-evolve/references/api.md +594 -0
  343. package/skills/ai-research/14-agents/a-evolve/references/architecture.md +417 -0
  344. package/skills/ai-research/14-agents/a-evolve/references/design-patterns.md +462 -0
  345. package/skills/ai-research/14-agents/a-evolve/references/examples.md +352 -0
  346. package/skills/ai-research/14-agents/a-evolve/references/issues.md +591 -0
  347. package/skills/ai-research/14-agents/a-evolve/references/releases.md +112 -0
  348. package/skills/ai-research/14-agents/a-evolve/references/tutorials.md +819 -0
  349. package/skills/ai-research/14-agents/autogpt/SKILL.md +403 -0
  350. package/skills/ai-research/14-agents/autogpt/references/advanced-usage.md +536 -0
  351. package/skills/ai-research/14-agents/autogpt/references/troubleshooting.md +421 -0
  352. package/skills/ai-research/14-agents/crewai/SKILL.md +498 -0
  353. package/skills/ai-research/14-agents/crewai/references/flows.md +439 -0
  354. package/skills/ai-research/14-agents/crewai/references/tools.md +430 -0
  355. package/skills/ai-research/14-agents/crewai/references/troubleshooting.md +481 -0
  356. package/skills/ai-research/14-agents/langchain/SKILL.md +480 -0
  357. package/skills/ai-research/14-agents/langchain/references/agents.md +500 -0
  358. package/skills/ai-research/14-agents/langchain/references/integration.md +563 -0
  359. package/skills/ai-research/14-agents/langchain/references/rag.md +601 -0
  360. package/skills/ai-research/14-agents/llamaindex/SKILL.md +569 -0
  361. package/skills/ai-research/14-agents/llamaindex/references/agents.md +84 -0
  362. package/skills/ai-research/14-agents/llamaindex/references/data_connectors.md +109 -0
  363. package/skills/ai-research/14-agents/llamaindex/references/query_engines.md +407 -0
  364. package/skills/ai-research/15-rag/chroma/SKILL.md +406 -0
  365. package/skills/ai-research/15-rag/chroma/references/integration.md +39 -0
  366. package/skills/ai-research/15-rag/faiss/SKILL.md +221 -0
  367. package/skills/ai-research/15-rag/faiss/references/index_types.md +281 -0
  368. package/skills/ai-research/15-rag/pinecone/SKILL.md +358 -0
  369. package/skills/ai-research/15-rag/pinecone/references/deployment.md +182 -0
  370. package/skills/ai-research/15-rag/qdrant/SKILL.md +493 -0
  371. package/skills/ai-research/15-rag/qdrant/references/advanced-usage.md +649 -0
  372. package/skills/ai-research/15-rag/qdrant/references/troubleshooting.md +632 -0
  373. package/skills/ai-research/15-rag/sentence-transformers/SKILL.md +255 -0
  374. package/skills/ai-research/15-rag/sentence-transformers/references/models.md +124 -0
  375. package/skills/ai-research/16-prompt-engineering/dspy/SKILL.md +590 -0
  376. package/skills/ai-research/16-prompt-engineering/dspy/references/examples.md +664 -0
  377. package/skills/ai-research/16-prompt-engineering/dspy/references/modules.md +476 -0
  378. package/skills/ai-research/16-prompt-engineering/dspy/references/optimizers.md +567 -0
  379. package/skills/ai-research/16-prompt-engineering/guidance/SKILL.md +572 -0
  380. package/skills/ai-research/16-prompt-engineering/guidance/references/backends.md +555 -0
  381. package/skills/ai-research/16-prompt-engineering/guidance/references/constraints.md +675 -0
  382. package/skills/ai-research/16-prompt-engineering/guidance/references/examples.md +768 -0
  383. package/skills/ai-research/16-prompt-engineering/instructor/SKILL.md +740 -0
  384. package/skills/ai-research/16-prompt-engineering/instructor/references/examples.md +108 -0
  385. package/skills/ai-research/16-prompt-engineering/instructor/references/providers.md +71 -0
  386. package/skills/ai-research/16-prompt-engineering/instructor/references/validation.md +607 -0
  387. package/skills/ai-research/16-prompt-engineering/outlines/SKILL.md +652 -0
  388. package/skills/ai-research/16-prompt-engineering/outlines/references/backends.md +616 -0
  389. package/skills/ai-research/16-prompt-engineering/outlines/references/examples.md +774 -0
  390. package/skills/ai-research/16-prompt-engineering/outlines/references/json_generation.md +653 -0
  391. package/skills/ai-research/17-observability/langsmith/SKILL.md +422 -0
  392. package/skills/ai-research/17-observability/langsmith/references/advanced-usage.md +549 -0
  393. package/skills/ai-research/17-observability/langsmith/references/troubleshooting.md +538 -0
  394. package/skills/ai-research/17-observability/phoenix/SKILL.md +475 -0
  395. package/skills/ai-research/17-observability/phoenix/references/advanced-usage.md +620 -0
  396. package/skills/ai-research/17-observability/phoenix/references/troubleshooting.md +539 -0
  397. package/skills/ai-research/18-multimodal/audiocraft/SKILL.md +564 -0
  398. package/skills/ai-research/18-multimodal/audiocraft/references/advanced-usage.md +667 -0
  399. package/skills/ai-research/18-multimodal/audiocraft/references/troubleshooting.md +505 -0
  400. package/skills/ai-research/18-multimodal/blip-2/SKILL.md +564 -0
  401. package/skills/ai-research/18-multimodal/blip-2/references/advanced-usage.md +681 -0
  402. package/skills/ai-research/18-multimodal/blip-2/references/troubleshooting.md +527 -0
  403. package/skills/ai-research/18-multimodal/clip/SKILL.md +253 -0
  404. package/skills/ai-research/18-multimodal/clip/references/applications.md +208 -0
  405. package/skills/ai-research/18-multimodal/cosmos-policy/SKILL.md +402 -0
  406. package/skills/ai-research/18-multimodal/cosmos-policy/references/libero-commands.md +175 -0
  407. package/skills/ai-research/18-multimodal/cosmos-policy/references/robocasa-commands.md +147 -0
  408. package/skills/ai-research/18-multimodal/llava/SKILL.md +304 -0
  409. package/skills/ai-research/18-multimodal/llava/references/training.md +198 -0
  410. package/skills/ai-research/18-multimodal/openpi/SKILL.md +480 -0
  411. package/skills/ai-research/18-multimodal/openpi/references/checkpoints-and-env-map.md +86 -0
  412. package/skills/ai-research/18-multimodal/openpi/references/config-recipes.md +50 -0
  413. package/skills/ai-research/18-multimodal/openpi/references/pytorch-gotchas.md +49 -0
  414. package/skills/ai-research/18-multimodal/openpi/references/remote-client-pattern.md +48 -0
  415. package/skills/ai-research/18-multimodal/openpi/references/training-debugging.md +46 -0
  416. package/skills/ai-research/18-multimodal/openvla-oft/SKILL.md +441 -0
  417. package/skills/ai-research/18-multimodal/openvla-oft/references/aloha-workflow.md +141 -0
  418. package/skills/ai-research/18-multimodal/openvla-oft/references/config-troubleshooting.md +97 -0
  419. package/skills/ai-research/18-multimodal/openvla-oft/references/libero-workflow.md +115 -0
  420. package/skills/ai-research/18-multimodal/openvla-oft/references/paper-and-checkpoints.md +84 -0
  421. package/skills/ai-research/18-multimodal/segment-anything/SKILL.md +500 -0
  422. package/skills/ai-research/18-multimodal/segment-anything/references/advanced-usage.md +590 -0
  423. package/skills/ai-research/18-multimodal/segment-anything/references/troubleshooting.md +485 -0
  424. package/skills/ai-research/18-multimodal/stable-diffusion/SKILL.md +519 -0
  425. package/skills/ai-research/18-multimodal/stable-diffusion/references/advanced-usage.md +717 -0
  426. package/skills/ai-research/18-multimodal/stable-diffusion/references/troubleshooting.md +556 -0
  427. package/skills/ai-research/18-multimodal/whisper/SKILL.md +317 -0
  428. package/skills/ai-research/18-multimodal/whisper/references/languages.md +190 -0
  429. package/skills/ai-research/19-emerging-techniques/knowledge-distillation/SKILL.md +458 -0
  430. package/skills/ai-research/19-emerging-techniques/knowledge-distillation/references/minillm.md +335 -0
  431. package/skills/ai-research/19-emerging-techniques/long-context/SKILL.md +536 -0
  432. package/skills/ai-research/19-emerging-techniques/long-context/references/extension_methods.md +469 -0
  433. package/skills/ai-research/19-emerging-techniques/long-context/references/fine_tuning.md +612 -0
  434. package/skills/ai-research/19-emerging-techniques/long-context/references/rope.md +403 -0
  435. package/skills/ai-research/19-emerging-techniques/model-merging/SKILL.md +497 -0
  436. package/skills/ai-research/19-emerging-techniques/model-merging/references/coefficient-tuning.md +415 -0
  437. package/skills/ai-research/19-emerging-techniques/model-merging/references/evaluation.md +463 -0
  438. package/skills/ai-research/19-emerging-techniques/model-merging/references/examples.md +429 -0
  439. package/skills/ai-research/19-emerging-techniques/model-merging/references/methods.md +353 -0
  440. package/skills/ai-research/19-emerging-techniques/model-pruning/SKILL.md +495 -0
  441. package/skills/ai-research/19-emerging-techniques/model-pruning/references/wanda.md +348 -0
  442. package/skills/ai-research/19-emerging-techniques/moe-training/SKILL.md +526 -0
  443. package/skills/ai-research/19-emerging-techniques/moe-training/references/architectures.md +433 -0
  444. package/skills/ai-research/19-emerging-techniques/moe-training/references/inference.md +349 -0
  445. package/skills/ai-research/19-emerging-techniques/moe-training/references/training.md +426 -0
  446. package/skills/ai-research/19-emerging-techniques/speculative-decoding/SKILL.md +467 -0
  447. package/skills/ai-research/19-emerging-techniques/speculative-decoding/references/lookahead.md +310 -0
  448. package/skills/ai-research/19-emerging-techniques/speculative-decoding/references/medusa.md +351 -0
  449. package/skills/ai-research/20-ml-paper-writing/academic-plotting/SKILL.md +479 -0
  450. package/skills/ai-research/20-ml-paper-writing/academic-plotting/references/data-visualization.md +509 -0
  451. package/skills/ai-research/20-ml-paper-writing/academic-plotting/references/diagram-generation.md +395 -0
  452. package/skills/ai-research/20-ml-paper-writing/academic-plotting/references/style-guide.md +305 -0
  453. package/skills/ai-research/20-ml-paper-writing/ml-paper-writing/SKILL.md +982 -0
  454. package/skills/ai-research/20-ml-paper-writing/ml-paper-writing/references/checklists.md +348 -0
  455. package/skills/ai-research/20-ml-paper-writing/ml-paper-writing/references/citation-workflow.md +563 -0
  456. package/skills/ai-research/20-ml-paper-writing/ml-paper-writing/references/reviewer-guidelines.md +349 -0
  457. package/skills/ai-research/20-ml-paper-writing/ml-paper-writing/references/sources.md +165 -0
  458. package/skills/ai-research/20-ml-paper-writing/ml-paper-writing/references/writing-guide.md +477 -0
  459. package/skills/ai-research/20-ml-paper-writing/presenting-conference-talks/SKILL.md +298 -0
  460. package/skills/ai-research/20-ml-paper-writing/presenting-conference-talks/references/slide-templates.md +505 -0
  461. package/skills/ai-research/20-ml-paper-writing/systems-paper-writing/SKILL.md +270 -0
  462. package/skills/ai-research/20-ml-paper-writing/systems-paper-writing/references/checklist.md +279 -0
  463. package/skills/ai-research/20-ml-paper-writing/systems-paper-writing/references/reviewer-guidelines.md +116 -0
  464. package/skills/ai-research/20-ml-paper-writing/systems-paper-writing/references/section-blueprints.md +400 -0
  465. package/skills/ai-research/20-ml-paper-writing/systems-paper-writing/references/systems-conferences.md +261 -0
  466. package/skills/ai-research/20-ml-paper-writing/systems-paper-writing/references/writing-patterns.md +231 -0
  467. package/skills/ai-research/21-research-ideation/brainstorming-research-ideas/SKILL.md +384 -0
  468. package/skills/ai-research/21-research-ideation/creative-thinking-for-research/SKILL.md +366 -0
  469. package/skills/ai-research/22-agent-native-research-artifact/compiler/SKILL.md +245 -0
  470. package/skills/ai-research/22-agent-native-research-artifact/compiler/references/ara-schema.md +439 -0
  471. package/skills/ai-research/22-agent-native-research-artifact/compiler/references/exploration-tree-spec.md +125 -0
  472. package/skills/ai-research/22-agent-native-research-artifact/compiler/references/validation-checklist.md +149 -0
  473. package/skills/ai-research/22-agent-native-research-artifact/research-manager/SKILL.md +324 -0
  474. package/skills/ai-research/22-agent-native-research-artifact/research-manager/references/event-taxonomy.md +124 -0
  475. package/skills/ai-research/22-agent-native-research-artifact/research-manager/references/provenance-tags.md +190 -0
  476. package/skills/ai-research/22-agent-native-research-artifact/research-manager/references/session-protocol.md +162 -0
  477. package/skills/ai-research/22-agent-native-research-artifact/rigor-reviewer/SKILL.md +322 -0
  478. package/skills/ai-research/22-agent-native-research-artifact/rigor-reviewer/references/review-dimensions.md +182 -0
  479. package/skills/ai-research/SKILL.md +101 -0
  480. package/skills/ai-research/SOURCE +38 -0
  481. package/skills/ai-research/index/1-frame.md +18 -0
  482. package/skills/ai-research/index/2-data.md +21 -0
  483. package/skills/ai-research/index/3-train.md +48 -0
  484. package/skills/ai-research/index/4-measure.md +25 -0
  485. package/skills/ai-research/index/5-run.md +23 -0
  486. package/skills/ai-research/index/6-write.md +35 -0
  487. package/skills/ai-research/library.json +3456 -0
  488. package/skills/analyze-app/EVALS.md +82 -0
  489. package/skills/analyze-app/SKILL.md +188 -0
  490. package/skills/design-contract/EVALS.md +80 -0
  491. package/skills/design-contract/SKILL.md +171 -0
  492. package/skills/design-library/EVALS.md +85 -0
  493. package/skills/design-library/INDEX.md +59 -0
  494. package/skills/design-library/SKILL.md +58 -0
  495. package/skills/design-library/SOURCE +131 -0
  496. package/skills/design-library/adaptive-interfaces/skills/colour-independence/SKILL.md +90 -0
  497. package/skills/design-library/adaptive-interfaces/skills/flexible-typography/SKILL.md +83 -0
  498. package/skills/design-library/adaptive-interfaces/skills/information-density/SKILL.md +87 -0
  499. package/skills/design-library/adaptive-interfaces/skills/preference-audit/SKILL.md +70 -0
  500. package/skills/design-library/adaptive-interfaces/skills/responsive-accessibility/SKILL.md +86 -0
  501. package/skills/design-library/adaptive-interfaces/skills/responsive-review/SKILL.md +76 -0
  502. package/skills/design-library/adaptive-interfaces/skills/simplified-views/SKILL.md +97 -0
  503. package/skills/design-library/adaptive-interfaces/skills/specify/SKILL.md +63 -0
  504. package/skills/design-library/adaptive-interfaces/skills/user-preference-respect/SKILL.md +100 -0
  505. package/skills/design-library/cognitive-accessibility/skills/adaptive-personalisation/SKILL.md +61 -0
  506. package/skills/design-library/cognitive-accessibility/skills/assess-load/SKILL.md +48 -0
  507. package/skills/design-library/cognitive-accessibility/skills/cognitive-load-assessment/SKILL.md +60 -0
  508. package/skills/design-library/cognitive-accessibility/skills/contextual-help-design/SKILL.md +61 -0
  509. package/skills/design-library/cognitive-accessibility/skills/error-prevention-recovery/SKILL.md +71 -0
  510. package/skills/design-library/cognitive-accessibility/skills/focus-attention-design/SKILL.md +67 -0
  511. package/skills/design-library/cognitive-accessibility/skills/memory-load-reduction/SKILL.md +60 -0
  512. package/skills/design-library/cognitive-accessibility/skills/plain-language-design/SKILL.md +78 -0
  513. package/skills/design-library/cognitive-accessibility/skills/review/SKILL.md +56 -0
  514. package/skills/design-library/cognitive-accessibility/skills/simplify/SKILL.md +39 -0
  515. package/skills/design-library/cognitive-accessibility/skills/wayfinding-navigation/SKILL.md +64 -0
  516. package/skills/design-library/design-research/skills/behavioural-analytics/SKILL.md +33 -0
  517. package/skills/design-library/design-research/skills/qual-quant-triangulation/SKILL.md +33 -0
  518. package/skills/design-library/inclusive-interaction/skills/audit/SKILL.md +50 -0
  519. package/skills/design-library/inclusive-interaction/skills/design-flow/SKILL.md +58 -0
  520. package/skills/design-library/inclusive-interaction/skills/feedback-and-status/SKILL.md +76 -0
  521. package/skills/design-library/inclusive-interaction/skills/gesture-alternatives/SKILL.md +70 -0
  522. package/skills/design-library/inclusive-interaction/skills/keyboard-navigation/SKILL.md +99 -0
  523. package/skills/design-library/inclusive-interaction/skills/keyboard-review/SKILL.md +54 -0
  524. package/skills/design-library/inclusive-interaction/skills/motion-sensitivity/SKILL.md +79 -0
  525. package/skills/design-library/inclusive-interaction/skills/multi-modal-input/SKILL.md +70 -0
  526. package/skills/design-library/inclusive-interaction/skills/touch-target-design/SKILL.md +71 -0
  527. package/skills/design-library/inclusive-interaction/skills/voice-interaction/SKILL.md +68 -0
  528. package/skills/design-library/visual-critique/skills/critique-affordance/SKILL.md +45 -0
  529. package/skills/design-library/visual-critique/skills/critique-brand-consistency/SKILL.md +42 -0
  530. package/skills/design-library/visual-critique/skills/critique-color/SKILL.md +44 -0
  531. package/skills/design-library/visual-critique/skills/critique-composition/SKILL.md +46 -0
  532. package/skills/design-library/visual-critique/skills/critique-information-density/SKILL.md +45 -0
  533. package/skills/design-library/visual-critique/skills/critique-typography/SKILL.md +45 -0
  534. package/skills/design-library/visual-critique/skills/critique-visual-hierarchy/SKILL.md +40 -0
  535. package/skills/feature-audit/EVALS.md +83 -0
  536. package/skills/feature-audit/SKILL.md +326 -0
  537. package/skills/harness/EVALS.md +81 -0
  538. package/skills/harness/SKILL.md +88 -0
  539. package/skills/i-have-adhd/EVALS.md +80 -0
  540. package/skills/i-have-adhd/SKILL.md +183 -0
  541. package/skills/no-ai-slop/EVALS.md +89 -0
  542. package/skills/no-ai-slop/SKILL.md +209 -0
  543. package/skills/no-ai-slop/eval.md +52 -0
  544. package/skills/plan-add/EVALS.md +79 -0
  545. package/skills/plan-add/SKILL.md +179 -0
  546. package/skills/plan-add/render_table.py +72 -0
  547. package/skills/plan-status/EVALS.md +78 -0
  548. package/skills/plan-status/SKILL.md +52 -0
  549. package/skills/plan-sync/EVALS.md +80 -0
  550. package/skills/plan-sync/SKILL.md +69 -0
  551. package/skills/pm-frameworks/SKILL.md +33 -0
  552. package/skills/pm-frameworks/SOURCE +39 -0
  553. package/skills/pm-frameworks/intended-vs-implemented/SKILL.md +42 -0
  554. package/skills/pm-frameworks/opportunity-solution-tree/SKILL.md +64 -0
  555. package/skills/ponytail/EVALS.md +80 -0
  556. package/skills/ponytail/SKILL.md +124 -0
  557. package/skills/product-analysis/EVALS.md +103 -0
  558. package/skills/product-analysis/SKILL.md +361 -0
  559. package/skills/research/EVALS.md +104 -0
  560. package/skills/research/SKILL.md +570 -0
  561. package/skills/rl-env/SKILL.md +53 -0
  562. package/skills/rl-env/SOURCE +41 -0
  563. package/skills/rl-env/generate-nemo-gym-env/SKILL.md +169 -0
  564. package/skills/rl-env/generate-nemo-gym-env/references/architecture.md +114 -0
  565. package/skills/rl-env/generate-openenv-env/SKILL.md +183 -0
  566. package/skills/rl-env/generate-openenv-env/references/architecture.md +82 -0
  567. package/skills/rl-env/generate-ors-env/SKILL.md +209 -0
  568. package/skills/rl-env/generate-ors-env/references/architecture.md +113 -0
  569. package/skills/rl-env/generate-verifiers-env/SKILL.md +188 -0
  570. package/skills/rl-env/generate-verifiers-env/references/architecture.md +119 -0
  571. package/skills/rl-env/rl-env-from-description/SKILL.md +124 -0
  572. package/skills/rl-env/rl-env-from-description/references/interview.md +75 -0
  573. package/skills/rl-env/rl-env-from-description/references/nemo_gym.md +41 -0
  574. package/skills/rl-env/rl-env-from-description/references/openenv.md +35 -0
  575. package/skills/rl-env/rl-env-from-description/references/ors.md +50 -0
  576. package/skills/rl-env/rl-env-from-description/references/verifiers.md +39 -0
  577. package/skills/tezgah-contract/EVALS.md +78 -0
  578. package/skills/tezgah-contract/SKILL.md +792 -0
  579. package/statusline.py +129 -0
  580. package/workflows/graph-impact.js +153 -0
  581. package/workflows/graph-map.js +158 -0
  582. package/workflows/graph-review.js +170 -0
@@ -0,0 +1,3564 @@
1
+ <!-- vendored from orchestra-research/AI-research-SKILLs@773a52944ba4747a18bd4ae9ade53fff041adcbc 03-fine-tuning/axolotl/references/other.md; MIT (c) Orchestra Research -->
2
+ # Axolotl - Other
3
+
4
+ **Pages:** 26
5
+
6
+ ---
7
+
8
+ ## Mixed Precision Training
9
+
10
+ **URL:** https://docs.axolotl.ai/docs/mixed_precision.html
11
+
12
+ **Contents:**
13
+ - Mixed Precision Training
14
+ - 1 FP16 Mixed Precision
15
+ - 1.1 Overview
16
+ - 1.2 Configuration
17
+ - 1.3 FP16 Considerations
18
+ - 2 BF16 Mixed Precision
19
+ - 2.1 Overview
20
+ - 2.2 Configuration
21
+ - 3 FP8 Mixed Precision
22
+ - 3.1 What is FP8?
23
+
24
+ Mixed precision training uses lower precision data types to reduce memory usage and increase training speed while maintaining model quality. Axolotl supports several mixed precision formats:
25
+
26
+ FP16 is the traditional half-precision format, supported on older GPUs but can be less numerically stable than BF16.
27
+
28
+ BF16 (Brain Float 16) offers better numerical stability than FP16 and is the recommended mixed precision format for modern GPUs. It provides the same dynamic range as FP32 while using half the memory.
29
+
30
+ FP8 support is experimental and requires compatible hardware (H100, H200) and recent PyTorch versions with TorchAO.
31
+
32
+ FP8 (8-bit floating point) can provide significant time savings compared to FP16/BF16 while maintaining training stability. Axolotl’s implementation uses PyTorch’s TorchAO library with “tensorwise” scaling strategy.
33
+
34
+ Add to your YAML config:
35
+
36
+ torch.compile is critical for FP8 performance
37
+
38
+ FP8 training requires torch_compile: true to see meaningful speedups. Without compilation, FP8 may actually be slower and use more memory than FP16/BF16.
39
+
40
+ For FSDP (Fully Sharded Data Parallel) training:
41
+
42
+ Always validate your mixed precision setup:
43
+
44
+ See examples/llama-3/3b-fp8-fsdp2.yaml for an optimized example config. Enabling FP8 mixed precision + FP8 all-gather training results in ~10% faster iterations per second vs. BF16 for a relatively small (3B param) model
45
+
46
+ For more information on multi-GPU training, see our Multi-GPU guide.
47
+
48
+ **Examples:**
49
+
50
+ Example 1 (yaml):
51
+ ```yaml
52
+ # Automatic BF16 detection (recommended)
53
+ bf16: auto
54
+
55
+ # Or explicitly enable
56
+ bf16: true
57
+
58
+ # For evaluation with BF16
59
+ bf16: full # Equivalent to bf16_full_eval in the HF trainer
60
+ ```
61
+
62
+ Example 2 (yaml):
63
+ ```yaml
64
+ # Enable FP8 mixed precision
65
+ fp8: true
66
+
67
+ # Optional: Enable FP8 for FSDP all-gather operations
68
+ fp8_enable_fsdp_float8_all_gather: true
69
+
70
+ # Enable torch.compile (almost always necessary for FP8 speedups)
71
+ torch_compile: true
72
+ ```
73
+
74
+ Example 3 (yaml):
75
+ ```yaml
76
+ fp8: true
77
+ fp8_enable_fsdp_float8_all_gather: true
78
+
79
+ torch_compile: true
80
+
81
+ # FSDP configuration
82
+ fsdp_version: 2
83
+ fsdp_config:
84
+ offload_params: false
85
+ cpu_ram_efficient_loading: true
86
+ auto_wrap_policy: TRANSFORMER_BASED_WRAP
87
+ transformer_layer_cls_to_wrap: LlamaDecoderLayer
88
+ state_dict_type: FULL_STATE_DICT
89
+ reshard_after_forward: true
90
+ ```
91
+
92
+ ---
93
+
94
+ ## FAQ
95
+
96
+ **URL:** https://docs.axolotl.ai/docs/faq.html
97
+
98
+ **Contents:**
99
+ - FAQ
100
+ - General
101
+ - Chat templates
102
+
103
+ Q: The trainer stopped and hasn’t progressed in several minutes.
104
+
105
+ A: Usually an issue with the GPUs communicating with each other. See the NCCL doc
106
+
107
+ A: This usually happens when you run out of system RAM.
108
+
109
+ Q: exitcode: -7 while using deepspeed
110
+
111
+ A: Try upgrading deepspeed w: pip install -U deepspeed
112
+
113
+ Q: AttributeError: ‘DummyOptim’ object has no attribute ‘step’
114
+
115
+ Q: ModuleNotFoundError: No module named ‘mpi4py’ using single GPU with deepspeed
116
+
117
+ A: You may be using deepspeed with single gpu. Please remove the deepspeed: section in the yaml file or --deepspeed CLI flag.
118
+
119
+ Q: The codes is stuck on saving preprocessed datasets.
120
+
121
+ A: This is usually an issue with the GPU. This can be resolved through setting the os environment variable CUDA_VISIBLE_DEVICES=0. If you are on runpod, this is usually a pod issue. Starting a new pod should take care of it.
122
+
123
+ Q: Received mismatch error on merge adapters / loading adapters between torch.Size of checkpoint and model.
124
+
125
+ A: This is likely due to vocab size mismatch. By default, Axolotl expands the model’s embeddings if the tokenizer has more tokens than the model. Please use the axolotl merge-lora command to merge the adapters instead of using your own scripts.
126
+
127
+ On the other hand, if the model has more tokens than the tokenizer, Axolotl does not shrink the model’s embeddings unless shrink_embeddings: true is set in the config.
128
+
129
+ Q: How to call Axolotl via custom python scripts?
130
+
131
+ A: Since Axolotl is just Python, please see src/axolotl/cli/main.py on how each command is called.
132
+
133
+ Q: How to know the value to use for fsdp_transformer_layer_cls_to_wrap?
134
+
135
+ A: This is the class name of the transformer layer to wrap with FSDP. For example, for LlamaForCausalLM, the value is LlamaDecoderLayer. To find this for a specific model, check the model’s PreTrainedModel definition and look for _no_split_modules variable in the modeling_<model_name>.py file within transformers library.
136
+
137
+ Q: ValueError: Asking to pad but the tokenizer does not have a padding token. Please select a token to use as pad_token
138
+
139
+ A: This is because the tokenizer does not have a padding token. Please add a padding token to the tokenizer via:
140
+
141
+ Q: IterableDataset error or KeyError: 'input_ids' when using preprocess CLI
142
+
143
+ A: This is because you may be using preprocess CLI with pretraining_dataset: or skip_prepare_dataset: true respectively. Please use axolotl train CLI directly instead as these datasets are prepared on demand.
144
+
145
+ Q: vLLM is not working with Axolotl
146
+
147
+ A: We currently recommend torch 2.6.0 for use with vllm. Please ensure you use the right version. For Docker, please use the main-py3.11-cu124-2.6.0 tag.
148
+
149
+ Q: FA2 2.8.0 undefined symbol runtime error on CUDA 12.4
150
+
151
+ A: There seems to be a wheel issue with FA2 2.8.0 on CUDA 12.4. Try CUDA 12.6 instead or downgrade to FA2 2.7.4. Please refer to the upstream issue: https://github.com/Dao-AILab/flash-attention/issues/1717.
152
+
153
+ Q: Can we mix text and text+image datasets for VLM training?
154
+
155
+ A: Yes, you can for newer VLM arch. The ones that would not work are LLaVA / Pixtral arch. If you notice one not working, please let us know!
156
+
157
+ Q: Why is memory/max_* different from nvidia-smi?
158
+
159
+ A: We use torch APIs to retrieve this information. You can see https://docs.pytorch.org/docs/stable/notes/cuda.html#cuda-memory-management for more information.
160
+
161
+ Q: jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'content' / 'role' / ____
162
+
163
+ A: This means that the property mapping for the stated attribute does not exist when building chat_template prompt. For example, if no attribute 'content', please check you have added the correct mapping for content under message_property_mappings.
164
+
165
+ Q: Empty template generated for turn ___
166
+
167
+ A: The content is empty for that turn.
168
+
169
+ Q: Could not find content start/end boundary for turn __
170
+
171
+ A: The specific turn’s start/end could not be detected. Please ensure you have set the eos_token following your chat_template. Otherwise, this could be a chat_template which doesn’t use proper boundaries for each turn (like system). On the rare occurrence, make sure your content is not [[dummy_message]]. Please let us know about this.
172
+
173
+ Q: Content end boundary is before start boundary for turn ___
174
+
175
+ A: This is an edge case which should not occur. Please create an Issue if this happens.
176
+
177
+ Q: Content end boundary is the same as start boundary for turn ___. This is likely an empty turn.
178
+
179
+ A: This is likely an empty turn.
180
+
181
+ Q: The EOS token is incorrectly being masked or not being masked / EOS token __ not found in chat template.
182
+
183
+ A: There can be two reasons:
184
+
185
+ Q: “chat_template choice is tokenizer_default but tokenizer’s chat_template is null. Please add a chat_template in tokenizer config”
186
+
187
+ A: This is because the tokenizer does not have a chat template. Please add a chat template in the tokenizer config. See chat_template for more details.
188
+
189
+ Q: The EOT token(s) are incorrectly being masked or not being masked / EOT token __ not found in chat template.
190
+
191
+ A: There can be two reasons:
192
+
193
+ Q: EOT token encoding failed. Please check if the token is valid and can be encoded.
194
+
195
+ A: There could be some issue with the tokenizer or unicode encoding. Please raise an issue with examples with the EOT token & tokenizer causing the issue.
196
+
197
+ Q: EOT token __ is encoded as multiple tokens.
198
+
199
+ A: This is because the EOT token is encoded as multiple tokens which can cause unexpected behavior. Please add it under tokens: or (recommended) override unused added_tokens via added_tokens_overrides:.
200
+
201
+ Q: Conflict between train_on_eos and train_on_eot. eos_token is in eot_tokens and train_on_eos != train_on_eot
202
+
203
+ A: This is because the EOS token is in the eot_tokens: while mismatch between train_on_eos: and train_on_eot:. This will cause one to override the other. Please ensure that train_on_eos: and train_on_eot: are the same or remove the EOS token from eot_tokens:.
204
+
205
+ Q: If eot_tokens: is not provided, what happens?
206
+
207
+ A: If eot_tokens: is not provided, the default behavior is the same as before. EOS tokens used to delimit turns are masked/unmasked depending on whether the turn is trainable.
208
+
209
+ Internally, eot_tokens: tokenizer.eos_token and train_on_eot: train_on_eos (which defaults to turn). This transition helps clarify the naming and behavior of EOT/EOS tokens.
210
+
211
+ Q: Data processing error: CAS service error
212
+
213
+ A: Try disabling XET with export HF_HUB_DISABLE_XET=1
214
+
215
+ Q: torch._inductor.exc.LoweringException: NoValidChoicesError: No choices to select, please consider adding ATEN into max_autotune_gemm_backends config (defined in torch/_inductor/config.py) to allow at least one choice.
216
+
217
+ A: Depending on the version of torch, you may need to include this in your YAML:
218
+
219
+ **Q: ValueError("Backward pass should have cleared tracker of all tensors")
220
+
221
+ A: This may happen due to edge cases in using the modern OffloadActivations context manager for CUDA streams. If you encounter this error, you may have success using the naive implementation with offload_activations: legacy in your YAML.
222
+
223
+ **Q: Error parsing tool_calls arguments as JSON.
224
+
225
+ A: There is an error parsing string arguments to a dict. Please check your dataset and the error message for more details.
226
+
227
+ **Examples:**
228
+
229
+ Example 1 (yaml):
230
+ ```yaml
231
+ special_tokens:
232
+ # str. If you're not sure, set to same as `eos_token`.
233
+ pad_token: "..."
234
+ ```
235
+
236
+ Example 2 (yaml):
237
+ ```yaml
238
+ flex_attn_compile_kwargs:
239
+ dynamic: false
240
+ mode: max-autotune-no-cudagraphs
241
+ ```
242
+
243
+ ---
244
+
245
+ ## Installation
246
+
247
+ **URL:** https://docs.axolotl.ai/docs/installation.html
248
+
249
+ **Contents:**
250
+ - Installation
251
+ - 1 Requirements
252
+ - 2 Installation Methods
253
+ - 2.1 PyPI Installation (Recommended)
254
+ - 2.2 uv Installation
255
+ - 2.3 Edge/Development Build
256
+ - 2.4 Docker
257
+ - 3 Cloud Environments
258
+ - 3.1 Cloud GPU Providers
259
+ - 3.2 Google Colab
260
+
261
+ This guide covers all the ways you can install and set up Axolotl for your environment.
262
+
263
+ Please make sure to have Pytorch installed before installing Axolotl in your local environment.
264
+
265
+ Follow the instructions at: https://pytorch.org/get-started/locally/
266
+
267
+ For Blackwell GPUs, please use Pytorch 2.7.0 and CUDA 12.8.
268
+
269
+ We use --no-build-isolation in order to detect the installed PyTorch version (if installed) in order not to clobber it, and so that we set the correct version of dependencies that are specific to the PyTorch version or other installed co-dependencies.
270
+
271
+ uv is a fast, reliable Python package installer and resolver built in Rust. It offers significant performance improvements over pip and provides better dependency resolution, making it an excellent choice for complex environments.
272
+
273
+ Install uv if not already installed
274
+
275
+ Choose your CUDA version to use with PyTorch; e.g. cu124, cu126, cu128, then create the venv and activate
276
+
277
+ Install PyTorch - PyTorch 2.6.0 recommended
278
+
279
+ Install axolotl from PyPi
280
+
281
+ For the latest features between releases:
282
+
283
+ For development with Docker:
284
+
285
+ For Blackwell GPUs, please use axolotlai/axolotl:main-py3.11-cu128-2.7.0 or the cloud variant axolotlai/axolotl-cloud:main-py3.11-cu128-2.7.0.
286
+
287
+ Please refer to the Docker documentation for more information on the different Docker images that are available.
288
+
289
+ For providers supporting Docker:
290
+
291
+ See Section 6 for Mac-specific issues.
292
+
293
+ We recommend using WSL2 (Windows Subsystem for Linux) or Docker.
294
+
295
+ Install PyTorch: https://pytorch.org/get-started/locally/
296
+
297
+ (Optional) Login to Hugging Face:
298
+
299
+ If you encounter installation issues, see our FAQ and Debugging Guide.
300
+
301
+ **Examples:**
302
+
303
+ Example 1 (bash):
304
+ ```bash
305
+ pip3 install -U packaging setuptools wheel ninja
306
+ pip3 install --no-build-isolation axolotl[flash-attn,deepspeed]
307
+ ```
308
+
309
+ Example 2 (bash):
310
+ ```bash
311
+ curl -LsSf https://astral.sh/uv/install.sh | sh
312
+ source $HOME/.local/bin/env
313
+ ```
314
+
315
+ Example 3 (bash):
316
+ ```bash
317
+ export UV_TORCH_BACKEND=cu126
318
+ uv venv --no-project --relocatable
319
+ source .venv/bin/activate
320
+ ```
321
+
322
+ Example 4 (bash):
323
+ ```bash
324
+ uv pip install packaging setuptools wheel
325
+ uv pip install torch==2.6.0
326
+ uv pip install awscli pydantic
327
+ ```
328
+
329
+ ---
330
+
331
+ ## Dataset Preprocessing
332
+
333
+ **URL:** https://docs.axolotl.ai/docs/dataset_preprocessing.html
334
+
335
+ **Contents:**
336
+ - Dataset Preprocessing
337
+ - Overview
338
+ - What are the benefits of pre-processing?
339
+ - What are the edge cases?
340
+
341
+ Dataset pre-processing is the step where Axolotl takes each dataset you’ve configured alongside the dataset format and prompt strategies to:
342
+
343
+ The processing of the datasets can happen one of two ways:
344
+
345
+ When training interactively or for sweeps (e.g. you are restarting the trainer often), processing the datasets can oftentimes be frustratingly slow. Pre-processing will cache the tokenized/formatted datasets according to a hash of dependent training parameters so that it will intelligently pull from its cache when possible.
346
+
347
+ The path of the cache is controlled by dataset_prepared_path: and is often left blank in example YAMLs as this leads to a more robust solution that prevents unexpectedly reusing cached data.
348
+
349
+ If dataset_prepared_path: is left empty, when training, the processed dataset will be cached in a default path of ./last_run_prepared/, but will ignore anything already cached there. By explicitly setting dataset_prepared_path: ./last_run_prepared, the trainer will use whatever pre-processed data is in the cache.
350
+
351
+ Let’s say you are writing a custom prompt strategy or using a user-defined prompt template. Because the trainer cannot readily detect these changes, we cannot change the calculated hash value for the pre-processed dataset.
352
+
353
+ If you have dataset_prepared_path: ... set and change your prompt templating logic, it may not pick up the changes you made and you will be training over the old prompt.
354
+
355
+ ---
356
+
357
+ ## Inference and Merging
358
+
359
+ **URL:** https://docs.axolotl.ai/docs/inference.html
360
+
361
+ **Contents:**
362
+ - Inference and Merging
363
+ - 1 Quick Start
364
+ - 1.1 Basic Inference
365
+ - 2 Advanced Usage
366
+ - 2.1 Gradio Interface
367
+ - 2.2 File-based Prompts
368
+ - 2.3 Memory Optimization
369
+ - 3 Merging LoRA Weights
370
+ - 3.1 Memory Management for Merging
371
+ - 4 Tokenization
372
+
373
+ This guide covers how to use your trained models for inference, including model loading, interactive testing, merging adapters, and common troubleshooting steps.
374
+
375
+ Use the same config used for training on inference/merging.
376
+
377
+ Launch an interactive web interface:
378
+
379
+ Process prompts from a text file:
380
+
381
+ For large models or limited memory:
382
+
383
+ Merge LoRA adapters with the base model:
384
+
385
+ Tokenization mismatches between training and inference are a common source of problems.
386
+
387
+ Verify inference tokenization by decoding tokens before model input
388
+
389
+ Compare token IDs between training and inference
390
+
391
+ Configure special tokens in your YAML:
392
+
393
+ For more details, see our debugging guide.
394
+
395
+ **Examples:**
396
+
397
+ Example 1 (bash):
398
+ ```bash
399
+ axolotl inference your_config.yml --lora-model-dir="./lora-output-dir"
400
+ ```
401
+
402
+ Example 2 (bash):
403
+ ```bash
404
+ axolotl inference your_config.yml --base-model="./completed-model"
405
+ ```
406
+
407
+ Example 3 (bash):
408
+ ```bash
409
+ axolotl inference your_config.yml --gradio
410
+ ```
411
+
412
+ Example 4 (bash):
413
+ ```bash
414
+ cat /tmp/prompt.txt | axolotl inference your_config.yml \
415
+ --base-model="./completed-model" --prompter=None
416
+ ```
417
+
418
+ ---
419
+
420
+ ## MultiModal / Vision Language Models (BETA)
421
+
422
+ **URL:** https://docs.axolotl.ai/docs/multimodal.html
423
+
424
+ **Contents:**
425
+ - MultiModal / Vision Language Models (BETA)
426
+ - Supported Models
427
+ - Usage
428
+ - Mllama
429
+ - Llama4
430
+ - Pixtral
431
+ - Llava-1.5
432
+ - Mistral-Small-3.1
433
+ - Magistral-Small-2509
434
+ - Voxtral
435
+
436
+ Multimodal support is limited and doesn’t have full feature parity.
437
+
438
+ Here are the hyperparams you’ll need to use to finetune a multimodal model.
439
+
440
+ Please see examples folder for full configs.
441
+
442
+ Some of our chat_templates have been extended to support broader dataset types. This should not break any existing configs.
443
+
444
+ As of now, we do not truncate nor drop samples based on sequence_len as each arch has different ways to process non-text tokens. We are looking for help on this.
445
+
446
+ Please make sure to install vision lib via pip install 'mistral-common[opencv]==1.8.5'
447
+
448
+ Please make sure to install vision lib via pip install 'mistral-common[opencv]==1.8.5'
449
+
450
+ Please make sure to install audio lib via pip3 install librosa==0.11.0 'mistral_common[audio]==1.8.3'
451
+
452
+ The Gemma3-1B model is a text-only model, so please train as regular text model.
453
+
454
+ For multi-modal 4B/12B/27B models, use the following config:
455
+
456
+ The model’s initial loss and grad norm will be very high. We suspect this to be due to the Conv in the vision layers.
457
+
458
+ Please make sure to install timm via pip3 install timm==1.0.17
459
+
460
+ Please make sure to install num2words via pip3 install num2words==0.5.14
461
+
462
+ Please uninstall causal-conv1d via pip3 uninstall -y causal-conv1d
463
+
464
+ For multi-modal datasets, we adopt an extended chat_template format similar to OpenAI’s Message format.
465
+
466
+ For backwards compatibility:
467
+
468
+ For image loading, you can use the following keys within content alongside "type": "image":
469
+
470
+ For audio loading, you can use the following keys within content alongside "type": "audio":
471
+
472
+ You may need to install librosa via pip3 install librosa==0.11.0.
473
+
474
+ This is not well tested at the moment. We welcome contributors!
475
+
476
+ For video loading, you can use the following keys within content alongside "type": "video":
477
+
478
+ Here is an example of a multi-modal dataset:
479
+
480
+ PIL could not retrieve the file at url using requests. Please check for typo. One alternative reason is that the request is blocked by the server.
481
+
482
+ **Examples:**
483
+
484
+ Example 1 (yaml):
485
+ ```yaml
486
+ processor_type: AutoProcessor
487
+
488
+ skip_prepare_dataset: true
489
+ remove_unused_columns: false # leave columns in place as they are needed to handle image embeddings during training
490
+ sample_packing: false # not yet supported with multimodal
491
+
492
+ chat_template: # see in next section if specified
493
+
494
+ # example dataset
495
+ datasets:
496
+ - path: HuggingFaceH4/llava-instruct-mix-vsft
497
+ type: chat_template
498
+ split: train[:1%]
499
+
500
+ # (optional) if doing lora, only finetune the Language model,
501
+ # leave the vision model and vision tower frozen
502
+ # load_in_8bit: true
503
+ adapter: lora
504
+ lora_target_modules: 'model.language_model.layers.[\d]+.(mlp|cross_attn|self_attn).(up|down|gate|q|k|v|o)_proj'
505
+
506
+ # (optional) if you want to resize images to a set size
507
+ image_size: 512
508
+ image_resize_algorithm: bilinear
509
+ ```
510
+
511
+ Example 2 (yaml):
512
+ ```yaml
513
+ base_model: meta-llama/Llama-3.2-11B-Vision-Instruct
514
+
515
+ chat_template: llama3_2_vision
516
+ ```
517
+
518
+ Example 3 (yaml):
519
+ ```yaml
520
+ base_model: meta-llama/Llama-4-Scout-17B-16E-Instruct
521
+
522
+ chat_template: llama4
523
+ ```
524
+
525
+ Example 4 (yaml):
526
+ ```yaml
527
+ base_model: mistralai/Pixtral-12B-2409
528
+
529
+ chat_template: pixtral
530
+ ```
531
+
532
+ ---
533
+
534
+ ## Reward Modelling
535
+
536
+ **URL:** https://docs.axolotl.ai/docs/reward_modelling.html
537
+
538
+ **Contents:**
539
+ - Reward Modelling
540
+ - Overview
541
+ - (Outcome) Reward Models
542
+ - Process Reward Models (PRM)
543
+
544
+ Reward modelling is a technique used to train models to predict the reward or value of a given input. This is particularly useful in reinforcement learning scenarios where the model needs to evaluate the quality of its actions or predictions. We support the reward modelling techniques supported by trl.
545
+
546
+ Outcome reward models are trained using data which contains preference annotations for an entire interaction between the user and model (e.g. rather than per-turn or per-step). For improved training stability, you can use the center_rewards_coefficient parameter to encourage mean-zero reward outputs (see TRL docs).
547
+
548
+ Bradley-Terry chat templates expect single-turn conversations in the following format:
549
+
550
+ Check out our PRM blog.
551
+
552
+ Process reward models are trained using data which contains preference annotations for each step in a series of interactions. Typically, PRMs are trained to provide reward signals over each step of a reasoning trace and are used for downstream reinforcement learning.
553
+
554
+ Please see stepwise_supervised for more details on the dataset format.
555
+
556
+ **Examples:**
557
+
558
+ Example 1 (yaml):
559
+ ```yaml
560
+ base_model: google/gemma-2-2b
561
+ model_type: AutoModelForSequenceClassification
562
+ num_labels: 1
563
+ tokenizer_type: AutoTokenizer
564
+
565
+ reward_model: true
566
+ chat_template: gemma
567
+ datasets:
568
+ - path: argilla/distilabel-intel-orca-dpo-pairs
569
+ type: bradley_terry.chat_template
570
+
571
+ val_set_size: 0.1
572
+ eval_steps: 100
573
+ ```
574
+
575
+ Example 2 (json):
576
+ ```json
577
+ {
578
+ "system": "...", // optional
579
+ "input": "...",
580
+ "chosen": "...",
581
+ "rejected": "..."
582
+ }
583
+ ```
584
+
585
+ Example 3 (yaml):
586
+ ```yaml
587
+ base_model: Qwen/Qwen2.5-3B
588
+ model_type: AutoModelForTokenClassification
589
+ num_labels: 2
590
+
591
+ process_reward_model: true
592
+ datasets:
593
+ - path: trl-lib/math_shepherd
594
+ type: stepwise_supervised
595
+ split: train
596
+
597
+ val_set_size: 0.1
598
+ eval_steps: 100
599
+ ```
600
+
601
+ ---
602
+
603
+ ## RLHF (Beta)
604
+
605
+ **URL:** https://docs.axolotl.ai/docs/rlhf.html
606
+
607
+ **Contents:**
608
+ - RLHF (Beta)
609
+ - Overview
610
+ - RLHF using Axolotl
611
+ - DPO
612
+ - chatml.argilla
613
+ - chatml.argilla_chat
614
+ - chatml.icr
615
+ - chatml.intel
616
+ - chatml.prompt_pairs
617
+ - chatml.ultra
618
+
619
+ Reinforcement Learning from Human Feedback is a method whereby a language model is optimized from data using human feedback. Various methods include, but not limited to:
620
+
621
+ This is a BETA feature and many features are not fully implemented. You are encouraged to open new PRs to improve the integration and functionality.
622
+
623
+ We rely on the TRL library for implementations of various RL training methods, which we wrap around to expose in axolotl. Each method has their own supported ways of loading datasets and prompt formats.
624
+
625
+ You can find what each method supports by going into src/axolotl/prompt_strategies/{method} where {method} is one of our supported methods. The type: can be retrieved from {method}.{function_name}.
626
+
627
+ DPO supports the following types with the following dataset format:
628
+
629
+ For custom behaviors,
630
+
631
+ The input format is a simple JSON input with customizable fields based on the above config.
632
+
633
+ As IPO is just DPO with a different loss function, all supported dataset formats for DPO are also supported for IPO.
634
+
635
+ Paper: https://arxiv.org/abs/2403.07691
636
+
637
+ ORPO supports the following types with the following dataset format:
638
+
639
+ KTO supports the following types with the following dataset format:
640
+
641
+ For custom behaviors,
642
+
643
+ The input format is a simple JSON input with customizable fields based on the above config.
644
+
645
+ Check out our GRPO cookbook.
646
+
647
+ In the latest GRPO implementation, vLLM is used to significantly speedup trajectory generation during training. In this example, we’re using 4 GPUs - 2 for training, and 2 for vLLM:
648
+
649
+ Make sure you’ve installed the correct version of vLLM by including it as an extra when installing axolotl, e.g. pip install axolotl[vllm].
650
+
651
+ Your vLLM instance will now attempt to spin up, and it’s time to kick off training utilizing our remaining two GPUs. In another terminal, execute:
652
+
653
+ Due to TRL’s implementation with vLLM, the vLLM instance must use the last N GPUs instead of the first N GPUs. This is why in the example above, we use CUDA_VISIBLE_DEVICES=2,3 for the vLLM instance.
654
+
655
+ GRPO uses custom reward functions and transformations. Please have them ready locally.
656
+
657
+ For example, to load OpenAI’s GSM8K and use a random reward for completions:
658
+
659
+ To see other examples of custom reward functions, please see TRL GRPO Docs.
660
+
661
+ To see all configs, please see TRLConfig.
662
+
663
+ The DAPO paper and subsequently Dr. GRPO paper proposed an alternative loss function for GRPO to remediate the penalty in longer responses.
664
+
665
+ For more information, see GRPO docs.
666
+
667
+ SimPO uses CPOTrainer but with alternative loss function.
668
+
669
+ This method uses the same dataset format as DPO.
670
+
671
+ TRL supports auto-unwrapping PEFT models for RL training paradigms which rely on a reference model. This significantly reduces memory pressure as an additional refreference model does not need to be loaded, and reference model log-probabilities can be obtained by disabling PEFT adapters. This is enabled by default. To turn it off, pass the following config:
672
+
673
+ **Examples:**
674
+
675
+ Example 1 (yaml):
676
+ ```yaml
677
+ rl: dpo
678
+ datasets:
679
+ - path: Intel/orca_dpo_pairs
680
+ split: train
681
+ type: chatml.intel
682
+ - path: argilla/ultrafeedback-binarized-preferences
683
+ split: train
684
+ type: chatml
685
+ ```
686
+
687
+ Example 2 (json):
688
+ ```json
689
+ {
690
+ "system": "...", // optional
691
+ "instruction": "...",
692
+ "chosen_response": "...",
693
+ "rejected_response": "..."
694
+ }
695
+ ```
696
+
697
+ Example 3 (json):
698
+ ```json
699
+ {
700
+ "chosen": [
701
+ {"role": "user", "content": "..."},
702
+ {"role": "assistant", "content": "..."}
703
+ ],
704
+ "rejected": [
705
+ {"role": "user", "content": "..."},
706
+ {"role": "assistant", "content": "..."}
707
+ ]
708
+ }
709
+ ```
710
+
711
+ Example 4 (json):
712
+ ```json
713
+ {
714
+ "system": "...", // optional
715
+ "input": "...",
716
+ "chosen": "...",
717
+ "rejected": "..."
718
+ }
719
+ ```
720
+
721
+ ---
722
+
723
+ ## LoRA Optimizations
724
+
725
+ **URL:** https://docs.axolotl.ai/docs/lora_optims.html
726
+
727
+ **Contents:**
728
+ - LoRA Optimizations
729
+ - Usage
730
+ - Requirements
731
+ - Implementation details
732
+ - Custom autograd functions
733
+ - Triton kernels
734
+ - Integration
735
+ - Future Work
736
+
737
+ Inspired by Unsloth, we’ve implemented two optimizations for LoRA and QLoRA fine-tuning, supporting both single GPU and multi-GPU (including the DDP, DeepSpeed, and FSDP2 settings) training. These include (1) SwiGLU and GEGLU activation function Triton kernels, and (2) LoRA MLP and attention custom autograd functions. Our goal was to leverage operator fusion and tensor re-use in order to improve speed and reduce memory usage during the forward and backward passes of these calculations.
738
+
739
+ We currently support several common model architectures, including (but not limited to):
740
+
741
+ The set of models we support is currently limited by our attention patching strategy, which assumes (and replaces) specific code blocks for query / key / value and output projections:
742
+
743
+ Where apply_qkv and apply_o are defined in the axolotl.kernels.lora module.
744
+
745
+ We welcome testing of other model architectures and / or PRs to expand our patching logic to be compatible with more of them.
746
+
747
+ Check out our LoRA optimizations blog.
748
+
749
+ These optimizations can be enabled in your Axolotl config YAML file. The lora_mlp_kernel option enables the optimized MLP path, while lora_qkv_kernel and lora_o_kernel enable the fused query-key-value projection and optimized output projection, respectively.
750
+
751
+ Currently, LoRA kernels are not supported for RLHF training, only SFT.
752
+
753
+ Models with pre-existing LoRA adapters that use Dropout or have bias terms may need to be re-finetuned without these features in order to be useful.
754
+
755
+ The LoRA MLP autograd function optimizes the entire MLP computation path. It fuses the LoRA and base weight computations together and provides a single, efficient backward pass for the entire MLP block.
756
+
757
+ For attention components, similar optimizations are provided through a function that handles the query, key, and value projections, and a function that handles the output projection. They are designed to work with the existing transformers attention implementation via some monkey-patching logic.
758
+
759
+ Two activation functions (SwiGLU and GeGLU) are implemented with Triton kernels for improved speed and memory performance. These kernels handle both the forward and backward passes.
760
+
761
+ The custom autograd functions and Triton kernels are designed to work together. The autograd function manages the high-level computation flow and gradient tracking, while calling the Triton kernels for the activation function computation. During the backward pass, the kernel computes both the activation output and the required gradients, which the autograd function then uses to compute the final gradients for the entire computation path.
762
+
763
+ **Examples:**
764
+
765
+ Example 1 (python):
766
+ ```python
767
+ ORIGINAL_QKV_CODE = """
768
+ query_states = self.q_proj(hidden_states).view(hidden_shape).transpose(1, 2)
769
+ key_states = self.k_proj(hidden_states).view(hidden_shape).transpose(1, 2)
770
+ value_states = self.v_proj(hidden_states).view(hidden_shape).transpose(1, 2)
771
+ """.lstrip(
772
+ "\n"
773
+ )
774
+
775
+ ORIGINAL_O_CODE = """
776
+ attn_output = self.o_proj(attn_output)
777
+ """.lstrip(
778
+ "\n"
779
+ )
780
+ ```
781
+
782
+ Example 2 (python):
783
+ ```python
784
+ PATCHED_QKV_CODE = """
785
+ query_states, key_states, value_states = self.apply_qkv(hidden_states)
786
+ query_states = query_states.view(hidden_shape).transpose(1, 2)
787
+ key_states = key_states.view(hidden_shape).transpose(1, 2)
788
+ value_states = value_states.view(hidden_shape).transpose(1, 2)
789
+ """.lstrip(
790
+ "\n"
791
+ )
792
+
793
+ PATCHED_O_CODE = """
794
+ attn_output = self.apply_o(attn_output)
795
+ """.lstrip(
796
+ "\n"
797
+ )
798
+ ```
799
+
800
+ Example 3 (yaml):
801
+ ```yaml
802
+ lora_mlp_kernel: true
803
+ lora_qkv_kernel: true
804
+ lora_o_kernel: true
805
+ ```
806
+
807
+ ---
808
+
809
+ ## Quantization with torchao
810
+
811
+ **URL:** https://docs.axolotl.ai/docs/quantize.html
812
+
813
+ **Contents:**
814
+ - Quantization with torchao
815
+ - Configuring Quantization in Axolotl
816
+
817
+ Quantization is a technique to lower the memory footprint of your model, potentially at the cost of accuracy or model performance. We support quantizing your model using the torchao library. Quantization is supported for both post-training quantization (PTQ) and quantization-aware training (QAT).
818
+
819
+ We do not currently support quantization techniques such as GGUF/GPTQ,EXL2 at the moment.
820
+
821
+ Quantization is configured using the quantization key in your configuration file.
822
+
823
+ Once quantization is complete, your quantized model will be saved in the {output_dir}/quantized directory.
824
+
825
+ You may also use the quantize command to quantize a model which has been trained with QAT - you can do this by using the existing QAT configuration file which you used to train the model:
826
+
827
+ This ensures that an identical quantization configuration is used to quantize the model as was used to train it.
828
+
829
+ If you have configured pushing to hub with hub_model_id, your model hub name will have the quantization schema appended to it, e.g. axolotl-ai-cloud/qat-nvfp4-llama3B will become axolotl-ai-cloud/qat-nvfp4-llama3B-nvfp4w
830
+
831
+ **Examples:**
832
+
833
+ Example 1 (yaml):
834
+ ```yaml
835
+ base_model: # The path to the model to quantize.
836
+ quantization:
837
+ activation_dtype: # Optional[str] = "int8". Fake quantization layout to use for activation quantization. Valid options are "int4", "int8", "float8"
838
+ weight_dtype: # Optional[str] = "int8". Fake quantization layout to use for weight quantization. Valid options are "int4", "fp8", and "nvfp4".
839
+ group_size: # Optional[int] = 32. The number of elements in each group for per-group fake quantization
840
+ quantize_embedding: # Optional[bool] = False. Whether to quantize the embedding layer.
841
+
842
+ output_dir: # The path to the output directory.
843
+ ```
844
+
845
+ Example 2 (yaml):
846
+ ```yaml
847
+ # qat.yml
848
+ qat:
849
+ activation_dtype: int8
850
+ weight_dtype: int4
851
+ group_size: 256
852
+
853
+ output_dir: # The path to the output directory used during training where the final checkpoint has been saved.
854
+ ```
855
+
856
+ Example 3 (bash):
857
+ ```bash
858
+ axolotl quantize qat.yml
859
+ ```
860
+
861
+ ---
862
+
863
+ ## NCCL
864
+
865
+ **URL:** https://docs.axolotl.ai/docs/nccl.html
866
+
867
+ **Contents:**
868
+ - NCCL
869
+
870
+ NVIDIA NCCL is a library to facilitate and optimize multi-GPU communication operations, such as broadcast, all-gather, reduce, all-reduce, etc. Broadly, NCCL configuration is highly environment-specific and is configured via several environment variables. A common NCCL-related problem occurs when a long-running operation times out causing the training process to abort:
871
+
872
+ Often, this timeout will happen after 30 minutes (the default setting) and is accompanied by below-average power consumption with near 100% GPU utilization before the error is raised. Nvidia recommends disabling PCI access control services (ACS) as a possible solution if this is available to you.
873
+
874
+ Forcing cross-GPU communication via NVLink may help without increasing timeouts. To verify that your configuration is leveraging NVLink run the following command:
875
+
876
+ To force NCCL to use NVLink, simply set this in the environment:
877
+
878
+ If NVLink is not available in your environment there are other options for NCCL_P2P_LEVEL in the table below:
879
+
880
+ To validate that acceptable data transfer speeds exist for your training job, running NCCL Tests can help pinpoint bottlenecks, for example:
881
+
882
+ It can be useful when debugging NCCL communication timeouts to activate additional logging in both PyTorch and NCCL:
883
+
884
+ Finally, if you believe your training job needs more time you can increase the timeout past 30 minutes by setting the ddp_timeout value in the Axolotl configuration. See PyTorch init_process_group for documentation on this value.
885
+
886
+ **Examples:**
887
+
888
+ Example 1 (unknown):
889
+ ```unknown
890
+ Watchdog caught collective operation timeout: WorkNCCL(SeqNum=42, OpType=ALLGATHER, Timeout(ms)=1800000) ran for 1806948 milliseconds before timing out.
891
+ ```
892
+
893
+ Example 2 (bash):
894
+ ```bash
895
+ nvidia-smi nvlink --status
896
+ ```
897
+
898
+ Example 3 (bash):
899
+ ```bash
900
+ export NCCL_P2P_LEVEL=NVL
901
+ ```
902
+
903
+ Example 4 (bash):
904
+ ```bash
905
+ ./build/all_reduce_perf -b 8 -e 128M -f 2 -g 3
906
+ ```
907
+
908
+ ---
909
+
910
+ ## Multi Node
911
+
912
+ **URL:** https://docs.axolotl.ai/docs/multi-node.html
913
+
914
+ **Contents:**
915
+ - Multi Node
916
+ - Accelerate
917
+ - Raytrain
918
+ - Torchrun
919
+ - Option 1: New Axolotl CLI with launcher args (Recommended)
920
+ - Option 2: Direct torchrun (Legacy)
921
+
922
+ The below are three ways to train multi-node in Axolotl.
923
+
924
+ Each machine needs a copy of Axolotl, we suggest using the same commit to ensure compatibility.
925
+
926
+ You will also need to have the same configuration file for your model on each machine.
927
+
928
+ Make sure the main machine is reachable by other machines.
929
+
930
+ You will need to create a configuration for accelerate, either by using accelerate config and follow the instructions or you can use one of the preset below:
931
+
932
+ ~/.cache/huggingface/accelerate/default_config.yaml
933
+
934
+ Configure your model to use FSDP in the Axolotl yaml. For example:
935
+
936
+ All you have to do now is launch using accelerate as you would usually do on each machine and voila, the processes will start once you have launched accelerate on every machine.
937
+
938
+ Please see ray train doc here.
939
+
940
+ If you are using Infiniband, we recommend torchrun to utilize the full bandwidth.
941
+
942
+ Set the following env (change buffersize/socketname depending on your system):
943
+
944
+ Run the following on each node:
945
+
946
+ Please make sure to substitute the placeholder variables:
947
+
948
+ The new CLI approach (Option 1) is recommended as it provides consistent argument handling and works seamlessly with other Axolotl CLI features.
949
+
950
+ More info on the available configs can be found on the Pytorch docs here
951
+
952
+ **Examples:**
953
+
954
+ Example 1 (yaml):
955
+ ```yaml
956
+ compute_environment: LOCAL_MACHINE
957
+ debug: false
958
+ distributed_type: FSDP
959
+ downcast_bf16: 'no'
960
+ machine_rank: 0 # Set to 0 for the main machine, increment by one for other machines
961
+ main_process_ip: 10.0.0.4 # Set to main machine's IP
962
+ main_process_port: 5000
963
+ main_training_function: main
964
+ mixed_precision: bf16
965
+ num_machines: 2 # Change to the number of machines
966
+ num_processes: 4 # That's the total number of GPUs, (for example: if you have 2 machines with 4 GPU, put 8)
967
+ rdzv_backend: static
968
+ same_network: true
969
+ tpu_env: []
970
+ tpu_use_cluster: false
971
+ tpu_use_sudo: false
972
+ use_cpu: false
973
+ ```
974
+
975
+ Example 2 (yaml):
976
+ ```yaml
977
+ fsdp_version: 2
978
+ fsdp_config:
979
+ offload_params: true
980
+ state_dict_type: FULL_STATE_DICT
981
+ auto_wrap_policy: TRANSFORMER_BASED_WRAP
982
+ transformer_layer_cls_to_wrap: LlamaDecoderLayer
983
+ reshard_after_forward: true
984
+ ```
985
+
986
+ Example 3 (bash):
987
+ ```bash
988
+ export NCCL_IB_DISABLE=0
989
+ export NCCL_SOCKET_IFNAME="eth0,en,eth,em,bond"
990
+ export NCCL_BUFFSIZE=2097152
991
+ ```
992
+
993
+ Example 4 (bash):
994
+ ```bash
995
+ axolotl train config.yaml --launcher torchrun -- --nnodes $num_nodes --nproc_per_node $gpu_per_node --rdzv_id $rdzv_id --rdzv_backend c10d --rdzv_endpoint "$head_node_ip:$head_node_port"
996
+ ```
997
+
998
+ ---
999
+
1000
+ ## Dataset Loading
1001
+
1002
+ **URL:** https://docs.axolotl.ai/docs/dataset_loading.html
1003
+
1004
+ **Contents:**
1005
+ - Dataset Loading
1006
+ - Overview
1007
+ - Loading Datasets
1008
+ - Local dataset
1009
+ - Files
1010
+ - Directory
1011
+ - Loading entire directory
1012
+ - Loading specific files in directory
1013
+ - HuggingFace Hub
1014
+ - Folder uploaded
1015
+
1016
+ Datasets can be loaded in a number of different ways depending on the how it is saved (the extension of the file) and where it is stored.
1017
+
1018
+ We use the datasets library to load datasets and a mix of load_dataset and load_from_disk to load them.
1019
+
1020
+ You may recognize the similar named configs between load_dataset and the datasets section of the config file.
1021
+
1022
+ Do not feel overwhelmed by the number of options here. A lot of them are optional. In fact, the most common config to use would be path and sometimes data_files.
1023
+
1024
+ This matches the API of datasets.load_dataset, so if you’re familiar with that, you will feel right at home.
1025
+
1026
+ For HuggingFace’s guide to load different dataset types, see here.
1027
+
1028
+ For full details on the config, see config-reference.qmd.
1029
+
1030
+ You can set multiple datasets in the config file by more than one entry under datasets.
1031
+
1032
+ To load a JSON file, you would do something like this:
1033
+
1034
+ Which translates to the following config:
1035
+
1036
+ In the example above, it can be seen that we can just point the path to the file or directory along with the ds_type to load the dataset.
1037
+
1038
+ This works for CSV, JSON, Parquet, and Arrow files.
1039
+
1040
+ If path points to a file and ds_type is not specified, we will automatically infer the dataset type from the file extension, so you could omit ds_type if you’d like.
1041
+
1042
+ If you’re loading a directory, you can point the path to the directory.
1043
+
1044
+ Then, you have two options:
1045
+
1046
+ You do not need any additional configs.
1047
+
1048
+ We will attempt to load in the following order: - datasets saved with datasets.save_to_disk - loading entire directory of files (such as with parquet/arrow files)
1049
+
1050
+ Provide data_files with a list of files to load.
1051
+
1052
+ The method you use to load the dataset depends on how the dataset was created, whether a folder was uploaded directly or a HuggingFace Dataset was pushed.
1053
+
1054
+ If you’re using a private dataset, you will need to enable the hf_use_auth_token flag in the root-level of the config file.
1055
+
1056
+ This would mean that the dataset is a single file or file(s) uploaded to the Hub.
1057
+
1058
+ This means that the dataset is created as a HuggingFace Dataset and pushed to the Hub via datasets.push_to_hub.
1059
+
1060
+ There are some other configs which may be required like name, split, revision, trust_remote_code, etc depending on the dataset.
1061
+
1062
+ Via the storage_options config under load_dataset, you can load datasets from remote filesystems like S3, GCS, Azure, and OCI.
1063
+
1064
+ This is currently experimental. Please let us know if you run into any issues!
1065
+
1066
+ The only difference between the providers is that you need to prepend the path with the respective protocols.
1067
+
1068
+ For directory, we load via load_from_disk.
1069
+
1070
+ Prepend the path with s3://.
1071
+
1072
+ The credentials are pulled in the following order:
1073
+
1074
+ We assume you have credentials setup and not using anonymous access. If you want to use anonymous access, let us know! We may have to open a config option for this.
1075
+
1076
+ Other environment variables that can be set can be found in boto3 docs
1077
+
1078
+ Prepend the path with gs:// or gcs://.
1079
+
1080
+ The credentials are loaded in the following order:
1081
+
1082
+ Prepend the path with adl://.
1083
+
1084
+ Ensure you have the following environment variables set:
1085
+
1086
+ Prepend the path with abfs:// or az://.
1087
+
1088
+ Ensure you have the following environment variables set:
1089
+
1090
+ Other environment variables that can be set can be found in adlfs docs
1091
+
1092
+ Prepend the path with oci://.
1093
+
1094
+ It would attempt to read in the following order:
1095
+
1096
+ Other environment variables:
1097
+
1098
+ Please see the ocifs docs.
1099
+
1100
+ The path should start with https://.
1101
+
1102
+ This must be publically accessible.
1103
+
1104
+ Now that you know how to load datasets, you can learn more on how to load your specific dataset format into your target output format dataset formats docs.
1105
+
1106
+ **Examples:**
1107
+
1108
+ Example 1 (yaml):
1109
+ ```yaml
1110
+ datasets:
1111
+ - path:
1112
+ name:
1113
+ data_files:
1114
+ split:
1115
+ revision:
1116
+ trust_remote_code:
1117
+ ```
1118
+
1119
+ Example 2 (yaml):
1120
+ ```yaml
1121
+ datasets:
1122
+ - path: /path/to/your/dataset
1123
+ - path: /path/to/your/other/dataset
1124
+ ```
1125
+
1126
+ Example 3 (python):
1127
+ ```python
1128
+ from datasets import load_dataset
1129
+
1130
+ dataset = load_dataset("json", data_files="data.json")
1131
+ ```
1132
+
1133
+ Example 4 (yaml):
1134
+ ```yaml
1135
+ datasets:
1136
+ - path: data.json
1137
+ ds_type: json
1138
+ ```
1139
+
1140
+ ---
1141
+
1142
+ ## Multi-GPU
1143
+
1144
+ **URL:** https://docs.axolotl.ai/docs/multi-gpu.html
1145
+
1146
+ **Contents:**
1147
+ - Multi-GPU
1148
+ - 1 Overview
1149
+ - 2 DeepSpeed
1150
+ - 2.1 Configuration
1151
+ - 2.2 Usage
1152
+ - 2.3 ZeRO Stages
1153
+ - 3 Fully Sharded Data Parallel (FSDP)
1154
+ - 3.1 Migrating from FSDP1 to FSDP2
1155
+ - 3.1.1 Config mapping
1156
+ - 3.2 FSDP1 (deprecated)
1157
+
1158
+ This guide covers advanced training configurations for multi-GPU setups using Axolotl.
1159
+
1160
+ Axolotl supports several methods for multi-GPU training:
1161
+
1162
+ Add to your YAML config:
1163
+
1164
+ We provide default configurations for:
1165
+
1166
+ Choose the configuration that offloads the least amount to memory while still being able to fit on VRAM for best performance.
1167
+
1168
+ Start from Stage 1 -> Stage 2 -> Stage 3.
1169
+
1170
+ FSDP2 is recommended for new users. FSDP1 is deprecated and will be removed in an upcoming release of Axolotl.
1171
+
1172
+ To migrate your config from FSDP1 to FSDP2, you must use the fsdp_version top-level config field to specify the FSDP version, and also follow the config field mapping below to update field names.
1173
+
1174
+ For more details, please see the migration guide in the torchtitan repo. In Axolotl, if you were using the following FSDP1 config:
1175
+
1176
+ You can migrate to the following FSDP2 config:
1177
+
1178
+ Using fsdp to configure FSDP is deprecated and will be removed in an upcoming release of Axolotl. Please use fsdp_config as above instead.
1179
+
1180
+ We support sequence parallelism (SP) via the ring-flash-attention project. This allows one to split up sequences across GPUs, which is useful in the event that a single sequence causes OOM errors during model training.
1181
+
1182
+ See our dedicated guide for more information.
1183
+
1184
+ For combining FSDP with QLoRA, see our dedicated guide.
1185
+
1186
+ Please see docs for more info.
1187
+
1188
+ For NCCL-related problems, see our NCCL troubleshooting guide.
1189
+
1190
+ For more detailed troubleshooting, see our debugging guide.
1191
+
1192
+ **Examples:**
1193
+
1194
+ Example 1 (yaml):
1195
+ ```yaml
1196
+ deepspeed: deepspeed_configs/zero1.json
1197
+ ```
1198
+
1199
+ Example 2 (bash):
1200
+ ```bash
1201
+ # Fetch deepspeed configs (if not already present)
1202
+ axolotl fetch deepspeed_configs
1203
+
1204
+ # Passing arg via config
1205
+ axolotl train config.yml
1206
+
1207
+ # Passing arg via cli
1208
+ axolotl train config.yml --deepspeed deepspeed_configs/zero1.json
1209
+ ```
1210
+
1211
+ Example 3 (yaml):
1212
+ ```yaml
1213
+ fsdp_version: 1
1214
+ fsdp_config:
1215
+ fsdp_offload_params: false
1216
+ fsdp_cpu_ram_efficient_loading: true
1217
+ fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP
1218
+ fsdp_transformer_layer_cls_to_wrap: Qwen3DecoderLayer
1219
+ fsdp_state_dict_type: FULL_STATE_DICT
1220
+ fsdp_sharding_strategy: FULL_SHARD
1221
+ ```
1222
+
1223
+ Example 4 (yaml):
1224
+ ```yaml
1225
+ fsdp_version: 2
1226
+ fsdp_config:
1227
+ offload_params: false
1228
+ cpu_ram_efficient_loading: true
1229
+ auto_wrap_policy: TRANSFORMER_BASED_WRAP
1230
+ transformer_layer_cls_to_wrap: Qwen3DecoderLayer
1231
+ state_dict_type: FULL_STATE_DICT
1232
+ reshard_after_forward: true
1233
+ ```
1234
+
1235
+ ---
1236
+
1237
+ ## Ray Train
1238
+
1239
+ **URL:** https://docs.axolotl.ai/docs/ray-integration.html
1240
+
1241
+ **Contents:**
1242
+ - Ray Train
1243
+ - Ray cluster setup
1244
+ - Sanity check
1245
+ - Configuring training with Ray Train
1246
+ - Launching training
1247
+
1248
+ Axolotl supports using Ray as an alternative to accelerate for orchestrating training. This is especially useful for multi-node training since you only have to setup code and dependencies in a single node and launch training as if you were using a single node.
1249
+
1250
+ With the --use-ray CLI flag, Axolotl will use Ray Train’s TorchTrainer to run training.
1251
+
1252
+ A prerequisite using the Ray Train integration is to setup a Ray cluster on your desired node(s). For a detailed guide on how you can get started with ray clusters, check the official Ray docs here.
1253
+
1254
+ Every Ray cluster has one head node and a set of worker nodes. The head node is just like any other worker node, but it also runs certain special processes related to scheduling and orchestration. Ray-enabled scripts are run on the head node and depending on the resources (number of CPUs, GPUs, etc) they request, will be scheduled to run certain tasks on the worker nodes. For more on key concepts behind a Ray cluster, you can refer this doc.
1255
+
1256
+ To run a sanity check on whether your ray cluster is setup properly, execute the following on the head node:
1257
+
1258
+ The output should have a summary of your Ray cluster - list of all the nodes in your cluster, the number of CPUs and GPUs in your cluster, etc. For example, if you have a cluster with 1 CPU-only head node and 2 4xL40S worker nodes, the output can look like this:
1259
+
1260
+ You should also be able to see the same on the Ray dashboard.
1261
+
1262
+ You can find an example configuration at configs/llama-3/lora-1b-ray.yaml.
1263
+
1264
+ The key parameters to note here are:
1265
+
1266
+ You can simply run the following command on the head node:
1267
+
1268
+ This will launch training on the head node and workers will be scheduled automatically by Ray Train to run on the appropriate head or worker nodes.
1269
+
1270
+ You can also monitor training progress on the Ray dashboard.
1271
+
1272
+ Coming back to the example on a Ray cluster with 1 head node and 2 4xL40S worker nodes, let’s say you want to make use of all 8 GPUs. You would be able to just set ray_num_workers: 8 and run the previous command. The Cluster tab will show the following:
1273
+
1274
+ **Examples:**
1275
+
1276
+ Example 1 (unknown):
1277
+ ```unknown
1278
+ Node status
1279
+ ---------------------------------------------------------------
1280
+ Active:
1281
+ 1 head
1282
+ Idle:
1283
+ 2 4xL40S:48CPU-384GB
1284
+ Pending:
1285
+ (no pending nodes)
1286
+ Recent failures:
1287
+ (no failures)
1288
+
1289
+ Resources
1290
+ ---------------------------------------------------------------
1291
+ Usage:
1292
+ 0.0/96.0 CPU
1293
+ 0.0/8.0 GPU
1294
+ 0B/800.00GiB memory
1295
+ 0B/229.57GiB object_store_memory
1296
+
1297
+ Demands:
1298
+ (no resource demands)
1299
+ ```
1300
+
1301
+ Example 2 (yaml):
1302
+ ```yaml
1303
+ use_ray: true
1304
+ ray_num_workers: 4
1305
+ # optional
1306
+ resources_per_worker:
1307
+ GPU: 1
1308
+ ```
1309
+
1310
+ Example 3 (yaml):
1311
+ ```yaml
1312
+ resources_per_worker:
1313
+ accelerator_type:L40S: 0.001
1314
+ ```
1315
+
1316
+ Example 4 (bash):
1317
+ ```bash
1318
+ axolotl train examples/llama-3/lora-1b-ray.yml --use-ray
1319
+ ```
1320
+
1321
+ ---
1322
+
1323
+ ## Sequence Parallelism
1324
+
1325
+ **URL:** https://docs.axolotl.ai/docs/sequence_parallelism.html
1326
+
1327
+ **Contents:**
1328
+ - Sequence Parallelism
1329
+ - When to Use Sequence Parallelism
1330
+ - Configuration
1331
+ - Implementation Details
1332
+ - Requirements
1333
+ - Limitations
1334
+ - Example
1335
+ - Sample Packing with Sequence Parallelism
1336
+ - Effect on Batch Size
1337
+
1338
+ Sequence parallelism is a technique that splits sequences across multiple GPUs, allowing you to train with very long sequences that wouldn’t fit on a single GPU. Each GPU processes a different portion of the sequence, and the results are aggregated through a ring communication pattern.
1339
+
1340
+ Use sequence parallelism when:
1341
+
1342
+ To enable sequence parallelism, add the following to your configuration file:
1343
+
1344
+ The context_parallel_size should be a divisor of the total number of GPUs. For example:
1345
+
1346
+ When sequence parallelism is enabled:
1347
+
1348
+ To use sequence parallelism, you need:
1349
+
1350
+ This will train the Llama 3 8B model with 8K context length, with each sequence split into 2 subsequences of length 4096 across 2 GPUs.
1351
+
1352
+ Sequence parallelism is compatible with Axolotl’s sample packing functionality. When using both features together:
1353
+
1354
+ When using sequence parallelism, your effective global batch size is divided by the context_parallel_size. This happens because:
1355
+
1356
+ For example: - With 8 GPUs and no sequence parallelism: 8 different batches processed per step - With 8 GPUs and context_parallel_size=4: Only 2 different batches processed per step (each split across 4 GPUs) - If your per-GPU micro_batch_size is 2, the global batch size decreases from 16 to 4
1357
+
1358
+ **Examples:**
1359
+
1360
+ Example 1 (yaml):
1361
+ ```yaml
1362
+ # Set to a divisor (> 1) of the number of GPUs available
1363
+ context_parallel_size: 4 # Split sequences across 4 GPUs
1364
+ # Optional; strides across the key dimension. Larger values use more memory but should make training faster.
1365
+ heads_k_stride: 1
1366
+ # Optional; one of "varlen_llama3" or "batch_ring". Defaults to
1367
+ # "varlen_llama3" when `sample_packing: true`, and "batch_ring" otherwise.
1368
+ ring_attn_func:
1369
+ ```
1370
+
1371
+ Example 2 (yaml):
1372
+ ```yaml
1373
+ base_model: meta-llama/Llama-3-8B-Instruct
1374
+ sequence_len: 8192
1375
+
1376
+ ...
1377
+
1378
+ context_parallel_size: 4 # Split each sequence into 4 parts, one per GPU
1379
+ # Optional; strides across the key dimension. Larger values use more memory but should make training faster.
1380
+ heads_k_stride: 1
1381
+ # Optional; one of "varlen_llama3" or "batch_ring". Defaults to
1382
+ # "varlen_llama3" when `sample_packing: true`, and "batch_ring" otherwise.
1383
+ ring_attn_func:
1384
+
1385
+ ...
1386
+ ```
1387
+
1388
+ ---
1389
+
1390
+ ## Quantization Aware Training (QAT)
1391
+
1392
+ **URL:** https://docs.axolotl.ai/docs/qat.html
1393
+
1394
+ **Contents:**
1395
+ - Quantization Aware Training (QAT)
1396
+ - Overview
1397
+ - Configuring QAT in Axolotl
1398
+
1399
+ Quantization Aware Training (QAT) is a technique for improving the accuracy of models which are quantized by applying “fake” quantizations to the model’s weights (and optionally, activations) during training. This fake quantization allows for the model to adjust for noise introduced by the quantization, so when the model is eventually quantized, the accuracy loss is minimized. We use the quantization techniques implemented in torchao to provide support for QAT and post-training quantization (PTQ) in axolotl.
1400
+
1401
+ We recommend reviewing the excellent QAT tutorial in the torchtune library, and the QAT documentation in the torchao library, for more details.
1402
+
1403
+ To enable QAT in axolotl, add the following to your configuration file:
1404
+
1405
+ We support the following quantization schemas:
1406
+
1407
+ Once you have finished training, you must quantize your model by using the same quantization configuration which you used to train the model with. You can use the quantize command to do this.
1408
+
1409
+ **Examples:**
1410
+
1411
+ Example 1 (yaml):
1412
+ ```yaml
1413
+ qat:
1414
+ activation_dtype: # Optional[str] = "int8". Fake quantization layout to use for activation quantization. Valid options are "int4", "int8", "float8"
1415
+ weight_dtype: # Optional[str] = "int8". Fake quantization layout to use for weight quantization. Valid options are "int4", "fp8", and "nvfp4".
1416
+ group_size: # Optional[int] = 32. The number of elements in each group for per-group fake quantization
1417
+ fake_quant_after_n_steps: # Optional[int] = None. The number of steps to apply fake quantization after
1418
+ ```
1419
+
1420
+ ---
1421
+
1422
+ ## FSDP + QLoRA
1423
+
1424
+ **URL:** https://docs.axolotl.ai/docs/fsdp_qlora.html
1425
+
1426
+ **Contents:**
1427
+ - FSDP + QLoRA
1428
+ - Background
1429
+ - Usage
1430
+ - Enabling Swap for FSDP2
1431
+ - Example Config
1432
+ - References
1433
+ - Footnotes
1434
+
1435
+ Using FSDP with QLoRA is essential for fine-tuning larger (70b+ parameter) LLMs on consumer GPUs. For example, you can use FSDP + QLoRA to train a 70b model on two 24GB GPUs1.
1436
+
1437
+ Below, we describe how to use this feature in Axolotl.
1438
+
1439
+ To enable QLoRA with FSDP, you need to perform the following steps:
1440
+
1441
+ ![Tip] See the example config file in addition to reading these instructions.
1442
+
1443
+ If available memory is insufficient even after FSDP’s CPU offloading, you can enable swap memory usage by setting cpu_offload_pin_memory: false alongside offload_params: true in FSDP config.
1444
+
1445
+ This disables memory pinning, allowing FSDP to use disk swap space as fallback. Disabling memory pinning itself incurs performance overhead, and actually having to use swap adds more, but it may enable training larger models that would otherwise cause OOM errors on resource constrained systems.
1446
+
1447
+ examples/llama-2/qlora-fsdp.yml contains an example of how to enable QLoRA + FSDP in axolotl.
1448
+
1449
+ This was enabled by this work from the Answer.AI team.↩︎
1450
+
1451
+ ---
1452
+
1453
+ ## Custom Integrations
1454
+
1455
+ **URL:** https://docs.axolotl.ai/docs/custom_integrations.html
1456
+
1457
+ **Contents:**
1458
+ - Custom Integrations
1459
+ - Cut Cross Entropy
1460
+ - Requirements
1461
+ - Installation
1462
+ - Usage
1463
+ - Supported Models
1464
+ - Citation
1465
+ - DenseMixer
1466
+ - Diffusion LM Training Plugin for Axolotl
1467
+ - Overview
1468
+
1469
+ Axolotl adds custom features through integrations. They are located within the src/axolotl/integrations directory.
1470
+
1471
+ To enable them, please check the respective documentations.
1472
+
1473
+ Cut Cross Entropy (CCE) reduces VRAM usage through optimization on the cross-entropy operation during loss calculation.
1474
+
1475
+ See https://github.com/apple/ml-cross-entropy
1476
+
1477
+ Run the following command to install cut_cross_entropy[transformers] if you don’t have it already.
1478
+
1479
+ Please see reference here
1480
+
1481
+ Simply add the following to your axolotl YAML config:
1482
+
1483
+ Please see reference here
1484
+
1485
+ This plugin enables diffusion language model training using an approach inspired by LLaDA (Large Language Diffusion Models) within Axolotl.
1486
+
1487
+ LLaDA is a diffusion-based approach to language model training that uses: - Random token masking during training instead of next-token prediction - Bidirectional attention to allow the model to attend to the full context - Importance weighting based on masking probabilities for stable training
1488
+
1489
+ This approach can lead to more robust language models with better understanding of bidirectional context.
1490
+
1491
+ The plugin is included with Axolotl. See our installation docs.
1492
+
1493
+ Train with an example config (Llama‑3.2 1B): - Pretrain: axolotl train examples/llama-3/diffusion-3.2-1b-pretrain.yaml - SFT: axolotl train examples/llama-3/diffusion-3.2-1b-sft.yaml
1494
+
1495
+ You can also modify your existing configs to enable / customize diffusion training.
1496
+
1497
+ Add the following to your Axolotl config:
1498
+
1499
+ And, configure the nested diffusion block (defaults shown):
1500
+
1501
+ Any models that support 4D attention masks should work out of the box. If not, please create an issue or open a PR!
1502
+
1503
+ During training, tokens are randomly masked: - Sample timestep t uniformly from [0, 1] - Calculate masking probability: p = (1 - eps) * t + eps - Randomly mask tokens with probability p
1504
+
1505
+ Loss is computed only on masked tokens with (optional) importance weighting:
1506
+
1507
+ When diffusion.generate_samples: true, the plugin generates samples during training:
1508
+
1509
+ Samples are logged to console and wandb (if enabled).
1510
+
1511
+ Diffusion inference is integrated into the standard Axolotl CLI. Use the same config you trained with and run:
1512
+
1513
+ Optionally, pass --gradio to use a simple web interface.
1514
+
1515
+ Interactive controls (prefix the prompt with commands): - :complete N → completion mode with N new masked tokens appended (default 64) - :mask R → random masking mode with target mask ratio R in [0.0, 1.0]
1516
+
1517
+ The plugin adds (or modifies) several metrics to track diffusion training:
1518
+
1519
+ Please see reference here
1520
+
1521
+ See https://github.com/ironjr/grokfast
1522
+
1523
+ Please see reference here
1524
+
1525
+ An example dataset can be found at axolotl-ai-co/evolkit-logprobs-pipeline-75k-v2-sample
1526
+
1527
+ Please see reference here
1528
+
1529
+ Fine-tune sparsified models in Axolotl using Neural Magic’s LLMCompressor.
1530
+
1531
+ This integration enables fine-tuning of models sparsified using LLMCompressor within the Axolotl training framework. By combining LLMCompressor’s model compression capabilities with Axolotl’s distributed training pipelines, users can efficiently fine-tune sparse models at scale.
1532
+
1533
+ It uses Axolotl’s plugin system to hook into the fine-tuning flows while maintaining sparsity throughout training.
1534
+
1535
+ Axolotl with llmcompressor extras:
1536
+
1537
+ Requires llmcompressor >= 0.5.1
1538
+
1539
+ This will install all necessary dependencies to fine-tune sparsified models using the integration.
1540
+
1541
+ To enable sparse fine-tuning with this integration, include the plugin in your Axolotl config:
1542
+
1543
+ This plugin does not apply pruning or sparsification itself — it is intended for fine-tuning models that have already been sparsified.
1544
+
1545
+ Pre-sparsified checkpoints can be: - Generated using LLMCompressor - Downloaded from Neural Magic’s Hugging Face page - Any custom LLM with compatible sparsity patterns that you’ve created yourself
1546
+
1547
+ To learn more about writing and customizing LLMCompressor recipes, refer to the official documentation: https://github.com/vllm-project/llm-compressor/blob/main/README.md
1548
+
1549
+ Setting save_compressed: true in your configuration enables saving models in a compressed format, which: - Reduces disk space usage by approximately 40% - Maintains compatibility with vLLM for accelerated inference - Maintains compatibility with llmcompressor for further optimization (example: quantization)
1550
+
1551
+ This option is highly recommended when working with sparse models to maximize the benefits of model compression.
1552
+
1553
+ See examples/llama-3/sparse-finetuning.yaml for a complete example.
1554
+
1555
+ After fine-tuning your sparse model, you can leverage vLLM for efficient inference. You can also use LLMCompressor to apply additional quantization to your fine-tuned sparse model before inference for even greater performance benefits.:
1556
+
1557
+ For more details on vLLM’s capabilities and advanced configuration options, see the official vLLM documentation.
1558
+
1559
+ For details on available sparsity and quantization schemes, fine-tuning recipes, and usage examples, visit the official LLMCompressor repository:
1560
+
1561
+ https://github.com/vllm-project/llm-compressor
1562
+
1563
+ Please see reference here
1564
+
1565
+ Run evaluation on model using the popular lm-evaluation-harness library.
1566
+
1567
+ See https://github.com/EleutherAI/lm-evaluation-harness
1568
+
1569
+ Please see reference here
1570
+
1571
+ Liger Kernel provides efficient Triton kernels for LLM training, offering:
1572
+
1573
+ See https://github.com/linkedin/Liger-Kernel
1574
+
1575
+ Please see reference here
1576
+
1577
+ by Eric Hartford, Lucas Atkins, Fernando Fernandes, David Golchinfar
1578
+
1579
+ This plugin contains code to freeze the bottom fraction of modules in a model, based on the Signal-to-Noise Ratio (SNR).
1580
+
1581
+ See https://github.com/cognitivecomputations/spectrum
1582
+
1583
+ Spectrum is a tool for scanning and evaluating the Signal-to-Noise Ratio (SNR) of layers in large language models. By identifying the top n% of layers with the highest SNR, you can optimize training efficiency.
1584
+
1585
+ Please see reference here
1586
+
1587
+ Plugins can be used to customize the behavior of the training pipeline through hooks. See axolotl.integrations.BasePlugin for the possible hooks.
1588
+
1589
+ To add a new integration, please follow these steps:
1590
+
1591
+ See src/axolotl/integrations/cut_cross_entropy for a minimal integration example.
1592
+
1593
+ If you could not load your integration, please ensure you are pip installing in editable mode.
1594
+
1595
+ and correctly spelled the integration name in the config file.
1596
+
1597
+ It is not necessary to place your integration in the integrations folder. It can be in any location, so long as it’s installed in a package in your python env.
1598
+
1599
+ See this repo for an example: https://github.com/axolotl-ai-cloud/diff-transformer
1600
+
1601
+ **Examples:**
1602
+
1603
+ Example 1 (bash):
1604
+ ```bash
1605
+ python scripts/cutcrossentropy_install.py | sh
1606
+ ```
1607
+
1608
+ Example 2 (bash):
1609
+ ```bash
1610
+ pip3 uninstall -y cut-cross-entropy && pip3 install "cut-cross-entropy[transformers] @ git+https://github.com/axolotl-ai-cloud/ml-cross-entropy.git@8a1a0ec"
1611
+ ```
1612
+
1613
+ Example 3 (yaml):
1614
+ ```yaml
1615
+ plugins:
1616
+ - axolotl.integrations.cut_cross_entropy.CutCrossEntropyPlugin
1617
+ ```
1618
+
1619
+ Example 4 (unknown):
1620
+ ```unknown
1621
+ @article{wijmans2024cut,
1622
+ author = {Erik Wijmans and
1623
+ Brody Huval and
1624
+ Alexander Hertzberg and
1625
+ Vladlen Koltun and
1626
+ Philipp Kr\"ahenb\"uhl},
1627
+ title = {Cut Your Losses in Large-Vocabulary Language Models},
1628
+ journal = {arXiv},
1629
+ year = {2024},
1630
+ url = {https://arxiv.org/abs/2411.09009},
1631
+ }
1632
+ ```
1633
+
1634
+ ---
1635
+
1636
+ ## Config Reference
1637
+
1638
+ **URL:** https://docs.axolotl.ai/docs/config-reference.html
1639
+
1640
+ **Contents:**
1641
+ - Config Reference
1642
+
1643
+ **Examples:**
1644
+
1645
+ Example 1 (yaml):
1646
+ ```yaml
1647
+ # Allow overwrite yml config using from cli
1648
+ strict: bool | None = False
1649
+ # Resume from a specific checkpoint dir
1650
+ resume_from_checkpoint: str | None
1651
+ # If resume_from_checkpoint isn't set and you simply want it to start where it left off.
1652
+ # Be careful with this being turned on between different models.
1653
+ auto_resume_from_checkpoints: bool | None
1654
+ # Resize the model embeddings when new tokens are added to multiples of 32. This is
1655
+ # reported to improve training speed on some models
1656
+ resize_token_embeddings_to_32x: bool | None
1657
+ mean_resizing_embeddings: bool | None = False
1658
+
1659
+ # Whether to shrink the embeddings to len(tokenizer). By default, we won't shrink.
1660
+ shrink_embeddings: bool | None
1661
+ # Don't upcast the embeddings to float32 when using PEFT. Useful for low-VRAM GPUs
1662
+ embeddings_skip_upcast: bool | None
1663
+ # Reinitialize model weights randomly instead of loading pretrained weights
1664
+ reinit_weights: bool | None
1665
+
1666
+ # module to custom trainer class to use for training
1667
+ trainer_cls: str | None
1668
+
1669
+ # Use RL training: 'dpo', 'ipo', 'kto', 'simpo', 'orpo', 'grpo'
1670
+ rl: RLType | None
1671
+
1672
+ trl: TRLConfig | None
1673
+ # For TRLConfig:
1674
+ # Beta parameter for the RL training. Same as `rl_beta`. Use
1675
+ beta: float | None
1676
+ # Maximum length of the completion for RL training.
1677
+ max_completion_length: int | None
1678
+
1679
+ # Whether to use VLLM for RL training.
1680
+ use_vllm: bool = False
1681
+ # VLLM mode to use, one of 'server' or 'colocate'
1682
+ vllm_mode: Literal['server', 'colocate'] | None
1683
+ # Host of the vLLM server to connect to.
1684
+ vllm_server_host: str | None = 0.0.0.0
1685
+ # Port of the vLLM server to connect to.
1686
+ vllm_server_port: int | None = 8000
1687
+ # Total timeout (in seconds) to wait for the vLLM server to respond.
1688
+ vllm_server_timeout: int | None
1689
+ # Regex for vLLM guided decoding.
1690
+ vllm_guided_decoding_regex: str | None
1691
+
1692
+ # List of reward functions to load. Paths must be importable from current dir.
1693
+ reward_funcs: list[str] | None
1694
+ # List of reward weights for the reward functions.
1695
+ reward_weights: list[float] | None
1696
+ # Number of generations to sample.
1697
+ num_generations: int | None
1698
+ # Whether to log completions.
1699
+ log_completions: bool | None = False
1700
+ # Number of completions to print when log_completions is True.
1701
+ num_completions_to_print: int | None
1702
+ # Controls whether importance sampling ratios are computed at the `'token'` or
1703
+ # `'sequence'` level. For GSPO, use `sequence`, default is None which corresponds to
1704
+ # the original GRPO paper.
1705
+ importance_sampling_level: Literal['sequence', 'token'] | None
1706
+
1707
+ # Whether to sync the reference model.
1708
+ sync_ref_model: bool | None = False
1709
+ # Mixup alpha for the reference model.
1710
+ ref_model_mixup_alpha: float | None = 0.9
1711
+ # Sync steps for the reference model.
1712
+ ref_model_sync_steps: int | None = 64
1713
+ # Whether to scale rewards by their standard deviation.
1714
+ scale_rewards: bool = True
1715
+
1716
+ # Sampling temperature for the GRPO policy.
1717
+ temperature: float | None
1718
+ # Top-p sampling probability for the generation policy.
1719
+ top_p: float | None
1720
+ # Top-k sampling for the generation policy.
1721
+ top_k: int | None
1722
+ # Minimum probability for the generation policy.
1723
+ min_p: float | None
1724
+ # Penalty for tokens that appear in prompt and generated text.
1725
+ repetition_penalty: float | None
1726
+ # Number of iterations per batch (μ) for GRPO.
1727
+ num_iterations: int | None
1728
+ # Epsilon value for clipping in the GRPO algorithm.
1729
+ epsilon: float | None
1730
+ # Upper-bound epsilon value for clipping in the GRPO algorithm.
1731
+ epsilon_high: float | None
1732
+ # Whether to use Liger loss for GRPO.
1733
+ use_liger_loss: bool | None
1734
+ # Loss formulation to use. Supported values: grpo, bnpo, dr_grpo.
1735
+ loss_type: str | None
1736
+ # Whether to exclude truncated completions from loss calculation.
1737
+ mask_truncated_completions: bool = False
1738
+ # Enable sleep mode for vLLM to offload VRAM when idle
1739
+ vllm_enable_sleep_mode: bool | None
1740
+
1741
+ vllm: VllmConfig | None
1742
+ # For VllmConfig:
1743
+ # Device to use for VLLM
1744
+ device: str | None = auto
1745
+ # Tensor parallel size for VLLM
1746
+ tensor_parallel_size: int | None
1747
+ # Data parallel size for VLLM
1748
+ data_parallel_size: int | None
1749
+ # GPU memory utilization for VLLM
1750
+ gpu_memory_utilization: float | None = 0.9
1751
+ # Data type for VLLM
1752
+ dtype: str | None = auto
1753
+ # Maximum length of the model context for VLLM
1754
+ max_model_len: int | None
1755
+ # Enable prefix caching for VLLM
1756
+ enable_prefix_caching: bool | None
1757
+ # Host for the vLLM server to start on
1758
+ host: str | None = 0.0.0.0
1759
+ # Port of the vLLM server to start on
1760
+ port: int | None = 8000
1761
+
1762
+ # Enable reasoning for VLLM
1763
+ enable_reasoning: bool | None
1764
+ # Reasoning parser for VLLM
1765
+ reasoning_parser: str | None
1766
+
1767
+ qat: QATConfig | None
1768
+ # For QATConfig:
1769
+ # Fake quantization layout to use for activation quantization.
1770
+ activation_dtype: TorchAOQuantDType | None
1771
+ # Fake quantization layout to use for weight quantization.
1772
+ weight_dtype: TorchAOQuantDType = TorchAOQuantDType.int8
1773
+ # Quantize embedding
1774
+ quantize_embedding: bool | None = False
1775
+ # The number of elements in each group for per-group fake quantization
1776
+ group_size: int | None = 32
1777
+ # The number of steps to apply fake quantization after
1778
+ fake_quant_after_n_steps: int | None
1779
+
1780
+ quantization: PTQConfig | None
1781
+ # For PTQConfig:
1782
+ # Fake quantization layout to use for weight quantization.
1783
+ weight_dtype: TorchAOQuantDType = TorchAOQuantDType.int8
1784
+ # Fake quantization layout to use for activation quantization.
1785
+ activation_dtype: TorchAOQuantDType | None
1786
+ # Whether to quantize the embedding layer.
1787
+ quantize_embedding: bool | None
1788
+ # The number of elements in each group for per-group fake quantization
1789
+ group_size: int | None = 32
1790
+
1791
+ # Reward modelling: `True` or `False`
1792
+ reward_model: bool | None
1793
+ # Process reward modelling: `True` or `False`
1794
+ process_reward_model: bool | None
1795
+ # Coefficient to incentivize the reward model to output mean-zero rewards (proposed by
1796
+ # https://huggingface.co/papers/2312.09244, Eq. 2). Recommended value: `0.01`.
1797
+ center_rewards_coefficient: float | None
1798
+ num_labels: int | None
1799
+
1800
+ # Whether to perform weighting in DPO trainer
1801
+ dpo_use_weighting: bool | None
1802
+ dpo_use_logits_to_keep: bool | None
1803
+ dpo_label_smoothing: float | None
1804
+ dpo_norm_loss: bool | None
1805
+ dpo_padding_free: bool | None
1806
+ dpo_generate_during_eval: bool | None
1807
+
1808
+ # A list of one or more datasets to finetune the model with
1809
+ datasets: Annotated[list[SFTDataset | DPODataset | KTODataset | StepwiseSupervisedDataset], MinLen(1)] | None
1810
+ # For SFTDataset:
1811
+ # HuggingFace dataset repo | s3:// | gs:// | path to local file or directory
1812
+ path: str | None
1813
+ # name of dataset split to load from
1814
+ split: str | None
1815
+ # The type of prompt to use for training. [alpaca, gpteacher, oasst, reflection]
1816
+ type: str | UserDefinedPrompterType | None
1817
+ # For UserDefinedPrompterType:
1818
+ # Custom user instruction prompt
1819
+ system_prompt: str | None
1820
+ # Use {system} as key to be replaced
1821
+ system_format: str | None
1822
+ field_system: str | None
1823
+ field_instruction: str | None
1824
+ field_input: str | None
1825
+ field_output: str | None
1826
+
1827
+ # Customizable to be single line or multi-line. Use {instruction}/{input} as key to
1828
+ # be replaced. 'format' can include {input}
1829
+ format: str | None
1830
+ # 'no_input_format' cannot include {input}
1831
+ no_input_format: str | None
1832
+ input_transform: str | None
1833
+ # split dataset into N pieces (use with shards_idx)
1834
+ shards: int | None
1835
+ # the index of sharded dataset to use
1836
+ shards_idx: int | None
1837
+ # process dataset in N sequential chunks for memory efficiency (exclusive with
1838
+ # `shards`)
1839
+ preprocess_shards: int | None
1840
+ conversation: str | None
1841
+
1842
+ # The name of the chat template to use for training, following values are supported:
1843
+ # tokenizer_default: Uses the chat template that is available in the
1844
+ # tokenizer_config.json. If the chat template is not available in the tokenizer, it
1845
+ # will raise an error. This is the default.
1846
+ # alpaca/inst/chatml/gemma/cohere/llama3/phi_3/deepseek_v2/jamba: These chat templates
1847
+ # are available in the axolotl codebase at src/axolotl/utils/chat_templates.py.
1848
+ # tokenizer_default_fallback_*: where * is the name of the chat template to fallback
1849
+ # to if the tokenizer does not have a chat template else default to tokenizer. E.g.
1850
+ # tokenizer_default_fallback_chatml. jinja: Uses a custom jinja template for the chat
1851
+ # template. The custom jinja template should be provided in the chat_template_jinja
1852
+ # field.
1853
+ chat_template: ChatTemplate | str | None
1854
+ # Custom jinja chat template or path to jinja file. Used only if `chat_template:
1855
+ # jinja` or empty.
1856
+ chat_template_jinja: str | None
1857
+ # path to source data files
1858
+ data_files: str | list[str] | None
1859
+ input_format: str | None
1860
+ # name of dataset configuration to load
1861
+ name: str | None
1862
+ # defines the datatype when path is a file
1863
+ ds_type: str | None
1864
+ # For `completion` datasets only, uses the provided field instead of `text` column
1865
+ field: str | None
1866
+ field_human: str | None
1867
+ field_model: str | None
1868
+ # Key containing the messages (default: "messages")
1869
+ field_messages: str | None
1870
+ # Key containing the tools (default: "tools"). Must be a list[dict] and follow [JSON
1871
+ # schema](https://json-schema.org/learn/getting-started-step-by-step).
1872
+ field_tools: str | None
1873
+ # Key containing the reasoning trace (default: "reasoning_content").
1874
+ field_thinking: str | None
1875
+ # The key the chat template expects that indicates the reasoning trace.
1876
+ template_thinking_key: str | None
1877
+
1878
+ message_field_role: str | None
1879
+
1880
+ message_field_content: str | None
1881
+ # Mapping of properties from the input dataset to the chat template. (default:
1882
+ # message_property_mappings={'role':'role', 'content':'content'}) If a property exists
1883
+ # in the template but not in this mapping, the system will attempt to load it directly
1884
+ # from the message using the property name as the key. Example: In the mapping below,
1885
+ # 'from' is loaded from input dataset and used as 'role', while 'value' is loaded and
1886
+ # used as 'content' in the chat template.
1887
+ message_property_mappings: dict[str, str] | None
1888
+ # The key in the message turn that indicates via boolean whether tokens of a turn
1889
+ # should be considered for training. Useful to selectively train on certain turns
1890
+ # besides the `roles_to_train`.
1891
+ message_field_training: str | None
1892
+ # The key in the message turn that contains the training details. Useful to
1893
+ # selectively train on certain tokens in a turn. The value of the key is a List[Dict]
1894
+ # containing `begin_offset` (start character index in content), `end_offset` (end
1895
+ # character index in content), and `train` (boolean whether to train).
1896
+ message_field_training_detail: str | None
1897
+ # (for Qwen3 template only) Whether to split the assistant content based on a
1898
+ # reasoning trace inside delimited tags
1899
+ split_thinking: bool | None
1900
+ logprobs_field: str | None
1901
+ temperature: float | None
1902
+ # Roles to train on. The tokens from these roles will be considered for the loss.
1903
+ roles_to_train: list[str] | None
1904
+ # Which EOS tokens to train on in the conversation. Possible values are: all: train on
1905
+ # all EOS tokens, turn (default): train on the EOS token at the end of each trainable
1906
+ # turn, last: train on the last EOS token in the conversation
1907
+ train_on_eos: Literal['all', 'turn', 'last'] | None
1908
+ # Roles mapping in the messages. The format is {target_role: [source_roles]}. All
1909
+ # source roles will be mapped to the target role. The default is: user: ["human",
1910
+ # "user"], assistant: ["gpt", "assistant"], system: ["system"], tool: ["tool"]
1911
+ roles: dict[str, list[str]] | None
1912
+ # Whether to drop the system turn from the dataset. Only works with chat_template.
1913
+ # This does not drop the default system message from chat_template if it exists. If
1914
+ # you wish to, we recommend using a custom jinja template with the default system
1915
+ # message removed or adding a system turn with empty content.
1916
+ drop_system_message: bool | None
1917
+ # Trust remote code for untrusted source
1918
+ trust_remote_code: bool | None = False
1919
+ # The specific revision of the dataset to use when loading from the Hugging Face Hub.
1920
+ # This can be a commit hash, tag, or branch name. If not specified, the latest version
1921
+ # will be used. This parameter is ignored for local datasets.
1922
+ revision: str | None
1923
+
1924
+ # For DPODataset:
1925
+ path: str | None
1926
+ split: str | None
1927
+ type: UserDefinedDPOType | str | None
1928
+ # For UserDefinedDPOType:
1929
+ field_system: str | None
1930
+ field_prompt: str | None
1931
+ field_chosen: str | None
1932
+ field_rejected: str | None
1933
+ prompt_format: str | None
1934
+ chosen_format: str | None
1935
+ rejected_format: str | None
1936
+ data_files: list[str] | None
1937
+ revision: str | None
1938
+ field_messages: str | None
1939
+
1940
+ # For KTODataset:
1941
+ path: str | None
1942
+ split: str | None
1943
+ type: UserDefinedKTOType | str | None
1944
+ # For UserDefinedKTOType:
1945
+ field_system: str | None
1946
+ field_prompt: str | None
1947
+ field_completion: str | None
1948
+ field_label: bool | None
1949
+ prompt_format: str | None
1950
+ completion_format: str | None
1951
+ data_files: list[str] | None
1952
+ trust_remote_code: bool | None = False
1953
+ revision: str | None
1954
+
1955
+ # For StepwiseSupervisedDataset:
1956
+ path: str | None
1957
+ split: str | None
1958
+ data_files: list[str] | None
1959
+ revision: str | None
1960
+ step_separator: str | None
1961
+ max_completion_length: int | None
1962
+ train_on_last_step_only: bool | None
1963
+
1964
+ # A list of one or more datasets to eval the model with. You can use either
1965
+ # test_datasets, or val_set_size, but not both.
1966
+ test_datasets: Annotated[list[SFTDataset | DPODataset | KTODataset | StepwiseSupervisedDataset], MinLen(1)] | None
1967
+ # For SFTDataset:
1968
+ # HuggingFace dataset repo | s3:// | gs:// | path to local file or directory
1969
+ path: str | None
1970
+ # name of dataset split to load from
1971
+ split: str | None
1972
+ # The type of prompt to use for training. [alpaca, gpteacher, oasst, reflection]
1973
+ type: str | UserDefinedPrompterType | None
1974
+ # For UserDefinedPrompterType:
1975
+ # Custom user instruction prompt
1976
+ system_prompt: str | None
1977
+ # Use {system} as key to be replaced
1978
+ system_format: str | None
1979
+ field_system: str | None
1980
+ field_instruction: str | None
1981
+ field_input: str | None
1982
+ field_output: str | None
1983
+
1984
+ # Customizable to be single line or multi-line. Use {instruction}/{input} as key to
1985
+ # be replaced. 'format' can include {input}
1986
+ format: str | None
1987
+ # 'no_input_format' cannot include {input}
1988
+ no_input_format: str | None
1989
+ input_transform: str | None
1990
+ # split dataset into N pieces (use with shards_idx)
1991
+ shards: int | None
1992
+ # the index of sharded dataset to use
1993
+ shards_idx: int | None
1994
+ # process dataset in N sequential chunks for memory efficiency (exclusive with
1995
+ # `shards`)
1996
+ preprocess_shards: int | None
1997
+ conversation: str | None
1998
+
1999
+ # The name of the chat template to use for training, following values are supported:
2000
+ # tokenizer_default: Uses the chat template that is available in the
2001
+ # tokenizer_config.json. If the chat template is not available in the tokenizer, it
2002
+ # will raise an error. This is the default.
2003
+ # alpaca/inst/chatml/gemma/cohere/llama3/phi_3/deepseek_v2/jamba: These chat templates
2004
+ # are available in the axolotl codebase at src/axolotl/utils/chat_templates.py.
2005
+ # tokenizer_default_fallback_*: where * is the name of the chat template to fallback
2006
+ # to if the tokenizer does not have a chat template else default to tokenizer. E.g.
2007
+ # tokenizer_default_fallback_chatml. jinja: Uses a custom jinja template for the chat
2008
+ # template. The custom jinja template should be provided in the chat_template_jinja
2009
+ # field.
2010
+ chat_template: ChatTemplate | str | None
2011
+ # Custom jinja chat template or path to jinja file. Used only if `chat_template:
2012
+ # jinja` or empty.
2013
+ chat_template_jinja: str | None
2014
+ # path to source data files
2015
+ data_files: str | list[str] | None
2016
+ input_format: str | None
2017
+ # name of dataset configuration to load
2018
+ name: str | None
2019
+ # defines the datatype when path is a file
2020
+ ds_type: str | None
2021
+ # For `completion` datasets only, uses the provided field instead of `text` column
2022
+ field: str | None
2023
+ field_human: str | None
2024
+ field_model: str | None
2025
+ # Key containing the messages (default: "messages")
2026
+ field_messages: str | None
2027
+ # Key containing the tools (default: "tools"). Must be a list[dict] and follow [JSON
2028
+ # schema](https://json-schema.org/learn/getting-started-step-by-step).
2029
+ field_tools: str | None
2030
+ # Key containing the reasoning trace (default: "reasoning_content").
2031
+ field_thinking: str | None
2032
+ # The key the chat template expects that indicates the reasoning trace.
2033
+ template_thinking_key: str | None
2034
+
2035
+ message_field_role: str | None
2036
+
2037
+ message_field_content: str | None
2038
+ # Mapping of properties from the input dataset to the chat template. (default:
2039
+ # message_property_mappings={'role':'role', 'content':'content'}) If a property exists
2040
+ # in the template but not in this mapping, the system will attempt to load it directly
2041
+ # from the message using the property name as the key. Example: In the mapping below,
2042
+ # 'from' is loaded from input dataset and used as 'role', while 'value' is loaded and
2043
+ # used as 'content' in the chat template.
2044
+ message_property_mappings: dict[str, str] | None
2045
+ # The key in the message turn that indicates via boolean whether tokens of a turn
2046
+ # should be considered for training. Useful to selectively train on certain turns
2047
+ # besides the `roles_to_train`.
2048
+ message_field_training: str | None
2049
+ # The key in the message turn that contains the training details. Useful to
2050
+ # selectively train on certain tokens in a turn. The value of the key is a List[Dict]
2051
+ # containing `begin_offset` (start character index in content), `end_offset` (end
2052
+ # character index in content), and `train` (boolean whether to train).
2053
+ message_field_training_detail: str | None
2054
+ # (for Qwen3 template only) Whether to split the assistant content based on a
2055
+ # reasoning trace inside delimited tags
2056
+ split_thinking: bool | None
2057
+ logprobs_field: str | None
2058
+ temperature: float | None
2059
+ # Roles to train on. The tokens from these roles will be considered for the loss.
2060
+ roles_to_train: list[str] | None
2061
+ # Which EOS tokens to train on in the conversation. Possible values are: all: train on
2062
+ # all EOS tokens, turn (default): train on the EOS token at the end of each trainable
2063
+ # turn, last: train on the last EOS token in the conversation
2064
+ train_on_eos: Literal['all', 'turn', 'last'] | None
2065
+ # Roles mapping in the messages. The format is {target_role: [source_roles]}. All
2066
+ # source roles will be mapped to the target role. The default is: user: ["human",
2067
+ # "user"], assistant: ["gpt", "assistant"], system: ["system"], tool: ["tool"]
2068
+ roles: dict[str, list[str]] | None
2069
+ # Whether to drop the system turn from the dataset. Only works with chat_template.
2070
+ # This does not drop the default system message from chat_template if it exists. If
2071
+ # you wish to, we recommend using a custom jinja template with the default system
2072
+ # message removed or adding a system turn with empty content.
2073
+ drop_system_message: bool | None
2074
+ # Trust remote code for untrusted source
2075
+ trust_remote_code: bool | None = False
2076
+ # The specific revision of the dataset to use when loading from the Hugging Face Hub.
2077
+ # This can be a commit hash, tag, or branch name. If not specified, the latest version
2078
+ # will be used. This parameter is ignored for local datasets.
2079
+ revision: str | None
2080
+
2081
+ # For DPODataset:
2082
+ path: str | None
2083
+ split: str | None
2084
+ type: UserDefinedDPOType | str | None
2085
+ # For UserDefinedDPOType:
2086
+ field_system: str | None
2087
+ field_prompt: str | None
2088
+ field_chosen: str | None
2089
+ field_rejected: str | None
2090
+ prompt_format: str | None
2091
+ chosen_format: str | None
2092
+ rejected_format: str | None
2093
+ data_files: list[str] | None
2094
+ revision: str | None
2095
+ field_messages: str | None
2096
+
2097
+ # For KTODataset:
2098
+ path: str | None
2099
+ split: str | None
2100
+ type: UserDefinedKTOType | str | None
2101
+ # For UserDefinedKTOType:
2102
+ field_system: str | None
2103
+ field_prompt: str | None
2104
+ field_completion: str | None
2105
+ field_label: bool | None
2106
+ prompt_format: str | None
2107
+ completion_format: str | None
2108
+ data_files: list[str] | None
2109
+ trust_remote_code: bool | None = False
2110
+ revision: str | None
2111
+
2112
+ # For StepwiseSupervisedDataset:
2113
+ path: str | None
2114
+ split: str | None
2115
+ data_files: list[str] | None
2116
+ revision: str | None
2117
+ step_separator: str | None
2118
+ max_completion_length: int | None
2119
+ train_on_last_step_only: bool | None
2120
+
2121
+ # If false, the datasets will not be shuffled and will keep their original order in
2122
+ # `datasets`. The same applies to the `test_datasets` option and the
2123
+ # `pretraining_dataset` option. Default is true.
2124
+ shuffle_merged_datasets: bool | None = True
2125
+ # If true, each dataset in `datasets` will be shuffled before merging. This allows
2126
+ # curriculum learning strategies to be applied at the dataset level. Default is false.
2127
+ shuffle_before_merging_datasets: bool | None = False
2128
+ # Axolotl attempts to save the dataset as an arrow after packing the data together so
2129
+ # subsequent training attempts load faster, relative path
2130
+ dataset_prepared_path: str | None
2131
+ # Num shards for whole dataset
2132
+ dataset_shard_num: int | None
2133
+ # Index of shard to use for whole dataset
2134
+ dataset_shard_idx: int | None
2135
+ skip_prepare_dataset: bool | None = False
2136
+ # Number of shards to save the prepared dataset
2137
+ num_dataset_shards_to_save: int | None
2138
+
2139
+ # Set to HF dataset for type: 'completion' for streaming instead of pre-tokenize
2140
+ pretraining_dataset: Annotated[list[PretrainingDataset | SFTDataset], MinLen(1)] | None
2141
+ # For PretrainingDataset:
2142
+ name: str | None
2143
+ path: str | None
2144
+ split: str | None = train
2145
+ text_column: str | None = text
2146
+ type: str | None = pretrain
2147
+ trust_remote_code: bool | None = False
2148
+ data_files: str | None
2149
+ skip: int | None
2150
+
2151
+ # For SFTDataset:
2152
+ # HuggingFace dataset repo | s3:// | gs:// | path to local file or directory
2153
+ path: str | None
2154
+ # name of dataset split to load from
2155
+ split: str | None
2156
+ # The type of prompt to use for training. [alpaca, gpteacher, oasst, reflection]
2157
+ type: str | UserDefinedPrompterType | None
2158
+ # For UserDefinedPrompterType:
2159
+ # Custom user instruction prompt
2160
+ system_prompt: str | None
2161
+ # Use {system} as key to be replaced
2162
+ system_format: str | None
2163
+ field_system: str | None
2164
+ field_instruction: str | None
2165
+ field_input: str | None
2166
+ field_output: str | None
2167
+
2168
+ # Customizable to be single line or multi-line. Use {instruction}/{input} as key to
2169
+ # be replaced. 'format' can include {input}
2170
+ format: str | None
2171
+ # 'no_input_format' cannot include {input}
2172
+ no_input_format: str | None
2173
+ input_transform: str | None
2174
+ # split dataset into N pieces (use with shards_idx)
2175
+ shards: int | None
2176
+ # the index of sharded dataset to use
2177
+ shards_idx: int | None
2178
+ # process dataset in N sequential chunks for memory efficiency (exclusive with
2179
+ # `shards`)
2180
+ preprocess_shards: int | None
2181
+ conversation: str | None
2182
+
2183
+ # The name of the chat template to use for training, following values are supported:
2184
+ # tokenizer_default: Uses the chat template that is available in the
2185
+ # tokenizer_config.json. If the chat template is not available in the tokenizer, it
2186
+ # will raise an error. This is the default.
2187
+ # alpaca/inst/chatml/gemma/cohere/llama3/phi_3/deepseek_v2/jamba: These chat templates
2188
+ # are available in the axolotl codebase at src/axolotl/utils/chat_templates.py.
2189
+ # tokenizer_default_fallback_*: where * is the name of the chat template to fallback
2190
+ # to if the tokenizer does not have a chat template else default to tokenizer. E.g.
2191
+ # tokenizer_default_fallback_chatml. jinja: Uses a custom jinja template for the chat
2192
+ # template. The custom jinja template should be provided in the chat_template_jinja
2193
+ # field.
2194
+ chat_template: ChatTemplate | str | None
2195
+ # Custom jinja chat template or path to jinja file. Used only if `chat_template:
2196
+ # jinja` or empty.
2197
+ chat_template_jinja: str | None
2198
+ # path to source data files
2199
+ data_files: str | list[str] | None
2200
+ input_format: str | None
2201
+ # name of dataset configuration to load
2202
+ name: str | None
2203
+ # defines the datatype when path is a file
2204
+ ds_type: str | None
2205
+ # For `completion` datasets only, uses the provided field instead of `text` column
2206
+ field: str | None
2207
+ field_human: str | None
2208
+ field_model: str | None
2209
+ # Key containing the messages (default: "messages")
2210
+ field_messages: str | None
2211
+ # Key containing the tools (default: "tools"). Must be a list[dict] and follow [JSON
2212
+ # schema](https://json-schema.org/learn/getting-started-step-by-step).
2213
+ field_tools: str | None
2214
+ # Key containing the reasoning trace (default: "reasoning_content").
2215
+ field_thinking: str | None
2216
+ # The key the chat template expects that indicates the reasoning trace.
2217
+ template_thinking_key: str | None
2218
+
2219
+ message_field_role: str | None
2220
+
2221
+ message_field_content: str | None
2222
+ # Mapping of properties from the input dataset to the chat template. (default:
2223
+ # message_property_mappings={'role':'role', 'content':'content'}) If a property exists
2224
+ # in the template but not in this mapping, the system will attempt to load it directly
2225
+ # from the message using the property name as the key. Example: In the mapping below,
2226
+ # 'from' is loaded from input dataset and used as 'role', while 'value' is loaded and
2227
+ # used as 'content' in the chat template.
2228
+ message_property_mappings: dict[str, str] | None
2229
+ # The key in the message turn that indicates via boolean whether tokens of a turn
2230
+ # should be considered for training. Useful to selectively train on certain turns
2231
+ # besides the `roles_to_train`.
2232
+ message_field_training: str | None
2233
+ # The key in the message turn that contains the training details. Useful to
2234
+ # selectively train on certain tokens in a turn. The value of the key is a List[Dict]
2235
+ # containing `begin_offset` (start character index in content), `end_offset` (end
2236
+ # character index in content), and `train` (boolean whether to train).
2237
+ message_field_training_detail: str | None
2238
+ # (for Qwen3 template only) Whether to split the assistant content based on a
2239
+ # reasoning trace inside delimited tags
2240
+ split_thinking: bool | None
2241
+ logprobs_field: str | None
2242
+ temperature: float | None
2243
+ # Roles to train on. The tokens from these roles will be considered for the loss.
2244
+ roles_to_train: list[str] | None
2245
+ # Which EOS tokens to train on in the conversation. Possible values are: all: train on
2246
+ # all EOS tokens, turn (default): train on the EOS token at the end of each trainable
2247
+ # turn, last: train on the last EOS token in the conversation
2248
+ train_on_eos: Literal['all', 'turn', 'last'] | None
2249
+ # Roles mapping in the messages. The format is {target_role: [source_roles]}. All
2250
+ # source roles will be mapped to the target role. The default is: user: ["human",
2251
+ # "user"], assistant: ["gpt", "assistant"], system: ["system"], tool: ["tool"]
2252
+ roles: dict[str, list[str]] | None
2253
+ # Whether to drop the system turn from the dataset. Only works with chat_template.
2254
+ # This does not drop the default system message from chat_template if it exists. If
2255
+ # you wish to, we recommend using a custom jinja template with the default system
2256
+ # message removed or adding a system turn with empty content.
2257
+ drop_system_message: bool | None
2258
+ # Trust remote code for untrusted source
2259
+ trust_remote_code: bool | None = False
2260
+ # The specific revision of the dataset to use when loading from the Hugging Face Hub.
2261
+ # This can be a commit hash, tag, or branch name. If not specified, the latest version
2262
+ # will be used. This parameter is ignored for local datasets.
2263
+ revision: str | None
2264
+
2265
+ # The maximum number of processes to use while preprocessing your input dataset. This
2266
+ # defaults to `os.cpu_count()` if not set. For Runpod VMs, it will default to number of
2267
+ # vCPUs via RUNPOD_CPU_COUNT.
2268
+ dataset_processes: int | None
2269
+ # The maximum number of processes to use while preprocessing your input dataset. This
2270
+ # defaults to `os.cpu_count()` if not set. For Runpod VMs, it will default to number of
2271
+ # vCPUs via RUNPOD_CPU_COUNT.
2272
+ dataset_num_proc: int | None
2273
+
2274
+ # Deduplicates datasets and test_datasets with identical entries
2275
+ dataset_exact_deduplication: bool | None
2276
+ # Keep dataset in memory while preprocessing. Only needed if cached dataset is taking
2277
+ # too much storage
2278
+ dataset_keep_in_memory: bool | None
2279
+ dataloader_pin_memory: bool | None
2280
+ dataloader_num_workers: int | None
2281
+ dataloader_prefetch_factor: int | None
2282
+ dataloader_drop_last: bool | None
2283
+
2284
+ accelerator_config: dict[str, Any] | None
2285
+
2286
+ remove_unused_columns: bool | None
2287
+
2288
+ # Push prepared dataset to hub - repo_org/repo_name
2289
+ push_dataset_to_hub: str | None
2290
+ # Whether to use hf `use_auth_token` for loading datasets. Useful for fetching private
2291
+ # datasets. Required to be true when used in combination with `push_dataset_to_hub`
2292
+ hf_use_auth_token: bool | None
2293
+
2294
+ device: Any | None
2295
+ # Passed through to transformers when loading the model when launched without
2296
+ # accelerate. Use `sequential` when training w/ model parallelism to limit memory
2297
+ device_map: Any | None
2298
+ world_size: int | None
2299
+ # Don't mess with this, it's here for accelerate and torchrun
2300
+ local_rank: int | None
2301
+ ddp: bool | None
2302
+
2303
+ # Seed for reproducibility
2304
+ seed: int | None
2305
+ # Advanced DDP Arguments - timeout
2306
+ ddp_timeout: int | None
2307
+ # Advanced DDP Arguments - bucket cap in MB
2308
+ ddp_bucket_cap_mb: int | None
2309
+ # Advanced DDP Arguments - broadcast buffers
2310
+ ddp_broadcast_buffers: bool | None
2311
+ ddp_find_unused_parameters: bool | None
2312
+
2313
+ # Approximate number of predictions sent to wandb depending on batch size. Enabled above
2314
+ # 0. Default is 0
2315
+ eval_table_size: int | None
2316
+ # Total number of tokens generated for predictions sent to wandb. Default is 128
2317
+ eval_max_new_tokens: int | None
2318
+ # Whether to run causal language model evaluation for metrics in
2319
+ # `eval_causal_lm_metrics`
2320
+ do_causal_lm_eval: bool | None
2321
+ # HF evaluate metrics used during evaluation. Default is ['sacrebleu', 'comet', 'ter',
2322
+ # 'chrf', 'perplexity']
2323
+ eval_causal_lm_metrics: list[str] | None
2324
+ do_bench_eval: bool | None
2325
+ bench_dataset: str | None
2326
+ bench_split: str | None
2327
+ metric_for_best_model: str | None
2328
+ greater_is_better: bool | None
2329
+
2330
+ # High loss value, indicating the learning has broken down (a good estimate is ~2 times
2331
+ # the loss at the start of training)
2332
+ loss_watchdog_threshold: float | None
2333
+ # Number of high-loss steps in a row before the trainer aborts (default: 3)
2334
+ loss_watchdog_patience: int | None
2335
+
2336
+ # Run garbage collection every `gc_steps` steps. -1 will run on epoch end and before
2337
+ # evaluations. Default is 0 (disabled).
2338
+ gc_steps: int | None
2339
+
2340
+ # Use CUDA bf16. bool or 'full' for `bf16_full_eval`, or 'auto' for automatic detection.
2341
+ # require >=ampere
2342
+ bf16: Literal['auto'] | bool | None = auto
2343
+ # Use CUDA fp16
2344
+ fp16: bool | None
2345
+ # Enable FP8 mixed precision training using TorchAO. Best used in combination with
2346
+ # torch.compile.
2347
+ fp8: bool | None
2348
+ # Enable FSDP float8 all-gather optimization for FP8 training. Can improve training
2349
+ # speed by 10-15% when FSDP is enabled.
2350
+ fp8_enable_fsdp_float8_all_gather: bool | None
2351
+ # No AMP (automatic mixed precision) - require >=ampere
2352
+ bfloat16: bool | None
2353
+ # No AMP (automatic mixed precision)
2354
+ float16: bool | None
2355
+ # Use CUDA tf32 - require >=ampere
2356
+ tf32: bool | None
2357
+ float32: bool | None
2358
+
2359
+ # Whether to use gradient checkpointing. Available options are: true, false, 'offload',
2360
+ # 'offload_disk'.
2361
+ # https://huggingface.co/docs/transformers/v4.18.0/en/performance#gradient-checkpointing
2362
+ gradient_checkpointing: Literal['offload', 'offload_disk'] | bool | None = False
2363
+ # Additional kwargs to pass to the trainer for gradient checkpointing
2364
+ gradient_checkpointing_kwargs: dict[str, Any] | None
2365
+ # Whether to offload activations. Available options are: true, false, 'legacy', 'disk'.
2366
+ activation_offloading: Literal['legacy', 'disk'] | bool | None = False
2367
+
2368
+ unfrozen_parameters: list[str] | None
2369
+
2370
+ # The maximum length of an input to train with, this should typically be less than 2048
2371
+ # as most models have a token/context limit of 2048
2372
+ sequence_len: int = 512
2373
+ # What to do when a tokenized row exceeds sequence_len. 'drop' removes the row;
2374
+ # 'truncate' slices tensors to sequence_len. Defaults to 'drop' for backward
2375
+ # compatibility.
2376
+ excess_length_strategy: Literal['drop', 'truncate'] | None
2377
+ # The maximum length of an input for evaluation. If not specified, defaults to
2378
+ # sequence_len
2379
+ eval_sequence_len: int | None
2380
+ min_sample_len: int | None
2381
+ # maximum prompt length for RL training
2382
+ max_prompt_len: int | None
2383
+ # Use efficient multi-packing with block diagonal attention and per sequence
2384
+ # position_ids. Recommend set to 'true'
2385
+ sample_packing: bool | None
2386
+ # The number of samples packed at a time. Increasing the following values helps with
2387
+ # packing, but usually only slightly (<%1.)
2388
+ sample_packing_group_size: int | None = 100000
2389
+ # The number of samples which can be packed into one sequence. Increase if using a large
2390
+ # sequence_len with many short samples.
2391
+ sample_packing_bin_size: int | None = 200
2392
+ # Whether to pack samples sequentially
2393
+ sample_packing_sequentially: bool | None
2394
+ # The multiprocessing start method to use for packing. Should be 'fork', 'spawn' or
2395
+ # 'forkserver'
2396
+ sample_packing_mp_start_method: str | None
2397
+ # Set to 'false' if getting errors during eval with sample_packing on
2398
+ eval_sample_packing: bool | None
2399
+ # Pad inputs so each step uses constant sized buffers. This will reduce memory
2400
+ # fragmentation and may prevent OOMs, by re-using memory more efficiently. Defaults to
2401
+ # True if `sample_packing` enabled
2402
+ pad_to_sequence_len: bool | None
2403
+ # Whether to use sequential sampling for curriculum learning
2404
+ curriculum_sampling: bool | None
2405
+ multipack_real_batches: bool | None
2406
+
2407
+ # Use batch flattening for speedups when not using sample_packing
2408
+ batch_flattening: Literal['auto'] | bool | None
2409
+
2410
+ use_pose: bool | None
2411
+ pose_split_on_token_ids: list[int] | None
2412
+ pose_max_context_len: int | None
2413
+ pose_num_chunks: int | None
2414
+
2415
+ pretrain_multipack_buffer_size: int | None
2416
+ # whether to prevent cross attention for packed sequences during pretraining
2417
+ pretrain_multipack_attn: bool | None = True
2418
+ # whether to concatenate samples during pretraining
2419
+ pretraining_sample_concatenation: bool | None
2420
+
2421
+ # Use streaming mode for loading datasets
2422
+ streaming: bool | None
2423
+ # Buffer size for multipack streaming datasets
2424
+ streaming_multipack_buffer_size: int | None = 10000
2425
+
2426
+ # Whether to use xformers attention patch https://github.com/facebookresearch/xformers
2427
+ xformers_attention: bool | None
2428
+ # Whether to use scaled-dot-product attention https://pytorch.org/docs/stable/generated/
2429
+ # torch.nn.functional.scaled_dot_product_attention.html
2430
+ sdp_attention: bool | None
2431
+ # Shifted-sparse attention (only llama) - https://arxiv.org/pdf/2309.12307.pdf
2432
+ s2_attention: bool | None
2433
+ flex_attention: bool | None
2434
+ flex_attn_compile_kwargs: dict[str, Any] | None
2435
+ # Whether to use flash attention patch https://github.com/Dao-AILab/flash-attention
2436
+ flash_attention: bool | None
2437
+ # Whether to use flash-attention cross entropy implementation - advanced use only
2438
+ flash_attn_cross_entropy: bool | None
2439
+ # Whether to use flash-attention rms norm implementation - advanced use only
2440
+ flash_attn_rms_norm: bool | None
2441
+ # Whether to fuse part of the MLP into a single operation
2442
+ flash_attn_fuse_mlp: bool | None
2443
+ # Whether to use bettertransformers
2444
+ flash_optimum: bool | None
2445
+
2446
+ eager_attention: bool | None
2447
+
2448
+ # Specify a custom attention implementation, used mostly for kernels.
2449
+ attn_implementation: str | None
2450
+
2451
+ unsloth_cross_entropy_loss: bool | None
2452
+ unsloth_lora_mlp: bool | None
2453
+ unsloth_lora_qkv: bool | None
2454
+ unsloth_lora_o: bool | None
2455
+ unsloth_rms_norm: bool | None
2456
+ unsloth_rope: bool | None
2457
+
2458
+ # Apply custom LoRA autograd functions and activation function Triton kernels for speed
2459
+ # and memory savings. See: https://docs.axolotl.ai/docs/lora_optims.html
2460
+ lora_mlp_kernel: bool | None
2461
+ # Apply custom LoRA autograd functions and activation function Triton kernels for speed
2462
+ # and memory savings. See: https://docs.axolotl.ai/docs/lora_optims.html
2463
+ lora_qkv_kernel: bool | None
2464
+ # Apply custom LoRA autograd functions and activation function Triton kernels for speed
2465
+ # and memory savings. See: https://docs.axolotl.ai/docs/lora_optims.html
2466
+ lora_o_kernel: bool | None
2467
+
2468
+ # Whether to use chunked cross entropy loss for memory efficiency
2469
+ chunked_cross_entropy: bool | None
2470
+ # Number of chunks to use for chunked cross entropy loss
2471
+ chunked_cross_entropy_num_chunks: int | None
2472
+
2473
+ # Whether to use ALST tiled mlp for memory efficient long context
2474
+ tiled_mlp: bool | None
2475
+
2476
+ # Number of shards to use for ALST tiled mlp. If unset, it will be set based on
2477
+ # seqlen/hidden_size
2478
+ tiled_mlp_num_shards: int | None
2479
+
2480
+ # Whether to use original mlp for ALST tiled mlp. Otherwise uses a generic MLP based on
2481
+ # llama.
2482
+ tiled_mlp_use_original_mlp: bool | None = True
2483
+
2484
+ llama4_linearized_experts: bool | None
2485
+
2486
+ # Deepspeed config path. e.g., deepspeed_configs/zero3.json
2487
+ deepspeed: str | dict[str, Any] | None
2488
+ # Whether to use deepcompile for faster training with deepspeed
2489
+ deepcompile: bool | None
2490
+ # FSDP configuration
2491
+ fsdp: list[str] | None
2492
+
2493
+ # FSDP configuration options
2494
+ fsdp_config: FSDPConfig | None
2495
+ # For FSDPConfig:
2496
+ # Enable activation checkpointing to reduce memory usage during forward passes
2497
+ activation_checkpointing: bool | None
2498
+ # Offload parameters to CPU to reduce GPU memory usage
2499
+ offload_params: bool | None
2500
+ # Synchronize module states across all processes
2501
+ sync_module_states: bool | None
2502
+ # Enable CPU RAM efficient loading to reduce memory usage during model loading
2503
+ cpu_ram_efficient_loading: bool | None
2504
+ # Disabling this enables swap memory usage for resource-constrained setups when
2505
+ # offload_params is enabled.
2506
+ cpu_offload_pin_memory: bool | None
2507
+ # Use original parameters instead of flattened parameters
2508
+ use_orig_params: bool | None
2509
+
2510
+ # Type of state dict to use for saving/loading checkpoints
2511
+ state_dict_type: Literal['FULL_STATE_DICT', 'LOCAL_STATE_DICT', 'SHARDED_STATE_DICT'] | None
2512
+ # Final state dict type to use after training completion
2513
+ final_state_dict_type: Literal['FULL_STATE_DICT', 'LOCAL_STATE_DICT', 'SHARDED_STATE_DICT'] | None
2514
+
2515
+ # Policy for automatically wrapping modules with FSDP
2516
+ auto_wrap_policy: Literal['TRANSFORMER_BASED_WRAP', 'SIZE_BASED_WRAP'] | None
2517
+ # Class name of transformer layers to wrap (e.g., 'LlamaDecoderLayer')
2518
+ transformer_layer_cls_to_wrap: str | None
2519
+
2520
+ # Reshard parameters after forward pass to save memory
2521
+ reshard_after_forward: bool | None
2522
+ # Mixed precision policy for FSDP (e.g., 'fp16', 'bf16')
2523
+ mixed_precision_policy: str | None
2524
+
2525
+ # FSDP version
2526
+ fsdp_version: int | None
2527
+ fsdp_final_state_dict_type: Literal['FULL_STATE_DICT', 'LOCAL_STATE_DICT', 'SHARDED_STATE_DICT'] | None
2528
+
2529
+ # How much of the dataset to set aside as evaluation. 1 = 100%, 0.50 = 50%, etc. 0 for
2530
+ # no eval.
2531
+ val_set_size: float | None = 0.0
2532
+
2533
+ # Number of devices to shard across. If not set, will use all available devices.
2534
+ dp_shard_size: int | None
2535
+ # Number of devices to replicate across.
2536
+ dp_replicate_size: int | None
2537
+ # Deprecated: use `context_parallel_size` instead
2538
+ sequence_parallel_degree: int | None
2539
+ # Set to a divisor of the number of GPUs available to split sequences into chunks of
2540
+ # equal size. Use in long context training to prevent OOM when sequences cannot fit into
2541
+ # a single GPU's VRAM. E.g., if 4 GPUs are available, set this value to 2 to split each
2542
+ # sequence into two equal-sized subsequences, or set to 4 to split into four equal-sized
2543
+ # subsequences. See https://docs.axolotl.ai/docs/sequence_parallelism.html for more
2544
+ # details.
2545
+ context_parallel_size: int | None
2546
+ # Optional; strides across the key dimension. Larger values use more memory but should
2547
+ # make training faster. Must evenly divide the number of KV heads in your model.
2548
+ heads_k_stride: int | None
2549
+ # One of 'varlen_llama3', 'batch_ring', 'batch_zigzag', 'batch_stripe'. Defaults to
2550
+ # 'varlen_llama3' in the sample packing case, and 'batch_ring' in the non-sample packing
2551
+ # case.
2552
+ ring_attn_func: RingAttnFunc | None
2553
+ # Number of tensor parallel processes in TP group. Only supported with DeepSpeed AutoTP.
2554
+ tensor_parallel_size: int | None
2555
+
2556
+ # Add or change special tokens. If you add tokens here, you don't need to add them to
2557
+ # the `tokens` list.
2558
+ special_tokens: SpecialTokensConfig | None
2559
+ # For SpecialTokensConfig:
2560
+ bos_token: str | None
2561
+ eos_token: str | None
2562
+ pad_token: str | None
2563
+ unk_token: str | None
2564
+ additional_special_tokens: list[str] | None
2565
+
2566
+ # Add extra tokens to the tokenizer
2567
+ tokens: list[str] | None
2568
+ # Mapping token_id to new_token_string to override reserved added_tokens in the
2569
+ # tokenizer. Only works for tokens that are not part of the base vocab (aka are
2570
+ # added_tokens). Can be checked if they exist in tokenizer.json added_tokens.
2571
+ added_tokens_overrides: dict[int, str] | None
2572
+
2573
+ # Whether to use torch.compile and which backend to use. setting to `auto` will enable
2574
+ # torch compile when torch>=2.6.0
2575
+ torch_compile: Literal['auto'] | bool | None
2576
+ # Backend to use for torch.compile
2577
+ torch_compile_backend: str | None
2578
+ torch_compile_mode: Literal['default', 'reduce-overhead', 'max-autotune'] | None
2579
+
2580
+ # Maximum number of iterations to train for. It precedes num_epochs which means that if
2581
+ # both are set, num_epochs will not be guaranteed. e.g., when 1 epoch is 1000 steps =>
2582
+ # `num_epochs: 2` and `max_steps: 100` will train for 100 steps
2583
+ max_steps: int | None
2584
+ # Number of warmup steps. Cannot use with warmup_ratio
2585
+ warmup_steps: int | None
2586
+ # Warmup ratio. Cannot use with warmup_steps
2587
+ warmup_ratio: float | None
2588
+ # Leave empty to eval at each epoch, integer for every N steps. float for fraction of
2589
+ # total steps
2590
+ eval_steps: int | float | None
2591
+ # Number of times per epoch to run evals, mutually exclusive with eval_steps
2592
+ evals_per_epoch: int | None
2593
+ # Set to `no` to skip evaluation, `epoch` at end of each epoch, leave empty to infer
2594
+ # from `eval_steps`
2595
+ eval_strategy: str | None
2596
+
2597
+ # Leave empty to save at each epoch, integer for every N steps. float for fraction of
2598
+ # total steps
2599
+ save_steps: int | float | None
2600
+ # Number of times per epoch to save a checkpoint, mutually exclusive with save_steps
2601
+ saves_per_epoch: int | None
2602
+ # Set to `no` to skip checkpoint saves, `epoch` at end of each epoch, `best` when better
2603
+ # result is achieved, leave empty to infer from `save_steps`
2604
+ save_strategy: str | None
2605
+ # Checkpoints saved at a time
2606
+ save_total_limit: int | None
2607
+ # Whether to checkpoint a model after the first step of training. Defaults to False.
2608
+ save_first_step: bool | None
2609
+
2610
+ # Logging frequency
2611
+ logging_steps: int | None
2612
+ # Stop training after this many evaluation losses have increased in a row. https://huggi
2613
+ # ngface.co/transformers/v4.2.2/_modules/transformers/trainer_callback.html#EarlyStoppin
2614
+ # gCallback
2615
+ early_stopping_patience: int | None
2616
+ load_best_model_at_end: bool | None = False
2617
+ # Save only the model weights, skipping the optimizer. Using this means you can't resume
2618
+ # from checkpoints.
2619
+ save_only_model: bool | None = False
2620
+ # Use tensorboard for logging
2621
+ use_tensorboard: bool | None
2622
+ # Enable the pytorch profiler to capture the first N steps of training to the
2623
+ # output_dir. see https://pytorch.org/blog/understanding-gpu-memory-1/ for more
2624
+ # information. Snapshots can be visualized @ https://pytorch.org/memory_viz
2625
+ profiler_steps: int | None
2626
+ # Which step to start the profiler at. Useful for only capturing a few steps mid-run.
2627
+ profiler_steps_start: int | None = 0
2628
+ # bool of whether to report tokens per second at the end of training. This is not
2629
+ # supported with pre-training datasets.
2630
+ include_tokens_per_second: bool | None
2631
+ # bool of whether to report tokens per second per-gpu during training by measuring
2632
+ # throughput of non-padding tokens.
2633
+ include_tkps: bool | None = True
2634
+ # NEFT https://arxiv.org/abs/2310.05914, set this to a number (paper default is 5) to
2635
+ # add noise to embeddings. Currently only supported on Llama and Mistral
2636
+ neftune_noise_alpha: float | None
2637
+
2638
+ # Parameter controlling the relative ratio loss weight in the ORPO loss. Passed to
2639
+ # `beta` in `ORPOConfig` due to trl mapping.
2640
+ orpo_alpha: float | None
2641
+ # Weighting of NLL term in loss from RPO paper
2642
+ rpo_alpha: float | None
2643
+ # Target reward margin for the SimPO loss
2644
+ simpo_gamma: float | None
2645
+ # Weight of the BC regularizer
2646
+ cpo_alpha: float | None
2647
+
2648
+ # Factor for desirable loss term in KTO loss
2649
+ kto_desirable_weight: float | None
2650
+ # Factor for undesirable loss term in KTO loss
2651
+ kto_undesirable_weight: float | None
2652
+ # The beta parameter for the RL training
2653
+ rl_beta: float | None
2654
+
2655
+ # Defines the max memory usage per gpu on the system. Passed through to transformers
2656
+ # when loading the model.
2657
+ max_memory: dict[int | Literal['cpu', 'disk'], int | str] | None
2658
+ # Limit the memory for all available GPUs to this amount (if an integer, expressed in
2659
+ # gigabytes); default: unset
2660
+ gpu_memory_limit: int | str | None
2661
+ # Whether to use low_cpu_mem_usage
2662
+ low_cpu_mem_usage: bool | None
2663
+
2664
+ # The name of the chat template to use for training, following values are supported:
2665
+ # tokenizer_default: Uses the chat template that is available in the
2666
+ # tokenizer_config.json. If the chat template is not available in the tokenizer, it will
2667
+ # raise an error. This is the default value.
2668
+ # alpaca/inst/chatml/gemma/cohere/llama3/phi_3/deepseek_v2/jamba: These chat templates
2669
+ # are available in the axolotl codebase at src/axolotl/utils/chat_templates.py.
2670
+ # tokenizer_default_fallback_*: where * is the name of the chat template to fallback to.
2671
+ # E.g. tokenizer_default_fallback_chatml. This is useful when the chat template is not
2672
+ # available in the tokenizer. jinja: Uses a custom jinja template for the chat template.
2673
+ # The custom jinja template should be provided in the chat_template_jinja field. The
2674
+ # selected chat template will be saved to the tokenizer_config.json for easier
2675
+ # inferencing
2676
+ chat_template: ChatTemplate | Annotated[str, StringConstraints(pattern='^tokenizer_default_fallback_')] | None
2677
+ # Custom jinja template or path to jinja file for chat template. This will be only used
2678
+ # if chat_template is set to `jinja` or `null` (in which case chat_template is
2679
+ # automatically set to `jinja`). Default is null.
2680
+ chat_template_jinja: str | None
2681
+ # Additional kwargs to pass to the chat template. This is useful for customizing the
2682
+ # chat template. For example, you can pass `thinking=False` to add a generation prompt
2683
+ # to the chat template.
2684
+ chat_template_kwargs: dict[str, Any] | None
2685
+ # Custom EOT (End-of-Turn) tokens to mask/unmask during training. These tokens mark the
2686
+ # boundaries between conversation turns. For example: ['/INST', '</s>',
2687
+ # '[/SYSTEM_PROMPT]']. If not specified, defaults to just the model's eos_token. This is
2688
+ # useful for templates that use multiple delimiter tokens.
2689
+ eot_tokens: list[str] | None
2690
+ # Changes the default system message. Currently only supports chatml.
2691
+ default_system_message: str | None
2692
+
2693
+ # Token index or indices to adjust embedding weights to the mean of the other tokens.
2694
+ # This is useful when the model has untrained embeddings.
2695
+ fix_untrained_tokens: int | list[int] | None
2696
+
2697
+ is_preprocess: bool | None
2698
+ preprocess_iterable: bool | None
2699
+
2700
+ # Total number of tokens - internal use
2701
+ total_num_tokens: int | None
2702
+ total_supervised_tokens: int | None
2703
+ # You can set these packing optimizations AFTER starting a training at least once. The
2704
+ # trainer will provide recommended values for these values.
2705
+ sample_packing_eff_est: float | None
2706
+ axolotl_config_path: str | None
2707
+
2708
+ # Internal use only - Used to identify which the model is based on
2709
+ is_falcon_derived_model: bool | None
2710
+ # Internal use only - Used to identify which the model is based on
2711
+ is_llama_derived_model: bool | None
2712
+ # Internal use only - Used to identify which the model is based on. Please note that if
2713
+ # you set this to true, `padding_side` will be set to 'left' by default
2714
+ is_mistral_derived_model: bool | None
2715
+ # Internal use only - Used to identify which the model is based on
2716
+ is_qwen_derived_model: bool | None
2717
+
2718
+ # Add plugins to extend the pipeline. See `src/axolotl/integrations` for the available
2719
+ # plugins or doc below for more details.
2720
+ # https://docs.axolotl.ai/docs/custom_integrations.html
2721
+ plugins: list[str] | None
2722
+
2723
+ # This is the huggingface model that contains *.pt, *.safetensors, or *.bin files. This
2724
+ # can also be a relative path to a model on disk
2725
+ base_model: str (required)
2726
+ # If the base_model repo on hf hub doesn't include configuration .json files, You can
2727
+ # set that here, or leave this empty to default to base_model
2728
+ base_model_config: str | None
2729
+ cls_model_config: str | None
2730
+ # Optional tokenizer configuration path in case you want to use a different tokenizer
2731
+ # than the one defined in the base model
2732
+ tokenizer_config: str | None
2733
+ # use_fast option for tokenizer loading from_pretrained, default to True
2734
+ tokenizer_use_fast: bool | None
2735
+ # Whether to use the legacy tokenizer setting, defaults to True
2736
+ tokenizer_legacy: bool | None
2737
+ # Whether to use mistral-common tokenizer. If set to True, it will use the mistral-
2738
+ # common tokenizer.
2739
+ tokenizer_use_mistral_common: bool | None
2740
+ # Corresponding tokenizer for the model AutoTokenizer is a good choice
2741
+ tokenizer_type: str | None
2742
+ # transformers processor class
2743
+ processor_type: str | None
2744
+ # Whether to save jinja files for tokenizer, transformers default is True
2745
+ tokenizer_save_jinja_files: bool | None = True
2746
+ # Trust remote code for untrusted source
2747
+ trust_remote_code: bool | None
2748
+
2749
+ # Don't move the model to the device before sharding. Set to `false` to revert to legacy
2750
+ # behavior.
2751
+ experimental_skip_move_to_device: bool | None = True
2752
+
2753
+ # Use custom kernels, e.g. MegaBlocks.
2754
+ use_kernels: bool | None
2755
+
2756
+ # Model loading quantization config
2757
+ model_quantization_config: Literal['Mxfp4Config'] | None
2758
+ # kwargs for model quantization config
2759
+ model_quantization_config_kwargs: dict[str, Any] | None
2760
+
2761
+ # Where to save the full-finetuned model to
2762
+ output_dir: str = ./model-out
2763
+ # push checkpoints to hub
2764
+ hub_model_id: str | None
2765
+ # how to push checkpoints to hub
2766
+ hub_strategy: str | None
2767
+ # Save model as safetensors (require safetensors package). Default True
2768
+ save_safetensors: bool | None = True
2769
+
2770
+ # This will attempt to quantize the model down to 8 bits and use adam 8 bit optimizer
2771
+ load_in_8bit: bool | None = False
2772
+ # Use bitsandbytes 4 bit
2773
+ load_in_4bit: bool | None = False
2774
+
2775
+ # If you want to use 'lora' or 'qlora' or leave blank to train all parameters in
2776
+ # original model
2777
+ adapter: str | None
2778
+ # If you already have a lora model trained that you want to load, put that here. This
2779
+ # means after training, if you want to test the model, you should set this to the value
2780
+ # of `output_dir`. Note that if you merge an adapter to the base model, a new
2781
+ # subdirectory `merged` will be created under the `output_dir`.
2782
+ lora_model_dir: str | None
2783
+ lora_r: int | None
2784
+ lora_alpha: int | None
2785
+ lora_fan_in_fan_out: bool | None
2786
+ lora_target_modules: str | list[str] | None
2787
+ lora_target_parameters: str | list[str] | None
2788
+ # If true, will target all linear modules
2789
+ lora_target_linear: bool | None
2790
+ # If you added new tokens to the tokenizer, you may need to save some LoRA modules
2791
+ # because they need to know the new tokens. For LLaMA and Mistral, you need to save
2792
+ # `embed_tokens` and `lm_head`. It may vary for other models. `embed_tokens` converts
2793
+ # tokens to embeddings, and `lm_head` converts embeddings to token probabilities.
2794
+ lora_modules_to_save: list[str] | None
2795
+ lora_dropout: float | None = 0.0
2796
+ # The layer indices to transform, otherwise, apply to all layers
2797
+ peft_layers_to_transform: list[int] | None
2798
+ peft_layers_pattern: list[str] | None
2799
+
2800
+ peft: PeftConfig | None
2801
+ # For PeftConfig:
2802
+ # Configuration options for loftq initialization for LoRA
2803
+ loftq_config: LoftQConfig | None
2804
+ # For LoftQConfig:
2805
+ # typically 4 bits
2806
+ loftq_bits: int = 4
2807
+
2808
+ # Whether to use DoRA.
2809
+ peft_use_dora: bool | None
2810
+ # Whether to use RSLoRA.
2811
+ peft_use_rslora: bool | None
2812
+ # List of layer indices to replicate.
2813
+ peft_layer_replication: list[tuple[int, int]] | None
2814
+ # How to initialize LoRA weights. Default to True which is MS original implementation.
2815
+ peft_init_lora_weights: bool | str | None
2816
+ # A list of token indices to fine-tune on the `embed_tokens` layer. Otherwise, a dict
2817
+ # mapping an embedding layer name to its trainable token indices. See
2818
+ # https://huggingface.co/docs/peft/v0.17.0/en/developer_guides/lora#efficiently-train-
2819
+ # tokens-alongside-lora
2820
+ peft_trainable_token_indices: list[int] | dict[str, list[int]] | None
2821
+
2822
+ # load qlora model in sharded format for FSDP using answer.ai technique.
2823
+ qlora_sharded_model_loading: bool | None = False
2824
+ # Do the LoRA/PEFT loading on CPU -- this is required if the base model is so large it
2825
+ # takes up most or all of the available GPU VRAM, e.g. during a model and LoRA merge
2826
+ lora_on_cpu: bool | None
2827
+ # Whether you are training a 4-bit GPTQ quantized model
2828
+ gptq: bool | None
2829
+ # optional overrides to the bnb 4bit quantization configuration
2830
+ bnb_config_kwargs: dict[str, Any] | None
2831
+
2832
+ # loraplus learning rate ratio lr_B / lr_A. Recommended value is 2^4.
2833
+ loraplus_lr_ratio: float | None
2834
+ # loraplus learning rate for lora embedding layers. Default value is 1e-6.
2835
+ loraplus_lr_embedding: float | None = 1e-06
2836
+
2837
+ merge_lora: bool | None
2838
+
2839
+ # Whether to use ReLoRA. Use with jagged_restart_*steps options.
2840
+ relora: bool | None
2841
+ # threshold for optimizer magnitude when pruning
2842
+ relora_prune_ratio: float | None
2843
+ # True to perform lora weight merges on cpu during restarts, for modest gpu memory
2844
+ # savings
2845
+ relora_cpu_offload: bool | None
2846
+
2847
+ # how often to reset for jagged restarts
2848
+ jagged_restart_steps: int | None
2849
+ # how many warmup steps to take after reset for jagged restarts
2850
+ jagged_restart_warmup_steps: int | None
2851
+ # how many anneal steps to take before reset for jagged restarts
2852
+ jagged_restart_anneal_steps: int | None
2853
+
2854
+ # If greater than 1, backpropagation will be skipped and the gradients will be
2855
+ # accumulated for the given number of steps.
2856
+ gradient_accumulation_steps: int | None = 1
2857
+ # The number of samples to include in each batch. This is the number of samples sent to
2858
+ # each GPU. Batch size per gpu = micro_batch_size * gradient_accumulation_steps
2859
+ micro_batch_size: int | None = 1
2860
+ # Total batch size, we do not recommended setting this manually
2861
+ batch_size: int | None
2862
+ # per gpu micro batch size for evals, defaults to value of micro_batch_size
2863
+ eval_batch_size: int | None
2864
+
2865
+ # whether to find batch size that fits in memory. Passed to underlying transformers
2866
+ # Trainer
2867
+ auto_find_batch_size: bool | None
2868
+
2869
+ # Whether to mask out or include the human's prompt from the training labels
2870
+ train_on_inputs: bool | None = False
2871
+ # Group similarly sized data to minimize padding. May be slower to start, as it must
2872
+ # download and sort the entire dataset. Note that training loss may have an oscillating
2873
+ # pattern with this enabled.
2874
+ group_by_length: bool | None
2875
+
2876
+ learning_rate: str | float (required)
2877
+ embedding_lr: float | None
2878
+ embedding_lr_scale: float | None
2879
+ # Specify weight decay
2880
+ weight_decay: float | None = 0.0
2881
+ # Specify optimizer
2882
+ optimizer: OptimizerNames | CustomSupportedOptimizers | None = OptimizerNames.ADAMW_TORCH_FUSED
2883
+ # Dictionary of arguments to pass to the optimizer
2884
+ optim_args: str | dict[str, Any] | None
2885
+ # The target modules to optimize, i.e. the module names that you would like to train,
2886
+ # right now this is used only for GaLore algorithm
2887
+ optim_target_modules: list[str] | Literal['all_linear'] | None
2888
+ # Path to torch distx for optim 'adamw_anyprecision'
2889
+ torchdistx_path: str | None
2890
+ lr_scheduler: SchedulerType | Literal['one_cycle'] | Literal['rex'] | None = SchedulerType.COSINE
2891
+ # Specify a scheduler and kwargs to use with the optimizer
2892
+ lr_scheduler_kwargs: dict[str, Any] | None
2893
+ lr_quadratic_warmup: bool | None
2894
+ # decay lr to some percentage of the peak lr, e.g. cosine_min_lr_ratio=0.1 for 10% of
2895
+ # peak lr
2896
+ cosine_min_lr_ratio: float | None
2897
+ # freeze lr at some percentage of the step, e.g. cosine_constant_lr_ratio=0.8 means
2898
+ # start cosine_min_lr at 80% of training step
2899
+ cosine_constant_lr_ratio: float | None
2900
+ # Learning rate div factor
2901
+ lr_div_factor: float | None
2902
+
2903
+ lr_groups: list[LrGroup] | None
2904
+ # For LrGroup:
2905
+ name: str (required)
2906
+ modules: list[str] (required)
2907
+ lr: float (required)
2908
+
2909
+ # adamw hyperparams
2910
+ adam_epsilon: float | None
2911
+ # only used for CAME Optimizer
2912
+ adam_epsilon2: float | None
2913
+ # adamw hyperparams
2914
+ adam_beta1: float | None
2915
+ # adamw hyperparams
2916
+ adam_beta2: float | None
2917
+ # only used for CAME Optimizer
2918
+ adam_beta3: float | None
2919
+
2920
+ # Dion Optimizer learning rate
2921
+ dion_lr: float | None
2922
+ # Dion Optimizer momentum
2923
+ dion_momentum: float | None
2924
+ # Dion Optimizer: r/d fraction for low-rank approximation. Used to compute the low-rank
2925
+ # dimension.
2926
+ dion_rank_fraction: float | None = 1.0
2927
+ # Dion Optimizer: Round up the low-rank dimension to a multiple of this number. This may
2928
+ # be useful to ensure even sharding.
2929
+ dion_rank_multiple_of: int | None = 1
2930
+
2931
+ # Gradient clipping max norm
2932
+ max_grad_norm: float | None
2933
+ num_epochs: float = 1.0
2934
+
2935
+ use_wandb: bool | None
2936
+ # Set the name of your wandb run
2937
+ wandb_name: str | None
2938
+ # Set the ID of your wandb run
2939
+ wandb_run_id: str | None
2940
+ # "offline" to save run metadata locally and not sync to the server, "disabled" to turn
2941
+ # off wandb
2942
+ wandb_mode: str | None
2943
+ # Your wandb project name
2944
+ wandb_project: str | None
2945
+ # A wandb Team name if using a Team
2946
+ wandb_entity: str | None
2947
+ wandb_watch: str | None
2948
+ # "checkpoint" to log model to wandb Artifacts every `save_steps` or "end" to log only
2949
+ # at the end of training
2950
+ wandb_log_model: str | None
2951
+
2952
+ use_mlflow: bool | None
2953
+ # URI to mlflow
2954
+ mlflow_tracking_uri: str | None
2955
+ # Your experiment name
2956
+ mlflow_experiment_name: str | None
2957
+ # Your run name
2958
+ mlflow_run_name: str | None
2959
+ # set to true to copy each saved checkpoint on each save to mlflow artifact registry
2960
+ hf_mlflow_log_artifacts: bool | None
2961
+
2962
+ # Enable or disable Comet integration.
2963
+ use_comet: bool | None
2964
+ # API key for Comet. Recommended to set via `comet login`.
2965
+ comet_api_key: str | None
2966
+ # Workspace name in Comet. Defaults to the user's default workspace.
2967
+ comet_workspace: str | None
2968
+ # Project name in Comet. Defaults to Uncategorized.
2969
+ comet_project_name: str | None
2970
+ # Identifier for the experiment. Used to append data to an existing experiment or
2971
+ # control the key of new experiments. Default to a random key.
2972
+ comet_experiment_key: str | None
2973
+ # Create a new experiment ("create") or log to an existing one ("get"). Default
2974
+ # ("get_or_create") auto-selects based on configuration.
2975
+ comet_mode: str | None
2976
+ # Set to True to log data to Comet server, or False for offline storage. Default is
2977
+ # True.
2978
+ comet_online: bool | None
2979
+ # Dictionary for additional configuration settings, see the doc for more details.
2980
+ comet_experiment_config: dict[str, Any] | None
2981
+
2982
+ # Enable OpenTelemetry metrics collection and Prometheus export
2983
+ use_otel_metrics: bool | None = False
2984
+ # Host to bind the OpenTelemetry metrics server to
2985
+ otel_metrics_host: str | None = localhost
2986
+ # Port for the Prometheus metrics HTTP server
2987
+ otel_metrics_port: int | None = 8000
2988
+
2989
+ # the number of activate layers in LISA
2990
+ lisa_n_layers: int | None
2991
+ # how often to switch layers in LISA
2992
+ lisa_step_interval: int | None
2993
+ # path under the model to access the layers
2994
+ lisa_layers_attribute: str | None = model.layers
2995
+
2996
+ gradio_title: str | None
2997
+ gradio_share: bool | None
2998
+ gradio_server_name: str | None
2999
+ gradio_server_port: int | None
3000
+ gradio_max_new_tokens: int | None
3001
+ gradio_temperature: float | None
3002
+
3003
+ use_ray: bool = False
3004
+ ray_run_name: str | None
3005
+ ray_num_workers: int = 1
3006
+ resources_per_worker: dict
3007
+
3008
+ # The size of the image to resize to. It can be an integer (resized into padded-square
3009
+ # image) or a tuple (width, height).If not provided, we will attempt to load from
3010
+ # preprocessor.size, otherwise, images won't be resized.
3011
+ image_size: int | tuple[int, int] | None
3012
+ # The resampling algorithm to use for image resizing. Default is bilinear. Please refer
3013
+ # to PIL.Image.Resampling for more details.
3014
+ image_resize_algorithm: Literal['bilinear', 'bicubic', 'lanczos'] | Resampling | None
3015
+
3016
+ # optional overrides to the base model configuration
3017
+ overrides_of_model_config: dict[str, Any] | None
3018
+ # optional overrides the base model loading from_pretrained
3019
+ overrides_of_model_kwargs: dict[str, Any] | None
3020
+ # If you want to specify the type of model to load, AutoModelForCausalLM is a good
3021
+ # choice too
3022
+ type_of_model: str | None
3023
+ # You can specify to choose a specific model revision from huggingface hub
3024
+ revision_of_model: str | None
3025
+
3026
+ max_packed_sequence_len: int | None
3027
+ rope_scaling: Any | None
3028
+ noisy_embedding_alpha: float | None
3029
+ dpo_beta: float | None
3030
+ evaluation_strategy: str | None
3031
+ ```
3032
+
3033
+ ---
3034
+
3035
+ ##
3036
+
3037
+ **URL:** https://docs.axolotl.ai
3038
+
3039
+ **Contents:**
3040
+ - 🎉 Latest Updates
3041
+ - ✨ Overview
3042
+ - 🚀 Quick Start - LLM Fine-tuning in Minutes
3043
+ - Google Colab
3044
+ - Installation
3045
+ - Using pip
3046
+ - Using Docker
3047
+ - Cloud Providers
3048
+ - Your First Fine-tune
3049
+ - 📚 Documentation
3050
+
3051
+ A Free and Open Source LLM Fine-tuning Framework
3052
+
3053
+ Axolotl is a free and open-source tool designed to streamline post-training and fine-tuning for the latest large language models (LLMs).
3054
+
3055
+ Installing with Docker can be less error prone than installing in your own environment.
3056
+
3057
+ Other installation approaches are described here.
3058
+
3059
+ That’s it! Check out our Getting Started Guide for a more detailed walkthrough.
3060
+
3061
+ Contributions are welcome! Please see our Contributing Guide for details.
3062
+
3063
+ Interested in sponsoring? Contact us at [email protected]
3064
+
3065
+ If you use Axolotl in your research or projects, please cite it as follows:
3066
+
3067
+ This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
3068
+
3069
+ **Examples:**
3070
+
3071
+ Example 1 (bash):
3072
+ ```bash
3073
+ pip3 install -U packaging==23.2 setuptools==75.8.0 wheel ninja
3074
+ pip3 install --no-build-isolation axolotl[flash-attn,deepspeed]
3075
+
3076
+ # Download example axolotl configs, deepspeed configs
3077
+ axolotl fetch examples
3078
+ axolotl fetch deepspeed_configs # OPTIONAL
3079
+ ```
3080
+
3081
+ Example 2 (bash):
3082
+ ```bash
3083
+ docker run --gpus '"all"' --rm -it axolotlai/axolotl:main-latest
3084
+ ```
3085
+
3086
+ Example 3 (bash):
3087
+ ```bash
3088
+ # Fetch axolotl examples
3089
+ axolotl fetch examples
3090
+
3091
+ # Or, specify a custom path
3092
+ axolotl fetch examples --dest path/to/folder
3093
+
3094
+ # Train a model using LoRA
3095
+ axolotl train examples/llama-3/lora-1b.yml
3096
+ ```
3097
+
3098
+ Example 4 (unknown):
3099
+ ```unknown
3100
+ @software{axolotl,
3101
+ title = {Axolotl: Open Source LLM Post-Training},
3102
+ author = {{Axolotl maintainers and contributors}},
3103
+ url = {https://github.com/axolotl-ai-cloud/axolotl},
3104
+ license = {Apache-2.0},
3105
+ year = {2023}
3106
+ }
3107
+ ```
3108
+
3109
+ ---
3110
+
3111
+ ## Quickstart
3112
+
3113
+ **URL:** https://docs.axolotl.ai/docs/getting-started.html
3114
+
3115
+ **Contents:**
3116
+ - Quickstart
3117
+ - 1 Quick Example
3118
+ - 2 Understanding the Process
3119
+ - 2.1 The Configuration File
3120
+ - 2.2 Training
3121
+ - 3 Your First Custom Training
3122
+ - 4 Common Tasks
3123
+ - 4.1 Testing Your Model
3124
+ - 4.2 Using a UI
3125
+ - 4.3 Preprocessing Data
3126
+
3127
+ This guide will walk you through your first model fine-tuning project with Axolotl.
3128
+
3129
+ Let’s start by fine-tuning a small language model using LoRA. This example uses a 1B parameter model to ensure it runs on most GPUs. Assuming axolotl is installed (if not, see our Installation Guide)
3130
+
3131
+ That’s it! Let’s understand what just happened.
3132
+
3133
+ The YAML configuration file controls everything about your training. Here’s what (part of) our example config looks like:
3134
+
3135
+ load_in_8bit: true and adapter: lora enables LoRA adapter finetuning.
3136
+
3137
+ See our config options for more details.
3138
+
3139
+ When you run axolotl train, Axolotl:
3140
+
3141
+ Let’s modify the example for your own data:
3142
+
3143
+ This specific config is for LoRA fine-tuning a model with instruction tuning data using the alpaca dataset format, which has the following format:
3144
+
3145
+ Please see our Dataset Formats for more dataset formats and how to format them.
3146
+
3147
+ The same yaml file is used for training, inference, and merging.
3148
+
3149
+ After training, test your model:
3150
+
3151
+ More details can be found in Inference.
3152
+
3153
+ Launch a Gradio interface:
3154
+
3155
+ For large datasets, preprocess first:
3156
+
3157
+ Please make sure to set dataset_prepared_path: in your config to set the path to save the prepared dataset.
3158
+
3159
+ More details can be found in Dataset Preprocessing.
3160
+
3161
+ To merge the LoRA weights back into the base model, run:
3162
+
3163
+ The merged model will be saved in the {output_dir}/merged directory.
3164
+
3165
+ More details can be found in Merging LoRA weights.
3166
+
3167
+ Now that you have the basics, you might want to:
3168
+
3169
+ Check our other guides for details on these topics:
3170
+
3171
+ **Examples:**
3172
+
3173
+ Example 1 (bash):
3174
+ ```bash
3175
+ axolotl fetch examples
3176
+ ```
3177
+
3178
+ Example 2 (bash):
3179
+ ```bash
3180
+ axolotl train examples/llama-3/lora-1b.yml
3181
+ ```
3182
+
3183
+ Example 3 (yaml):
3184
+ ```yaml
3185
+ base_model: NousResearch/Llama-3.2-1B
3186
+
3187
+ load_in_8bit: true
3188
+ adapter: lora
3189
+
3190
+ datasets:
3191
+ - path: teknium/GPT4-LLM-Cleaned
3192
+ type: alpaca
3193
+ dataset_prepared_path: last_run_prepared
3194
+ val_set_size: 0.1
3195
+ output_dir: ./outputs/lora-out
3196
+ ```
3197
+
3198
+ Example 4 (yaml):
3199
+ ```yaml
3200
+ base_model: NousResearch/Nous-Hermes-llama-1b-v1
3201
+
3202
+ load_in_8bit: true
3203
+ adapter: lora
3204
+
3205
+ # Training settings
3206
+ micro_batch_size: 2
3207
+ num_epochs: 3
3208
+ learning_rate: 0.0003
3209
+
3210
+ # Your dataset
3211
+ datasets:
3212
+ - path: my_data.jsonl # Your local data file
3213
+ type: alpaca # Or other format
3214
+ ```
3215
+
3216
+ ---
3217
+
3218
+ ## Multipack (Sample Packing)
3219
+
3220
+ **URL:** https://docs.axolotl.ai/docs/multipack.html
3221
+
3222
+ **Contents:**
3223
+ - Multipack (Sample Packing)
3224
+ - Visualization of Multipack with Flash Attention
3225
+ - Multipack without Flash Attention
3226
+
3227
+ Because Flash Attention simply drops the attention mask, we do not need to construct a 4d attention mask. We only need to concatenate the sequences into a single batch and let flash attention know where each new sequence begins.
3228
+
3229
+ 4k context, bsz =4, each character represents 256 tokens X represents a padding token
3230
+
3231
+ after padding to longest input in each step
3232
+
3233
+ w packing ( note it’s the same effective number of tokens per step, but a true bsz of 1)
3234
+
3235
+ cu_seqlens: [[ 0, 11, 17, 24, 28, 36, 41 44, 48, 51, 55, 60, 64]]
3236
+
3237
+ Multipack can still be achieved without Flash attention, but with lower packing efficiency as we are not able to join multiple batches into a single batch due to context length limits without flash attention. We can use either Pytorch’s Scaled Dot Product Attention implementation or native Pytorch attention implementation along with 4d attention masks to pack sequences together and avoid cross attention.
3238
+
3239
+ **Examples:**
3240
+
3241
+ Example 1 (unknown):
3242
+ ```unknown
3243
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
3244
+ [[ A A A A A A A A A A A ]
3245
+ B B B B B B ]
3246
+ C C C C C C C ]
3247
+ D D D D ]]
3248
+
3249
+ [[ E E E E E E E E ]
3250
+ [ F F F F ]
3251
+ [ G G G ]
3252
+ [ H H H H ]]
3253
+
3254
+ [[ I I I ]
3255
+ [ J J J ]
3256
+ [ K K K K K]
3257
+ [ L L L ]]
3258
+ ```
3259
+
3260
+ Example 2 (unknown):
3261
+ ```unknown
3262
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
3263
+ [[ A A A A A A A A A A A ]
3264
+ B B B B B B X X X X X X ]
3265
+ C C C C C C C X X X X ]
3266
+ D D D D X X X X X X X ]]
3267
+
3268
+ [[ E E E E E E E E ]
3269
+ [ F F F F X X X X ]
3270
+ [ G G G X X X X X ]
3271
+ [ H H H H X X X X ]]
3272
+
3273
+ [[ I I I X X ]
3274
+ [ J J J X X ]
3275
+ [ K K K K K ]
3276
+ [ L L L X X ]]
3277
+ ```
3278
+
3279
+ Example 3 (unknown):
3280
+ ```unknown
3281
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
3282
+ [[ A A A A A A A A A A A B B B B B
3283
+ B C C C C C C C D D D D E E E E
3284
+ E E E E F F F F F G G G H H H H
3285
+ I I I J J J J K K K K K L L L X ]]
3286
+ ```
3287
+
3288
+ ---
3289
+
3290
+ ## Batch size vs Gradient accumulation
3291
+
3292
+ **URL:** https://docs.axolotl.ai/docs/batch_vs_grad.html
3293
+
3294
+ **Contents:**
3295
+ - Batch size vs Gradient accumulation
3296
+
3297
+ Gradient accumulation means accumulating gradients over several mini-batches and updating the model weights afterward. When the samples in each batch are diverse, this technique doesn’t significantly impact learning.
3298
+
3299
+ This method allows for effective training with larger effective batch sizes without needing proportionally larger memory. Here’s why:
3300
+
3301
+ Memory Consumption with Batch Size: The primary reason increasing the batch size impacts memory is due to the storage requirements for intermediate activations. When you forward propagate a batch through a network, you have to store the activations at each layer for each sample in the batch, because these activations are used during backpropagation to compute gradients. Therefore, larger batches mean more activations, leading to greater GPU memory consumption.
3302
+
3303
+ Gradient Accumulation: With gradient accumulation, you’re effectively simulating a larger batch size by accumulating gradients over several smaller batches (or micro-batches). However, at any given time, you’re only forward and backward propagating a micro-batch. This means you only store activations for the micro-batch, not the full accumulated batch. As a result, you can simulate the effect of a larger batch size without the memory cost of storing activations for a large batch.
3304
+
3305
+ Example 1: Micro batch size: 3 Gradient accumulation steps: 2 Number of GPUs: 3 Total batch size = 3 * 2 * 3 = 18
3306
+
3307
+ Example 2: Micro batch size: 2 Gradient accumulation steps: 1 Number of GPUs: 3 Total batch size = 2 * 1 * 3 = 6
3308
+
3309
+ **Examples:**
3310
+
3311
+ Example 1 (unknown):
3312
+ ```unknown
3313
+ | GPU 1 | GPU 2 | GPU 3 |
3314
+ |----------------|----------------|----------------|
3315
+ | S1, S2, S3 | S4, S5, S6 | S7, S8, S9 |
3316
+ | e1, e2, e3 | e4, e5, e6 | e7, e8, e9 |
3317
+ |----------------|----------------|----------------|
3318
+ | → (accumulate) | → (accumulate) | → (accumulate) |
3319
+ |----------------|----------------|----------------|
3320
+ | S10, S11, S12 | S13, S14, S15 | S16, S17, S18 |
3321
+ | e10, e11, e12 | e13, e14, e15 | e16, e17, e18 |
3322
+ |----------------|----------------|----------------|
3323
+ | → (apply) | → (apply) | → (apply) |
3324
+
3325
+ Accumulated gradient for the weight w1 after the second iteration (considering all GPUs):
3326
+ Total gradient for w1 = e1 + e2 + e3 + e4 + e5 + e6 + e7 + e8 + e9 + e10 + e11 + e12 + e13 + e14 + e15 + e16 + e17 + e18
3327
+
3328
+ Weight update for w1:
3329
+ w1_new = w1_old - learning rate x (Total gradient for w1 / 18)
3330
+ ```
3331
+
3332
+ Example 2 (unknown):
3333
+ ```unknown
3334
+ | GPU 1 | GPU 2 | GPU 3 |
3335
+ |-----------|-----------|-----------|
3336
+ | S1, S2 | S3, S4 | S5, S6 |
3337
+ | e1, e2 | e3, e4 | e5, e6 |
3338
+ |-----------|-----------|-----------|
3339
+ | → (apply) | → (apply) | → (apply) |
3340
+
3341
+ Accumulated gradient for the weight w1 (considering all GPUs):
3342
+ Total gradient for w1 = e1 + e2 + e3 + e4 + e5 + e6
3343
+
3344
+ Weight update for w1:
3345
+ w1_new = w1_old - learning rate × (Total gradient for w1 / 6)
3346
+ ```
3347
+
3348
+ ---
3349
+
3350
+ ## Debugging
3351
+
3352
+ **URL:** https://docs.axolotl.ai/docs/debugging.html
3353
+
3354
+ **Contents:**
3355
+ - Debugging
3356
+ - Table of Contents
3357
+ - General Tips
3358
+ - Debugging with VSCode
3359
+ - Background
3360
+ - Setup
3361
+ - Remote Hosts
3362
+ - Configuration
3363
+ - Customizing your debugger
3364
+ - Video Tutorial
3365
+
3366
+ This document provides some tips and tricks for debugging Axolotl. It also provides an example configuration for debugging with VSCode. A good debugging setup is essential to understanding how Axolotl code works behind the scenes.
3367
+
3368
+ While debugging it’s helpful to simplify your test scenario as much as possible. Here are some tips for doing so:
3369
+
3370
+ [!Important] All of these tips are incorporated into the example configuration for debugging with VSCode below.
3371
+
3372
+ Make sure you are using the latest version of axolotl: This project changes often and bugs get fixed fast. Check your git branch and make sure you have pulled the latest changes from main.
3373
+
3374
+ Eliminate concurrency: Restrict the number of processes to 1 for both training and data preprocessing:
3375
+
3376
+ Use a small dataset: Construct or use a small dataset from HF Hub. When using a small dataset, you will often have to make sure sample_packing: False and eval_sample_packing: False to avoid errors. If you are in a pinch and don’t have time to construct a small dataset but want to use from the HF Hub, you can shard the data (this will still tokenize the entire dataset, but will only use a fraction of the data for training. For example, to shard the dataset into 20 pieces, add the following to your axolotl config):
3377
+
3378
+ Use a small model: A good example of a small model is TinyLlama/TinyLlama-1.1B-Chat-v1.0.
3379
+
3380
+ Minimize iteration time: Make sure the training loop finishes as fast as possible, with these settings.
3381
+
3382
+ Clear Caches: Axolotl caches certain steps and so does the underlying HuggingFace trainer. You may want to clear some of these caches when debugging.
3383
+
3384
+ The below example shows how to configure VSCode to debug data preprocessing of the chat_template format. This is the format used when you have the following in your axolotl config:
3385
+
3386
+ [!Important] If you are already familiar with advanced VSCode debugging, you can skip the below explanation and look at the files .vscode/launch.json and .vscode/tasks.json for an example configuration.
3387
+
3388
+ [!Tip] If you prefer to watch a video, rather than read, you can skip to the video tutorial below (but doing both is recommended).
3389
+
3390
+ Make sure you have an editable install of Axolotl, which ensures that changes you make to the code are reflected at runtime. Run the following commands from the root of this project:
3391
+
3392
+ If you developing on a remote host, you can easily use VSCode to debug remotely. To do so, you will need to follow this remote - SSH guide. You can also see the video below on Docker and Remote SSH debugging.
3393
+
3394
+ The easiest way to get started is to modify the .vscode/launch.json file in this project. This is just an example configuration, so you may need to modify or copy it to suit your needs.
3395
+
3396
+ For example, to mimic the command cd devtools && CUDA_VISIBLE_DEVICES=0 accelerate launch -m axolotl.cli.train dev_chat_template.yml, you would use the below configuration1. Note that we add additional flags that override the axolotl config and incorporate the tips above (see the comments). We also set the working directory to devtools and set the env variable HF_HOME to a temporary folder that is later partially deleted. This is because we want to delete the HF dataset cache before each run in order to ensure that the data preprocessing code is run from scratch.
3397
+
3398
+ Additional notes about this configuration:
3399
+
3400
+ [!Tip] You may not want to delete these folders. For example, if you are debugging model training instead of data pre-processing, you may NOT want to delete the cache or output folders. You may also need to add additional tasks to the tasks.json file depending on your use case.
3401
+
3402
+ Below is the ./vscode/tasks.json file that defines the cleanup-for-dataprep task. This task is run before each debugging session when you use the above configuration. Note how there are two tasks that delete the two folders mentioned above. The third task cleanup-for-dataprep is a composite task that combines the two tasks. A composite task is necessary because VSCode does not allow you to specify multiple tasks in the preLaunchTask argument of the launch.json file.
3403
+
3404
+ Your debugging use case may differ from the example above. The easiest thing to do is to put your own axolotl config in the devtools folder and modify the launch.json file to use your config. You may also want to modify the preLaunchTask to delete different folders or not delete anything at all.
3405
+
3406
+ The following video tutorial walks through the above configuration and demonstrates how to debug with VSCode, (click the image below to watch):
3407
+
3408
+ Using official Axolotl Docker images is a great way to debug your code, and is a very popular way to use Axolotl. Attaching VSCode to Docker takes a few more steps.
3409
+
3410
+ On the host that is running axolotl (ex: if you are using a remote host), clone the axolotl repo and change your current directory to the root:
3411
+
3412
+ [!Tip] If you already have axolotl cloned on your host, make sure you have the latest changes and change into the root of the project.
3413
+
3414
+ Next, run the desired docker image and mount the current directory. Below is a docker command you can run to do this:2
3415
+
3416
+ [!Tip] To understand which containers are available, see the Docker section of the README and the DockerHub repo. For details of how the Docker containers are built, see axolotl’s Docker CI builds.
3417
+
3418
+ You will now be in the container. Next, perform an editable install of Axolotl:
3419
+
3420
+ Next, if you are using a remote host, Remote into this host with VSCode. If you are using a local host, you can skip this step.
3421
+
3422
+ Next, select Dev Containers: Attach to Running Container... using the command palette (CMD + SHIFT + P) in VSCode. You will be prompted to select a container to attach to. Select the container you just created. You will now be in the container with a working directory that is at the root of the project. Any changes you make to the code will be reflected both in the container and on the host.
3423
+
3424
+ Now you are ready to debug as described above (see Debugging with VSCode).
3425
+
3426
+ Here is a short video that demonstrates how to attach to a Docker container on a remote host:
3427
+
3428
+ The config actually mimics the command CUDA_VISIBLE_DEVICES=0 python -m accelerate.commands.launch -m axolotl.cli.train devtools/chat_template.yml, but this is the same thing.↩︎
3429
+
3430
+ Many of the below flags are recommended best practices by Nvidia when using nvidia-container-toolkit. You can read more about these flags here.↩︎
3431
+
3432
+ **Examples:**
3433
+
3434
+ Example 1 (yaml):
3435
+ ```yaml
3436
+ datasets:
3437
+ ...
3438
+ shards: 20
3439
+ ```
3440
+
3441
+ Example 2 (yaml):
3442
+ ```yaml
3443
+ datasets:
3444
+ - path: <path to your chat_template formatted dataset> # example on HF Hub: fozziethebeat/alpaca_messages_2k_test
3445
+ type: chat_template
3446
+ ```
3447
+
3448
+ Example 3 (bash):
3449
+ ```bash
3450
+ pip3 install packaging
3451
+ pip3 install --no-build-isolation -e '.[flash-attn,deepspeed]'
3452
+ ```
3453
+
3454
+ Example 4 (json):
3455
+ ```json
3456
+ // .vscode/launch.json
3457
+ {
3458
+ "version": "0.2.0",
3459
+ "configurations": [
3460
+ {
3461
+ "name": "Debug axolotl prompt - chat_template",
3462
+ "type": "python",
3463
+ "module": "accelerate.commands.launch",
3464
+ "request": "launch",
3465
+ "args": [
3466
+ "-m", "axolotl.cli.train", "dev_chat_template.yml",
3467
+ // The flags below simplify debugging by overriding the axolotl config
3468
+ // with the debugging tips above. Modify as needed.
3469
+ "--dataset_num_proc=1", // limits data preprocessing to one process
3470
+ "--max_steps=1", // limits training to just one step
3471
+ "--batch_size=1", // minimizes batch size
3472
+ "--micro_batch_size=1", // minimizes batch size
3473
+ "--val_set_size=0", // disables validation
3474
+ "--sample_packing=False", // disables sample packing which is necessary for small datasets
3475
+ "--eval_sample_packing=False",// disables sample packing on eval set
3476
+ "--dataset_prepared_path=temp_debug/axolotl_outputs/data", // send data outputs to a temp folder
3477
+ "--output_dir=temp_debug/axolotl_outputs/model" // send model outputs to a temp folder
3478
+ ],
3479
+ "console": "integratedTerminal", // show output in the integrated terminal
3480
+ "cwd": "${workspaceFolder}/devtools", // set working directory to devtools from the root of the project
3481
+ "justMyCode": true, // step through only axolotl code
3482
+ "env": {"CUDA_VISIBLE_DEVICES": "0", // Since we aren't doing distributed training, we need to limit to one GPU
3483
+ "HF_HOME": "${workspaceFolder}/devtools/temp_debug/.hf-cache"}, // send HF cache to a temp folder
3484
+ "preLaunchTask": "cleanup-for-dataprep", // delete temp folders (see below)
3485
+ }
3486
+ ]
3487
+ }
3488
+ ```
3489
+
3490
+ ---
3491
+
3492
+ ## Docker
3493
+
3494
+ **URL:** https://docs.axolotl.ai/docs/docker.html
3495
+
3496
+ **Contents:**
3497
+ - Docker
3498
+ - Base
3499
+ - Image
3500
+ - Tags format
3501
+ - Main
3502
+ - Image
3503
+ - Tags format
3504
+ - Cloud
3505
+ - Image
3506
+ - Tags format
3507
+
3508
+ This section describes the different Docker images that are released by AxolotlAI at Docker Hub.
3509
+
3510
+ For Blackwell GPUs, please use the tags with PyTorch 2.7.1 and CUDA 12.8.
3511
+
3512
+ The base image is the most minimal image that can install Axolotl. It is based on the nvidia/cuda image. It includes python, torch, git, git-lfs, awscli, pydantic, and more.
3513
+
3514
+ The main image is the image that is used to run Axolotl. It is based on the axolotlai/axolotl-base image and includes the Axolotl codebase, dependencies, and more.
3515
+
3516
+ There may be some extra tags appended to the image, like -vllm which installs those packages.
3517
+
3518
+ The cloud image is the image that is used to run Axolotl in the cloud. It is based on the axolotlai/axolotl image and sets ENV variables like HuggingFace cache directories for volume mounts, tmux, and more for different cloud providers.
3519
+
3520
+ Jupyter lab is run by default. Set JUPYTER_DISABLE=1 in the environment variables to disable it.
3521
+
3522
+ This uses the same tags as the main image.
3523
+
3524
+ We recommend mounting volumes to /workspace/data for data persistence. /workspace/axolotl contains the source code and is ephemeral.
3525
+
3526
+ This is the same as the cloud image but without tmux.
3527
+
3528
+ The naming may be a bit confusing as it has -term appended to the end.
3529
+
3530
+ This uses the same tags as the cloud image.
3531
+
3532
+ **Examples:**
3533
+
3534
+ Example 1 (unknown):
3535
+ ```unknown
3536
+ axolotlai/axolotl-base
3537
+ ```
3538
+
3539
+ Example 2 (bash):
3540
+ ```bash
3541
+ main-base-py{python_version}-cu{cuda_version}-{pytorch_version}
3542
+ ```
3543
+
3544
+ Example 3 (unknown):
3545
+ ```unknown
3546
+ axolotlai/axolotl
3547
+ ```
3548
+
3549
+ Example 4 (bash):
3550
+ ```bash
3551
+ # on push to main
3552
+ main-py{python_version}-cu{cuda_version}-{pytorch_version}
3553
+
3554
+ # latest main (currently torch 2.6.0, python 3.11, cuda 12.4)
3555
+ main-latest
3556
+
3557
+ # nightly build
3558
+ {branch}-{date_in_YYYYMMDD}-py{python_version}-cu{cuda_version}-{pytorch_version}
3559
+
3560
+ # tagged release
3561
+ {version}
3562
+ ```
3563
+
3564
+ ---