Skip to content

[0.3] Make CPU-first execution and tiered memory placement the Runtime default #11

Open

Description

@pschildgen87-code

Goal

Make CPU-only execution a first-class performance target and universal compatibility baseline for Quantum Runtime, while treating GPUs/accelerators as optional performance tiers rather than hard requirements.

The default architectural principle is CPU-first, but not as a naive reactive migration strategy. Quantum Runtime should evaluate a CPU/RAM execution plan first, benchmark or predict whether it can satisfy the requested model/workload policy, and choose any GPU/hybrid placement before model activation when acceleration is needed.

A request must remain runnable on supported CPU-only systems when the selected backend/model combination supports CPU execution.

Core principle

CPU is mandatory baseline / control plane
GPU is optional accelerator
NVMe/filesystem is an explicit cold/offload tier

Do not begin generation on CPU and then migrate arbitrary live tensors to GPU only after latency degrades. Mid-generation migration is expensive, backend-specific and often unsafe. Placement should normally be decided before load or at explicit backend-supported paging boundaries.

CPU-only path

For systems with no GPU:

CPU compute
   |
RAM hot working set
   |
file-backed model mapping / page cache
   |
optional NVMe-backed cold weights / prefix-cache tier

There is no VRAM tier on these hosts.

CPU-only behavior should prefer explicit Runtime memory policy over relying on uncontrolled OS swap. A model that exceeds practical RAM bandwidth/capacity should degrade predictably, use bounded mmap/file-backed paging where supported, or report that the requested performance profile cannot be met. It must not thrash the host blindly.

GPU / hybrid path

When an accelerator exists, the planner may choose a hybrid placement such as:

CPU scheduler/control + host RAM
          |
GPU VRAM hot compute/KV/model tensors
          |
pinned host RAM overflow/offload tier
          |
NVMe/filesystem secondary cold tier

Important rules:

  • CPU/RAM remains the gateway and authoritative host tier.
  • VRAM should contain the hottest tensors/KV blocks that materially benefit latency/throughput.
  • Overflow from VRAM should prefer pinned/system RAM before filesystem storage.
  • Filesystem/NVMe should be a secondary/cold tier for data that can tolerate higher latency, such as cold model pages or cache blocks where the backend supports it.
  • Do not assume direct GPU-to-disk transfer unless a reviewed backend explicitly supports and tests it.
  • Active intermediate activations must not be casually spilled to disk.
  • Hybrid placement must be benchmarked; a partial GPU offload that performs worse than CPU-only should be rejected by policy.

Separate memory classes

The planner must track these separately because they have different locality/performance requirements:

  • model weights
  • MoE expert weights
  • KV cache
  • prefix/prompt cache
  • multimodal/projector weights
  • temporary activations/workspaces
  • tokenizer/templates/metadata

Do not expose a single ambiguous memory_offload=true flag.

CPU optimization targets

Quantum Runtime should detect and exploit host CPU capabilities through the selected backend, including where available:

x86/x86-64

  • SSE4/AVX/AVX2
  • AVX-VNNI
  • AVX-512 variants/VNNI/BF16
  • vendor-optimized matrix kernels such as oneMKL/OpenBLAS/BLIS where beneficial
  • ZenDNN-style AMD EPYC optimization where supported

ARM

  • NEON/dot-product
  • int8mm
  • SVE/SME
  • KleidiAI-style optimized kernels where supported

Topology

  • physical-core vs SMT awareness
  • NUMA topology and memory locality
  • thread pinning/affinity where useful
  • memory-channel saturation awareness
  • separate prefill and decode tuning
  • batch/ubatch calibration

A backend may expose further architecture-specific kernels without changing the public Runtime API.

Auto-tuning / host calibration

Add a machine-readable host performance profile built from hardware discovery plus a short bounded calibration benchmark.

Example data:

cpu.arch
cpu.features[]
cpu.physical_cores
cpu.logical_cores
numa.nodes
memory.total
memory.bandwidth_class
storage.type
storage.measured_read_bandwidth
accelerators[]

Calibration should test representative operations rather than trusting hardware names alone.

For each backend/model profile, the Runtime may retain tested placement data such as:

cpu_only.tokens_per_second
cpu_only.prefill_tokens_per_second
hybrid.tokens_per_second
hybrid.vram_bytes
hybrid.host_ram_bytes
hybrid.offload_bytes

The scheduler can then choose the latest-known-good placement instead of guessing every startup.

Placement policy

A normalized placement decision should consider:

  • model artifact/quantization size
  • architecture and active parameters
  • context length
  • expected KV-cache size
  • requested concurrency
  • requested latency/throughput class
  • CPU/RAM benchmark data
  • GPU/NPU availability and free memory
  • backend capability support
  • memory/offload transfer cost
  • current host pressure
  • operator policy

Recommended policy shape:

1. Construct CPU-only candidate.
2. If it fits and satisfies policy, use CPU-only.
3. If not and a compatible accelerator exists, construct hybrid/GPU candidate.
4. Prefer the measured faster candidate, not automatically the GPU candidate.
5. If accelerator memory is insufficient, use reviewed VRAM -> host RAM offload.
6. If supported and policy permits, use host RAM -> NVMe secondary cold/cache tier.
7. If no candidate can meet the requested profile, return an explicit capacity/performance decision instead of host thrashing.

MoE-specific placement

MoE models are a primary use case for CPU-first/hybrid execution because total parameters may be much larger than active parameters.

Represent and benchmark:

  • shared experts
  • routed expert count
  • active top-k experts
  • CPU-resident experts
  • accelerator-resident experts
  • expert prefetch where supported
  • model-family/backend-specific expert placement

Do not assume partial MoE GPU offload is always faster. The Runtime conformance/performance ledger must be able to block a known-slow split on a hardware/backend combination.

KV and cache tiering

Treat cache tiering separately from model-weight offload.

Where supported, use a hierarchy such as:

accelerator KV cache
      <-> pinned host RAM primary offload
      <-> filesystem/NVMe secondary tier

Secondary tiers must not be advertised when the backend cannot safely promote/demote blocks.

CPU-only systems may use RAM plus an optional filesystem-backed prefix/cache tier, but active decode state should not be pushed to disk by default if it makes generation unusably slow.

Disk policy

NVMe offload is an explicit Runtime feature, not generic swap.

Requirements:

  • dedicated configurable directory/device
  • free-space reservation and hard limits
  • bounded cache size
  • cleanup/recovery journal
  • checksum/integrity metadata where persistence matters
  • no user secrets in filenames/paths
  • optional encryption policy for persistent cache tiers
  • SSD-wear awareness and metrics
  • disable or reduce disk tier on slow rotational storage by default

Backend fusion direction

The Runtime may combine ideas/capabilities from mature backends while keeping a stable Quantum contract.

Examples to evaluate through the latest-known-good policy:

  • llama.cpp/ggml for portable CPU execution, mmap, quantized CPU kernels, partial GPU/MoE placement and NUMA controls
  • vLLM for host-memory weight offload and hierarchical KV-cache tiering
  • OpenVINO/oneDNN/oneMKL paths for Intel CPU-specific acceleration where they outperform the generic path
  • ZenDNN/vendor paths for supported AMD server CPUs
  • MLX for Apple unified-memory systems
  • other reviewed backends when they provide a proven CPU/offload capability

Do not vendor unrelated full runtimes into one monolith. Capability adoption happens through adapters, tested components or clearly attributed compatible code.

Latest-known-good performance policy

CPU performance regressions are release blockers even if a newer upstream backend has more features.

The tested-upstream ledger from Runtime 0.3 must include performance guardrails for CPU-only and hybrid profiles.

A backend update should not replace the production pin if representative CPU-only throughput or correctness regresses beyond an explicit tolerance.

Metrics

Expose enough local metrics to explain placement without leaking prompts:

  • selected backend
  • selected placement profile
  • CPU threads used
  • accelerator layers/tensors/expert placement
  • model RAM/VRAM footprint
  • KV/cache footprint by tier
  • page/cache hit metrics where available
  • prefill throughput
  • decode throughput
  • transfer/offload bandwidth and stalls
  • filesystem tier reads/writes
  • fallback reason

Acceptance criteria

  • CPU-only is a supported first-class execution profile in the backend contract
  • placement planner evaluates a CPU-only candidate before optional acceleration
  • no GPU is required for Runtime startup or generic model management
  • accelerator placement is chosen before model activation rather than naive mid-stream migration
  • Runtime can prefer CPU-only when hybrid/GPU is measured slower
  • model weights, MoE experts, KV cache, prefix cache and activations have separate placement classes
  • CPU feature/topology detection and bounded calibration profile exist
  • NUMA/thread/batch tuning can be expressed without model-family API hacks
  • hybrid path supports reviewed VRAM -> host RAM overflow where the backend supports it
  • filesystem/NVMe is an explicit secondary/cold tier, not uncontrolled OS swap
  • CPU-only mmap/file-backed model behavior is documented and bounded
  • disk-tier size, free-space and cleanup policy are enforced
  • CPU/MoE performance regressions can block an upstream update
  • placement and fallback decisions are observable through metrics/status
  • normal CI remains hardware-independent with performance fixtures/mocks; optional hardware benchmarks are documented

Relationship to other Runtime milestones

This is a cross-cutting 0.3 priority and should shape the backend interface in #8 rather than being bolted on after GPU-centric design.

Agent compatibility (#9) and generative media (#10) should consume the same host resource/placement primitives later, but CPU-first text/model inference remains the primary optimization target.

Non-goals

  • requiring a GPU
  • automatically preferring GPU merely because one exists
  • relying on OS swap as the memory scheduler
  • blindly spilling active inference state to disk
  • moving arbitrary live workloads between CPU/GPU without backend support
  • hiding severe capacity/performance degradation from clients
  • sacrificing CPU-only performance to track the newest upstream release

Activity

  1. pschildgen87-code commented on Sep 4, 2026

    @pschildgen87-code
    ContributorAuthor

    Turin/5th Gen AMD EPYC is now a Tier-1 CPU-only reference platform tracked in #12. Treat #12 as the AMD EPYC specialization of this generic CPU-first milestone, including NUMA/NPS, memory-bandwidth saturation, prefill/decode tuning, backend regression gates and MoE placement.

  2. pschildgen87-code commented on Sep 4, 2026

    @pschildgen87-code
    ContributorAuthor

    Product identity decision: GPU independence is a defining Runtime property

    Quantum Runtime should be distinguished by making CPU-only inference a primary optimization target rather than a degraded fallback path.

    The product goal is:

    CPU-only = first-class optimized execution
    GPU/NPU = optional accelerator when measured beneficial
    existing GPU systems = fully compatible
    no GPU = no functional downgrade in Runtime architecture
    

    We should not make the unverifiable blanket promise that CPU will beat every modern GPU on every model/workload. Instead, release-quality success is defined by these measurable principles:

    • CPU-only must be aggressively optimized and benchmarked as a primary path.
    • The planner evaluates CPU-only first and may keep it even when a GPU exists.
    • GPU/hybrid execution is selected only when the measured placement is actually better for the requested workload/policy.
    • A GPU must never be required for Runtime startup, model registry, model lifecycle, agents, tools, or ordinary inference APIs when the chosen model/backend supports CPU execution.
    • New GPU features must not regress CPU-only correctness or representative performance beyond policy tolerance.
    • CPU-only performance, TTFT, decode throughput, RAM efficiency, energy/TCO and host independence are product KPIs, not compatibility afterthoughts.
    • Current GPU-equipped systems must remain fully supported through the same public Runtime API and capability router.
    • Backend/model/hardware-specific performance data decides placement; hardware presence alone does not.

    This makes GPU independence a deliberate product feature rather than merely an installation option.

  3. pschildgen87-code commented on Sep 4, 2026

    @pschildgen87-code
    ContributorAuthor

    E.M.B.E.R.-specific hardware admission is now tracked separately in #13 so this CPU-first issue stays generic. Current E.M.B.E.R. production baseline: 64 GiB DDR5 ECC RAM, 8 physical CPU cores, ~2.6 GHz/core reference class, GPU optional, MoE model architecture required. The ~2.6 GHz value is only a reference class; once host calibration exists here, admission should prefer measured throughput/topology/bandwidth over raw clock frequency. Runtime itself must continue to support smaller/different hosts where the selected model/backend is valid.

  4. pschildgen87-code commented on Sep 5, 2026

    @pschildgen87-code
    ContributorAuthor

    0.3.0-alpha.3 landed

    PR #16 is merged and the prerelease is published. The first CPU-first placement foundation is now implemented:

    • host discovery: CPU topology/features, NUMA, RAM/huge pages, storage/NVMe and visible accelerators/VRAM
    • bounded explicit worker/memory calibration instead of benchmarking during daemon startup
    • separate placement classes for model weights, MoE experts, KV cache, prefix cache, projector, workspace and cold bytes
    • CPU/RAM candidate is evaluated first and remains selected when the hot set fits
    • GPU/hybrid is only a pre-activation candidate after CPU-only capacity fails and acceleration was explicitly allowed
    • NVMe is explicit cold-tier storage only; hot state never silently falls through to disk/swap
    • capacity failure is explicit (capacity_exceeded)

    Still open under this issue: real model/backend prefill/decode calibration, automatic GGUF/KV sizing, persisted calibration, NUMA/thread affinity, backend activation from a validated plan, dynamic free-VRAM signals and measured CPU-vs-GPU policy selection.

  5. pschildgen87-code commented on Sep 5, 2026

    @pschildgen87-code
    ContributorAuthor

    CPU-first follow-up landed in Runtime 0.3.0-alpha.4 (PR #17).

    New pieces relevant to #11:

    • separate guest/process CPU-limit contract from process affinity, cgroup cpusets and CPU quota
    • virtualization evidence so physical host model identity is not confused with guest allocation
    • explicit operator core_budget for application admission; current production example can reserve 16 of 20 allocated CPUs for Ember and leave four for other services
    • /v1/benchmark-plan creates repeatable CPU worker-count candidates without claiming unmeasured performance
    • current 20-CPU / four-core-reserve reference produces 8/12/16 production candidates and optional 20-core full-guest comparison
    • historical deployment evidence is now kept separate from the supported production profile: small models/RAG-Lite/LTM can run on smaller hosts, but that does not redefine the current E.M.B.E.R. MoE production baseline

    Still open for #11: real model prefill/decode/TTFT calibration, GGUF/KV resource estimation, persistent per-model/backend tuning, NUMA/thread affinity, and measured CPU-vs-hybrid selection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions