Research language · edition alpha-2027 (draft)
Compile a learning system, from its mathematics to its GPU instructions.
Alpha is a dependently typed language and compiler. You write a model, how it learns and where it runs as one program; the compiler checks all of it and emits every byte of a self-contained executable for the device you choose.
module Hello
def double : (pi unrestricted n : Nat . Nat) =
(lambda unrestricted n : Nat . (nat-add n n))
def main : Nat =
(double 21)alpha run → exit status 42The vision, in a short film
The vision1 min 36 s · sound onWhat Alpha is
One programThe model, its learner, the training run and the device pairing are one typed program. The compiler sees all of it before it specializes anything.Any deviceA device is a typed profile, not a runtime. Model code never mentions hardware, so moving to new hardware means adding a target, not rewriting the model.No fixed catalogueThere is no closed list of operators or kernels. Mathematics, memory layouts, schedules and GPU instructions are ordinary values you can recombine.Built for agentsEverything has a literal name, checks take seconds and errors have stable codes, so an agent can take a system apart and rebuild it safely.How it works
From a description to a running executable.
Every layer is Alpha code the compiler can see: the mathematics, the learning rule, the memory plan, the launch schedule and the machine instructions. Nothing is hidden in a vendor library.
- 01
Describe
Write the model, the learner and the run as ordinary Alpha definitions, with no device in sight. A separate pairing names the hardware.
- 02
Check
Dependent types, quantities and effects are checked across the whole program. Shapes, layouts and resource limits are facts, not comments.
- 03
Realize
The compiler plans memory, schedules launches and lowers each computation to the target's machine code, refusing anything that fails its hazard checks.
- 04
Run
The result is one self-contained executable that trains, checkpoints and predicts, talking to the device driver directly with no framework underneath.
Learning systems
What Alpha trains today.
Four systems are active, each a model, a learner, a run and a device pairing compiled into one executable. Their dashboards read the runs' own records.
Every system and where it runs →GPT-2 small (124M), trained on an RTX 3070, and nanochat's 1.38B d24, trained through the record's full schedule on two H100s.
systems/alphaosAlphaOSA GPU-resident operating system Alpha compiles, launched once per GPU: its nodes claim tasks from queues and dataflow graphs.
systems/gpt2-alphaosGPT-2 on AlphaOSGPT-2 small trained as AlphaOS tasks instead of kernel launches: the model the knots research runs on.
systems/midgetMidgetA byte-level transformer that learns as AlphaOS tasks: its learner, updater, sampler and evaluator are loaded programs.
Any device
The model never names the hardware.
A model's definition cannot reach a device, an address or a launch. Hardware enters through a small pairing that names the card's typed profile and the command-stream words its launches need; the host built from it refuses any other card, by name, before its first allocation. GPT-2's model source already builds for two NVIDIA GPU generations, the RTX 3070 (sm_86) and the H100 (sm_90), and a new vendor is a new target package beside them.
-- GPT-2 small, openai-community/gpt2 config.json (Radford et al. 2019):
-- vocabulary 50257 (byte-level BPE, <|endoftext|> = 50256), context 1024,
-- 12 blocks of width 768, 12 heads of 64, feed-forward width 3072
-- (n_inner = 4 n_embd), gelu_new, LayerNorm epsilon 1e-5, tied input and
-- output embeddings, learned positions, biases on every linear map.
-- The weights start fresh; the released checkpoint is not used.
def gpt2TokenVocabulary : Nat = 50257
def gpt2Geometry : LearnedPositionDecoderGeometry =
(constructor LearnedPositionDecoderGeometry LearnedPositionDecoderGeometryValue
50432 gpt2TokenVocabulary 1024 12 768 12 64 3072)-- The H100 SXM: the same typed SM86 kernels, realized on sm_90 by
-- Accelerator.SM90.Lowering (global accesses in raw form, Hopper's branch
-- displacements, every other word kept), launched with QMD V04 on Hopper's
-- classes (comparisons/h100/README.md).
def gpt2H100Target : GPT2Target =
(record
GPT2Target
(gpt2TargetProfileValue = runPodH100TargetProfile)
(gpt2TargetQMDArchitectureValue = runPodSM90QMDArchitecture)
(gpt2TargetComputeClassValue = runPodSM90ComputeClass)
(gpt2TargetSPAVersionValue = runPodSM90SPAVersion)
(gpt2TargetPlanHostABIValue = nvidiaPlanHostHopper)
(gpt2TargetQMDSlotBytesValue = runPodSM90QMDSlotBytes)
(gpt2TargetRealizationValue = gpt2SM90Realization))Beyond today's architectures
Not a transformer framework.
Alpha is not built around a tensor operation, a model family or one vendor. Transformers, attention and matrix products are libraries written in Alpha, not assumptions in the compiler, so the same machinery can express very different learning systems and change an algorithm and its hardware realization together.
How learning systems are built →- Feed-forward and recurrent networks
- Scans and state-space models
- Convolutional and spectral systems
- Sparse, graph and event-driven systems
- Fixed-point and differential-equation systems
- Energy-based and implicit models
- Forward-, reverse- and mixed-mode differentiation
- Local, perturbation and population learning
The language
Strict where it matters.
Invalid programs are rejected before anything runs, on the CPU, on the GPU, or on a rented card by the hour.
Read the language guide →- Dependent types
- Types can mention values, so a tile that does not fit shared memory, or a buffer of the wrong length, is a type error.
- Quantities
- Every binder is erased, affine, linear or unrestricted. Proofs and type-level data vanish from the executable by construction.
- Explicit effects
- Effects and partiality are part of a computation's type. Nothing performs I/O or diverges without saying so.
- No fallbacks
- If a target cannot do something, compilation stops with a stable diagnostic. Work never silently moves somewhere else.
Built for agents
Start with a coding agent.
Most of Alpha is written by AI agents, and the repository's AGENTS.md tells them how to work in it. Paste this into Claude Code, Codex or OpenCode to get going.
Clone https://github.com/thomasdavis/alpha and read AGENTS.md first. Build the compiler: (cd bootstrap/haskell && cabal build -O2 exe:alpha). Write a small Alpha module whose main computes a number, check it with alpha check, run it with alpha run, and explain what each quantity in it means. Then read systems/gpt2/src/GPT2/Speedrun.alpha and explain how nanochat's d24 model is stated without naming any GPU.
Where next
Pick a starting point.
Build the compiler and run a first program.
LearnLanguage guideSyntax, types, quantities, effects and families, with examples.
ExploreLearning systemsThe models written in Alpha and where each one runs.
ExploreHardwareEvery target device and its typed profile.
UnderstandLearning systems in AlphaHow a learning idea becomes a checked, comparable experiment.
UnderstandPhilosophyWhy Alpha reopens the design space instead of freezing today's stack.
ExploreSource browserEvery Alpha file, with definitions linked across modules.
EvaluateHard questionsThe strongest objections to the project, answered in the open.