Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
447 changes: 447 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

48 changes: 32 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

**Fastest LLM inference on Apple Silicon — now on NVIDIA GB10 (DGX Spark) and AMD Strix Halo / Strix Point, too.**

Pull a model from HuggingFace, chat with it, or serve an OpenAI-compatible API — all from one CLI.
Pull a model from HuggingFace, chat with it, or serve it over OpenAI-, Anthropic- and Ollama-compatible APIs — all from one CLI.

[![Docs](https://img.shields.io/badge/docs-docs.basecompute.co-5b8fa8)](https://docs.basecompute.co)
[![Docs](https://img.shields.io/badge/docs-basert.basecompute.co-5b8fa8)](https://basert.basecompute.co)
[![License](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE)
[![Platform](https://img.shields.io/badge/platform-Apple%20Silicon%20%C2%B7%20NVIDIA%20GB10%20%C2%B7%20AMD%20Strix-black)](#requirements)
[![Bindings](https://img.shields.io/badge/bindings-Python%20%C2%B7%20Node%20%C2%B7%20Rust%20%C2%B7%20Swift-444)](docs/bindings/index.md)
Expand All @@ -22,21 +22,23 @@ engine: the `basert` CLI (model hub + converter), the `.base` model format, the
public C API, and language bindings for Python, Node, Rust, and Swift.

- **One CLI for everything** — `basert pull`, `chat`, `serve`, `convert`.
- **OpenAI-compatible server** — chat, completions, embeddings, transcription,
tool calls, continuous batching, paged-KV, and prefix caching.
- **A local API server** — `basert serve` runs
[Superfluid](https://github.com/basecompute/superfluid): OpenAI-, Anthropic-
and Ollama-compatible endpoints, tool calls, continuous batching, prefix
caching and speculative decoding.
- **Multimodal** — text, vision, and audio on supported models.
- **Its own `.base` format** — affine quantization (Q2–Q8), optional AWQ
calibration, and signed bundles.
- **Bindings everywhere** — Python, Node, Rust, and Swift over a stable C API.
- **A drop-in coding-agent backend** — see [below](#use-it-as-a-coding-agent).

> **Documentation:** **[docs.basecompute.co](https://docs.basecompute.co)** (source in [`docs/`](docs/index.md)).
> **Documentation:** **[basert.basecompute.co](https://basert.basecompute.co)** (source in [`docs/`](docs/index.md)). The server's API is documented at [docs.basecompute.co](https://docs.basecompute.co).

## Requirements

One of:

- Apple Silicon (M1 or later), macOS 14+.
- Apple Silicon (M1 or later), macOS 15+.
- NVIDIA GB10 (DGX Spark), Linux / arm64 with a CUDA driver.
- AMD Strix Halo (Ryzen AI Max, gfx1151) or Strix Point (Ryzen AI 300,
gfx1150), Linux / x86-64 on Ubuntu 24.04 or newer, with the ROCm 10 runtime
Expand Down Expand Up @@ -70,8 +72,18 @@ curl -LsSf https://basecompute.co/install.sh | sh

This installs the prebuilt engine for your platform and the `basert` CLI to
`~/.basert` and adds it to your `PATH`. Restart your shell afterward (or
`export PATH="$HOME/.basert:$PATH"`). See
[Installation](docs/getting-started/installation.md) for building from source.
`export PATH="$HOME/.basert:$PATH"`). Update later with `basert self update`.

Or use a package manager:

```sh
brew install basecompute/tap/basert
pip install basert # also pipx / uv tool
npm install -g @basecompute/basert
```

See [Installation](docs/getting-started/installation.md) for the details and
for building from source.

### 2. Pull a model

Expand All @@ -80,8 +92,8 @@ basert pull Qwen/Qwen3-4B # download from HuggingFace + convert to .base
basert list # show installed models
```

Models are cached under `~/.cache/baseRT/models` (override with
`$BASERT_MODELS_DIR`). To pick a specific quant build, append `:default-q8` to
Models are cached under `~/Library/Caches/baseRT/models` on macOS and
`~/.cache/baseRT/models` on Linux (override with `$BASERT_MODELS_DIR`). To pick a specific quant build, append `:default-q8` to
the id (or pass `--variant default-q8`).

### 3. Chat
Expand All @@ -90,7 +102,7 @@ the id (or pass `--variant default-q8`).
basert chat Qwen/Qwen3-4B
```

### 4. Serve an OpenAI-compatible API
### 4. Serve an API

```sh
basert serve Qwen/Qwen3-4B --api-key "$(uuidgen)" --port 8080
Expand Down Expand Up @@ -134,20 +146,24 @@ Inside pi, run `/model` to pick a served model. See the

## The `basert` CLI

`basert` is a single front-end. Model-management commands run natively; runtime
commands are forwarded to the matching `basert-<cmd>` engine binary.
`basert` is a single front-end. Model-management commands run natively; `chat`,
`complete` and `bench` run the matching `basert-<cmd>` engine binary, and `serve`
runs Superfluid, installing it on first use.

| Command | What it does |
| --- | --- |
| `basert pull <id>` | Download from HuggingFace (convert-on-pull) or the catalog |
| `basert list` | List installed models (`--remote` to include the catalog) |
| `basert convert <src>` | Convert a local GGUF / HF / MLX checkpoint to `.base` |
| `basert chat <model>` | Interactive chat |
| `basert serve <model>` | OpenAI-compatible HTTP server (`--model` repeats for multi-model) |
| `basert serve <model>` | HTTP server (Superfluid; `--model` repeats for multi-model) |
| `basert complete <model>` | One-shot completion (text / image / audio) |
| `basert bench <model>` | Throughput benchmark |
| `basert inspect <model>` | Dump a `.base` header + tensor inventory |
| `basert sign` / `verify` / `keygen` | ed25519 signing of `.base` bundles |
| `basert computearena` | Run a ComputeArena benchmark and save a signed report |
| `basert superfluid install` / `status` | Install or check the server `basert serve` runs |
| `basert self update` / `check` / `list` / `use` | Update basert, or switch between installed versions |

Full flag reference: [CLI reference](docs/cli/reference.md).

Expand All @@ -159,7 +175,7 @@ Full flag reference: [CLI reference](docs/cli/reference.md).
| [`include/baseRT/`](include/baseRT/) | The stable public C API (`baseRT.h`, `types.h`). |
| [`bindings/`](bindings/) | Python, Node, Rust, and Swift. |
| [`benchmarks/`](benchmarks/) | Scripts and reference results. |
| [`docs/`](docs/index.md) | The documentation site. |
| [`docs/`](docs/index.md) | The documentation site ([basert.basecompute.co](https://basert.basecompute.co)). |

This repository — the CLI, `.base` format, public headers, and bindings — is
licensed under **Apache-2.0**. The engine ships as a separate prebuilt binary
Expand All @@ -168,7 +184,7 @@ under its own license; see

## Links

- **[Documentation](https://docs.basecompute.co)** · [Server API](docs/reference/server-api.md) · [`.base` format](base-convert/FORMAT.md)
- **[Documentation](https://basert.basecompute.co)** · [Server API](docs/reference/server-api.md) · [`.base` format](base-convert/FORMAT.md)
- [Security policy](SECURITY.md) · [Contributing](CONTRIBUTING.md)

## License
Expand Down
21 changes: 13 additions & 8 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

## Supported Versions

baseRT is pre-1.0. Security fixes are applied to the current `v1.0`
branch only. Once we tag a `v1.0.0` release, the latest minor will be
supported for security fixes; older minors may not be.
baseRT is pre-1.0. Security fixes go into the next release only; update
with `basert self update`. Once we tag a `v1.0.0` release, the latest
minor will be supported for security fixes; older minors may not be.

## Reporting a Vulnerability

Expand Down Expand Up @@ -37,15 +37,20 @@ depend on severity; we will coordinate disclosure with you.

## Hardening notes for operators

The HTTP server shipped via `basert-serve` is intended for trusted
networks. Before exposing it to a public network:
`basert serve` runs [Superfluid](https://github.com/basecompute/superfluid),
which is intended for trusted networks. Before exposing it to a public
network:

- Always set `--api-key` to a non-empty value. The server will print a
loud warning at startup if no key is set.
- Always set `--api-key` to a non-empty value. The server prints a
warning at startup when it binds off loopback without one.
- Bind to a specific interface; do not bind to `0.0.0.0` without an
upstream auth layer.
- Place it behind a reverse proxy (nginx, Caddy) that enforces TLS,
rate limiting, and request-size limits independent of the server's
own caps.
- Restrict who can call `POST /v1/models/load` — that endpoint accepts
a file path, and on the host where the server runs.
a file path on the host where the server runs.

See [Security](docs/reference/security.md) for the rest, and
[Superfluid's security policy](https://github.com/basecompute/superfluid/blob/main/SECURITY.md)
for issues in the server itself.
13 changes: 7 additions & 6 deletions base-convert/profiles/PROFILES.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ tensor, matched by glob pattern. Pass one with `--profile <file.json>`.
from most-specific to the catch-all `**`.
- `dtype` — `f16`, `bf16`, `f32`, or a packed quant: `base_q2` … `base_q8`
(see `CANONICAL_QUANT_SPEC.md` for the layouts).
- Optional `calibration` block enables AWQ:
```json
"calibration": { "method": "awq", "tokens": 1024, "dataset": "wikitext-103" }
```
AWQ needs a calibration corpus; download WikiText-103 and pass
`--calib-file <wiki.train.raw>`.
- Optional `"algo": "awq"` on a rule asks for AWQ on the tensors it matches
(the default is `"rtn"`, round to nearest). AWQ also needs an
activation-stats sidecar, passed to `basert convert` with
`--awq-profile <sidecar.json>`; see
[AWQ calibration](../../docs/guides/converting.md#awq-calibration).
- A top-level `calibration` block is accepted and recorded, but does not turn
AWQ on; the per-rule `algo` does.

## Bundled profiles

Expand Down
35 changes: 14 additions & 21 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,20 @@

Reproduce baseRT throughput numbers on your own hardware.

## Prerequisites

1. Download an engine release and unpack it into `build/` at the repo root
(see the top-level README's "Getting the engine"). You need `build/basert-bench`.
2. Convert a model to `.base` (see `base-convert/`) into `models/`.

## Run

```sh
# benchmark every models/*.base, 5 reps, pp ∈ {128,256,512}, tg 128
benchmarks/scripts/run_bench.sh
Install baseRT (see [Installation](../docs/getting-started/installation.md)),
then benchmark a model with `basert bench`:

# or a specific model / custom sweep
PP_VALS="128 512" REPS=3 benchmarks/scripts/run_bench.sh models/your-model.base
```sh
basert bench basecompute/Qwen3-4B # pp512 / tg128, 5 reps
basert bench ./models/your-model.base -p 128 -n 128 -r 3
```

Results are written to `benchmarks/results/<arch>_baseRT.csv` with columns
`model,size_mb,engine,test,tok_per_sec,stddev`. `ppN` rows are prefill
throughput at prompt length N; `tgN` rows are decode (token-generation)
throughput.
`ppN` is prefill throughput at prompt length N; `tgN` is decode
(token-generation) throughput. See
[Benchmarking](../docs/guides/benchmarking.md) for every flag and for
ComputeArena, which saves a signed report.

## Example results

Expand All @@ -30,10 +24,9 @@ numbers from earlier runs (dated by commit). They are not continuously
republished — regenerate locally for an apples-to-apples comparison with your
build and models.

## Legacy / comparison scripts
## Scripts

The other scripts in `scripts/` (`mlx_benchmark.sh`, `gguf_benchmark.sh`,
`three_way_benchmark.sh`, `uzu_benchmark.sh`, …) compare against external engines
(mlx-lm, llama.cpp, uzu). They require those tools installed and predate the
`.base`-only loader, so they reference GGUF inputs — keep them as a reference for
methodology rather than a turnkey run.
The scripts in `scripts/` sweep `basert-bench` over a model list (override the
binary with `BASERT`) and compare against external engines (mlx-lm). They need
those tools installed and name their own model files; keep them as a reference
for methodology rather than a turnkey run.
60 changes: 40 additions & 20 deletions docs/bindings/index.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,53 @@
# Bindings

BaseRT exposes a stable C API (`include/baseRT/baseRT.h`) and ships idiomatic
wrappers for four languages. All of them link the single `libbaseRT.dylib`
(Metal kernels embedded) — no separate `.metallib` to manage.
BaseRT exposes a C API (`include/baseRT/baseRT.h`) and ships idiomatic
wrappers for four languages. All of them drive the same engine library:
`libbaseRT.dylib` on macOS (Metal kernels embedded, no separate `.metallib`
to manage) and `libbaseRT.so` on Linux.

| Language | Package | Import | Source |
| Language | Install | Import | Source |
| --- | --- | --- | --- |
| [Python](python.md) | `baseRT` | `import baseRT` | [`bindings/python`](https://github.com/basecompute/baseRT/tree/main/bindings/python) |
| [Node](node.md) | `@baseRT/node` | `import { BaseRTModel }` | [`bindings/node`](https://github.com/basecompute/baseRT/tree/main/bindings/node) |
| [Rust](rust.md) | `baseRT` | `use baseRT::…` | [`bindings/rust`](https://github.com/basecompute/baseRT/tree/main/bindings/rust) |
| [Swift](swift.md) | `BaseRT` | `import BaseRT` | [`bindings/swift`](https://github.com/basecompute/baseRT/tree/main/bindings/swift) |
| [Python](python.md) | `pip install basert` | `import baseRT` | [`bindings/python`](https://github.com/basecompute/baseRT/tree/main/bindings/python) |
| [Node](node.md) | `npm install @basecompute/basert` | `import { BaseRTModel } from "@basecompute/basert"` | [`bindings/node`](https://github.com/basecompute/baseRT/tree/main/bindings/node) |
| [Rust](rust.md) | `cargo add baseRT` | `use baseRT::…` | [`bindings/rust`](https://github.com/basecompute/baseRT/tree/main/bindings/rust) |
| [Swift](swift.md) | local Swift package | `import BaseRT` | [`bindings/swift`](https://github.com/basecompute/baseRT/tree/main/bindings/swift) |

The PyPI and npm packages include the prebuilt engine for your platform. The
Rust crates and the Swift package link an engine you have installed.

## Finding the engine

Each binding needs to locate `libbaseRT.dylib` at runtime. Unpack an
[engine release](../reference/engine-releases.md) into `build/` at the repo root
(the default search path) or set:
Each binding needs to locate the engine library. Without an override, the
bindings look in this order:

1. The engine inside the package (`pip install basert`, `npm install
@basecompute/basert`) — Python and Node.
2. A source checkout's `build/` directory.
3. An install-script engine: `$BASERT_INSTALL_DIR`, default `~/.basert`.
4. Homebrew: `/opt/homebrew/opt/basert/libexec` on macOS,
`/home/linuxbrew/.linuxbrew/opt/basert/libexec` on Linux.

To point a binding at a specific engine instead, set:

| Variable | Used by | Value |
| --- | --- | --- |
| `BASERT_LIB_PATH` | Python, Node | The library file itself |
| `BASERT_LIB_DIR` | Rust, Swift | The directory containing it |

| Variable | Used by |
| --- | --- |
| `BASERT_LIB_PATH` | Python, Node |
| `BASERT_LIB_DIR` | Rust, Swift |
The Swift package uses `BASERT_LIB_DIR`, or the checkout's `build/`, only.

The dylib carries the Metal kernels and its own framework/C++ dependencies, so
it's a single redistributable artifact across every binding.
An [engine release](../reference/engine-releases.md) unpacked into `build/`
at the repo root works for all four.

## Shared model

All bindings load the same `.base` files you produce with `basert pull` /
`basert convert`, and expose the same primitives: encode/decode, prefill, single
or streaming generation, embeddings, chat-template formatting, and (for
Whisper-class models) transcription.
`basert convert`, and expose the same primitives: encode/decode, prefill,
single or streaming generation, multi-turn continuation from the KV cache,
embeddings, chat-template formatting, and (for Whisper models) transcription.
Python, Node and Swift add image and audio prefill for multimodal models. Node
and Swift also expose the process-wide engine settings, such as the KV-cache
width and the Neural Engine prefill split; set those before loading a model.

A model handle is single-owner: use one model from one thread at a time, and
don't call a model from inside its own token callback.
Loading
Loading