How ai-hypercomputer/maxtext works
MaxText is a JAX-based LLM library for scalable TPU/GPU training and inference. The main workflow is to configure a run, load and prepare data, construct a supported model, train it, and save checkpoints; post-training, serving, evaluation, and checkpoint conversion are distinct branches. The graph combines sampled source relationships and README-documented capabilities. Several important subsystems are represented from the file tree and README without claiming their unsampled internals were inspected.
Main entry points: pyconfig.py Run configuration · maxtext_engine.py Training engine · train.py Pre-training · model_creation_utils.py Model construction
Components 21
Training
- Run configuration
src/maxtext/configs/pyconfig.py - Training engine
src/maxtext/training_engine/maxtext_engine.py - Pre-training
src/maxtext/trainers/pre_train/train.py - Post-training
src/maxtext/trainers/post_train - DiLoCo training
src/maxtext/trainers/diloco/diloco.py
Models and compute
- Model construction
src/maxtext/utils/model_creation_utils.py - Model families
src/maxtext/models/models.py - Model layers
src/maxtext/layers - Accelerator kernels
src/maxtext/kernels - Device sharding
src/maxtext/utils/sharding.py
Inference and evaluation
- Generation engine
src/maxtext/inference/maxengine/maxengine.py - Serving entrypoint
src/maxtext/inference/maxengine/maxengine_server.py - Evaluation framework
src/maxtext/eval/runner/run.py - vLLM integration
src/maxtext/integration/vllm
Checkpoint lifecycle
- Checkpointing
src/maxtext/common/checkpointing.py - Checkpoint conversion
src/maxtext/checkpoint_conversion
Data and modalities
- Input pipeline
src/maxtext/input_pipeline/input_pipeline_interface.py - Data processing
src/maxtext/input_pipeline/input_pipeline_utils.py - Multimodal processing
src/maxtext/multimodal/processor.py
Other components
- Engineer
- Cloud storage
Connections 26
- Engineer → Run configuration: configures run
README.md - Run configuration → Input pipeline: selects dataset
src/maxtext/input_pipeline/input_pipeline_interface.py - Input pipeline → Data processing: builds iterators
src/maxtext/input_pipeline/input_pipeline_interface.py - Data processing → Multimodal processing: uses processors
src/maxtext/input_pipeline/input_pipeline_utils.py - Run configuration → Model construction: configures model
src/maxtext/utils/model_creation_utils.py - Model construction → Model families: constructs models
src/maxtext/utils/model_creation_utils.py - Model families → Model layers: uses layers
- Model layers → Accelerator kernels: uses kernels
- Training engine → Model construction: builds model
src/maxtext/training_engine/maxtext_engine.py - Training engine → Run configuration: reads settings
src/maxtext/training_engine/maxtext_engine.py - Training engine → Device sharding: uses shardings
src/maxtext/training_engine/maxtext_engine.py - Pre-training → Training engine: runs training
src/maxtext/training_engine/maxtext_engine.py - Pre-training → Input pipeline: loads batches
- Pre-training → Checkpointing: saves state
- Engineer → Pre-training: starts training
README.md - Engineer → Post-training: starts fine-tuning
README.md - Engineer → DiLoCo training: starts distributed run
README.md - Checkpointing → Cloud storage: stores checkpoints
- Engineer → Checkpoint conversion: converts checkpoint
- Engineer → Serving entrypoint: requests generation
- Serving entrypoint → Generation engine: dispatches requests
src/maxtext/inference/maxengine/maxengine_server.py - Generation engine → Model construction: creates model
src/maxtext/inference/maxengine/maxengine.py - Generation engine → Run configuration: loads settings
src/maxtext/inference/maxengine/maxengine.py - Evaluation framework → Serving entrypoint: manages server
- Evaluation framework → vLLM integration: integrates runtime
- Engineer → Evaluation framework: evaluates model