MCPcopy Index your code
hub / github.com/Avarok-Cybersecurity/atlas

github.com/Avarok-Cybersecurity/atlas @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
7,896 symbols 31,024 edges 1,027 files 2,841 documented · 36%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Atlas Inference Engine

Atlas Inference Engine

<strong>Pure Rust LLM Inference</strong>


<em>Universal Inference At Unimaginable Speeds</em>






<img alt="NVIDIA" src="https://img.shields.io/badge/NVIDIA-76B900?style=flat-square&logo=nvidia&logoColor=white">
<img alt="AMD" src="https://img.shields.io/badge/AMD-ED1C24?style=flat-square&logo=amd&logoColor=white">
<img alt="Intel" src="https://img.shields.io/badge/Intel-0071C5?style=flat-square&logo=intel&logoColor=white">






<a href="https://github.com/Avarok-Cybersecurity/atlas/raw/main/LICENSE"><img alt="License: AGPLv3" src="https://img.shields.io/badge/license-AGPLv3-yellow?style=flat-square"></a>
<a href="#quick-start"><img alt="Pure Rust" src="https://img.shields.io/badge/runtime-pure%20Rust-orange?style=flat-square"></a>
<a href="https://hub.docker.com/r/avarok/atlas-gb10"><img alt="Docker Hub" src="https://img.shields.io/badge/Docker%20Hub-avarok%2Fatlas--gb10-2496ED?style=flat-square&logo=docker&logoColor=white"></a>
<a href="https://discord.gg/6vDbKaKrKD"><img alt="Discord" src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fdiscord.com%2Fapi%2Fv10%2Finvites%2F6vDbKaKrKD%3Fwith_counts%3Dtrue&query=%24.approximate_member_count&label=discord&suffix=%20members&style=flat-square&logo=discord&logoColor=white&color=5865F2"></a>

Atlas demo — click for full-quality MP4

Quick Start — under 2 minutes atlasinference.io Launch announcement on X


📑 Table of Contents


🧭 Philosophy

The foundation of any given field of science is philosophy. It is that which inspires direction, structure, and mission.

Atlas began as a solution to widely known problem in using other (python) inference engines built by data scientists: the code was steeped in a poly codebase with an ever shifting ecosystem of dependencies, patches, and cross-dependencies. One day your workaround for running a model works, the next day you have to update to a nightly branch of several dependencies and inject a new workaround. This is not how you build a software ecosystem; that's how you build a proof of concept. We thank the great and hard work data scientists made in proving LLMs can revolutionize our world, its economy, and how it challenges us to higher epochs. Now, the software engineers take the torch to turn a proof of concept into something that is designed to withstand the test of time.

Main Objective

Similar to how llama.cpp was built with the intent to prove you don't need $10000-$100000 GPUs to run LLMs, Atlas is built with the intent to consistently force the narrative that as hardware continues to advance, we should not have to pay premium Cloud API prices for inference. Atlas, by virtue of its philosophy, maximizes speed for each hardware/model combination, thus paving the way for meaningfully powerful and intelligent LLMs to be run locally in such a way the model is truly useful.

Design Choices

Free and Open Source, Always

We promised this since the beginning. We believe great software comes from opening the source, not from just keeping it closed. The more eyes, the better. And therein brings us to the next point.

Community-First

For those who've followed us this far since the inception of our Discord, you know the extent to which our commitment to the community is, according to one user humourously put, "cracked". We want to build something incredible, and that means we not only build for you, but you, now having access to the source code, can now build for others in ways that triumph over existing solutions. This is the only way we all win. We are the Pirates of the inference space.

Monorepo

We chose a monorepo design to ensure that, as we head further into the agentic age of coding, the average data scientist or engineer can contribute meaningful PRs to any part of the system. Eventually, since this is a monorepo, there will be a day where the repo is autonomously self-improving and self-patching. This is most efficient and most effective when all the code is in one place, not many.

Hardware+Model Specific Kernels

We make no compromises or generalizations. Each hardware and model combination has its own unique properties that require fine-tuning custom kernels that leverage the model for that specific hardware configuration. The end result? 2-3x faster kernels all around.

AI-Friendly Codebase

It took a significant amount of time to build this codebase. We also know people will want to submit AI-generated PRs. We can't stop you, and in fact, given SOTA, you might just have to! The good news is that this codebase was built with enough railguards, structure, and abstraction to guide your AI to absorb the entire monorepo and contribute meaningfully. There's enough context to keep this going off the rails like a crazy train.This means ultimately that instead of waiting for days to weeks before getting model support, you can just fork this repo, and ask your AI to integrate it, then within hours you'll more likely than not have a working model running. We will not be condescending, unlike some other inference engines out there when good-faith PRs that simply work are posted. We are not stymied by bureacracy, and want to enable the community to rapidly expand this monorepo ecosystem safely and effectively.

Theory-Friendly Codebase

Arxiv is getting countless papers published every day on AI. Nobody can keep up. Yet, some papers may be relevant to this project, others may not. Research endeavors to improve quality, alignment, and speed ought to be considered by our community as something we can integrate cleanly. Feel free to open a PoC PR here and just explain what you did and why, and how it works.

Plug and Play Design

Our system is modular, with tight abstraction boundaries and trait requirements that force the architecture to take on a certain form. This form is designed to prevent pigeon-holing the project into the wrong direction. The business logic is the same across all hardware/model combinations, just the concrete implementations differ.

🏛️ Architecture

The diagram below shows how a single HTTP request flows from the API surface down to hardware-specific CUDA kernel execution. Dashed borders mark the plug-and-play abstraction boundaries — the traits and registries where a new hardware target, model family, communication backend, or storage backend plugs in without touching the layers above or below it.

flowchart TB
    %% ── Colours & styles ──────────────────────────────────────────────
    classDef server fill:#2d6a4f,stroke:#1b4332,color:#d8f3dc
    classDef scheduler fill:#1e6091,stroke:#184e77,color:#d9ed92
    classDef model fill:#b5179e,stroke:#7209b7,color:#ffe5fc
    classDef layer fill:#7209b7,stroke:#560bad,color:#ffd6ff
    classDef kernel fill:#f48c06,stroke:#dc2f02,color:#fff
    classDef storage fill:#264653,stroke:#1d3557,color:#a8dadc
    classDef comm fill:#3a86ff,stroke:#1d3557,color:#fff
    classDef trait stroke-dasharray: 6 4,stroke-width:2px

    %% ── Top layer: HTTP API ───────────────────────────────────────────
    HTTP["HTTP Server (spark-server)

OpenAI · Anthropic · Responses"]:::server
    SCHED["Scheduler

batches, MTP verify, KV alloc"]:::scheduler

    HTTP --> SCHED

    %% ── Model abstraction (plug-in #1) ────────────────────────────────
    subgraph MODEL ["🔌 trait Model"]
      direction TB
      TRANSFORMER["TransformerModel

generic prefill/decode loop"]:::model
    end
    class MODEL trait

    SCHED --> MODEL

    %% ── Weight loader abstraction (plug-in #2) ────────────────────────
    subgraph LOADER ["🔌 trait ModelWeightLoader"]
      direction LR
      QW35["Qwen3.5

27B/35B/122B"]:::layer
      QW36["Qwen3.6

35B-A3B"]:::layer
      QWNEXT["Qwen3-Next

80B-A3B"]:::layer
      QWVL["Qwen3-VL

30B-A3B"]:::layer
      GEMMA["Gemma-4

26B/31B"]:::layer
      MISTRAL["Mistral-Small-4

119B"]:::layer
      MINIMAX["MiniMax M2.7

229B-A10B"]:::layer
      NEMO["Nemotron-3

Nano/Super"]:::layer
    end
    class LOADER trait

    TRANSFORMER --> LOADER

    %% ── Layer trait (plug-in #3) ──────────────────────────────────────
    subgraph LAYERS ["🔌 trait TransformerLayer"]
      direction LR
      ATTN["Attention

(GQA, MLA, sliding)"]:::layer
      SSM["SSM

(Mamba-2, GDN)"]:::layer
      MOE["MoE

(routed + shared)"]:::layer
      FFN["Dense FFN

(GeGLU, SwiGLU)"]:::layer
      MTP["MTP Head

(draft proposer)"]:::layer
    end
    class LAYERS trait

    LOADER --> LAYERS

    %% ── GPU backend (plug-in #4) ──────────────────────────────────────
    subgraph GPU ["🔌 trait GpuBackend"]
      direction LR
      CUDA["CUDA backend

(GB10 / Blackwell)"]:::kernel
      AMD["AMD ROCm

(future)"]:::kernel
      APPLE["Apple Metal

(future)"]:::kernel
    end
    class GPU trait

    LAYERS --> GPU

    %% ── Kernel registry (plug-in #5) ──────────────────────────────────
    subgraph KERNELS ["🔌 kernels/<hw>/<model>/<quant>/ — auto-discovered"]
      direction LR
      K_GB10["gb10/qwen3.5-35b-a3b/nvfp4

+ 11 other targets"]:::kernel
    end
    class KERNELS trait

    CUDA --> KERNELS

    %% ── EP / multi-GPU (plug-in #6) ───────────────────────────────────
    subgraph EP ["🔌 trait CommBackend"]
      direction LR
      NCCL["NCCL

(EP=2, all-reduce)"]:::comm
    end
    class EP trait

    LAYERS -.-> EP

    %% ── Storage backend (plug-in #7) ──────────────────────────────────
    subgraph STORE ["🔌 trait StorageBackend"]
      direction LR
      IORING["io_uring

(NVMe KV offload)"]:::storage
    end
    class STORE trait

    SCHED -.-> STORE

    %% ── Cross-references ──────────────────────────────────────────────
    KERNELS -. "kernels selected by

(hardware × model × quant)

at build time" .-> CUDA

Reading the Diagram

Solid boxes are concrete implementations. Dashed borders with 🔌 are the trait-based abstraction boundaries — each is a Rust trait (or a filesystem convention for kernels) where a new integration plugs in:

Plug Point What It Abstracts To Add New Support
trait Model Full model forward pass Rarely needed — the existing TransformerModel handles all architectures via composable layers
trait ModelWeightLoader HuggingFace → layer translation Implement one struct with weight-name patterns for your model family (factory.rs adds one match arm)
trait TransformerLayer Per-layer compute (attn, SSM, MoE, FFN) Compose existing layer types or implement a new one for novel architectures
trait GpuBackend All GPU memory and kernel ops Swap the CUDA driver for another accelerator backend
kernels/<hw>/<model>/<quant>/ Hardware-tuned CUDA kernels Drop a new directory with MODEL.toml + .cu files; build.rs auto-discovers it
trait CommBackend Multi-GPU collective communication Implement for MPI, GDR, or custom interconnects
trait StorageBackend NVMe KV-cache offload I/O Implement for CXL, RDMA, or other storage tiers

Data Flow Summary

  1. HTTPspark-server receives OpenAI/Anthropic requests, tokenizes, and enqueues
  2. Scheduler → batches sequences, orchestrates prefill/decode/speculative-verify steps
  3. Model → generic loop: embed → [layer₀ … layerₙ] → norm → lm_head
  4. Layers → each layer dispatches through GpuBackend to launch kernels from AtlasRegistry
  5. Kernels → pre-compiled PTX selected by (hardware × model × quant) target at build time
  6. EPCommBackend handles cross-GPU all-reduce after MoE expert computation
  7. StorageStorageBackend spills/restores KV blocks to NVMe for long-context sequences

📦 What We Ship Today

We have to walk before we can run. Today's Atlas is targeted at a single hardware platform — NVIDIA's GB10 (DGX Spark, SM121) — and fifteen hand-tuned (Hardware × Model × Quantization) targets. Every supported model below runs off one multi-model binary; the right kernel set is selected at startup from the model's config.json. No swapping images, no rebuilding, no per-model magic — just point Atlas at a HuggingFace ID.

Family Model HuggingFace ID Params / active Architecture
Qwen3.5 Qwen3.5-27B Kbenkhaled/Qwen3.5-27B-NVFP4 27B dense Hybrid SSM + attention, dense FFN, MRoPE
Qwen3.5 Qwen3.5-35B-A3B Sehyo/Qwen3.5-35B-A3B-NVFP4 35B / 3B GDN + attention + MoE, MTP
Qwen3.5 Qwen3.5-122B-A10B `S

Extension points exported contracts — how you extend this code

ModelWeightLoader (Interface)
Loads weights from a [`WeightStore`] into typed layer objects. [10 implementers]
crates/spark-model/src/weight_loader/mod.rs
HintInjector (Interface)
Trait for injecting recovery hints into failed tool responses. Implementations detect specific error patterns and gener [7 …
crates/spark-server/src/hint_injector.rs
GrammarMutator (Interface)
A grammar-transforming pass. Mirrors C++ `GrammarMutator`: the default `apply` adds empty rules to keep ids stable, then [4 …
crates/xgrammar/src/grammar/functor/mutator.rs
ComputeTarget (Interface)
Build-time kernel compilation target. Abstracts away the specific compiler and output format so the same build.rs works [4 …
crates/atlas-kernels/build_target.rs
GpuBackend (Interface)
GPU backend trait — SBIO IORouter for all CUDA operations. Implementations: `AtlasCudaBackend` (production), `MockGpuBa [3 …
crates/spark-runtime/src/gpu.rs
Quantize (Interface)
Quantize activations from a higher-precision format to a lower one. [2 implementers]
crates/atlas-quant/src/traits.rs
CommBackend (Interface)
Communication backend trait for distributed operations. All collective operations take raw device pointer + byte count. [2 …
crates/spark-comm/src/lib.rs
ComputeTarget (Interface)
Build-time compilation target contract. Each hardware vendor implements this trait to describe how kernel source files [1 …
crates/atlas-core/src/compute.rs

Core symbols most depended-on inside this repo

arg_ptr
called by 2370
crates/spark-runtime/src/kernel_args.rs
arg_u32
called by 1829
crates/spark-runtime/src/kernel_args.rs
iter
called by 952
crates/xgrammar/src/support/compact_2d_array.rs
get
called by 942
crates/spark-server/src/lqer.rs
offset
called by 621
crates/spark-runtime/src/gpu.rs
kernel
called by 496
crates/spark-runtime/src/gpu/mock.rs
launch
called by 483
crates/spark-storage/src/cuda_graph.rs
grid
called by 480
crates/spark-runtime/src/kernel_args.rs

Shape

Function 4,405
Method 2,644
Class 673
Enum 142
Interface 32

Languages

Rust87%
Python10%
C++2%
TypeScript1%
C1%

Modules by API surface

crates/spark-model/src/model/trait_impl/mod.rs70 symbols
crates/atlas-kernels/hip/libcuda_hip_shim.cpp55 symbols
kernels/gb10/qwen3.6-27b/nvfp4/q4k_vendor/ggml-impl.h52 symbols
crates/xgrammar/src/schema/tests_objects.rs46 symbols
crates/spark-model/src/traits/model.rs43 symbols
crates/xgrammar/src/schema/tests.rs42 symbols
crates/spark-runtime/src/buffers.rs41 symbols
crates/spark-runtime/src/kv_cache/paged_impl.rs39 symbols
crates/spark-model/src/engine/tests.rs39 symbols
crates/xgrammar/src/structural_tag/tests.rs38 symbols
bench/fp8_dgx2_drift/vllm_src/fp8.py38 symbols
bench/fp8_dgx2_drift/vllm_src/qwen3_5.py37 symbols

For agents

$ claude mcp add atlas \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact