Rai

•
2
•

Run 4-bit quantized large language models efficiently on CPU-only hardware using pure Rust.

Rai is a unique CPU-only LLM inference engine crafted entirely in Rust, designed to run 4-bit quantized language models with exceptional efficiency. It distinguishes itself by eschewing GPUs, Python runtimes, and heavyweight ML frameworks, opting instead for hand-written AVX2 kernels for all matrix multiplications. This lean architecture ensures a minimal dependency footprint, allowing users to load `.raimodel` files and generate text on any modern x86-64 laptop without requiring dedicated machine learning hardware. It features on-the-fly 4-bit weight dequantization within registers, a simple `.raimodel` format, and advanced techniques like speculative decoding, alongside a local HTTP chat server and a REST/MCP server for agent integration.

主要功能

01Efficient 4-bit quantized weights dequantized directly in registers
02Speculative decoding for faster generation (draft-model and self-speculative)
03Local HTTP chat server with web UI and REST/MCP server for agentic tools
04CPU-only LLM inference with hand-written AVX2 kernels
05Single, flat, zero-copy loadable `.raimodel` binary format
060 GitHub stars

使用案例

01Serve quantized LLMs locally for chat applications via an HTTP API
02Integrate LLM memory and reasoning capabilities into agentic tools through REST or MCP protocols
03Perform fast LLM text generation on x86-64 laptops without a GPU