Skip to content

[Bug] Studio memory estimate conflicts with context warning and loader KV estimate #10489

Closed

Description

@Imagineer99

Problem

Studio shows conflicting memory assessments for the same reported GGUF configuration: the Estimated Memory Usage panel reports 11.58 GiB, the context warning says the selected context exceeds VRAM capacity, and subsequently supplied loader logs estimate substantially more KV memory than the panel.

The new logs also show a real CPU placement decision for the vision projector. This should not be treated solely as a false warning: the estimates and their inputs need to be reconciled.

Reported configuration and UI

The user reports a GPU with 16 GB VRAM. Their loader logs identify unsloth/gemma-4-12b-it-GGUF, gemma-4-12b-it-Q4_K_M.gguf, mmproj-F16.gguf, and the separate mtp-gemma-4-12b-it.gguf drafter.

Setting / estimate in the screenshot Value
Context length 262,144 tokens
KV cache precision q8_0
Speculative decoding MTP
Estimated GPU memory 11.58 GiB
Estimated total memory 11.58 GiB
Weights 7.07 GiB
KV cache 2.37 GiB
Compute buffers 2.14 GiB

At the same time, the context control displayed:

Exceeds estimated VRAM capacity (131,072 tokens). The model may use system RAM.

New evidence: loader logs supplied September 8

Relevant messages from the successful load, with personal paths omitted:

Auto: running the vision projector on the CPU (--no-mmproj-offload); it does not fit in VRAM alongside the model at 262144 context. Image encoding gets slower, text generation is unaffected. Pass --mmproj-offload in the advanced arguments to keep it on the GPU.

GGUF size: 6.6 GB, est. KV cache: 9.4 GB, MTP reserve: 0.43 GB (draft KV @ 262144 + verify n_max=2), context: 262144, GPUs free: [(0, 14744)], selected: None, --fit: on

Load mode: the whole load (19.3 GB) fits without paging, using --load-mode none.
KV cache type: q8_0
Spec decoding: draft-mtp (MTP-only)

The launch command includes --parallel 1, -c 262144, --fit on, --fit-ctx 262144, --cache-type-k q8_0, --cache-type-v q8_0, --spec-type draft-mtp, --spec-draft-n-max 2, and --no-mmproj-offload. The server subsequently reports ready and the model loaded.

What this establishes:

  • The vision projector was explicitly assigned to CPU/system RAM because the loader judged it would not fit alongside the model at the selected context.
  • The loader's 9.4 GB estimated KV cache conflicts with the panel's 2.37 GiB. Both refer to 262,144 tokens, and the launch uses q8_0 for K and V. Neither number is an observed allocation; investigate the differing inputs/accounting before deciding which is correct.
  • --fit on allows placement adjustments. These parent-server logs do not report the final placement of the main model's weights or KV cache.
  • The 19.3 GB "fits without paging" message is not confirmation of a fit entirely in VRAM.

The exact Studio version remains unknown. A later full llama-server log identifies the GPU and actual allocations; see the follow-up below. The original load's final allocation remains unverified. The separate resource-monitor screenshot shared in the discussion is illustrative, not verified telemetry from this user's machine.

Source investigation: independent warning threshold

Source inspected at a37dea7f4430041e29c68d1322fbd73db699f6d5:

  • The memory estimate is requested for the pending configuration, including context length, KV precision, speculative decoding and GPU placement. Estimate request
  • The context warning independently checks contextValue > loadedMaxContextLength for an active model. It does not use the pending memory estimate. Warning condition
  • The backend documents that limit as the largest context fitting on the hardware at load time. Backend property

Editing memory-affecting settings can therefore update the estimate while the warning judges the new context against the previous load's limit. This dependency mismatch is confirmed by source inspection, but is not yet established as the complete explanation for this user's conflicting figures.

Expected behavior / validation

  • Reconcile the panel's KV estimate with the loader's estimate for this model, including context, cache precision, slots, MTP and vision placement. Explain any intentionally different accounting.
  • Assess the pending configuration against a consistent available-memory budget and loader reserves. If the context threshold cannot be recalculated yet, label it explicitly as the previous load's estimated limit.
  • Cover changing KV precision or other memory-affecting settings after loading: an old threshold should not be presented as a current fit verdict.

Follow-up: actual placement is hard to identify

The user asked whether rising system RAM meant the model or context had been offloaded. Settings' live monitor and the floating resource meter show overall usage, which cannot distinguish normal host allocations, retained weights, or actual CPU placement. A successful load does not resolve that question either.

The relevant logs are already accessible under Settings → Logs, by selecting the appropriate llama-server source. The source for this attempt is llama-1788862534-port-52787-try0.log; Copy path provides access to the full file if startup lines are no longer visible.

A post-load summary of actual weight/tensor, KV-cache and vision-projector placement would make this understandable without interpreting raw logs. It should use runtime evidence, label unknowns explicitly, and keep estimated/requested placement distinct from observed placement.

Later full log: main layers and KV cache are on GPU in this run

The user supplied a full verbosity-4 log after testing different settings. Treat this as evidence for that particular later run, not proof of the earlier run's final placement.

The log identifies an NVIDIA GeForce RTX 4080 (16,375 MiB total, 15,076 MiB free at startup), Windows AMD64, and Unsloth's llama.cpp build 10840 (58670d128). It still loads Gemma-4-12B-It Q4_K_M at 262,144 tokens, one slot, q8_0 K/V, with the separate MTP drafter.

Actual main-model allocation lines:

load_tensors: offloaded 49/49 layers to GPU
load_tensors:        CUDA0 model buffer size =  6776.91 MiB
load_tensors:    CUDA_Host model buffer size =   540.00 MiB
llama_kv_cache:      CUDA0 KV buffer size =  2176.00 MiB
llama_kv_cache: size = 2176.00 MiB (262144 cells, 8 layers, 1/1 seqs), K (q8_0): 1088.00 MiB, V (q8_0): 1088.00 MiB
llama_kv_cache:      CUDA0 KV buffer size =   255.00 MiB
llama_kv_cache: size = 255.00 MiB (1536 cells, 40 layers, 1/1 seqs), K (q8_0): 127.50 MiB, V (q8_0): 127.50 MiB

The main KV buffers total 2,431 MiB = 2.374 GiB, matching the screenshot's 2.37 GiB. All 49 main-model layers are reported offloaded to GPU. This supports the panel's main KV figure for the later configuration; it does not validate every component of the panel's total, or reconcile the earlier parent-loader estimate of 9.4 GB.

Other relevant evidence:

  • The separate drafter reports offloaded 5/5 layers to GPU, with a 428.53 MiB CUDA0 model buffer and 272.00 MiB CUDA_Host model buffer.
  • Both vision and audio projectors report CLIP using CPU backend.
  • Host compute/output buffers are present. Full layer offload does not mean zero host model/runtime allocations.
  • The prompt cache is enabled with an 8,192 MiB limit. This is a limit, not evidence that the entire amount has been allocated.
  • llama.cpp's fit pass projects 10,025 MiB for the main model/context/compute and reports no changes needed; it cannot measure the separate Gemma4Assistant context during that pass and loads the drafter afterward. The main-model figure must not be presented as the entire load's footprint.

The evidence now confirms that, in this later run, the main model's layers and main KV cache fit on GPU while other components use system RAM. The unresolved issue is why the warning and earlier parent-loader estimate disagree with the panel/runtime sizing, and how to present component placement clearly.

Activity

  1. changed the title [-][Bug] Studio context VRAM warning uses previous load limit while memory estimate uses pending settings[/-] [+][Bug] Studio memory estimate conflicts with context warning and loader KV estimate[/+] on Sep 8, 2026
  2. debojyoti-dev commented on Sep 9, 2026

    @debojyoti-dev
    Contributor

    I’d like to take this issue up.

    I’ve gone through the reported configuration, loader logs, and the relevant Studio/llama.cpp code paths. The later full log confirms that the main model layers and main KV cache are actually on GPU, with the 2,431 MiB KV allocation matching the Studio estimate of ~2.37 GiB. However, the earlier parent-loader estimate of 9.4 GB KV and the independent context warning still need to be reconciled.

    I’ll investigate the estimate inputs/accounting across Studio and the loader, particularly context size, KV precision, slots, MTP reserves, and vision-projector placement. I’ll also look at how the previous load’s context limit is surfaced so that memory-affecting configuration changes don’t result in a stale fit warning being presented as a current verdict.

    I’ll aim to add a clearer post-load breakdown of estimated vs. actual placement where possible, while keeping unknown/runtime-dependent values explicitly labelled.

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