Apsi

Documentation · Apsi 2.6.0

Learn Apsi

Guides and references for the language, the native compiler, AI and science libraries, and the library ecosystem.

You are reading the documentation of Apsi 2.6.0. The current version is Apsi 2.6.2 — what changed.

Start here

Getting started

This guide takes you from installation to a first program, a first trained model and a first library in about ten minutes.

3 min read

Write Apsi your way

Apsi is designed so that you do not have to learn a new language before you are productive.

4 min read

Install on Windows

After installing, run apsi doctor to check your machine against these targets. Download: the Windows installer, the Linux installer (ApsiSetup-2.6.0-linux.sh) and the .deb are on apsi.dev/download, each with its SHA-256.

5 min read

Install on Linux

Works on every x86-64 distribution with glibc 2.17 or newer, such as Ubuntu 18.04+, Debian 10+, Fedora, Arch, openSUSE, Mint and Pop!OS (the shell installer also on ARM, and in WSL on Windows).

3 min read

Troubleshooting

This page covers the problems people most often hit right after installing Apsi, with the exact commands to fix them. Why it happens.

6 min read

Versions compared

2.6.0 for everything new. Programs written for 2.4.4, 2.0.0 and 1.10.0 run on 2.6.0 unchanged — each version only adds.

3 min read

What's new in 2.6.0

Adding cards should make training faster, not different.

15 min read

Project overview

Apsi is a programming language for AI, physics and servers. Physical units, tensor-shape checking, automatic differentiation, number formats from FP64 down to FP4, data pipelines and a hardened HTTP server are built into the language.

16 min read

Licensing

Apsi is published under the Apsi License 2.0 (the LICENSE file). This page explains it in plain words with examples.

5 min read

AI

AI and machine learning

Apsi does not force a ready-made architecture on you. Every network is an ordinary function that takes a "parameter tree" (record / list / struct), and grad differentiates with respect to every parameter in it.

8 min read

Training that finishes

This page explains how Apsi 2.6.0 keeps a training run correct, repeatable and alive: training by steps, checkpoints that resume to the exact bit, protection against crashes and bad batches.

12 min read

Training on your GPU

Everything Apsi does on a graphics card, in one place: running language models, the weight formats, training, serving, temperature control, and what to do when something goes wrong.

29 min read

Layers

use layers builds neural networks of any architecture out of small, composable layers: plain stacks, residual networks, any directed acyclic graph (several inputs and outputs, shared weights), convolutional and recurrent networks.

12 min read

Physics-informed networks

A physics-informed network learns the solution of an equation from the equation itself: the loss is the equation's residual at chosen points, written with the network's derivatives.

3 min read

Graphs that reach far

Graph neural networks pass messages along edges: one layer moves information one hop.

4 min read

From Python and PyTorch

apsi convert translates Python files — or whole projects — into Apsi with Python's exact semantics: the converted program prints the same text, raises the same errors, byte for byte.

15 min read

Reinforcement learning

use rl provides environments, advantage estimation, policy helpers, complete training algorithms (PPO, DQN, REINFORCE), the losses used to train language models from human preferences (RLHF, DPO, IPO, GRPO), beam search.

4 min read

Model files

Apsi saves and loads models in the formats the rest of the ecosystem uses, and in its own checkpoint format (.apsim) for everything those formats cannot hold: physical units, compressed tensors, the shape of the parameter tree.

6 min read

Large models & clusters

Training a 21B, 500B, 1T or 2T-parameter model is decided by arithmetic before any code runs: how much memory each GPU needs, how the model must be split, how many GPUs, and how many days.

3 min read

Backends

Every model built with use layers runs on two backends without changing a line of the model:

8 min read

Fewer AI tokens

Language models charge by the token and read slower the more they get.

9 min read

Hugging Face models

use hub downloads models from the Hugging Face Hub, tokenizes text and runs the models natively — embeddings, classification, named entities, fill-mask and text generation — with Apsi's own code.

16 min read

RAM, SSD and GPU

Big data and big models run out of memory in the middle of the night.

5 min read