Picotron: Minimalistic 4D-Parallelism Framework for LLM Training Education

This repository profile is provided by osrepos.com, an open source repository discovery platform.

Picotron: Minimalistic 4D-Parallelism Framework for LLM Training Education

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

Analyzed by OSRepos on December 12, 2025

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.

requests-html: Pythonic HTML Parsing with JavaScript Support

requests-html: Pythonic HTML Parsing with JavaScript Support

July 25, 2026

requests-html is a Python library designed to simplify HTML parsing and web scraping. It extends the familiar Requests experience with powerful parsing capabilities, including full JavaScript support via Chromium, CSS selectors, and XPath. This makes it an ideal tool for developers needing to interact with dynamic web content.

PythonWeb ScrapingHTML Parsing
Grab: A Powerful Python Web Scraping Framework

Grab: A Powerful Python Web Scraping Framework

July 24, 2026

Grab is a robust Python web scraping framework designed to simplify complex data extraction tasks. It provides comprehensive tools for handling network requests, processing scraped content, and managing asynchronous operations through its powerful Spider component. Developers can leverage features like automatic cookie support, HTTP/SOCKS proxies, and XPath queries for efficient web data collection.

PythonWeb ScrapingFramework
Awesome Django: A Curated List of Essential Django Resources and Packages

Awesome Django: A Curated List of Essential Django Resources and Packages

July 24, 2026

Awesome Django is a comprehensive curated list of outstanding Django apps, projects, and resources. It focuses on mature, well-maintained packages with good documentation and active user bases. This repository serves as an invaluable guide for developers looking for high-quality tools and examples within the Django ecosystem.

DjangoAwesome ListPython
Awesome Django: A Curated List of Essential Resources for Developers

Awesome Django: A Curated List of Essential Resources for Developers

July 24, 2026

Awesome Django is a comprehensive, curated list of exceptional resources, packages, and tools for Django web development. It serves as an invaluable guide for developers looking to enhance their projects with the best the Django ecosystem has to offer. With over 11,000 stars, it's a trusted community-maintained collection.

awesomeawesome-listdjango

Source repository

Open the original repository on GitHub.

9 counted GitHub visits

View on GitHub
OS
OSRepos

Analysis and discovery of open source repositories. Find interesting projects and follow their updates.

Monitor your website with YourWebsiteScore

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of third-party repository code is at your own risk. Always review source code, dependencies, licenses, and security implications before running anything.

© 2025 OSRepos. Built with Nuxt 3 and lots of ❤️