How jiwubu/minimind works
MiniMind is a from-scratch, lightweight language-model implementation and learning project. Its main workflow is to prepare or generate training data, train or adapt a MiniMind model, then serve or interact with it and evaluate its outputs. The repository also has a substantial specialized math-data and math-evaluation branch, plus distillation, preference optimization, RL and tool-using agent workflows. The graph reflects documented capabilities and SOURCE INDEX references; unsampled modules are represented only at the level supported by the tree and README.
Main entry points: model_minimind.py MiniMind architecture · lm_dataset.py Language datasets · trainer_utils.py Training utilities · train_ppo.py PPO and GRPO
Components 27
Model and tokenizer
- MiniMind architecture
model/model_minimind.py - LoRA adaptation
model/model_lora.py - Tokenizer training
trainer/train_tokenizer.py
Data and math
- Language datasets
dataset/lm_dataset.py - Math trace format
math/math_format.py - Add/sub data
math/gen_math_data_addsub.py - Mul/div data
math/gen_math_data_muldiv.py
Training workflows
- Pretraining and SFT
trainer/train_pretrain.py - Full SFT
trainer/train_full_sft.py - LoRA training
trainer/train_lora.py - DPO training
trainer/train_dpo.py - PPO and GRPO
trainer/train_ppo.py - Agentic RL
trainer/train_agent.py - Model distillation
trainer/train_distillation.py - Rollout engines
trainer/rollout_engine.py - Training utilities
trainer/trainer_utils.py
Inference and tools
- Chat examples
scripts/chat_api.py - OpenAI-compatible API
scripts/serve_openai_api.py - Chat web UI
scripts/web_demo.py - Merge and export
scripts/convert_model.py
Evaluation
- Math evaluation
math/eval_math.py - Tool-call evaluation
scripts/eval_toolcall.py - Model evaluation
eval_llm.py
Other components
- Model learner
- Chat user
- SGLang service
- Model user
Connections 48
- Model learner → Tokenizer training: trains tokenizer
README.md - Model learner → Add/sub data: generates math data
README.md - Model learner → Mul/div data: generates math data
README.md - Model learner → Pretraining and SFT: trains model
README.md - Model learner → Full SFT: fine-tunes model
README.md - Model learner → DPO training: optimizes preferences
README.md - Model learner → PPO and GRPO: trains with RL
README.md - Model learner → Agentic RL: trains tool agent
README.md - Model learner → Model distillation: distills model
README.md - Add/sub data → Math trace format: uses format
math/gen_math_data_addsub.py - Mul/div data → Math trace format: uses format
math/gen_math_data_muldiv.py - Pretraining and SFT → Language datasets: loads datasets
trainer/train_pretrain.py - Pretraining and SFT → MiniMind architecture: trains model
trainer/train_pretrain.py - Pretraining and SFT → Training utilities: uses utilities
trainer/train_pretrain.py - Full SFT → Language datasets: loads datasets
trainer/train_full_sft.py - Full SFT → MiniMind architecture: trains model
trainer/train_full_sft.py - Full SFT → Training utilities: uses utilities
trainer/train_full_sft.py - LoRA training → Language datasets: loads datasets
trainer/train_lora.py - LoRA training → MiniMind architecture: trains model
trainer/train_lora.py - LoRA training → LoRA adaptation: applies adaptation
trainer/train_lora.py - DPO training → Language datasets: loads datasets
trainer/train_dpo.py - DPO training → MiniMind architecture: trains model
trainer/train_dpo.py - DPO training → Training utilities: uses utilities
trainer/train_dpo.py - PPO and GRPO → Language datasets: loads datasets
trainer/train_ppo.py - PPO and GRPO → MiniMind architecture: builds policy
trainer/train_ppo.py - PPO and GRPO → Rollout engines: generates rollouts
trainer/train_ppo.py - PPO and GRPO → Training utilities: uses utilities
trainer/train_ppo.py - Agentic RL → Language datasets: loads datasets
trainer/train_agent.py - Agentic RL → MiniMind architecture: trains model
trainer/train_agent.py - Agentic RL → Rollout engines: generates rollouts
trainer/train_agent.py - Agentic RL → Training utilities: uses utilities
trainer/train_agent.py - Model distillation → Language datasets: loads datasets
trainer/train_distillation.py - Model distillation → MiniMind architecture: trains model
trainer/train_distillation.py - Model distillation → Training utilities: uses utilities
trainer/train_distillation.py - Rollout engines → MiniMind architecture: generates with
trainer/rollout_engine.py - Rollout engines → SGLang service: sends HTTP requests
trainer/rollout_engine.py - Chat user → Chat examples: asks questions
README.md - Chat user → OpenAI-compatible API: sends chat requests
README.md - Chat user → Chat web UI: uses chat UI
README.md - Chat examples → MiniMind architecture: runs inference
- OpenAI-compatible API → MiniMind architecture: serves inference
scripts/serve_openai_api.py - Chat web UI → Training utilities: uses utilities
scripts/web_demo.py - Chat web UI → MiniMind architecture: serves inference
- Model user → Model evaluation: evaluates model
README.md - Model evaluation → MiniMind architecture: loads model
eval_llm.py - Model user → Math evaluation: checks math ability
README.md - Math evaluation → MiniMind architecture: generates answers
math/eval_math.py - Math evaluation → Math trace format: uses parser
math/eval_math.py