Skip to content
KarpelesLabPublic

About

Pure-Rust local inference for language, vision, image, speech and embedding models from Hugging Face (safetensors, GGUF, MLX). SIMD CPU kernels everywhere, Metal, CUDA and Vulkan GPUs, a WebAssembly + WebGPU browser build, and an OpenAI-compatible server.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

oxinfer

CI crates.io docs.rs License: MIT

Local inference in pure Rust for language, vision, image, speech and embedding models: run Hugging Face checkpoints (safetensors, GGUF, MLX) on the CPU of any machine, on Metal, CUDA and Vulkan GPUs, or in a browser tab. Early days: the crate is at 0.0.x and the API and file formats may still change.

Get started

  1. Install it. On macOS and Linux:

    curl -fsSL https://karpeleslab.github.io/oxinfer/install.sh | sh

    On Windows (PowerShell):

    irm https://karpeleslab.github.io/oxinfer/install.ps1 | iex

    Or take an archive from the latest release, or build it: cargo build --release.

  2. Run oxinfer web. It opens http://127.0.0.1:8080/ in your browser.

  3. Pick a model from the catalog. It shows each model's size and whether it fits this machine, downloads it with live progress, and loads it. Then chat (with images), generate images, transcribe, synthesize speech or compare embeddings.

The same address serves an OpenAI-compatible API (/v1) and Anthropic's (/v1/messages). The Connect apps page has ready-to-paste settings for opencode, Claude Code, Aider and the openai SDKs. More in docs/web.md.

No install at all: try it in your browser (small models run in the tab, with WebGPU when the browser has it).

Quick start: the command line

cargo build --release          # or take a binary from the GitHub releases
./target/release/oxinfer --models                                   # what this machine can run, with estimated speeds
./target/release/oxinfer --model google/gemma-4-E4B-it -p "Explain RMSNorm in two sentences."
./target/release/oxinfer --model google/gemma-4-E4B-it --chat       # interactive, multi-turn
./target/release/oxinfer --model google/gemma-4-E4B-it --image photo.jpg -p "What is this?"
./target/release/oxinfer --model openai/whisper-small --transcribe talk.mp3
./target/release/oxinfer serve --model google/gemma-4-E4B-it        # OpenAI-compatible HTTP server
./target/release/oxinfer web                                        # the browser GUI, see above

A Hugging Face repo id is downloaded to the cache on first use; a local folder or GGUF file works too. The device is chosen at run time (--device auto: a GPU when one starts, else the CPU). docs/cli.md has the flags, the release binaries, --update, --models and oxinfer models list / rm for the downloaded models; docs/library.md the Rust and C API.

What it is

oxinfer runs chat and vision-language models (dense and mixture-of-experts, up to trillion-parameter ones streamed from storage), image generation and editing, video, speech to text, text to speech and embeddings; the full list, with what was checked for each, is in Supported models. No BLAS, no ML framework: weights are read straight out of the checkpoint files (safetensors, GGUF, MLX) and every operation (matmuls, attention, norms, RoPE, sampling) is implemented here, with hand-written SIMD kernels (NEON, SME, AVX2, wasm simd128) and its own thread pool. The CPU path runs everywhere; GPUs (Metal, CUDA, Vulkan, WebGPU in the browser) are detected at run time, with nothing linked at build time.

Output is validated against the transformers float32 reference: on Gemma 4 E2B-it the last-token logits agree to a max absolute difference of about 1e-4 and greedy decoding produces identical tokens.

Goals

  1. Run everything, everywhere. Any model on any machine: a phone, a browser tab, a laptop with no GPU, a server. It may be slow, but it works. A missing accelerator, too little memory or an unusual platform should never be the reason a model cannot run. The CPU path is the reference and is always there; a 1 TB model on a machine with 1 GB of RAM and no GPU should still produce tokens, by reading the weights from storage as it goes (see Streaming weights from flash), very slowly.
  2. Then make it fast. Anything that improves speed on a given machine is in scope: a GPU when there is one (Metal, CUDA, WebGPU, detected at run time), the Neural Engine through Core ML, quantization, SIMD kernels per CPU (NEON, SDOT / i8mm, AVX2, wasm simd128), speculative decoding (MTP, drafters, prompt lookup), prompt caches restored from disk, prefetching and caching for weights that do not fit in memory. When something is missing, oxinfer falls back to a slower path rather than failing.

Correctness comes first in both: every model and every fast path is checked against the reference implementation (the verification section and the per-model notes give the measured agreement), and a speed-up that changes the output must say so and stay optional.

Documentation

Using it

Command line building, flags, release binaries and self-update, --models
Library use the Rust and C API, features, use from other crates
Supported models every tested checkpoint with its size and measured agreement with the reference
Getting weights Hugging Face downloads, the mirror, GGUF files, MLX checkpoints
OpenAI-compatible server chat, embeddings, images, audio; structured outputs, forced tool calls, log probabilities
Web GUI on this machine oxinfer web: the browser GUI with native models, the catalog, downloads, the model cache
Tool calling built-in and caller-defined tools
Session snapshots and the prompt cache saving and restoring a conversation's state
Embeddings dense, sparse and ColBERT embedding models
Typed decisions the Jev decision models, over text and images
Runtime interventions neuron edits, steering, abliteration, SAE features
LoRA adapters PEFT and llama.cpp GGUF adapters on language models, at run time or merged

Text models

Gemma 4 26B-A4B the mixture-of-experts Gemma 4
Qwen3.5 / Qwen3.8 dense and MoE Qwen, MTP and DSpark speculative decoding
Mistral Large 4 1T parameters streamed from storage, FP8 on the GPU
DeepSeek V4 Flash, V4.1 Flash 284B MoE as GGUF; V4.1 (748B with its engram tables) streamed from a 231 GB IQ1_M, long prompts at 66-87 tok/s
GLM-5.3 and GLM-5.3-Flash hyper-connections, KDA linear attention, MLA with the DSA indexer; text only
ERNIE 5.5 Flash Base 280B MoE base model (HCA and MLA-DSA attention); on tiny checkpoints only
Kimi K3.1 Pro, Kimi K3 2.8T MoE with linear and sparse attention, on tiny checkpoints only
LongCat-2.5, LongCat-2.0, LongCat-Flash-Lite-Sparse 1.6T MoE with sparse attention and a hashed n-gram embedding; the 69B sibling on its real weights, LongCat-2.5 on tiny checkpoints only
Nemotron 3.5 Lightning and Transcribe Mamba-2 / attention / MoE hybrid; a 34B speech LM for speech to text
Inkling-2 Small 594B MoE with images (relative-bias attention, short convolutions, attention residual); the decoder on tiny checkpoints only
Raon-1 nano delta-rule linear attention and gated MLA on four residual streams, per-layer embeddings
Ripple-65B Preview dense 65B with sliding and full attention layers, gated attention, value residuals; run as NVFP4
Liquid LFM3 and LFM3-Omni conv and attention hybrid for small devices; Omni reads images and audio and answers in text or speech
Qwen3.8-Flash-Next 125B MoE with an n-gram embedding table
Unlimited-OCR-2 document OCR: page images to text with layout, block-sparse attention
IBM Granite 4 and TwIL-8B Granite 4.1 / 4.2 and their fine-tunes, safetensors and GGUF
Image, video and audio input the vision and audio towers of Gemma 4 and Qwen, Qwen2.5-VL

Images and audio

Stable Diffusion 1.x / 2.x / XL text to image, image to image, inpainting, InstructPix2Pix
Stable Diffusion 3 / 3.5 text to image, image to image
FLUX.1 Kontext editing, schnell / dev, Fill, Canny / Depth, Redux
Qwen-Image, Qwen-Image-Edit and Qwen-Image-2.1 editing, text to image, ControlNet, layers; Qwen-Image-2.1 / 2.1-Turbo
MOSS-Image and Kromoss text to image with Qwen3.5-9B conditioning; LoRA / LoKr, DMD turbo LoRAs, curated presets (--preset kromoss-famegrid)
MiniMax-H3 video text to video, first / last frame to video, with the stereo soundtrack
OmniGen2, BAGEL, Step1X-Edit, Janus-Pro instruction editing, unified generation and understanding
Whisper speech to text
Nemotron 3.5 Transcribe speech to text and speech translation with a speech LM
Orpheus text to speech, batches, voice cloning, the SNAC codec
ZONOS3-Mini text to speech at 44.1 kHz in 43 languages, default voices, cloning from a clip
Audio8 TTS text to speech at 44.1 kHz in 23 languages, cloning from a clip and its transcript, its codec
Haru-4B full-duplex speech to speech at 24 kHz: a recording of the user in, what the model says meanwhile out
Fish Audio Drama 3 text to speech at 44.1 kHz with a 35B MoE, several speakers per text, cloning from a clip and its transcript

Under the hood

Performance measurements, GPU decoding, comparison with llama.cpp, quantization
Speculative decoding drafters, MTP, multi-token passes, prompt lookup
Streaming weights from flash models larger than RAM, mixed GPU / CPU decoding
Platforms and accelerators what runs where; CUDA, Vulkan
WebAssembly and the browser WASI, WebGPU
Core ML / Apple Neural Engine running and converting Core ML models
How it works the layout of the code
Verifying against the reference how outputs are compared with transformers and others
Core ML model format, llama.cpp notes reference notes

License

MIT, see LICENSE. Model weights carry their own licenses.

About

Pure-Rust local inference for language, vision, image, speech and embedding models from Hugging Face (safetensors, GGUF, MLX). SIMD CPU kernels everywhere, Metal, CUDA and Vulkan GPUs, a WebAssembly + WebGPU browser build, and an OpenAI-compatible server.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages