Skip to main content

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

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

Apache-2.0. See LICENSE and NOTICE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tinyjax-0.1.0.dev0.tar.gz (21.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tinyjax-0.1.0.dev0-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

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

Hashes for tinyjax-0.1.0.dev0.tar.gz
Algorithm Hash digest
SHA256 288c7f939e109dadb1c54eae866aa19bf12908d885da7dd6a946c9ff0719fe19
MD5 dd15aa3dbd410f99c92bb2fe053b67ea
BLAKE2b-256 ab00c94fcdb2c42f02f4662576fa1819217a683ff177ab09d23660437a6c3408

See more details on using hashes here.

Provenance

The following attestation bundles were made for tinyjax-0.1.0.dev0.tar.gz:

Publisher: release.yml on gkatte/tinyjax

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for tinyjax-0.1.0.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 f2a4e359afdf6fc171bf7095744a1be4089553ff019097fc553335e50e1766f6
MD5 541a6e873e8c2f156584b9b87fb3ab42
BLAKE2b-256 a246fb47db6791e326773fee2fad95fa0f31fcd0b7394ac6cacbda0de823822f

See more details on using hashes here.

Provenance

The following attestation bundles were made for tinyjax-0.1.0.dev0-py3-none-any.whl:

Publisher: release.yml on gkatte/tinyjax

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page