A minimal JAX-like training engine for transformer LLMs — built as a learning artifact.
Project description
tinyjax
A tiny training engine for transformer LLMs — built as a learning artifact first, working trainer second.
If you know Python and numpy and have wondered what a "framework" like PyTorch or JAX actually does between your model definition and a running GPU kernel, this repo is for you. Every file, function, doc, and notebook is written for that reader.
What tinyjax is
- A minimal, JAX-shaped Python library that trains modern decoder-only transformer language models on CPU and NVIDIA GPU.
- Small enough to hold in one head: about 5–7k lines of library code, an unlimited number of lines of prose.
- Built chapter by chapter. Each chapter introduces one concept (arrays → tracing → jaxpr → autodiff → jit → vmap → transformer → training loop → mixed precision → data parallelism) and ships with code, docs, tests, and a runnable notebook.
What tinyjax is not
- A general-purpose array library (no image models, no encoder-decoder, no sparse ops).
- A production framework (no TPU, no full sharding, no cuDNN fused attention in v1).
- Trying to beat JAX on speed — targeting within 10–20 % of JAX on the same hardware is enough.
Start here
- New to training engines? Read
docs/00-what-is-a-training-engine.md. - Ready to walk through the whole thing? Follow
LEARNING_PATH.mdtop to bottom. - Ready to contribute? Read
CONTRIBUTING.mdfirst.
Install
tinyjax is a normal PEP 621 Python package. Once published on PyPI it will install with any standard tool.
Using uv (fast, recommended):
uv pip install tinyjax
Using pip:
python -m pip install tinyjax
For a local development checkout:
git clone https://github.com/gkatte/tinyjax
cd tinyjax
uv pip install -e ".[dev,docs]" # or: python -m pip install -e ".[dev,docs]"
pre-commit install
git config --local core.hooksPath .githooks
Requires Python >= 3.12. Runtime dependencies (numpy, ml_dtypes, jaxlib==0.10.2) are pulled automatically. See RELEASING.md for how releases are cut and docs/23-comparing-to-real-jax.md (lands with CH23) for why jaxlib is a pinned dependency.
Status
Under construction. The chapter roadmap lives in LEARNING_PATH.md; the currently-shipped chapters appear there with a check mark.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tinyjax-0.1.0.dev0.tar.gz.
File metadata
- Download URL: tinyjax-0.1.0.dev0.tar.gz
- Upload date:
- Size: 21.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
288c7f939e109dadb1c54eae866aa19bf12908d885da7dd6a946c9ff0719fe19
|
|
| MD5 |
dd15aa3dbd410f99c92bb2fe053b67ea
|
|
| BLAKE2b-256 |
ab00c94fcdb2c42f02f4662576fa1819217a683ff177ab09d23660437a6c3408
|
Provenance
The following attestation bundles were made for tinyjax-0.1.0.dev0.tar.gz:
Publisher:
release.yml on gkatte/tinyjax
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tinyjax-0.1.0.dev0.tar.gz -
Subject digest:
288c7f939e109dadb1c54eae866aa19bf12908d885da7dd6a946c9ff0719fe19 - Sigstore transparency entry: 2123691760
- Sigstore integration time:
-
Permalink:
gkatte/tinyjax@96035644fd694e001ffd3af29121a488db50c108 -
Branch / Tag:
refs/tags/v0.1.0.dev0 - Owner: https://github.com/gkatte
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@96035644fd694e001ffd3af29121a488db50c108 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tinyjax-0.1.0.dev0-py3-none-any.whl.
File metadata
- Download URL: tinyjax-0.1.0.dev0-py3-none-any.whl
- Upload date:
- Size: 15.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2a4e359afdf6fc171bf7095744a1be4089553ff019097fc553335e50e1766f6
|
|
| MD5 |
541a6e873e8c2f156584b9b87fb3ab42
|
|
| BLAKE2b-256 |
a246fb47db6791e326773fee2fad95fa0f31fcd0b7394ac6cacbda0de823822f
|
Provenance
The following attestation bundles were made for tinyjax-0.1.0.dev0-py3-none-any.whl:
Publisher:
release.yml on gkatte/tinyjax
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tinyjax-0.1.0.dev0-py3-none-any.whl -
Subject digest:
f2a4e359afdf6fc171bf7095744a1be4089553ff019097fc553335e50e1766f6 - Sigstore transparency entry: 2123691812
- Sigstore integration time:
-
Permalink:
gkatte/tinyjax@96035644fd694e001ffd3af29121a488db50c108 -
Branch / Tag:
refs/tags/v0.1.0.dev0 - Owner: https://github.com/gkatte
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@96035644fd694e001ffd3af29121a488db50c108 -
Trigger Event:
push
-
Statement type: