yunwei37/modelos
À propos
ModelOS: a bare-metal operating system for LLM inference and training. It boots straight into the model, drives the GPU from ring 0 and serves models over HTTP.
Systèmes et infrastructureWhat you can do
- 2.4× llama.cpp's throughput on a batch. 128 concurrent Qwen3-0.6B requests of 128 prompt and 128 output tokens finish a round in 2.39 s on ModelOS and in 5.79 s on llama.cpp (BF16 GGUF, CUDA, flash attention); llama.cpp's first token comes sooner, at 0.57 s against 1.15 s.
- 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. Qwen3.8-27B streams its first token 8.0 s after the guest starts, 3.9× sooner than llama.cpp's 31.5 s.
Progression mesurée des étoiles
- in 24h
- +2
- in 7 days
- Historique en cours
- in 15 days
- Historique en cours
- in 1 month
- Historique en cours
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
OriginalModelOS
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).
Highlights
Measured on one NVIDIA RTX 5090 (32 GB).
- 2.4× llama.cpp's throughput on a batch. 128 concurrent Qwen3-0.6B requests of 128 prompt and 128 output tokens finish a round in 2.39 s on ModelOS and in 5.79 s on llama.cpp (BF16 GGUF, CUDA, flash attention); llama.cpp's first token comes sooner, at 0.57 s against 1.15 s.
- 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. Qwen3.8-27B streams its first token 8.0 s after the guest starts, 3.9× sooner than llama.cpp's 31.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.
Receipts (job IDs in results/index.jsonl)
- Against llama.cpp:
bench-qwen3-06b-b128-modelos-1795808782742868044,bench-qwen3-06b-b128-llamacpp-1795902646967087407,bench-qwen3-8b-modelos-1795809854682218617,bench-qwen3-8b-llamacpp-1795905518335081020(median of five rounds). - 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). - Cold start of the 27B:
bench-cold-start-27b-modelos-sample20-1795867403324364067(median of four),bench-cold-start-27b-llamacpp-sample20-1795902999743515111(one run). - 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.
- Against llama.cpp on Qwen3-8B: 1.19× its throughput at 16 concurrent requests (1,118 against 936 tokens a second); at one request llama.cpp is 1.13× faster (98.5 against 87.0 tokens a second) and streams its first token sooner.
- Next: the latency of a single request, Flash's composed path, and more models through one graph composer.
Repository
os/the runtime: engine, server, platform, image, memory, devicesmodels/model adapters (src/) beside the Image builders and catalogskernel/,kernels/source pins, configs and GPU program captureeval/,bench/the guest harness, baselines and benchmark scenestests/,tools/integration tests, build and receipt toolsdocs/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.
Explorer des projets similaires
Chargement…