Documentation · Apsi 2.4.4
Learn Apsi
Guides and references for the language, the native compiler, AI and science libraries, and the library ecosystem.
What's new in 2.4.4
Exact Python conversion, real time, memory, tokens, tables, databases — with examples and numbers.
Open →02New to Apsi?
Write it like Python, let an AI write it, or convert Python — no new language to learn first.
Open →03Everything on one page
All syntax with examples, then every built-in, module member and command.
Open →04Fast by design
The few habits that make Apsi run at C speed — and why each one matters.
Open →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.
2 min readWrite Apsi your way
Apsi is designed so that you do not have to learn a new language before you are productive.
4 min readInstall on Windows
After installing, run apsi doctor to check your machine against these targets. Download: the Windows installer, the Linux installer (ApsiSetup-2.4.4-linux.sh) and the .deb are on apsi.dev/download, each with its SHA-256.
4 min readInstall 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 readTroubleshooting
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 readVersions compared
2.4.4 for everything new. Programs written for 2.0.0 and 1.10.0 run on 2.4.4 unchanged — each version only adds.
2 min readWhat's new in 2.4.4
This page walks through everything 2.4.4 adds, with a working example for each part, the numbers we measured, and the limits you should know about.
12 min readProject 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.
15 min readLicensing
Apsi is published under the Apsi License 2.0 (the LICENSE file). This page explains it in plain words with examples.
4 min readThe language
Everything on one page
This page is the whole language in one place: every piece of syntax with a short example, then every built-in function, every standard module and every member, and every command of Apsi 2.4.4.
85 min readLanguage reference
Apsi 2.4.4 · source files use the extension .apsi and the UTF-8 encoding.
55 min readNative compiler
Apsi compiles functions to machine code.
18 min readMaximum performance — and why
Apsi programs are correct by default. Being fast as well depends on a handful of habits. Each one below says what to do, why (what happens inside Apsi), and how big the difference is.
3 min readHardware & performance
About speed: f64/f32/f16 use the CPU's instructions directly. In the current runtime BF16/FP8/FP6/FP4/INT4 are stored as real-size codes (saving RAM, SSD and bandwidth in proportion to the bits) and decoded to FP32 for computing.
8 min readNumber formats (f64 … FP8)
Apsi tensors can hold six floating-point formats and the usual integer ones.
4 min readPermissions & security
Apsi assumes any program might be hostile, including one you downloaded, one an AI wrote, or a dependency of either. The defences are layered.
8 min readAI
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 readLayers
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 readGraphs that reach far
Graph neural networks pass messages along edges: one layer moves information one hop.
3 min readFrom 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.
11 min readReinforcement 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 readModel 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 readLarge 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 readBackends
Every model built with use layers runs on two backends without changing a line of the model:
8 min readFewer AI tokens
Language models charge by the token and read slower the more they get.
5 min readHugging 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.
8 min readRAM, SSD and GPU
Big data and big models run out of memory in the middle of the night.
5 min readReal time & data
Real time and video
use rt runs work on time: control loops at 1–2 kHz with microsecond accuracy, many periodic tasks on one scheduler, and video pipelines from 640×480 to 3840×2160 with the lowest possible latency.
5 min readTables
A columnar table engine built into Apsi: typed columns, whole-column kernels, no per-cell objects. It reads CSV, JSON and JSON Lines, filters, groups, joins, sorts and writes, with an API close to Polars.
3 min readDatabases
PostgreSQL, MySQL / MariaDB, MongoDB, Redis and SQLite clients built into Apsi's runtime — nothing to install, no driver to compile.
4 min readEcosystem
Libraries (.apsil)
Apsi libraries are distributed as .apsil files through the official registry. One command installs the newest version, every file is verified, and a library is used exactly like a standard module.
5 min readPublishing to apsi.dev
Everything on the website can be added and removed from the command line on any computer, or with the server command when you are on the server itself.
2 min readC, C++ and Python interop
Apsi keeps a clear border between its own world and the outside: values that cross it are converted by fixed rules (quantities with units always travel as {"value": ..., "unit": "..."}).
2 min readHTTP and WebSocket servers
Measured — a synthetic benchmark (a route that returns a fixed 25-byte JSON object, keep-alive, the Go load generator in benchmarks/web on the same machine):
6 min read.env, secrets and venvs
The file format is the one python-dotenv and Docker Compose read: KEY=value, export KEY=value, single and double quotes, multi-line double-quoted values, \n escapes in double quotes, # comments, and ${OTHER} expansion.
3 min readDebugging
Apsi has a real debugger: breakpoints, stepping, the call stack, variables and tensors — in VS Code and the other VS Code-family editors (F5) or in the terminal.
4 min readEditors
Apsi works in the editors people already use.
7 min readBuilding from source
Linux release files that need no internet and no Node.js (any Linux, also WSL):
3 min readPlayground
The playground/ folder is a web page that runs Apsi in the browser with no server doing the work. It uses Pyodide (CPython compiled to WebAssembly) and numpy entirely on the visitor's machine, so it can be put on the official website as is.
1 min read