Picotron: Minimalistic 4D-Parallelism Framework for LLM Training Education
This repository profile is provided by osrepos.com, an open source repository discovery platform.

Summary
Picotron is a minimalistic and hackable distributed training framework designed for educational purposes. Inspired by NanoGPT, it focuses on pre-training Llama-like models using 4D Parallelism, making complex concepts accessible. Its simple and readable codebase, with core files under 300 lines, provides an excellent tool for learning and experimentation in distributed machine learning.
Repository Information
Topics
Click on any tag to explore related repositories
Use at your own risk
OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.
Introduction
Picotron, inspired by NanoGPT, is a minimalistic and highly hackable repository for pre-training Llama-like models. It implements 4D Parallelism (Data, Tensor, Pipeline, Context parallel) and is specifically designed for educational purposes, making it an excellent tool for learning and experimentation in distributed training. The codebase is simple and readable, with train.py, model.py, and parallelism files all under 300 lines of code. While performance is under active development, it has shown promising MFU results on LLaMA-2-7B and SmolLM-1.7B models.
Installation
To get started with Picotron, you can install it directly from the repository:
pip install -e .
Examples
Picotron provides quick start examples for both GPU and CPU environments, demonstrating how to configure and run training with different parallelism strategies.
First, obtain a Hugging Face token from Hugging Face settings to download models.
GPU Training
To create a configuration file and run training locally with 3D Parallelism:
# Create a config file (e.g., for Llama-1B with Data Parallelism)
python create_config.py --out_dir tmp --exp_name llama-1B --dp 8 --model_name HuggingFaceTB/SmolLM-1.7B --num_hidden_layers 15 --grad_acc_steps 32 --mbs 4 --seq_len 1024 --hf_token <HF_TOKEN>
# Run locally
torchrun --nproc_per_node 8 train.py --config tmp/llama-1B/config.json
# Example for 3D Parallelism (Data, Tensor, Pipeline)
python create_config.py --out_dir tmp --dp 4 --tp 2 --pp 2 --pp_engine 1f1b --exp_name llama-7B --model_name meta-llama/Llama-2-7b-hf --grad_acc_steps 32 --mbs 4 --seq_len 1024 --hf_token <HF_TOKEN>
# Submit to Slurm
python submit_slurm_jobs.py --inp_dir tmp/llama-7B --qos high --hf_token <HF_TOKEN>
CPU Training (Expect slower performance)
You can also run Picotron on a CPU for experimentation, though it will be significantly slower:
# Create a config file for CPU training with 3D Parallelism
python create_config.py --out_dir tmp --exp_name llama-1B-cpu --dp 2 --tp 2 --pp 2 --pp_engine 1f1b --model_name HuggingFaceTB/SmolLM-1.7B --num_hidden_layers 5 --grad_acc_steps 2 --mbs 4 --seq_len 128 --hf_token <HF_TOKEN> --use_cpu
# Run locally on CPU
torchrun --nproc_per_node 8 train.py --config tmp/llama-1B-cpu/config.json
Why Use Picotron
Picotron stands out as an exceptional resource for anyone looking to understand the intricacies of distributed training for large language models. Its primary focus on education, combined with a minimalist and hackable design, allows users to quickly grasp complex concepts like 4D Parallelism without being overwhelmed by excessive code. Unlike more production-oriented frameworks, Picotron prioritizes clarity and learning, making it an ideal starting point for researchers and students to experiment and build their own distributed training setups from scratch.
Links
- GitHub Repository: huggingface/picotron
- Picotron Tutorial (Playlist): YouTube
- Picotron Tutorial (Codebase): GitHub
- Citation:
@misc{zhao2025picotron, author = {Haojun Zhao and Ferdinand Mom}, title = {Picotron: Distributed training framework for education and research experimentation}, year = {2025}, publisher = {GitHub}, journal = {GitHub repository}, howpublished = {\url{https://github.com/huggingface/picotron}} }
Related repositories
Similar repositories that may be relevant next.

Tau: A Minimalist Python Coding Agent for Your Terminal
September 8, 2026
Tau is a Python port of Pi's minimalist coding agent, designed to live in your terminal. It allows users to make requests like "explain this repo" or "add tests," and it can read files, edit code, and run commands. Beyond its utility, Tau also serves as a teaching project, demonstrating how coding agents are built with a small, readable codebase.

Awesome Harness Engineering: Building Reliable AI Agent Systems
September 7, 2026
Awesome Harness Engineering is a comprehensive curated list dedicated to the discipline of designing robust AI agent harnesses. It offers a wealth of resources, patterns, and templates essential for building reliable AI agent systems. Developers can explore tools, best practices, and foundational concepts across various critical areas of agent development.
Best of Agent Harnesses: A Curated List for AI Agent Development
September 7, 2026
RyanAlberts' Best of Agent Harnesses is a comprehensive, curated, and ranked list of over 100 AI agent harnesses and orchestration frameworks. It provides valuable insights for building reliable agentic systems, offering both human-readable guides and machine-readable formats for agents themselves. The repository is rescored weekly to ensure up-to-date recommendations.

Wasm Agents Blueprint: Run Python AI Agents in Your Browser with WebAssembly
September 3, 2026
Wasm Agents Blueprint is an innovative project from Mozilla AI that allows you to run Python-based AI agents directly in your web browser using WebAssembly (Wasm) and Pyodide. It bridges the gap between powerful Python AI frameworks, like the OpenAI Agents SDK, and browser-based applications. This blueprint eliminates the need for complex server setups or Docker containers, offering a streamlined way to experience AI agents.
Source repository
Open the original repository on GitHub.
18 counted GitHub visits