Apsi

Documentation · Apsi 2.0.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.0.0. The current version is Apsi 2.4.4 — what changed.

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.

5 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.

11 min read

From Python and PyTorch

apsi convert translates Python files — or whole folders — into Apsi, maps the libraries you use onto Apsi's own built-ins, checks the result and tells you exactly which lines need a human look.

9 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.

4 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