Skip to content

Feature Request: Disk-based context checkpoint offloading (--cache-disk) #20697

Description

@wypiki

Prerequisites

  • I am running the latest code. Mention the version if possible as well.
  • I carefully followed the README.md.
  • I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
  • I reviewed the Discussions, and have a new and useful enhancement to share.

Feature Description

Problem

Context checkpoints (--ctx-checkpoints, --cache-ram) are currently stored exclusively in system RAM. On UMA (Unified Memory Architecture) systems such as AMD Strix Halo, system RAM and VRAM are physically the same memory pool. This means checkpoint caching actively competes with model weights and KV cache for the same limited resource, rather than providing relief.

On these systems, --cache-ram doesn't offload anything – it just reserves more of the same unified memory that the model already needs, reducing the effective memory available for context or GPU layers.

Proposed Solution

Add a --cache-disk <path> option (or --cache-ssd) that allows context checkpoints to be serialized to a fast local storage device (NVMe SSD) instead of being held in RAM.

Modern NVMe SSDs deliver 5-7 GB/s sequential read throughput, which would allow restoring a typical checkpoint (50-100 MiB) in ~10-20ms – negligible compared to the seconds or minutes saved by avoiding full prompt re-processing on hybrid/recurrent models like Qwen 3.5.

Suggested interface

--cache-disk <path>       directory for disk-based checkpoint storage (default: disabled)
--cache-disk-max <MiB>    maximum disk space for checkpoints (default: unlimited)

When --cache-disk is set, checkpoints would be written to disk instead of (or in addition to) RAM. On restore, the checkpoint is read back from disk into the appropriate memory (GPU/unified).

Use Case

This is particularly relevant for:

  1. UMA/APU systems (AMD Strix Halo, Strix Point, future Apple Silicon with large models) where RAM = VRAM and every megabyte of RAM used for checkpoints is a megabyte less for model/context
  2. Multi-user systems: this kind of almost unlimited caching would make serving multiple users with different system prompts or several agents simultaniously fast on systems with slow prompt processing speeds
  3. Large context windows (100k+ tokens) where checkpoints can grow large and numerous

Why not just use --cache-ram?

On discrete GPU systems with separate VRAM, --cache-ram makes sense – it uses a different memory pool. But on UMA systems:

  • RAM is VRAM – there's no offloading benefit
  • Checkpoint RAM usage directly reduces available memory for model layers, KV cache, and context size
  • Users are forced to choose between more checkpoints (faster turn transitions) and more context/layers

Disk-based checkpoints would completely eliminate this trade-off on UMA systems, and also benefit discrete GPU setups where system RAM is also limited.

Environment

  • Hardware: AMD Strix Halo (Ryzen AI Max+ 395, Radeon 8060S, 128 GB unified memory)
  • Model: Qwen3.5-122B-A10B (Q5_K_XL, ~85 GB)
  • Context: 220k tokens
  • Backend: Vulkan
  • llama.cpp version: b8398

Motivation

Making UMA systems like Strix Halo or Apple Silicon a real option for multiple users, also making the experience for single users much better with assistants like OpenClaw, Claude Code etc.

Possible Implementation

Instead of copying the checkpoints to RAM, they would be copied to the SSD and read from there when matched.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions