palingenesis 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (502) hide show
  1. palingenesis-0.3.0/.gitignore +40 -0
  2. palingenesis-0.3.0/LICENSE +202 -0
  3. palingenesis-0.3.0/PKG-INFO +199 -0
  4. palingenesis-0.3.0/README.md +109 -0
  5. palingenesis-0.3.0/configs/agentic_traces.yaml +68 -0
  6. palingenesis-0.3.0/configs/distill_agent_traces.yaml +60 -0
  7. palingenesis-0.3.0/configs/distill_chat.yaml +53 -0
  8. palingenesis-0.3.0/configs/distill_math.yaml +44 -0
  9. palingenesis-0.3.0/configs/distill_multi.yaml +55 -0
  10. palingenesis-0.3.0/configs/distill_opd.yaml +87 -0
  11. palingenesis-0.3.0/configs/distill_qwen35.yaml +46 -0
  12. palingenesis-0.3.0/configs/distill_xtok.yaml +48 -0
  13. palingenesis-0.3.0/configs/dpo_qwen35_08b.yaml +69 -0
  14. palingenesis-0.3.0/configs/eval/bbh.yaml +26 -0
  15. palingenesis-0.3.0/configs/eval/belebele_it.yaml +25 -0
  16. palingenesis-0.3.0/configs/eval/bfcl_simple.yaml +20 -0
  17. palingenesis-0.3.0/configs/eval/gpqa_diamond.yaml +24 -0
  18. palingenesis-0.3.0/configs/eval/gsm8k.yaml +17 -0
  19. palingenesis-0.3.0/configs/eval/humaneval.yaml +20 -0
  20. palingenesis-0.3.0/configs/eval/ifeval.yaml +14 -0
  21. palingenesis-0.3.0/configs/eval/math500.yaml +16 -0
  22. palingenesis-0.3.0/configs/eval/mbpp.yaml +20 -0
  23. palingenesis-0.3.0/configs/eval/mmlu.yaml +27 -0
  24. palingenesis-0.3.0/configs/eval/mmlu_pro.yaml +18 -0
  25. palingenesis-0.3.0/configs/eval/mmlu_pro_mc.yaml +20 -0
  26. palingenesis-0.3.0/configs/eval/mmmlu_it.yaml +22 -0
  27. palingenesis-0.3.0/configs/eval/suites/core.yaml +18 -0
  28. palingenesis-0.3.0/configs/eval/suites/loglikelihood.yaml +5 -0
  29. palingenesis-0.3.0/configs/eval/suites/multilingual.yaml +5 -0
  30. palingenesis-0.3.0/configs/eval/suites/quick.yaml +7 -0
  31. palingenesis-0.3.0/configs/gemma4_12b.yaml +95 -0
  32. palingenesis-0.3.0/configs/gemma4_e2b.yaml +121 -0
  33. palingenesis-0.3.0/configs/gemma4_e4b.yaml +93 -0
  34. palingenesis-0.3.0/configs/llama3_8b.yaml +56 -0
  35. palingenesis-0.3.0/configs/long_context.yaml +65 -0
  36. palingenesis-0.3.0/configs/mixed_data.yaml +85 -0
  37. palingenesis-0.3.0/configs/qat_nvfp4_qwen35_08b.yaml +64 -0
  38. palingenesis-0.3.0/configs/quickstart.yaml +54 -0
  39. palingenesis-0.3.0/configs/qwen35_08b/a100_40gb.yaml +62 -0
  40. palingenesis-0.3.0/configs/qwen35_08b/a100_80gb.yaml +76 -0
  41. palingenesis-0.3.0/configs/qwen35_08b.yaml +97 -0
  42. palingenesis-0.3.0/configs/qwen35_35b_moe/a100_80gb.yaml +78 -0
  43. palingenesis-0.3.0/configs/qwen35_35b_moe/a100_80gb_multigpu.yaml +84 -0
  44. palingenesis-0.3.0/configs/qwen35_35b_moe/b200.yaml +70 -0
  45. palingenesis-0.3.0/configs/qwen35_35b_moe/h100_multigpu.yaml +75 -0
  46. palingenesis-0.3.0/configs/qwen35_35b_moe.yaml +102 -0
  47. palingenesis-0.3.0/configs/qwen35_4b/a100_40gb.yaml +73 -0
  48. palingenesis-0.3.0/configs/qwen35_4b/a100_80gb.yaml +105 -0
  49. palingenesis-0.3.0/configs/qwen35_4b/a100_80gb_largescale.yaml +84 -0
  50. palingenesis-0.3.0/configs/qwen35_4b/a100_80gb_multidataset.yaml +96 -0
  51. palingenesis-0.3.0/configs/qwen35_4b/a100_80gb_multigpu.yaml +84 -0
  52. palingenesis-0.3.0/configs/qwen35_4b/a100_80gb_test.yaml +164 -0
  53. palingenesis-0.3.0/configs/qwen35_4b/b200.yaml +79 -0
  54. palingenesis-0.3.0/configs/qwen35_4b/h100_80gb.yaml +83 -0
  55. palingenesis-0.3.0/configs/qwen35_4b/h100_multigpu.yaml +84 -0
  56. palingenesis-0.3.0/configs/qwen35_4b.yaml +118 -0
  57. palingenesis-0.3.0/configs/qwen3_08b.yaml +105 -0
  58. palingenesis-0.3.0/configs/qwen3_4b.yaml +0 -0
  59. palingenesis-0.3.0/configs/rl_agentic_math.yaml +81 -0
  60. palingenesis-0.3.0/configs/rl_code.yaml +46 -0
  61. palingenesis-0.3.0/configs/rl_harbor.yaml +44 -0
  62. palingenesis-0.3.0/configs/rl_harbor_steps.yaml +59 -0
  63. palingenesis-0.3.0/configs/rl_math.yaml +36 -0
  64. palingenesis-0.3.0/configs/rl_scenario_checked_answer.yaml +57 -0
  65. palingenesis-0.3.0/configs/rl_scenario_cluster.yaml +72 -0
  66. palingenesis-0.3.0/configs/rl_scenario_handoff.yaml +57 -0
  67. palingenesis-0.3.0/configs/rl_scenario_lead_workers.yaml +57 -0
  68. palingenesis-0.3.0/configs/rl_scenario_ledger_sum.yaml +51 -0
  69. palingenesis-0.3.0/configs/rl_scenario_plan_execute.yaml +62 -0
  70. palingenesis-0.3.0/configs/rl_scenario_solve_check.yaml +59 -0
  71. palingenesis-0.3.0/configs/rl_scenario_take_away.yaml +52 -0
  72. palingenesis-0.3.0/configs/rl_tools.yaml +45 -0
  73. palingenesis-0.3.0/configs/sft_agent_traces.yaml +45 -0
  74. palingenesis-0.3.0/configs/single_gpu.yaml +64 -0
  75. palingenesis-0.3.0/configs/ternary_qat_qwen35_08b.yaml +58 -0
  76. palingenesis-0.3.0/pyproject.toml +196 -0
  77. palingenesis-0.3.0/src/palingenesis/__init__.py +14 -0
  78. palingenesis-0.3.0/src/palingenesis/__main__.py +6 -0
  79. palingenesis-0.3.0/src/palingenesis/accelerator.py +479 -0
  80. palingenesis-0.3.0/src/palingenesis/actgra.py +569 -0
  81. palingenesis-0.3.0/src/palingenesis/activation_offload.py +526 -0
  82. palingenesis-0.3.0/src/palingenesis/agent_tooling/__init__.py +15 -0
  83. palingenesis-0.3.0/src/palingenesis/agent_tooling/__main__.py +68 -0
  84. palingenesis-0.3.0/src/palingenesis/agent_tooling/_logparse.py +75 -0
  85. palingenesis-0.3.0/src/palingenesis/agent_tooling/_pipeline.py +90 -0
  86. palingenesis-0.3.0/src/palingenesis/agent_tooling/audit.py +145 -0
  87. palingenesis-0.3.0/src/palingenesis/agent_tooling/check_gradients.py +235 -0
  88. palingenesis-0.3.0/src/palingenesis/agent_tooling/check_loss.py +289 -0
  89. palingenesis-0.3.0/src/palingenesis/agent_tooling/compare.py +242 -0
  90. palingenesis-0.3.0/src/palingenesis/agent_tooling/diagnose.py +238 -0
  91. palingenesis-0.3.0/src/palingenesis/agent_tooling/fit_memory.py +287 -0
  92. palingenesis-0.3.0/src/palingenesis/agent_tooling/inspect_batch.py +152 -0
  93. palingenesis-0.3.0/src/palingenesis/agent_tooling/monitor_run.py +239 -0
  94. palingenesis-0.3.0/src/palingenesis/agent_tooling/profile_memory.py +510 -0
  95. palingenesis-0.3.0/src/palingenesis/agent_tooling/rollouts.py +345 -0
  96. palingenesis-0.3.0/src/palingenesis/agent_tooling/validate_masking.py +161 -0
  97. palingenesis-0.3.0/src/palingenesis/audit/__init__.py +64 -0
  98. palingenesis-0.3.0/src/palingenesis/audit/core.py +235 -0
  99. palingenesis-0.3.0/src/palingenesis/audit/harbor.py +469 -0
  100. palingenesis-0.3.0/src/palingenesis/audit/hypotheses.py +589 -0
  101. palingenesis-0.3.0/src/palingenesis/audit/live.py +88 -0
  102. palingenesis-0.3.0/src/palingenesis/audit/packet.py +185 -0
  103. palingenesis-0.3.0/src/palingenesis/audit/registry.py +116 -0
  104. palingenesis-0.3.0/src/palingenesis/audit/render.py +181 -0
  105. palingenesis-0.3.0/src/palingenesis/audit/report.py +100 -0
  106. palingenesis-0.3.0/src/palingenesis/audit/selectors.py +565 -0
  107. palingenesis-0.3.0/src/palingenesis/audit/signals.py +555 -0
  108. palingenesis-0.3.0/src/palingenesis/audit/sources.py +245 -0
  109. palingenesis-0.3.0/src/palingenesis/audit/trends.py +341 -0
  110. palingenesis-0.3.0/src/palingenesis/audit/view.py +422 -0
  111. palingenesis-0.3.0/src/palingenesis/audit/wandb_export.py +99 -0
  112. palingenesis-0.3.0/src/palingenesis/autopilot/__init__.py +16 -0
  113. palingenesis-0.3.0/src/palingenesis/autopilot/ablate.py +231 -0
  114. palingenesis-0.3.0/src/palingenesis/autopilot/adaptive_sweep.py +629 -0
  115. palingenesis-0.3.0/src/palingenesis/autopilot/evaluate.py +92 -0
  116. palingenesis-0.3.0/src/palingenesis/autopilot/monitor.py +171 -0
  117. palingenesis-0.3.0/src/palingenesis/autopilot/profile.py +225 -0
  118. palingenesis-0.3.0/src/palingenesis/autopilot/run.py +592 -0
  119. palingenesis-0.3.0/src/palingenesis/autopilot/sweep.py +246 -0
  120. palingenesis-0.3.0/src/palingenesis/bf16_adamw.py +457 -0
  121. palingenesis-0.3.0/src/palingenesis/checkpoint.py +912 -0
  122. palingenesis-0.3.0/src/palingenesis/cli.py +496 -0
  123. palingenesis-0.3.0/src/palingenesis/cmr.py +218 -0
  124. palingenesis-0.3.0/src/palingenesis/compat.py +86 -0
  125. palingenesis-0.3.0/src/palingenesis/config.py +1641 -0
  126. palingenesis-0.3.0/src/palingenesis/context_parallel.py +755 -0
  127. palingenesis-0.3.0/src/palingenesis/data.py +3331 -0
  128. palingenesis-0.3.0/src/palingenesis/data_clean.py +449 -0
  129. palingenesis-0.3.0/src/palingenesis/data_size.py +704 -0
  130. palingenesis-0.3.0/src/palingenesis/distill/__init__.py +34 -0
  131. palingenesis-0.3.0/src/palingenesis/distill/build.py +455 -0
  132. palingenesis-0.3.0/src/palingenesis/distill/cache.py +388 -0
  133. palingenesis-0.3.0/src/palingenesis/distill/chunked.py +93 -0
  134. palingenesis-0.3.0/src/palingenesis/distill/config.py +295 -0
  135. palingenesis-0.3.0/src/palingenesis/distill/distiller.py +702 -0
  136. palingenesis-0.3.0/src/palingenesis/distill/features.py +120 -0
  137. palingenesis-0.3.0/src/palingenesis/distill/losses.py +161 -0
  138. palingenesis-0.3.0/src/palingenesis/distill/teachers.py +154 -0
  139. palingenesis-0.3.0/src/palingenesis/distill/views.py +142 -0
  140. palingenesis-0.3.0/src/palingenesis/distributed.py +428 -0
  141. palingenesis-0.3.0/src/palingenesis/dpo.py +898 -0
  142. palingenesis-0.3.0/src/palingenesis/eval/__init__.py +48 -0
  143. palingenesis-0.3.0/src/palingenesis/eval/async_eval.py +447 -0
  144. palingenesis-0.3.0/src/palingenesis/eval/cli.py +344 -0
  145. palingenesis-0.3.0/src/palingenesis/eval/config.py +754 -0
  146. palingenesis-0.3.0/src/palingenesis/eval/conformance.py +156 -0
  147. palingenesis-0.3.0/src/palingenesis/eval/contamination.py +120 -0
  148. palingenesis-0.3.0/src/palingenesis/eval/direct.py +644 -0
  149. palingenesis-0.3.0/src/palingenesis/eval/engines.py +314 -0
  150. palingenesis-0.3.0/src/palingenesis/eval/handoff.py +121 -0
  151. palingenesis-0.3.0/src/palingenesis/eval/ifeval.py +395 -0
  152. palingenesis-0.3.0/src/palingenesis/eval/lmeval.py +454 -0
  153. palingenesis-0.3.0/src/palingenesis/eval/loglikelihood.py +207 -0
  154. palingenesis-0.3.0/src/palingenesis/eval/placement.py +214 -0
  155. palingenesis-0.3.0/src/palingenesis/eval/push.py +528 -0
  156. palingenesis-0.3.0/src/palingenesis/eval/report.py +160 -0
  157. palingenesis-0.3.0/src/palingenesis/eval/runner.py +800 -0
  158. palingenesis-0.3.0/src/palingenesis/eval/scorers.py +571 -0
  159. palingenesis-0.3.0/src/palingenesis/eval/service.py +617 -0
  160. palingenesis-0.3.0/src/palingenesis/eval/tasks.py +411 -0
  161. palingenesis-0.3.0/src/palingenesis/eval/training.py +154 -0
  162. palingenesis-0.3.0/src/palingenesis/evalstats.py +275 -0
  163. palingenesis-0.3.0/src/palingenesis/examples/__init__.py +60 -0
  164. palingenesis-0.3.0/src/palingenesis/examples/distill.yaml +44 -0
  165. palingenesis-0.3.0/src/palingenesis/examples/dpo.yaml +69 -0
  166. palingenesis-0.3.0/src/palingenesis/examples/kd.yaml +48 -0
  167. palingenesis-0.3.0/src/palingenesis/examples/lora.yaml +60 -0
  168. palingenesis-0.3.0/src/palingenesis/examples/rl.yaml +36 -0
  169. palingenesis-0.3.0/src/palingenesis/examples/sft.yaml +54 -0
  170. palingenesis-0.3.0/src/palingenesis/float8.py +78 -0
  171. palingenesis-0.3.0/src/palingenesis/fused_optim.py +652 -0
  172. palingenesis-0.3.0/src/palingenesis/health.py +626 -0
  173. palingenesis-0.3.0/src/palingenesis/hf_configs.py +41 -0
  174. palingenesis-0.3.0/src/palingenesis/hooks.py +767 -0
  175. palingenesis-0.3.0/src/palingenesis/internals/__init__.py +62 -0
  176. palingenesis-0.3.0/src/palingenesis/internals/capture.py +316 -0
  177. palingenesis-0.3.0/src/palingenesis/internals/causal.py +250 -0
  178. palingenesis-0.3.0/src/palingenesis/internals/cli.py +451 -0
  179. palingenesis-0.3.0/src/palingenesis/internals/config.py +159 -0
  180. palingenesis-0.3.0/src/palingenesis/internals/hooks.py +273 -0
  181. palingenesis-0.3.0/src/palingenesis/internals/lens.py +284 -0
  182. palingenesis-0.3.0/src/palingenesis/internals/positions.py +181 -0
  183. palingenesis-0.3.0/src/palingenesis/internals/probes.py +453 -0
  184. palingenesis-0.3.0/src/palingenesis/internals/run.py +141 -0
  185. palingenesis-0.3.0/src/palingenesis/internals/score.py +236 -0
  186. palingenesis-0.3.0/src/palingenesis/internals/similarity.py +135 -0
  187. palingenesis-0.3.0/src/palingenesis/internals/sites.py +127 -0
  188. palingenesis-0.3.0/src/palingenesis/internals/stats.py +141 -0
  189. palingenesis-0.3.0/src/palingenesis/kernels.py +251 -0
  190. palingenesis-0.3.0/src/palingenesis/logging.py +338 -0
  191. palingenesis-0.3.0/src/palingenesis/logits.py +227 -0
  192. palingenesis-0.3.0/src/palingenesis/lora.py +636 -0
  193. palingenesis-0.3.0/src/palingenesis/loss.py +330 -0
  194. palingenesis-0.3.0/src/palingenesis/margins.py +126 -0
  195. palingenesis-0.3.0/src/palingenesis/memory.py +434 -0
  196. palingenesis-0.3.0/src/palingenesis/merge.py +760 -0
  197. palingenesis-0.3.0/src/palingenesis/model_init.py +99 -0
  198. palingenesis-0.3.0/src/palingenesis/moe.py +879 -0
  199. palingenesis-0.3.0/src/palingenesis/moe_experts.py +371 -0
  200. palingenesis-0.3.0/src/palingenesis/msft.py +287 -0
  201. palingenesis-0.3.0/src/palingenesis/multi_eval.py +299 -0
  202. palingenesis-0.3.0/src/palingenesis/multimodal.py +598 -0
  203. palingenesis-0.3.0/src/palingenesis/muon.py +447 -0
  204. palingenesis-0.3.0/src/palingenesis/opd/__init__.py +52 -0
  205. palingenesis-0.3.0/src/palingenesis/opd/align.py +282 -0
  206. palingenesis-0.3.0/src/palingenesis/opd/config.py +949 -0
  207. palingenesis-0.3.0/src/palingenesis/opd/formatting.py +243 -0
  208. palingenesis-0.3.0/src/palingenesis/opd/fused_rkl.py +370 -0
  209. palingenesis-0.3.0/src/palingenesis/opd/losses.py +456 -0
  210. palingenesis-0.3.0/src/palingenesis/opd/orchestrator.py +360 -0
  211. palingenesis-0.3.0/src/palingenesis/opd/packing.py +98 -0
  212. palingenesis-0.3.0/src/palingenesis/opd/pool.py +104 -0
  213. palingenesis-0.3.0/src/palingenesis/opd/rollout.py +1127 -0
  214. palingenesis-0.3.0/src/palingenesis/opd/score_pool.py +165 -0
  215. palingenesis-0.3.0/src/palingenesis/opd/sglang_rollout.py +1620 -0
  216. palingenesis-0.3.0/src/palingenesis/opd/sources.py +405 -0
  217. palingenesis-0.3.0/src/palingenesis/opd/teachers.py +307 -0
  218. palingenesis-0.3.0/src/palingenesis/opd/token_bridge.py +150 -0
  219. palingenesis-0.3.0/src/palingenesis/opd/trace_trainer.py +892 -0
  220. palingenesis-0.3.0/src/palingenesis/opd/traces.py +734 -0
  221. palingenesis-0.3.0/src/palingenesis/opd/trainer.py +1297 -0
  222. palingenesis-0.3.0/src/palingenesis/optim.py +958 -0
  223. palingenesis-0.3.0/src/palingenesis/packing.py +130 -0
  224. palingenesis-0.3.0/src/palingenesis/pairs.py +330 -0
  225. palingenesis-0.3.0/src/palingenesis/parallel_dims.py +114 -0
  226. palingenesis-0.3.0/src/palingenesis/perf.py +784 -0
  227. palingenesis-0.3.0/src/palingenesis/pipeline_parallel.py +548 -0
  228. palingenesis-0.3.0/src/palingenesis/plugins.py +814 -0
  229. palingenesis-0.3.0/src/palingenesis/precision.py +269 -0
  230. palingenesis-0.3.0/src/palingenesis/prepare.py +1602 -0
  231. palingenesis-0.3.0/src/palingenesis/privileged.py +86 -0
  232. palingenesis-0.3.0/src/palingenesis/qat/__init__.py +748 -0
  233. palingenesis-0.3.0/src/palingenesis/qat/compressed.py +366 -0
  234. palingenesis-0.3.0/src/palingenesis/qat/formats.py +396 -0
  235. palingenesis-0.3.0/src/palingenesis/qat/fp.py +857 -0
  236. palingenesis-0.3.0/src/palingenesis/qat/merge.py +304 -0
  237. palingenesis-0.3.0/src/palingenesis/qat/ternary.py +249 -0
  238. palingenesis-0.3.0/src/palingenesis/rl/__init__.py +43 -0
  239. palingenesis-0.3.0/src/palingenesis/rl/adapters.py +429 -0
  240. palingenesis-0.3.0/src/palingenesis/rl/catalog/__init__.py +48 -0
  241. palingenesis-0.3.0/src/palingenesis/rl/catalog/adapters.py +303 -0
  242. palingenesis-0.3.0/src/palingenesis/rl/catalog/audit.py +271 -0
  243. palingenesis-0.3.0/src/palingenesis/rl/catalog/cli.py +573 -0
  244. palingenesis-0.3.0/src/palingenesis/rl/catalog/envs/__init__.py +1 -0
  245. palingenesis-0.3.0/src/palingenesis/rl/catalog/envs/code.py +765 -0
  246. palingenesis-0.3.0/src/palingenesis/rl/catalog/envs/extraction.py +432 -0
  247. palingenesis-0.3.0/src/palingenesis/rl/catalog/envs/function_call.py +417 -0
  248. palingenesis-0.3.0/src/palingenesis/rl/catalog/envs/games.py +317 -0
  249. palingenesis-0.3.0/src/palingenesis/rl/catalog/envs/harbor.py +137 -0
  250. palingenesis-0.3.0/src/palingenesis/rl/catalog/envs/instructions.py +495 -0
  251. palingenesis-0.3.0/src/palingenesis/rl/catalog/envs/math_boxed.py +447 -0
  252. palingenesis-0.3.0/src/palingenesis/rl/catalog/envs/search.py +331 -0
  253. palingenesis-0.3.0/src/palingenesis/rl/catalog/envs/sql.py +518 -0
  254. palingenesis-0.3.0/src/palingenesis/rl/catalog/envs/stateful.py +815 -0
  255. palingenesis-0.3.0/src/palingenesis/rl/catalog/registry.py +181 -0
  256. palingenesis-0.3.0/src/palingenesis/rl/catalog/runner.py +275 -0
  257. palingenesis-0.3.0/src/palingenesis/rl/catalog/scaffold.py +161 -0
  258. palingenesis-0.3.0/src/palingenesis/rl/catalog/spec.py +286 -0
  259. palingenesis-0.3.0/src/palingenesis/rl/catalog/verify.py +149 -0
  260. palingenesis-0.3.0/src/palingenesis/rl/chat.py +475 -0
  261. palingenesis-0.3.0/src/palingenesis/rl/concurrency.py +670 -0
  262. palingenesis-0.3.0/src/palingenesis/rl/config.py +1464 -0
  263. palingenesis-0.3.0/src/palingenesis/rl/data.py +420 -0
  264. palingenesis-0.3.0/src/palingenesis/rl/env.py +329 -0
  265. palingenesis-0.3.0/src/palingenesis/rl/envs/__init__.py +15 -0
  266. palingenesis-0.3.0/src/palingenesis/rl/envs/harbor.py +2603 -0
  267. palingenesis-0.3.0/src/palingenesis/rl/envs/harbor_egress.py +250 -0
  268. palingenesis-0.3.0/src/palingenesis/rl/envs/harbor_fetch.py +486 -0
  269. palingenesis-0.3.0/src/palingenesis/rl/envs/harbor_mcp.py +526 -0
  270. palingenesis-0.3.0/src/palingenesis/rl/envs/harbor_mcp_relay.py +297 -0
  271. palingenesis-0.3.0/src/palingenesis/rl/envs/harbor_sources.py +512 -0
  272. palingenesis-0.3.0/src/palingenesis/rl/envs/harbor_spec.py +1129 -0
  273. palingenesis-0.3.0/src/palingenesis/rl/envs/harness/__init__.py +37 -0
  274. palingenesis-0.3.0/src/palingenesis/rl/envs/harness/capture.py +315 -0
  275. palingenesis-0.3.0/src/palingenesis/rl/envs/harness/context.py +109 -0
  276. palingenesis-0.3.0/src/palingenesis/rl/envs/harness/ops.py +528 -0
  277. palingenesis-0.3.0/src/palingenesis/rl/envs/harness/profile.py +359 -0
  278. palingenesis-0.3.0/src/palingenesis/rl/envs/harness/profiles.py +1524 -0
  279. palingenesis-0.3.0/src/palingenesis/rl/envs/harness/profiles_more.py +1338 -0
  280. palingenesis-0.3.0/src/palingenesis/rl/envs/harness/protocols.py +213 -0
  281. palingenesis-0.3.0/src/palingenesis/rl/envs/harness/rules.py +136 -0
  282. palingenesis-0.3.0/src/palingenesis/rl/envs/harness/schemas.py +379 -0
  283. palingenesis-0.3.0/src/palingenesis/rl/envs/harness/terminus.py +340 -0
  284. palingenesis-0.3.0/src/palingenesis/rl/envs/mcp.py +369 -0
  285. palingenesis-0.3.0/src/palingenesis/rl/envs/nemo_gym.py +113 -0
  286. palingenesis-0.3.0/src/palingenesis/rl/envs/openenv.py +196 -0
  287. palingenesis-0.3.0/src/palingenesis/rl/episodes.py +164 -0
  288. palingenesis-0.3.0/src/palingenesis/rl/formats.py +108 -0
  289. palingenesis-0.3.0/src/palingenesis/rl/generation.py +395 -0
  290. palingenesis-0.3.0/src/palingenesis/rl/grading.py +419 -0
  291. palingenesis-0.3.0/src/palingenesis/rl/head_kernels.py +165 -0
  292. palingenesis-0.3.0/src/palingenesis/rl/losses.py +803 -0
  293. palingenesis-0.3.0/src/palingenesis/rl/parallel.py +255 -0
  294. palingenesis-0.3.0/src/palingenesis/rl/pipeline.py +1112 -0
  295. palingenesis-0.3.0/src/palingenesis/rl/pool/__init__.py +15 -0
  296. palingenesis-0.3.0/src/palingenesis/rl/pool/buckets.py +256 -0
  297. palingenesis-0.3.0/src/palingenesis/rl/pool/client.py +771 -0
  298. palingenesis-0.3.0/src/palingenesis/rl/pool/protocol.py +139 -0
  299. palingenesis-0.3.0/src/palingenesis/rl/pool/worker.py +658 -0
  300. palingenesis-0.3.0/src/palingenesis/rl/reference.py +121 -0
  301. palingenesis-0.3.0/src/palingenesis/rl/rewards.py +442 -0
  302. palingenesis-0.3.0/src/palingenesis/rl/sandbox.py +404 -0
  303. palingenesis-0.3.0/src/palingenesis/rl/sandbox_worker.py +320 -0
  304. palingenesis-0.3.0/src/palingenesis/rl/scenarios/__init__.py +33 -0
  305. palingenesis-0.3.0/src/palingenesis/rl/scenarios/base.py +226 -0
  306. palingenesis-0.3.0/src/palingenesis/rl/scenarios/cli.py +347 -0
  307. palingenesis-0.3.0/src/palingenesis/rl/scenarios/config.py +142 -0
  308. palingenesis-0.3.0/src/palingenesis/rl/scenarios/credit.py +238 -0
  309. palingenesis-0.3.0/src/palingenesis/rl/scenarios/export.py +129 -0
  310. palingenesis-0.3.0/src/palingenesis/rl/scenarios/library/__init__.py +1 -0
  311. palingenesis-0.3.0/src/palingenesis/rl/scenarios/library/checked_answer.py +196 -0
  312. palingenesis-0.3.0/src/palingenesis/rl/scenarios/library/handoff.py +200 -0
  313. palingenesis-0.3.0/src/palingenesis/rl/scenarios/library/harbor_steps.py +299 -0
  314. palingenesis-0.3.0/src/palingenesis/rl/scenarios/library/lead_workers.py +231 -0
  315. palingenesis-0.3.0/src/palingenesis/rl/scenarios/library/ledger_sum.py +198 -0
  316. palingenesis-0.3.0/src/palingenesis/rl/scenarios/library/patterns.py +290 -0
  317. palingenesis-0.3.0/src/palingenesis/rl/scenarios/library/plan_execute.py +358 -0
  318. palingenesis-0.3.0/src/palingenesis/rl/scenarios/library/solve_check.py +322 -0
  319. palingenesis-0.3.0/src/palingenesis/rl/scenarios/library/take_away.py +179 -0
  320. palingenesis-0.3.0/src/palingenesis/rl/scenarios/pipeline.py +464 -0
  321. palingenesis-0.3.0/src/palingenesis/rl/scenarios/placement.py +342 -0
  322. palingenesis-0.3.0/src/palingenesis/rl/scenarios/runtime.py +694 -0
  323. palingenesis-0.3.0/src/palingenesis/rl/screen.py +397 -0
  324. palingenesis-0.3.0/src/palingenesis/rl/trainer.py +2182 -0
  325. palingenesis-0.3.0/src/palingenesis/rl/trajectory.py +316 -0
  326. palingenesis-0.3.0/src/palingenesis/rollouts.py +486 -0
  327. palingenesis-0.3.0/src/palingenesis/s0_tuning.py +444 -0
  328. palingenesis-0.3.0/src/palingenesis/seco.py +1140 -0
  329. palingenesis-0.3.0/src/palingenesis/seco_attention.py +282 -0
  330. palingenesis-0.3.0/src/palingenesis/seco_tree.py +439 -0
  331. palingenesis-0.3.0/src/palingenesis/stable_softmax.py +68 -0
  332. palingenesis-0.3.0/src/palingenesis/surgery.py +1649 -0
  333. palingenesis-0.3.0/src/palingenesis/tensor_parallel.py +551 -0
  334. palingenesis-0.3.0/src/palingenesis/text_clean.py +365 -0
  335. palingenesis-0.3.0/src/palingenesis/tfp.py +228 -0
  336. palingenesis-0.3.0/src/palingenesis/train.py +2837 -0
  337. palingenesis-0.3.0/src/palingenesis/tree_packing.py +1121 -0
  338. palingenesis-0.3.0/src/palingenesis/validate_data.py +523 -0
  339. palingenesis-0.3.0/tests/conftest.py +6 -0
  340. palingenesis-0.3.0/tests/distill_helpers.py +111 -0
  341. palingenesis-0.3.0/tests/fixtures/harbor_task/environment/Dockerfile +2 -0
  342. palingenesis-0.3.0/tests/fixtures/harbor_task/instruction.md +1 -0
  343. palingenesis-0.3.0/tests/fixtures/harbor_task/solution/solve.sh +2 -0
  344. palingenesis-0.3.0/tests/fixtures/harbor_task/task.toml +17 -0
  345. palingenesis-0.3.0/tests/fixtures/harbor_task/tests/test.sh +3 -0
  346. palingenesis-0.3.0/tests/fixtures/mcp_basket_server.py +58 -0
  347. palingenesis-0.3.0/tests/fixtures/mcp_line_server.py +241 -0
  348. palingenesis-0.3.0/tests/fixtures/qwen3_5_chat_template.jinja +154 -0
  349. palingenesis-0.3.0/tests/fixtures/rl_rows/nemotron_mcqa.jsonl +2 -0
  350. palingenesis-0.3.0/tests/fixtures/rl_rows/nemotron_workplace.jsonl +2 -0
  351. palingenesis-0.3.0/tests/fixtures/rl_rows/ultradata_math.jsonl +2 -0
  352. palingenesis-0.3.0/tests/harbor_fixtures.py +205 -0
  353. palingenesis-0.3.0/tests/multimodal_helpers.py +123 -0
  354. palingenesis-0.3.0/tests/parallel_helpers.py +392 -0
  355. palingenesis-0.3.0/tests/seco_archs.py +218 -0
  356. palingenesis-0.3.0/tests/test_accelerator.py +580 -0
  357. palingenesis-0.3.0/tests/test_acceptance_smoke.py +101 -0
  358. palingenesis-0.3.0/tests/test_actgra.py +503 -0
  359. palingenesis-0.3.0/tests/test_activation_offload.py +511 -0
  360. palingenesis-0.3.0/tests/test_adaptive_sweep.py +578 -0
  361. palingenesis-0.3.0/tests/test_agent_tooling.py +367 -0
  362. palingenesis-0.3.0/tests/test_agentic_masking.py +525 -0
  363. palingenesis-0.3.0/tests/test_async_eval.py +330 -0
  364. palingenesis-0.3.0/tests/test_async_eval_distributed.py +149 -0
  365. palingenesis-0.3.0/tests/test_async_eval_placement.py +134 -0
  366. palingenesis-0.3.0/tests/test_async_eval_push.py +350 -0
  367. palingenesis-0.3.0/tests/test_attention_flash_gpu.py +35 -0
  368. palingenesis-0.3.0/tests/test_audit.py +1301 -0
  369. palingenesis-0.3.0/tests/test_audit_harbor.py +390 -0
  370. palingenesis-0.3.0/tests/test_autopilot_wiring.py +104 -0
  371. palingenesis-0.3.0/tests/test_bf16_adamw.py +503 -0
  372. palingenesis-0.3.0/tests/test_checkpoint_names.py +95 -0
  373. palingenesis-0.3.0/tests/test_checkpoint_optimizer.py +185 -0
  374. palingenesis-0.3.0/tests/test_chunked_gated_losses.py +49 -0
  375. palingenesis-0.3.0/tests/test_cli_config_and_sharding.py +185 -0
  376. palingenesis-0.3.0/tests/test_cmr.py +221 -0
  377. palingenesis-0.3.0/tests/test_compare.py +87 -0
  378. palingenesis-0.3.0/tests/test_compat.py +100 -0
  379. palingenesis-0.3.0/tests/test_config_validation.py +499 -0
  380. palingenesis-0.3.0/tests/test_container_contract.py +75 -0
  381. palingenesis-0.3.0/tests/test_context_parallel.py +589 -0
  382. palingenesis-0.3.0/tests/test_context_parallel_gpu.py +152 -0
  383. palingenesis-0.3.0/tests/test_context_parallel_train.py +165 -0
  384. palingenesis-0.3.0/tests/test_data_size.py +340 -0
  385. palingenesis-0.3.0/tests/test_deep_techniques.py +340 -0
  386. palingenesis-0.3.0/tests/test_distill_cache.py +291 -0
  387. palingenesis-0.3.0/tests/test_distill_distributed.py +162 -0
  388. palingenesis-0.3.0/tests/test_distill_losses.py +274 -0
  389. palingenesis-0.3.0/tests/test_distill_memory.py +33 -0
  390. palingenesis-0.3.0/tests/test_distill_train.py +346 -0
  391. palingenesis-0.3.0/tests/test_distributed.py +844 -0
  392. palingenesis-0.3.0/tests/test_dpo.py +543 -0
  393. palingenesis-0.3.0/tests/test_dpo_packing.py +645 -0
  394. palingenesis-0.3.0/tests/test_dpo_training.py +271 -0
  395. palingenesis-0.3.0/tests/test_dpo_tree_check.py +68 -0
  396. palingenesis-0.3.0/tests/test_empty_source_and_packing.py +156 -0
  397. palingenesis-0.3.0/tests/test_eval.py +906 -0
  398. palingenesis-0.3.0/tests/test_eval_fast.py +360 -0
  399. palingenesis-0.3.0/tests/test_eval_lmeval.py +324 -0
  400. palingenesis-0.3.0/tests/test_eval_loglikelihood.py +321 -0
  401. palingenesis-0.3.0/tests/test_eval_reader.py +33 -0
  402. palingenesis-0.3.0/tests/test_eval_training.py +117 -0
  403. palingenesis-0.3.0/tests/test_evalstats.py +133 -0
  404. palingenesis-0.3.0/tests/test_fallback_offsets.py +207 -0
  405. palingenesis-0.3.0/tests/test_fit_memory.py +158 -0
  406. palingenesis-0.3.0/tests/test_flash_kernel.py +146 -0
  407. palingenesis-0.3.0/tests/test_fp_qat.py +997 -0
  408. palingenesis-0.3.0/tests/test_fsdp_trainer_path.py +121 -0
  409. palingenesis-0.3.0/tests/test_fused_optim.py +522 -0
  410. palingenesis-0.3.0/tests/test_harbor.py +598 -0
  411. palingenesis-0.3.0/tests/test_harbor_docker_sessions.py +164 -0
  412. palingenesis-0.3.0/tests/test_harbor_format.py +1121 -0
  413. palingenesis-0.3.0/tests/test_harbor_mcp.py +406 -0
  414. palingenesis-0.3.0/tests/test_harbor_sources.py +331 -0
  415. palingenesis-0.3.0/tests/test_harbor_steps.py +298 -0
  416. palingenesis-0.3.0/tests/test_harness_more.py +585 -0
  417. palingenesis-0.3.0/tests/test_harness_profiles.py +1010 -0
  418. palingenesis-0.3.0/tests/test_hf_configs.py +78 -0
  419. palingenesis-0.3.0/tests/test_hooks.py +168 -0
  420. palingenesis-0.3.0/tests/test_integration.py +682 -0
  421. palingenesis-0.3.0/tests/test_internals.py +835 -0
  422. palingenesis-0.3.0/tests/test_label_shift_and_loss_family.py +434 -0
  423. palingenesis-0.3.0/tests/test_last_turn_integration.py +349 -0
  424. palingenesis-0.3.0/tests/test_length_grouping.py +122 -0
  425. palingenesis-0.3.0/tests/test_lora.py +570 -0
  426. palingenesis-0.3.0/tests/test_margins.py +70 -0
  427. palingenesis-0.3.0/tests/test_memory.py +328 -0
  428. palingenesis-0.3.0/tests/test_merge.py +274 -0
  429. palingenesis-0.3.0/tests/test_moe.py +1197 -0
  430. palingenesis-0.3.0/tests/test_msft.py +260 -0
  431. palingenesis-0.3.0/tests/test_multi_eval.py +287 -0
  432. palingenesis-0.3.0/tests/test_multi_rank_agreement.py +391 -0
  433. palingenesis-0.3.0/tests/test_multimodal.py +547 -0
  434. palingenesis-0.3.0/tests/test_multimodal_rl.py +558 -0
  435. palingenesis-0.3.0/tests/test_multimodal_trainers.py +170 -0
  436. palingenesis-0.3.0/tests/test_muon.py +176 -0
  437. palingenesis-0.3.0/tests/test_muon_distributed.py +89 -0
  438. palingenesis-0.3.0/tests/test_observation_loss.py +588 -0
  439. palingenesis-0.3.0/tests/test_opd.py +1076 -0
  440. palingenesis-0.3.0/tests/test_opd_align.py +210 -0
  441. palingenesis-0.3.0/tests/test_opd_fused_rkl.py +180 -0
  442. palingenesis-0.3.0/tests/test_opd_gpu.py +145 -0
  443. palingenesis-0.3.0/tests/test_opd_losses.py +412 -0
  444. palingenesis-0.3.0/tests/test_opd_orchestrator.py +175 -0
  445. palingenesis-0.3.0/tests/test_opd_packing.py +649 -0
  446. palingenesis-0.3.0/tests/test_opd_privileged.py +160 -0
  447. palingenesis-0.3.0/tests/test_opd_privileged_tools.py +159 -0
  448. palingenesis-0.3.0/tests/test_opd_trace_trainer.py +661 -0
  449. palingenesis-0.3.0/tests/test_opd_traces.py +395 -0
  450. palingenesis-0.3.0/tests/test_opd_trainer.py +495 -0
  451. palingenesis-0.3.0/tests/test_optim_and_health.py +650 -0
  452. palingenesis-0.3.0/tests/test_packing_forward.py +85 -0
  453. palingenesis-0.3.0/tests/test_pairs.py +94 -0
  454. palingenesis-0.3.0/tests/test_perf_techniques.py +569 -0
  455. palingenesis-0.3.0/tests/test_pipeline_parallel.py +182 -0
  456. palingenesis-0.3.0/tests/test_precision.py +300 -0
  457. palingenesis-0.3.0/tests/test_prepare_cleaning.py +563 -0
  458. palingenesis-0.3.0/tests/test_prepare_selection.py +85 -0
  459. palingenesis-0.3.0/tests/test_preprocess_and_logging.py +590 -0
  460. palingenesis-0.3.0/tests/test_pretokenize.py +428 -0
  461. palingenesis-0.3.0/tests/test_pretraining.py +883 -0
  462. palingenesis-0.3.0/tests/test_qat.py +312 -0
  463. palingenesis-0.3.0/tests/test_reasoning_masking.py +153 -0
  464. palingenesis-0.3.0/tests/test_release.py +133 -0
  465. palingenesis-0.3.0/tests/test_right_padding_mask.py +29 -0
  466. palingenesis-0.3.0/tests/test_rl.py +2112 -0
  467. palingenesis-0.3.0/tests/test_rl_async.py +381 -0
  468. palingenesis-0.3.0/tests/test_rl_catalog.py +707 -0
  469. palingenesis-0.3.0/tests/test_rl_catalog_envs.py +611 -0
  470. palingenesis-0.3.0/tests/test_rl_concurrency.py +863 -0
  471. palingenesis-0.3.0/tests/test_rl_envs.py +1153 -0
  472. palingenesis-0.3.0/tests/test_rl_lora.py +607 -0
  473. palingenesis-0.3.0/tests/test_rl_mcp.py +172 -0
  474. palingenesis-0.3.0/tests/test_rl_opd_logging.py +183 -0
  475. palingenesis-0.3.0/tests/test_rl_pass_k.py +92 -0
  476. palingenesis-0.3.0/tests/test_rl_patterns.py +956 -0
  477. palingenesis-0.3.0/tests/test_rl_pool.py +941 -0
  478. palingenesis-0.3.0/tests/test_rl_pool_safe.py +344 -0
  479. palingenesis-0.3.0/tests/test_rl_sampling_support.py +531 -0
  480. palingenesis-0.3.0/tests/test_rl_scenarios.py +1392 -0
  481. palingenesis-0.3.0/tests/test_rl_screen.py +161 -0
  482. palingenesis-0.3.0/tests/test_rollouts.py +421 -0
  483. palingenesis-0.3.0/tests/test_s0_tuning.py +314 -0
  484. palingenesis-0.3.0/tests/test_sandbox_worker.py +154 -0
  485. palingenesis-0.3.0/tests/test_seco.py +857 -0
  486. palingenesis-0.3.0/tests/test_seco_tree.py +228 -0
  487. palingenesis-0.3.0/tests/test_sglang_rollout.py +1484 -0
  488. palingenesis-0.3.0/tests/test_single_gpu_offload.py +112 -0
  489. palingenesis-0.3.0/tests/test_smart_truncate.py +349 -0
  490. palingenesis-0.3.0/tests/test_source_layout_export.py +162 -0
  491. palingenesis-0.3.0/tests/test_stable_softmax.py +190 -0
  492. palingenesis-0.3.0/tests/test_streaming_shard.py +65 -0
  493. palingenesis-0.3.0/tests/test_surgery.py +538 -0
  494. palingenesis-0.3.0/tests/test_tensor_parallel.py +331 -0
  495. palingenesis-0.3.0/tests/test_ternary_components.py +538 -0
  496. palingenesis-0.3.0/tests/test_tfp.py +217 -0
  497. palingenesis-0.3.0/tests/test_think_blocks.py +203 -0
  498. palingenesis-0.3.0/tests/test_train_accumulation.py +26 -0
  499. palingenesis-0.3.0/tests/test_train_log_line.py +18 -0
  500. palingenesis-0.3.0/tests/test_train_loop.py +581 -0
  501. palingenesis-0.3.0/tests/test_tree_packing.py +724 -0
  502. palingenesis-0.3.0/tests/test_validate_data.py +373 -0
@@ -0,0 +1,40 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ dist/
5
+ build/
6
+ .eggs/
7
+ .venv/
8
+ .pytest_cache/
9
+ .ruff_cache/
10
+ .mypy_cache/
11
+ .cache/
12
+ .coverage
13
+ htmlcov/
14
+ .DS_Store
15
+ checkpoints/
16
+ logs/
17
+ wandb/
18
+ outputs/
19
+ torchtitan/
20
+ *.pt
21
+ *.bin
22
+ *.safetensors
23
+
24
+
25
+ # MkDocs build output
26
+ site/
27
+
28
+ # Project training artifacts & local/proprietary data
29
+ projects/*/base_chat/
30
+ projects/*/checkpoints/
31
+ projects/*/checkpoints_cpt/
32
+ projects/*/data/
33
+ projects/*/prepared/
34
+
35
+ # Local working folders (not part of the library)
36
+ research/
37
+ post-training/
38
+
39
+ # Local agent tooling (skills, worktrees)
40
+ .claude/
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,199 @@
1
+ Metadata-Version: 2.5
2
+ Name: palingenesis
3
+ Version: 0.3.0
4
+ Summary: Fire-and-forget LLM fine-tuning with state-of-the-art defaults.
5
+ Project-URL: Repository, https://github.com/mii-llm/palingenesis
6
+ Project-URL: Documentation, https://mii-llm.github.io/palingenesis/
7
+ Author: palingenesis contributors
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Keywords: finetuning,llm,palingenesis,pytorch,sft,training
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
17
+ Requires-Python: >=3.11
18
+ Requires-Dist: accelerate>=1.10
19
+ Requires-Dist: datasets>=4.0
20
+ Requires-Dist: numpy>=1.26
21
+ Requires-Dist: pyyaml>=6.0
22
+ Requires-Dist: safetensors>=0.4.0
23
+ Requires-Dist: torch>=2.11
24
+ Requires-Dist: transformers<5.13,>=5.12
25
+ Provides-Extra: agent-sandbox
26
+ Requires-Dist: k8s-agent-sandbox[async]>=1.0; extra == 'agent-sandbox'
27
+ Provides-Extra: all
28
+ Requires-Dist: bitsandbytes>=0.49; extra == 'all'
29
+ Requires-Dist: cut-cross-entropy>=25.1.0; extra == 'all'
30
+ Requires-Dist: flash-linear-attention>=0.4; (sys_platform == 'linux') and extra == 'all'
31
+ Requires-Dist: liger-kernel>=0.5.0; (sys_platform == 'linux') and extra == 'all'
32
+ Requires-Dist: math-verify>=0.8; extra == 'all'
33
+ Requires-Dist: mcp>=2.2; extra == 'all'
34
+ Requires-Dist: schedulefree>=1.4.0; extra == 'all'
35
+ Requires-Dist: sentence-transformers>=3.0.0; extra == 'all'
36
+ Requires-Dist: torchao>=0.9.0; extra == 'all'
37
+ Requires-Dist: torchvision>=0.26; extra == 'all'
38
+ Requires-Dist: trackio>=0.25.0; extra == 'all'
39
+ Requires-Dist: wandb>=0.19.0; extra == 'all'
40
+ Provides-Extra: dev
41
+ Requires-Dist: bitsandbytes>=0.49; extra == 'dev'
42
+ Requires-Dist: cut-cross-entropy>=25.1.0; extra == 'dev'
43
+ Requires-Dist: flash-linear-attention>=0.4; (sys_platform == 'linux') and extra == 'dev'
44
+ Requires-Dist: liger-kernel>=0.5.0; (sys_platform == 'linux') and extra == 'dev'
45
+ Requires-Dist: math-verify>=0.8; extra == 'dev'
46
+ Requires-Dist: mcp>=2.2; extra == 'dev'
47
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
48
+ Requires-Dist: ruff>=0.8.0; extra == 'dev'
49
+ Requires-Dist: schedulefree>=1.4.0; extra == 'dev'
50
+ Requires-Dist: sentence-transformers>=3.0.0; extra == 'dev'
51
+ Requires-Dist: torchao>=0.9.0; extra == 'dev'
52
+ Requires-Dist: torchvision>=0.26; extra == 'dev'
53
+ Requires-Dist: trackio>=0.25.0; extra == 'dev'
54
+ Requires-Dist: wandb>=0.19.0; extra == 'dev'
55
+ Provides-Extra: float8
56
+ Requires-Dist: torchao>=0.9.0; extra == 'float8'
57
+ Provides-Extra: hybrid
58
+ Requires-Dist: causal-conv1d>=1.5; (sys_platform == 'linux') and extra == 'hybrid'
59
+ Provides-Extra: logging
60
+ Requires-Dist: trackio>=0.25.0; extra == 'logging'
61
+ Requires-Dist: wandb>=0.19.0; extra == 'logging'
62
+ Provides-Extra: loss
63
+ Requires-Dist: cut-cross-entropy>=25.1.0; extra == 'loss'
64
+ Provides-Extra: mcp
65
+ Requires-Dist: mcp>=2.2; extra == 'mcp'
66
+ Provides-Extra: multimodal
67
+ Requires-Dist: torchvision>=0.26; extra == 'multimodal'
68
+ Provides-Extra: optim
69
+ Requires-Dist: schedulefree>=1.4.0; extra == 'optim'
70
+ Provides-Extra: prepare
71
+ Requires-Dist: sentence-transformers>=3.0.0; extra == 'prepare'
72
+ Provides-Extra: rl
73
+ Requires-Dist: math-verify>=0.8; extra == 'rl'
74
+ Provides-Extra: train
75
+ Requires-Dist: bitsandbytes>=0.49; extra == 'train'
76
+ Requires-Dist: flash-linear-attention>=0.4; (sys_platform == 'linux') and extra == 'train'
77
+ Requires-Dist: liger-kernel>=0.5.0; (sys_platform == 'linux') and extra == 'train'
78
+ Provides-Extra: vllm
79
+ Requires-Dist: torchaudio==2.11.0; (sys_platform == 'linux') and extra == 'vllm'
80
+ Requires-Dist: torchcodec>=0.14; (sys_platform == 'linux') and extra == 'vllm'
81
+ Requires-Dist: torchvision==0.26.0; (sys_platform == 'linux') and extra == 'vllm'
82
+ Requires-Dist: vllm==0.26.0; (sys_platform == 'linux') and extra == 'vllm'
83
+ Provides-Extra: vllm-server
84
+ Requires-Dist: ray>=2.40; (sys_platform == 'linux') and extra == 'vllm-server'
85
+ Requires-Dist: torchaudio==2.11.0; (sys_platform == 'linux') and extra == 'vllm-server'
86
+ Requires-Dist: torchcodec>=0.14; (sys_platform == 'linux') and extra == 'vllm-server'
87
+ Requires-Dist: torchvision==0.26.0; (sys_platform == 'linux') and extra == 'vllm-server'
88
+ Requires-Dist: vllm==0.26.0; (sys_platform == 'linux') and extra == 'vllm-server'
89
+ Description-Content-Type: text/markdown
90
+
91
+ # palingenesis
92
+
93
+ <p align="center">
94
+ <img src="https://raw.githubusercontent.com/mii-llm/palingenesis/main/assets/pgs.webp" alt="palingenesis" width="100%">
95
+ </p>
96
+
97
+ **Post-train LLMs and agents from one config: SFT, multi-turn RL in tool environments, on-policy distillation, DPO and
98
+ merging, with state-of-the-art defaults.**
99
+
100
+ [Documentation](https://mii-llm.github.io/palingenesis/) · [Quickstart](https://mii-llm.github.io/palingenesis/getting-started/quickstart/) · [Configs](https://github.com/mii-llm/palingenesis/tree/main/configs)
101
+
102
+ From PyPI (Linux + NVIDIA GPU):
103
+
104
+ ```bash
105
+ pip install "torch>=2.11" --index-url https://download.pytorch.org/whl/cu129 # FIRST: the CUDA 12.9 build (driver >= 575)
106
+ pip install "palingenesis[train,logging]"
107
+ pgs init sft # writes ./sft.yaml: set your model and dataset
108
+ pgs train --config sft.yaml
109
+ ```
110
+
111
+ > **Install torch from PyTorch's CUDA index first.** Plain `pip install palingenesis` on Linux otherwise pulls PyPI's
112
+ > default torch, built for the newest CUDA (13.x, driver >= 580): on an older driver it installs fine and then sees no
113
+ > GPU. Other CUDA versions: [Installation](https://mii-llm.github.io/palingenesis/getting-started/install/).
114
+
115
+ From source (the locked, tested versions; the CUDA torch index is configured for you):
116
+
117
+ ```bash
118
+ git clone https://github.com/mii-llm/palingenesis.git && cd palingenesis
119
+ uv sync --extra train --extra logging # .venv with CUDA-enabled torch (+ --extra hybrid for Qwen3.5: faster, needed to pack)
120
+ source .venv/bin/activate
121
+ pgs train --config configs/quickstart.yaml
122
+ ```
123
+
124
+ In a notebook or a script: `palingenesis.train.train(config)` on one GPU, see
125
+ [Training from a notebook](https://mii-llm.github.io/palingenesis/getting-started/notebook/).
126
+ AMD GPUs (ROCm): [Training on AMD GPUs](https://mii-llm.github.io/palingenesis/getting-started/amd/).
127
+
128
+ ## What it does
129
+
130
+ | | Command | Guide |
131
+ |---|---|---|
132
+ | **Supervised fine-tuning**, including agentic traces with tool calls and reasoning | `pgs train --config configs/quickstart.yaml` | [Data](https://mii-llm.github.io/palingenesis/guides/data/), [Agentic](https://mii-llm.github.io/palingenesis/guides/agentic-training/) |
133
+ | **Reinforcement learning**: verifiable rewards, multi-turn tool use, GRPO-style groups, vLLM rollouts | `pgs rl --config configs/rl_math.yaml` | [RL](https://mii-llm.github.io/palingenesis/guides/rl/) |
134
+ | **Agent environments**: Python classes, MCP servers, OpenEnv, NeMo Gym, Harbor tasks in Docker, with emulated harness dialects (opencode, pi, OpenHands, …) | `pgs rl --config configs/rl_harbor.yaml` | [Harbor](https://mii-llm.github.io/palingenesis/guides/harbor/), [Harness profiles](https://mii-llm.github.io/palingenesis/guides/harness-profiles/) |
135
+ | **On-policy distillation**: the student samples, one or more teachers score those tokens, reverse KL | `pgs distill --config configs/distill_math.yaml` | [Distillation](https://mii-llm.github.io/palingenesis/guides/distillation/) |
136
+ | **Off-policy distillation**: fixed data against one or more teachers' distributions (online, or a cached top-k), context distillation, hidden-state targets, multi-GPU, plugins for QAT | `pgs init kd && pgs train --config kd.yaml` | [Off-policy distillation](https://mii-llm.github.io/palingenesis/guides/offpolicy-distillation/) |
137
+ | **Preference optimization**: DPO, IPO, SLiC-HF, robust and length-normalised DPO, SFT anchor | `pgs train --config configs/dpo_qwen35_08b.yaml` | [DPO](https://mii-llm.github.io/palingenesis/guides/dpo/) |
138
+ | **FP4 / FP8 quantisation-aware training** (plugin): NVFP4, MXFP4, FP8 fake quantisation while distilling from the bf16 model (SFT, KD, OPD, RL); packed checkpoints vLLM serves; `pgs quantize` for PTQ | `pgs train --config configs/qat_nvfp4_qwen35_08b.yaml` | [QAT](https://mii-llm.github.io/palingenesis/guides/qat/) |
139
+ | **LoRA** (plugin): frozen base, rank-r adapters (rsLoRA, DoRA, LoRA+), merged export and PEFT adapter; full fine-tuning stays the default | `pgs init lora && pgs train --config lora.yaml` | [LoRA](https://mii-llm.github.io/palingenesis/guides/lora/) |
140
+ | **Model merging**: interpolation, soups, task arithmetic | `pgs merge interpolate START END --lam 0.3 -o OUT` | [Merging](https://mii-llm.github.io/palingenesis/guides/merging/) |
141
+ | **Data preparation**: drop broken rows and duplicates, hold out an eval set, with the same config you train with | `pgs prepare --config configs/qwen35_4b/a100_80gb.yaml` | [Data](https://mii-llm.github.io/palingenesis/guides/data/) |
142
+ | **Autopilot**: profiles the GPU, sweeps the learning rate, trains to completion | `pgs autopilot --model Qwen/Qwen3.5-4B --dataset data.jsonl` | [Autopilot](https://mii-llm.github.io/palingenesis/guides/autopilot/) |
143
+
144
+ ## Highlights
145
+
146
+ - **Correct by construction.** The loss path is checked step by step against a plain reference loop; packed conversations
147
+ never see each other; multi-GPU gradients equal single-GPU ones; saved models load with plain `from_pretrained`.
148
+ - **Masking from the chat template itself.** Whole assistant turns are trained as the template renders them, tool calls and
149
+ end-of-turn tokens included; `tools` are rendered into the prompt; `"loss": false` keeps a message as context only.
150
+ - **Token-exact RL.** What the trainer scores is exactly what the sampler produced, tool results included; nothing is
151
+ re-tokenized. Rewards are checked answers, hidden tests, LLM judges or any Python function.
152
+ - **Memory.** Chunked losses (the full logits are never materialised), selective activation checkpointing, gradient
153
+ release, 8-bit optimizers. A Qwen3.5-4B fine-tune (attention pathway, 36% of the weights) fits in about 16 GiB.
154
+ `pgs fit` measures which memory settings are the fastest that fit your GPU.
155
+ - **Long sequences on one GPU (SeCO).** Chunk-by-chunk training with a cache gives the exact gradient, verified against full
156
+ backpropagation on 23 architectures, including the Qwen3.5 and Qwen3-Next hybrids.
157
+ - **Mixture-of-Experts models.** Routers are balanced in every trainer (load-balancing loss with the expert load measured
158
+ over the global batch, router z-loss, DeepSeek-V3's selection-bias update), with per-layer load and entropy in the log;
159
+ RL replays the experts the rollout engine chose. Gradients tested against the written-out losses on five families.
160
+ - **Training you can inspect.** wandb and trackio with grad norm, spike and clip counters, gradient noise scale, entropy and
161
+ the generalisation gap on one step axis; best-checkpoint tracking on eval loss.
162
+ - **Evaluation that agrees with training.** `pgs eval --model X --suite core` runs tasks defined in YAML (GSM8K,
163
+ MATH-500, MMLU, MMLU-Pro, IFEval, BBH, HumanEval, MBPP, function calling, Italian sets, your own, agentic
164
+ environments, or task files of lm-evaluation-harness as they are) with the trainer's own prompt rendering, tool
165
+ parsing and rewards, in each thinking mode: one engine per run, scoring next to generation, multiple choice with
166
+ one prefill per question; `pgs compare` gives paired tests between two checkpoints.
167
+ - **Crash-safe.** Re-run the same command to resume from the last complete checkpoint, in the same tracker run.
168
+ - **Scale out.** FSDP across GPUs, multi-node SLURM with sharded checkpoints, and a container image for Kubernetes.
169
+ - **Research options, one line each.** DEFT / DFT / InfoSFT token weighting, Hyperball, power-decay schedules: implemented to
170
+ their papers' definitions; the benefits are as reported by the papers, not reproduced here.
171
+
172
+ ## Hardware
173
+
174
+ | GPU | Model | Config |
175
+ |-----|-------|--------|
176
+ | A100 40 GB | Qwen3.5-4B, attention pathway (36% of weights) | `configs/qwen35_4b/a100_40gb.yaml` |
177
+ | A100 80 GB | Qwen3.5-4B, batch 4 | `configs/qwen35_4b/a100_80gb.yaml` |
178
+ | H100 80 GB | Qwen3.5-4B, FP8 | `configs/qwen35_4b/h100_80gb.yaml` |
179
+ | 8× A100 80 GB | Qwen3.5-35B MoE | `configs/qwen35_35b_moe/a100_80gb_multigpu.yaml` |
180
+
181
+ ```bash
182
+ ./scripts/train_multi_gpu.sh configs/qwen35_4b/a100_80gb_multigpu.yaml # one node, all GPUs
183
+ sbatch scripts/train_slurm.sh configs/qwen35_35b_moe/a100_80gb_multigpu.yaml # SLURM
184
+ ```
185
+
186
+ Containers and Kubernetes: [docs/containers.md](https://github.com/mii-llm/palingenesis/blob/main/docs/containers.md).
187
+
188
+ ## Development
189
+
190
+ ```bash
191
+ pytest tests/ # test suite
192
+ mkdocs serve # docs locally (pip install mkdocs-material)
193
+ ```
194
+
195
+ ## License
196
+
197
+ [Apache-2.0](https://github.com/mii-llm/palingenesis/blob/main/LICENSE).
198
+
199
+ *A new form emerging from what came before.*
@@ -0,0 +1,109 @@
1
+ # palingenesis
2
+
3
+ <p align="center">
4
+ <img src="https://raw.githubusercontent.com/mii-llm/palingenesis/main/assets/pgs.webp" alt="palingenesis" width="100%">
5
+ </p>
6
+
7
+ **Post-train LLMs and agents from one config: SFT, multi-turn RL in tool environments, on-policy distillation, DPO and
8
+ merging, with state-of-the-art defaults.**
9
+
10
+ [Documentation](https://mii-llm.github.io/palingenesis/) · [Quickstart](https://mii-llm.github.io/palingenesis/getting-started/quickstart/) · [Configs](https://github.com/mii-llm/palingenesis/tree/main/configs)
11
+
12
+ From PyPI (Linux + NVIDIA GPU):
13
+
14
+ ```bash
15
+ pip install "torch>=2.11" --index-url https://download.pytorch.org/whl/cu129 # FIRST: the CUDA 12.9 build (driver >= 575)
16
+ pip install "palingenesis[train,logging]"
17
+ pgs init sft # writes ./sft.yaml: set your model and dataset
18
+ pgs train --config sft.yaml
19
+ ```
20
+
21
+ > **Install torch from PyTorch's CUDA index first.** Plain `pip install palingenesis` on Linux otherwise pulls PyPI's
22
+ > default torch, built for the newest CUDA (13.x, driver >= 580): on an older driver it installs fine and then sees no
23
+ > GPU. Other CUDA versions: [Installation](https://mii-llm.github.io/palingenesis/getting-started/install/).
24
+
25
+ From source (the locked, tested versions; the CUDA torch index is configured for you):
26
+
27
+ ```bash
28
+ git clone https://github.com/mii-llm/palingenesis.git && cd palingenesis
29
+ uv sync --extra train --extra logging # .venv with CUDA-enabled torch (+ --extra hybrid for Qwen3.5: faster, needed to pack)
30
+ source .venv/bin/activate
31
+ pgs train --config configs/quickstart.yaml
32
+ ```
33
+
34
+ In a notebook or a script: `palingenesis.train.train(config)` on one GPU, see
35
+ [Training from a notebook](https://mii-llm.github.io/palingenesis/getting-started/notebook/).
36
+ AMD GPUs (ROCm): [Training on AMD GPUs](https://mii-llm.github.io/palingenesis/getting-started/amd/).
37
+
38
+ ## What it does
39
+
40
+ | | Command | Guide |
41
+ |---|---|---|
42
+ | **Supervised fine-tuning**, including agentic traces with tool calls and reasoning | `pgs train --config configs/quickstart.yaml` | [Data](https://mii-llm.github.io/palingenesis/guides/data/), [Agentic](https://mii-llm.github.io/palingenesis/guides/agentic-training/) |
43
+ | **Reinforcement learning**: verifiable rewards, multi-turn tool use, GRPO-style groups, vLLM rollouts | `pgs rl --config configs/rl_math.yaml` | [RL](https://mii-llm.github.io/palingenesis/guides/rl/) |
44
+ | **Agent environments**: Python classes, MCP servers, OpenEnv, NeMo Gym, Harbor tasks in Docker, with emulated harness dialects (opencode, pi, OpenHands, …) | `pgs rl --config configs/rl_harbor.yaml` | [Harbor](https://mii-llm.github.io/palingenesis/guides/harbor/), [Harness profiles](https://mii-llm.github.io/palingenesis/guides/harness-profiles/) |
45
+ | **On-policy distillation**: the student samples, one or more teachers score those tokens, reverse KL | `pgs distill --config configs/distill_math.yaml` | [Distillation](https://mii-llm.github.io/palingenesis/guides/distillation/) |
46
+ | **Off-policy distillation**: fixed data against one or more teachers' distributions (online, or a cached top-k), context distillation, hidden-state targets, multi-GPU, plugins for QAT | `pgs init kd && pgs train --config kd.yaml` | [Off-policy distillation](https://mii-llm.github.io/palingenesis/guides/offpolicy-distillation/) |
47
+ | **Preference optimization**: DPO, IPO, SLiC-HF, robust and length-normalised DPO, SFT anchor | `pgs train --config configs/dpo_qwen35_08b.yaml` | [DPO](https://mii-llm.github.io/palingenesis/guides/dpo/) |
48
+ | **FP4 / FP8 quantisation-aware training** (plugin): NVFP4, MXFP4, FP8 fake quantisation while distilling from the bf16 model (SFT, KD, OPD, RL); packed checkpoints vLLM serves; `pgs quantize` for PTQ | `pgs train --config configs/qat_nvfp4_qwen35_08b.yaml` | [QAT](https://mii-llm.github.io/palingenesis/guides/qat/) |
49
+ | **LoRA** (plugin): frozen base, rank-r adapters (rsLoRA, DoRA, LoRA+), merged export and PEFT adapter; full fine-tuning stays the default | `pgs init lora && pgs train --config lora.yaml` | [LoRA](https://mii-llm.github.io/palingenesis/guides/lora/) |
50
+ | **Model merging**: interpolation, soups, task arithmetic | `pgs merge interpolate START END --lam 0.3 -o OUT` | [Merging](https://mii-llm.github.io/palingenesis/guides/merging/) |
51
+ | **Data preparation**: drop broken rows and duplicates, hold out an eval set, with the same config you train with | `pgs prepare --config configs/qwen35_4b/a100_80gb.yaml` | [Data](https://mii-llm.github.io/palingenesis/guides/data/) |
52
+ | **Autopilot**: profiles the GPU, sweeps the learning rate, trains to completion | `pgs autopilot --model Qwen/Qwen3.5-4B --dataset data.jsonl` | [Autopilot](https://mii-llm.github.io/palingenesis/guides/autopilot/) |
53
+
54
+ ## Highlights
55
+
56
+ - **Correct by construction.** The loss path is checked step by step against a plain reference loop; packed conversations
57
+ never see each other; multi-GPU gradients equal single-GPU ones; saved models load with plain `from_pretrained`.
58
+ - **Masking from the chat template itself.** Whole assistant turns are trained as the template renders them, tool calls and
59
+ end-of-turn tokens included; `tools` are rendered into the prompt; `"loss": false` keeps a message as context only.
60
+ - **Token-exact RL.** What the trainer scores is exactly what the sampler produced, tool results included; nothing is
61
+ re-tokenized. Rewards are checked answers, hidden tests, LLM judges or any Python function.
62
+ - **Memory.** Chunked losses (the full logits are never materialised), selective activation checkpointing, gradient
63
+ release, 8-bit optimizers. A Qwen3.5-4B fine-tune (attention pathway, 36% of the weights) fits in about 16 GiB.
64
+ `pgs fit` measures which memory settings are the fastest that fit your GPU.
65
+ - **Long sequences on one GPU (SeCO).** Chunk-by-chunk training with a cache gives the exact gradient, verified against full
66
+ backpropagation on 23 architectures, including the Qwen3.5 and Qwen3-Next hybrids.
67
+ - **Mixture-of-Experts models.** Routers are balanced in every trainer (load-balancing loss with the expert load measured
68
+ over the global batch, router z-loss, DeepSeek-V3's selection-bias update), with per-layer load and entropy in the log;
69
+ RL replays the experts the rollout engine chose. Gradients tested against the written-out losses on five families.
70
+ - **Training you can inspect.** wandb and trackio with grad norm, spike and clip counters, gradient noise scale, entropy and
71
+ the generalisation gap on one step axis; best-checkpoint tracking on eval loss.
72
+ - **Evaluation that agrees with training.** `pgs eval --model X --suite core` runs tasks defined in YAML (GSM8K,
73
+ MATH-500, MMLU, MMLU-Pro, IFEval, BBH, HumanEval, MBPP, function calling, Italian sets, your own, agentic
74
+ environments, or task files of lm-evaluation-harness as they are) with the trainer's own prompt rendering, tool
75
+ parsing and rewards, in each thinking mode: one engine per run, scoring next to generation, multiple choice with
76
+ one prefill per question; `pgs compare` gives paired tests between two checkpoints.
77
+ - **Crash-safe.** Re-run the same command to resume from the last complete checkpoint, in the same tracker run.
78
+ - **Scale out.** FSDP across GPUs, multi-node SLURM with sharded checkpoints, and a container image for Kubernetes.
79
+ - **Research options, one line each.** DEFT / DFT / InfoSFT token weighting, Hyperball, power-decay schedules: implemented to
80
+ their papers' definitions; the benefits are as reported by the papers, not reproduced here.
81
+
82
+ ## Hardware
83
+
84
+ | GPU | Model | Config |
85
+ |-----|-------|--------|
86
+ | A100 40 GB | Qwen3.5-4B, attention pathway (36% of weights) | `configs/qwen35_4b/a100_40gb.yaml` |
87
+ | A100 80 GB | Qwen3.5-4B, batch 4 | `configs/qwen35_4b/a100_80gb.yaml` |
88
+ | H100 80 GB | Qwen3.5-4B, FP8 | `configs/qwen35_4b/h100_80gb.yaml` |
89
+ | 8× A100 80 GB | Qwen3.5-35B MoE | `configs/qwen35_35b_moe/a100_80gb_multigpu.yaml` |
90
+
91
+ ```bash
92
+ ./scripts/train_multi_gpu.sh configs/qwen35_4b/a100_80gb_multigpu.yaml # one node, all GPUs
93
+ sbatch scripts/train_slurm.sh configs/qwen35_35b_moe/a100_80gb_multigpu.yaml # SLURM
94
+ ```
95
+
96
+ Containers and Kubernetes: [docs/containers.md](https://github.com/mii-llm/palingenesis/blob/main/docs/containers.md).
97
+
98
+ ## Development
99
+
100
+ ```bash
101
+ pytest tests/ # test suite
102
+ mkdocs serve # docs locally (pip install mkdocs-material)
103
+ ```
104
+
105
+ ## License
106
+
107
+ [Apache-2.0](https://github.com/mii-llm/palingenesis/blob/main/LICENSE).
108
+
109
+ *A new form emerging from what came before.*
@@ -0,0 +1,68 @@
1
+ # Agentic trace training — tool-use, reasoning, multi-turn
2
+ #
3
+ # Data format: standard HF chat messages with system/user/assistant/tool roles.
4
+ # Only assistant turns are trained on. Agentic traces are typically long
5
+ # (tool calls, reasoning chains, multi-step outputs).
6
+ #
7
+ # Example:
8
+ # [
9
+ # {"role": "system", "content": "You are an agent with tools..."},
10
+ # {"role": "user", "content": "Find recent papers on X"},
11
+ # {"role": "assistant", "content": "<think>...</think>\n<tool_call>search(...)"},
12
+ # {"role": "tool", "content": "{\"results\": [...]}"},
13
+ # {"role": "assistant", "content": "Based on my search..."},
14
+ # ]
15
+
16
+ model:
17
+ name_or_path: meta-llama/Llama-3.1-8B-Instruct
18
+ trust_remote_code: true
19
+ torch_dtype: bfloat16
20
+ attn_implementation: sdpa
21
+ use_liger_kernel: true
22
+ compile: true
23
+ compile_backend: inductor
24
+
25
+ data:
26
+ dataset: your-org/agentic-traces
27
+ dataset_split: train
28
+ streaming: true
29
+ max_seq_length: 16384 # Agentic loops are long
30
+ messages_field: messages
31
+ num_workers: 4
32
+ packing: false
33
+
34
+ train:
35
+ output_dir: ./checkpoints/agentic-8b
36
+ epochs: 3
37
+ max_steps: -1
38
+ per_device_batch_size: 1
39
+ gradient_accumulation_steps: 32 # Large effective batch with long seqs
40
+ learning_rate: 1.0e-5
41
+ min_learning_rate: 1.0e-6
42
+ weight_decay: 0.1
43
+ warmup_ratio: 0.03
44
+ max_grad_norm: 1.0
45
+ lr_scheduler: cosine
46
+ seed: 42
47
+ save_steps: 250
48
+ logging_steps: 1
49
+ bf16: true
50
+ gradient_checkpointing: selective
51
+
52
+ parallel:
53
+ fsdp: true
54
+ context_parallel: false # Enable if > 32k seq
55
+ cpu_offload: false
56
+ reshard_after_forward: true
57
+
58
+ memory:
59
+ chunked_loss: true
60
+ loss_num_chunks: 8
61
+ float32_matmul_precision: high
62
+
63
+ logging:
64
+ project: palingenesis
65
+ run_name: agentic-llama3-8b
66
+ use_wandb: true
67
+ use_trackio: true
68
+ log_grad_norm: true