AIFeed

ModelOS: A bare-metal GPU OS for LLM inference and training

Original text(via HN AI)

ModelOS

A bare-metal operating system for LLM inference and training. Boot it on a GPU machine and it comes up serving models.

ModelOS is an operating system built for models, written in Rust. It has no processes, no user space and no file system. The machine runs one kernel, and what that kernel manages are models: their weights, KV caches, experts and GPU programs. It drives the GPU itself from ring 0, takes its GPU kernels unchanged from production binaries (cuBLAS, Strata, SGLang), and answers HTTP/SSE requests with tokenization, batching and GPU launch all on one core.

Give it a GPU, on bare metal or in a KVM guest with the GPU passed through, and boot it. It is designed for OS-level RSI (recursive self-improvement).

ModelOS architecture
ModelOS architecture

Highlights

Measured on one NVIDIA RTX 5090 (32 GB).

  • 2.4× faster short requests than SGLang. A Qwen3-0.6B request with a 64-token prompt completes in 2.28 ms against SGLang's 5.48 ms; 1.9× at 512 tokens and 1.5× at 1,024.
  • 1.4× faster first token than vLLM, 1.5× than SGLang. Qwen3.8-27B streams its first token 56 ms after a 128-token request; vLLM takes 80 ms and SGLang 87 ms.
  • 11× faster cold start than SGLang, 4.9× faster than CRIU restore. Qwen3-0.6B streams its first token 4.95 s after the guest starts; a fresh SGLang process takes 54.6 s and a CRIU restore 24.5 s.
  • A parked model is ready again in 1.19 s. vLLM's sleep mode takes 1.55 to 1.69 s for the same model.
  • Long contexts for a 27B model on one 32 GB card. Qwen3.8-27B (NVFP4, hybrid Gated DeltaNet attention, MTP) serves a 48,064-token agent request with its first token at 8.48 s and 14.9 ms a token after that, and a 27,648-token request at 5.10 s; SGLang on the same card accepts inputs up to 15,760 tokens.
  • The whole GPU goes to the model. 31.44 GiB of the 32 GB is free for models after boot; a vLLM process leaves at most 28.85 GiB for weights and KV on the same card.
  • Many models on one GPU. Six models (Qwen3-0.6B and 8B, Qwen3Guard, fine-tuned copies) at 0.5 requests a second each complete 1,346 of 1,800 requests, against 1,169 for the same models in fixed equal VRAM shares.
  • Short requests: perfaudit-20261106-closed-main-64-1-1, perfaudit-20261106-closed-main-512-1-1, perfaudit-20261106-closed-main-1024-1-1, bench-short-requests-sglang-1794509894231398105 (median of five).
  • First token: bench-qwen38-27b-nvfp4-modelos-1795310631820095057, bench-qwen38-27b-nvfp4-vllm-client-r1, bench-qwen38-27b-nvfp4-sglang-client-r1.
  • Cold start: bench-cold-start-modelos-1795645466122989356, bench-cold-start-sglang-1794495766669804514, bench-cold-start-criu-1794495212022526566 (guest start to first token, median of five).
  • Activation: bench-activation-modelos-qwen-1795892341137307534 (median of five), bench-activation-vllm-sleep1-1794497825108927189.
  • Long context: bench-agentx-27b-modelos-sample20-1795929554159638903, bench-agentx-27b-sglang-mtp-sample20-1795873796692119683.
  • Memory: graph-native-route-co29, bench-qwen3-8b-vllm-1794505586996242640.
  • Many models: bench-rq1-count-6-modelos-1795846638875146452, bench-rq1-count-6-fixed-modelos-1795854081280648697.

How it works

ModelOS replaces one general-purpose OS abstraction at a time with one built for models:

  • Pages and page faults → object groups. Weights, KV, experts, recurrent state and GPU programs are Objects in one ledger per tier, placed by the compute graph across VRAM, RAM and disk. A long context grows its KV in place; several models larger than VRAM share one card.
  • Processes → Images and Instances. A model ships as an Image whose objects have precomputed layouts. Activating it DMAs them into place and attaches the recorded programs; parking it keeps its state for the next wake.
  • The scheduler → Steps. A Step is one fenced round of GPU work over a model's ready requests, with the request rows as data. Cores take roles that can change between Steps.
  • Sockets → TCP and HTTP in the owner loop. The NIC, TCP, HTTP parsing, tokenization, Step scheduling and the GPU launch run on one core in ring 0.
  • Files and the page cache → model objects placed directly. Weights move from disk to RAM to VRAM by DMA, so the memory a Linux stack spends on a CUDA context, a caching allocator and a page-cache copy of the weights goes to the model.

        HTTP/SSE ─▶ polled NIC ─▶ TCP ─▶ HTTP ─▶ tokenizer ─▶ Request ─┐
                                                                  ▼
             GPU programs ◀── Step (one round, rows as data) ◀── owner core
                  │
   weights · KV · experts · programs = Objects in VRAM ⇄ RAM ⇄ disk
      

One OS-wide budget spans every model on the machine: each model holds an equal floor of VRAM and RAM, the rest is lent by demand, idle models park to RAM, and wakes follow the deadlines of the requests waiting for them.

Models

  • Qwen3-0.6B and Qwen3-8B (BF16), and Qwen3Guard-Gen 0.6B and 8B
  • Qwen3.8-27B (NVFP4, MTP draft), hybrid Gated DeltaNet and attention
  • Qwen3.8-Flash-Next (IQ3_S mixture of experts), with its experts in RAM

Quick start


        ./modelos build                          # one kernel and one Image from the pinned inputs
./modelos test unit                      # the OS library tests
./modelos bench run <scene> --dry-run    # a benchmark scene, checked before it boots
      

The build takes the pinned source and prepared local inputs (toolchain, firmware, weights, licensed programs): see getting started and environment. GPU runs use QEMU/KVM with the GPU passed through by VFIO.

Status

  • Inference serves complete HTTP/SSE requests for every model above, one at a time or side by side on one GPU.
  • Training has its objects in place: trainable adapters, their Adam moments and Step-lived gradients share the Step and device interface of serving (os/engine/training.rs); the forward and backward Steps are in development.
  • Machines: the numbers above run ModelOS as the operating system of a KVM guest that owns the RTX 5090 through VFIO; the image also carries a UEFI boot path for physical machines.
  • Next: head-to-head single-model numbers against llama.cpp, and more models through one graph composer.

Repository

  • os/ the runtime: engine, server, platform, image, memory, devices
  • models/ model adapters (src/) beside the Image builders and catalogs
  • kernel/, kernels/ source pins, configs and GPU program capture
  • eval/, bench/ the guest harness, baselines and benchmark scenes
  • tests/, tools/ integration tests, build and receipt tools
  • docs/ design, engineering, guides and reports; results/ measurements

Start with the design, then engineering. Contributions are welcome through issues and pull requests; see CONTRIBUTING.

License

MIT (LICENSE), with the GPL and third-party exceptions in NOTICE.

The text above was extracted automatically from the source page and may miss images, tables or code blocks. The original is authoritative.

Published by HN AI
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗