Skip to main content

nanoscope

CI PyPI License: MIT

A web app for learning how small language models work and for testing changes to them properly. You build a model in lessons, edit it as code or as a graph, train it, and compare it with another model with confidence intervals instead of a single loss number.

It has three parts that share one code path:

  • Lessons: 33 of them in 8 paths. Foundations and The modern block build a model from a bigram up to a modern transformer block; later paths cover honest ablations, evaluation, scaling, interpretability, efficiency and extending the library. Each lesson has a check that says why it fails, and passing one unlocks the bigger blocks.
  • A model page where one file is both code and a graph. Drag a block onto another to swap it and the file changes by one line. A model written in plain PyTorch shows the structure its code builds.
  • Experiments with seeds, paired comparisons, 95% intervals, preregistered studies and baselines for the shipped models.

Screenshots

A lesson's check says why it fails:

The multi-head attention lesson with a failed check: MultiHead has no parameter named q.weight

Dragging RMSNorm onto LayerNorm in the graph changes one line of the file:

The model page with the block palette, the graph with RMSNorm selected, the inspector and the code

Compare reports each difference with a 95% interval over seeds:

Compare: Modern, Bigram and GPT-2 baselines with intervals and a forest plot

A study trains every variant with several seeds under one budget:

The m1-ablation study: eight variants, three seeds each

Installation

With Docker:

git clone https://github.com/almajd3713/nanoscope
cd nanoscope
./up.sh -d
docker compose logs api | grep login

Open the link that grep prints. The app is at http://127.0.0.1:8765 and trains on one CPU worker. ./up.sh also starts a GPU worker when Docker can use an NVIDIA GPU (./up.sh --cpu skips it).

Without Docker, on Python 3.10 to 3.13:

pip install torch --index-url https://download.pytorch.org/whl/cpu   # optional: CPU-only torch
pip install "nanoscope-lab[server]"
nanoscope serve --worker cpu

On Linux, pip's default torch brings about 4 GB of CUDA libraries; the first line skips them when you have no NVIDIA GPU. nanoscope serve serves on http://127.0.0.1:8000. The login token lets whoever has it run code on your machine, so keep the server on localhost or behind an SSH tunnel. Setup for GPUs, remote use and backups is in docs/deploy.md.

Usage

The Learn, Tinker, Research and Extend switch hides controls you don't need yet. It doesn't change what runs. docs/gui.md describes each screen. The app calls the same code as Python and the command line:

from nanoscope import compare, run

result = run(MyModel, preset="tinystories-5min")
compare(result, "gpt2")
nanoscope run models/my_model.py:MyModel --seeds 3
nanoscope compare modern gpt2 --preset tinystories-5min
nanoscope --help

docs/research.md covers studies and docs/blocks.md covers writing your own blocks. All the guides are listed in docs/.

Develop

uv sync --all-extras
make check        # what CI runs
make web          # build the app into the package
pnpm -C web dev   # app with hot reload

Data

Tokens come from TinyStories (CDLA-Sharing-1.0) and FineWeb-Edu (ODC-By 1.0), cached under ~/.nanoscope/data.

Architecture notes are in docs/architecture.md. MIT licensed.

Metadata

Release files for nanoscope-lab 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nanoscope-lab 0.7.0
File Size Uploaded Provenance Actions
nanoscope_lab-0.7.0.tar.gz 4.6 MB With provenance Details for nanoscope_lab-0.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nanoscope-lab 0.7.0
File Interpreter ABI Platform Actions
nanoscope_lab-0.7.0-py3-none-any.whl Python 3 none any Details for nanoscope_lab-0.7.0-py3-none-any.whl

Total release size: 7.2 MB

Release files / nanoscope_lab-0.7.0.tar.gz

Download URL nanoscope_lab-0.7.0.tar.gz
Size 4.6 MB
Tags Source
SHA-256 checksum
How to use checksums
1a752b602d3b50838cedecf7b7ca1f8a0992ca71cb66d0f1e425b9fcb29f1f07
BLAKE2b-256 checksum
How to use checksums
7ca1bb41fb51658f6eeca38c415ab537d8f66eae0a62386270dbbf2ba0b36c95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Release files / nanoscope_lab-0.7.0-py3-none-any.whl

Download URL nanoscope_lab-0.7.0-py3-none-any.whl
Size 2.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
e72c968635f246703bf996fdc435d19e7bc5979ba103a12b1c25374e8a6b2251
BLAKE2b-256 checksum
How to use checksums
77ba3b497d283b0940d7902fa687329e5396196bd1f92044cf4a7b5c32b708b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Security for nanoscope-lab 0.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nanoscope_lab-0.7.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page