Architecture
mindxtrain is a single-package training framework producing checkpoints with
verifiable provenance, served through an OpenAI-compatible API. The repository
is organized per docs/blueprints/mindxtrain2.md Β§Part 4.
mindxtrain/
βββ cli/ entry point (typer): init|bench|train|eval|quantize|serve|publish|receipt
βββ config/ Pydantic schema + JSON / YAML loaders
βββ data/ curate -> dedupe -> filter -> tokenize -> pack -> synth -> verify
βββ models/ ModelRegistry + ChatTemplate + per-base presets
βββ train/ sft, dpo, grpo, rlhf, tool_use, distributed, callbacks, recipes/*.yaml
βββ eval/ lighteval, inspect_ai, bfcl, persona/agenda regression, tau_bench, card
βββ autotune/ 60-second AOT MI300X probe (the differentiator)
βββ operator/ FastAPI app, Coach UI, ml-intern patterns (tool_router, agent_loop, β¦)
βββ storage/ StorageProvider interface + local_fs / hf_hub / lighthouse / ipfs
βββ provenance/ TrainingRun manifest, BLAKE3, ERC-8004, Algorand, x402
βββ deploy/ content-addressed registry, hot_swap, ab_test, vllm/sglang launchers, quark
βββ budget/ psutil-derived ResourceBudget + per-provider pricing
The five conceptual layers
The codebase is concentric β each inner layer is consumed by the next, never the reverse.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 1. CLI layer (typer) β
β init | bench | train | dataset prep | eval | quantize β
β serve | publish | receipt β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β 2. Autotune layer (60s AOT probe β DIFFERENTIATOR) β
β attention_probe (CK vs Triton) β gemm_probe β rccl β
β β β
β AutotunePlan (JSON, AOT β JIT autotune is forbidden) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β 3. Dataset layer β
β HF datasets streaming β MinHash + SemDeDup β packing β
β β FSDP sharding β Lighthouse-pinned CIDs β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β 4. Training layer (backend dispatch) β
β axolotl β unsloth β torchtune β primus β
β LoRA β QLoRA β full SFT β DPO β ORPO β GRPO β GSPO β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β 5. Artifact + Integration layer β
β Quark FP8 / MXFP4 β lm-eval-harness β
β β HF Hub push β Lighthouse pin β
β β mindX register β AgenticPlace listing β
β β BANKON ENS subname β x402 Algorand metering β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
The CLI never reaches into the training backend; it consumes the autotune plan
and a Pydantic-validated config and dispatches downward through
mindxtrain/train/dispatch.py. The training backend never reaches up to the
CLI; it returns a checkpoint directory that the artifact layer consumes.
Autotune is the spine
The single architectural choice that distinguishes mindxtrain from Axolotl,
LLaMA-Factory, Unsloth, torchtune and Primus is the autotune layer. It runs a
60-second MI300X micro-benchmark (CK-vs-Triton SDPA, hipBLASLt heuristic
check, RCCL bus-bandwidth probe) and emits a static AutotunePlan JSON
consumed at training start.
AOT-only β JIT autotune is forbidden in production. The plan is fixed at training start; no Triton / Inductor / MIOpen JIT autotune runs in the live training loop. This is reproducible, latency-stable, and the point of the entire framework.
See autotune.md for the full probe taxonomy and the
AutotunePlan schema.
MI300X-specific invariants (non-negotiable)
These are encoded in the schema and the recipe library; violating them is a deployment bug.
- FSDP topology must be 1- or 8-GPU (
hardware.gpus: Literal[1, 8]). The 2- and 4-GPU groups have asymmetric xGMI bandwidth on MI300X β kills throughput silently. Enforced by the schema; tested intests/test_config_schema.py. PYTORCH_ROCM_ARCH=gfx942must be set; AOTriton compiles for the GPU arch andgfx942is MI300X. Default in every recipe'strain.env.HSA_NO_SCRATCH_RECLAIM=1+HIP_FORCE_DEV_KERNARG=1+GPU_MAX_HW_QUEUES=1β the three runtime knobs that make Primus-Turbo MI300X paths stable. Default in every recipe'strain.env.- Numpy must be pinned
<2.0againsttorch==2.9.1+rocm7.2.1.lw. Pinned in the projectpyproject.toml. - Container is
rocm/primus:v26.2; SHA256 digest snapshot lives inops/containerfiles/digest.lock.
End-to-end data flow
examples/demo_qwen3_8b_sft.yaml
β
ββ[parse, validate]ββΊ XTrainConfig (Pydantic v2)
β
ββ[mindxtrain bench]ββΊ AutotunePlan {ck/triton, gemm, rccl, β¦}
β β
β βΌ
ββ[mindxtrain train]βββΊ dispatch_training(cfg, plan, out_dir)
β β
β βΌ (Axolotl YAML, env vars set)
β checkpoint_dir/ + train.log
β β
ββ[mindxtrain eval]ββββββΊ eval.json (lm-eval-harness)
β β
ββ[mindxtrain quantize]ββΊ checkpoint_dir/quantized/ (Quark FP8 PTPC)
β β
ββ[mindxtrain publish]βββΊ Manifest with BLAKE3 of YAML+dataset+
checkpoint+eval, plus HF/Lighthouse/
INFT/ASA pointers
β
βΌ
mindxtrain.operator.app serves the FP8
weights on /v1/chat/completions
mindxtrain receipt re-hashes the artifacts and verifies the BLAKE3 fields
against the manifest. That round-trip is the cypherpunk2048 reproducibility
guarantee.
Model strategy (per mindxtrain2.md Β§Part 6)
mindxtrain targets a family, not a single flagship: edge β mid β
flagship β specialist. Per the rigorous comparison in
blueprints/mindXtrain2.md Β§Part 6:
- Primary base = Qwen3.5 (Apache-2.0, contiguous family from 0.6 B β 235 B β Qwen3.5-122B-A10B; mature PEFT/Axolotl/Unsloth recipes; BFCL leadership in the Qwen lineage).
- Specialist track = GLM-5.1 (MIT-licensed weights; SOTA SWE-Bench Pro 58.4; long-horizon agentic reasoning with 200 K-context DSA). Used where 8-hour autonomous SWE sessions matter; otherwise overkill.
- DeepSeek V3.2 / Mistral Large 3 / Phi-4-mini / Gemma 4 are watchlist or jurisdictional secondary tracks.
The five mindxtrain.models.{glm51,qwen35,deepseek_v32,mistral3,phi4_mini}.py
preset modules auto-register on import so mindxtrain init and the
ModelRegistry know all five from day one.
Actualization status
The framework ships with 38 modules actualized as real Python on a
CPU-only laptop, 6 optional-dep groups (ml, eval, data, serve,
chain, obs) for the heavyweight paths, and 5 cloud-provider stubs
preserved in budget/providers/* for future work. Per-module map at
actualization_status.md.
Verification gate that should always pass on the base install:
uv run pytest -q # β 564 passed
uv run ruff check . # clean
What lives outside the Python tree
contracts/β Foundry workspace formindxtrain_registry.sol(write-once anchor) andx402_receiver.sol(immutable facilitator). No proxies, no admin keys, no setters.examples/βdemo_qwen3_8b_sft.yaml(the hero config).Containerfile,compose.yamlβ top-level Podman / podman-compose entries.ops/β per-role container files, compose stacks, k8s manifests, vmm and Gensyn definitions.docs/blueprints/β the source design briefs the project was built against.