Skip to content

Repository files navigation

zerogravity

The inference stack you can program live.

Run models and program every layer of inference — from pipelines and kernels to memory and scheduling. Use the Rust SDK or let your agent inspect, measure and improve the stack through MCP.

One native runtime. From local models to distributed fleets.

Quick start · Rust SDK · Make it yours · Live programming · Architecture · Roadmap

Quick start

Use the zerogravity executable on your PATH. The first prebuilt release is pending; install from source for now.

Run a local Qwen3.5 0.8B or 2B GGUF with its matching config.json and tokenizer.json alongside it:

zerogravity run ./model.gguf "Explain Rust ownership." --backend cpu
zerogravity inspect ./model.gguf

Or open an interactive interface:

zerogravity       # Terminal UI
zerogravity web   # Open the private URL printed in the terminal

Each interface runs in the foreground. See the CLI guide for cached models, acquisition, device selection and serving, or the OpenAI-compatible API guide for application integration. Available backends and commands depend on the installed build.

SDK at a glance

API preview: the SDK and live-programming examples below describe the planned Service/Client API; they are not runnable against the current SDK. See Quick start for current commands.

use zerogravity::Service;

let service = Service::embedded().await?;
let zg = service.client();
let source = zg.pull("catalog:qwen3.5-0.8b").await?;
let model = zg.load(source).await?;

println!("{}", model.run("Explain Rust ownership.").await?.text());
service.shutdown().await?;

Load local files or pull a model into the cache. Stream responses or serve the same model through an OpenAI-compatible endpoint. Applications also join shutdown on error paths.

Make the stack yours

Start with useful defaults, then shape inference around your models, hardware and workloads. Compose reusable parts at the level your application needs.

Layer What you control
Models and pipelines Model definitions, reusable operators, and text, image, audio, video and real-time task composition
Kernels and execution Native kernels, library calls, fusion and execution mappings
Placement and memory Devices, distributed workers, VRAM/UMA/RAM/SSD residency and prefetch
Scheduling and serving Concurrent models and requests, batching, speculation, fairness and latency budgets
State and caches Private sessions, paged growth, checkpoints, prefix reuse and configurable cache providers
Observation and improvement Live metrics, traces, experiments, comparisons and revision activation

These are the stack's design surfaces; current support and planned work are tracked below.

Live programming

Inspect a running model, try another implementation, and measure it against a representative workload. Activate a passing revision for new requests while admitted tasks and sessions keep their original revision.

This separate example uses a client connected to an active assistant route. region_id comes from inspection; fused_mapping is a supported implementation recipe; workload includes the inputs and comparison requirements.

let base = zg.revisions().active("assistant").await?;
let region = base.program().region(region_id)?;
let candidate = zg.revisions().derive(&base)
    .map_region(&region, &fused_mapping)
    .prepare().await?;

let report = zg.experiments().compare(&base, &candidate)
    .workload(workload)
    .check_inherited_contract()
    .record("kernel-comparison").run().await?;
report.require_acceptable()?;

zg.activate("assistant", &candidate)
    .if_generation(base.activation_generation())
    .for_new_requests().await?;

The report must satisfy declared numerical/state checks and workload performance requirements before activation. The experiment keeps its recipe and results so you can reopen, rerun, and iterate. The planned MCP adapter exposes the same native operations to agents.

An inference stack that evolves with you. Keep the revisions, workloads and measurements behind each improvement. Revisit a choice as your models, hardware or traffic change, or let an agent explore candidates within your budgets and promotion policy.

Deep execution pipelines

Choose how an inspected mathematical region executes: bind a kernel chain or request a fused implementation from a provider supporting the same contract.

API preview. These excerpts assume a live zg client and loaded model. norm_region_id and the kernel handles come from supported inspection and implementation discovery.

let program = model.program().await?;
let norm = program.region(norm_region_id)?;

let fused_mapping = zg.implementations().for_region(&norm)
    .fuse()
    .backend(Backend::Rocm)
    .compile().await?;

let fused_candidate = zg.revisions().derive(model.revision())
    .map_region(&norm, &fused_mapping)
    .prepare().await?;
Build an explicit RMS kernel chain

Typed bindings connect the region's inputs, parameters and attributes to supported kernel ports. The reduction produces the inverse RMS used by the application step.

let chain = zg.implementations().for_region(&norm)
    .chain()
    .step("reduce", rms_reduce_kernel)?
    .step("apply", rms_apply_kernel)?
    .bind(bindings! {
        "reduce.x"   <- norm.input("x")?,
        "reduce.eps" <- norm.attribute("epsilon")?,
        "apply.x"    <- norm.input("x")?,
        "apply.inv"  <- output("reduce", "inverse_rms"),
        "apply.w"    <- norm.parameter("weight")?,
        norm.output("y")? <- output("apply", "y"),
    })?
    .finish()?;

let chain_candidate = zg.revisions().derive(model.revision())
    .map_region(&norm, &chain)
    .prepare().await?;

The binding macro is illustrative authoring syntax over typed port references. RMS epsilon remains a fixed semantic attribute.

Compilation and chain construction produce recipes. Preparation checks target, bindings and resource ownership; the comparison workflow above determines whether a candidate should become active.

This RMS example compares physical implementations of one mathematical operation. Larger supported regions can fuse several operations while preserving their outputs, numerical rules and state effects. Command capture reuses a sequence and may still contain many kernels.

Explore task pipelines, model authoring, chains, fusion and placement.

CLI and Web

Native terminal and browser interfaces, captured from development builds. Open either image for a full-size view.

Terminal UI Web UI
ZeroGravity terminal model catalog ZeroGravity Web model catalog

Architecture

ZeroGravity inference stack architecture

This section describes the target architecture; current support is tracked separately.

One service, one execution fabric. CLI, TUI, Web, Rust SDK and MCP use the same native operations. Typed task pipelines and source-bound model programs map to prepared kernels, libraries and device execution.

The service owns lifecycle and revisions. The execution fabric owns scheduling, session state, physical resources and actual device completion. Run embedded or attach to an existing service; choose implementations within the model's declared numerical and state contract.

Define a model once. Original Hugging Face checkpoints (Safetensors) and GGUF feed source-bound model definitions. Native operators and optional compiled providers lower the semantic program into prepared execution. ONNX remains an optional import path.

Scale the same fabric. Compute, immutable weights, private session state and shared caches have independent placement. CPU, ROCm/HIP, CUDA and Vulkan supply execution; VRAM, unified memory, RAM and SSD supply residency. Distributed execution extends these contracts across workers with explicit resource budgets.

Optimize the workload as a whole. Batching, speculation, kernel selection, cache reuse, residency and placement are coordinated against actual throughput, latency and fairness goals. Concurrent models and pipelines share physical capacity while retaining their own session state.

ZeroGravity and AW

Layer What it programs
ZeroGravity Models, inference pipelines, kernels, scheduling and device resources
AW Agent context, behavior, tools, action graphs, collaboration, state and environments
Your application Goals, domain behavior and the experience built above them

AW selects an inference target; ZeroGravity executes inference. Each has its own revisions and lifecycle. Use them together to build an autonomous stack that can evolve at both layers, or use either with other compatible providers.

Implementation status and roadmap

Available today: native Rust text inference, CLI/TUI/Web controls, and supported OpenAI-compatible text serving. Model, source and accelerator support is qualified for specific paths and devices; optimized backend parity remains in progress.

The Service/Client SDK, live programming and MCP examples above are previews. Broader model/media support, generalized composition, elastic paging and cache tiering, distributed execution and optional compiled providers remain in progress or planned.

Next: complete the shared service/SDK foundations, then advance ROCm, CUDA, MCP and composition in parallel. Vulkan and optional compiled providers follow the same contracts.

Implementation phases · Full plan · Current baseline · Current status

Engineering

FAQ

What does “you can program live” mean? You, your software through the Rust SDK, or your agent through MCP can inspect, compose and adapt the running inference stack—from model definitions and pipelines to kernels, device placement, memory, caches and scheduling.

Build a candidate, measure it against representative requests, learn from the results, and activate validated improvements while the service keeps running. Your software or agent can repeat that loop as requests, hardware, models and resource budgets change, building and refining an inference stack for the work it actually serves.

The aim is to maximize throughput for your workload while meeting your latency, quality and resource requirements. Live changes use supported extension points and activation boundaries; already admitted requests and sessions retain their original revision.

See Live programming for the workflow and implementation status for current support and previews.

How are models defined? Each model family supplies verified source semantics, tensor encodings, task definitions and state requirements. Shared operators and execution providers realize those definitions under one engine.

Does it require a GPU or a Python inference engine? No. The core is native Rust and supports CPU execution; accelerator providers are optional. ZeroGravity does not wrap a separate Python/C++ model-serving engine.

Related projects

From scratch, informed by prior art. No source from any prior-art project was copied or linked unless it is directly vendored (for example, CubeCL (vendored)) and therefore retains its upstream license. Zerogravity is an independent Rust rebuild that learns from the concepts, research and engineering of the projects acknowledged under Related projects.

Zerogravity would not exist without the open-source inference and systems community. We thank and acknowledge the following projects as inspiration and prior art; their ideas, research and engineering shaped this work:

  • llama.cpp — portable GGUF execution and the dead-simple local single-binary experience.
  • vLLM — high-throughput serving, continuous batching and paged state.
  • SGLang — structured program execution and prefix-aware cache reuse.
  • Ollama — one-command local model UX and resident model management.
  • gufo — model-family specialization, accelerator kernels and multimodal tasks.
  • strata and maya — extreme model specialization and VRAM→RAM→SSD expert tiering.
  • CubeCL (vendored) — the Rust GPU kernel IR, vendored with its upstream license.
  • pi and dwarfstar4 — agentic engineering and extreme-model execution research.

These names are acknowledged as inspiration and interoperability references only. No source code from any prior-art project is copied or linked unless it is directly vendored and retains its upstream license; Zerogravity is an independent, from-scratch rebuild.

Contributing

We build zerogravity in the open and would love your ideas, architectural challenges, research, and focused improvements. See CONTRIBUTING.md for the best ways to take part.

AI disclosure

Human-centric design. AI-centric implementation. Zerogravity is built with extensive AI assistance for research, code, tests, and documentation. We believe the best software comes from human-led design and AI-assisted implementation: humans own the architecture, priorities, and acceptance criteria, while AI helps implement, test, and iterate. We don't hand direction to autonomous models or claim every generated line is manually reviewed — correctness rests on explicit designs, reproducible tests, and continuous validation.

License

MIT © 2026 Prasanna Loganathar and zerogravity contributors. Zerogravity-authored text and software are MIT-licensed. Vendored third-party components (for example, CubeCL) and other assets retain their respective upstream licenses. Model weights, third-party libraries, and other assets retain their respective licenses.