DEV Community

Cover image for SenseNova-Loop-9B GGUF on Your Own Device: Layers That Run Twice Make the KV Cache 1.75x Bigger Than 8 Layers
GINIGEN AI
GINIGEN AI

Posted on Originally published at ginigen-ai-edge-ai-news.static.hf.space

SenseNova-Loop-9B GGUF on Your Own Device: Layers That Run Twice Make the KV Cache 1.75x Bigger Than 8 Layers

TL;DR

SenseNova-Loop-9B is a 9B-parameter multimodal model that runs 24 of its 32 decoder layers twice per token, so 32 sets of weights do the work of 56 layer executions. The official GGUF repo (published 2026-11-18) ships Q4_K_M at 5.419 GiB, Q5_K_M at 6.211 GiB, Q8_0 at 9.126 GiB, BF16 at 17.155 GiB and a 0.855 GiB vision projector. The weights are small, and the part worth planning is the KV cache. From config.json, 8 of the 32 layers use full attention, and because the looped block repeats 6 of them, a forward pass contains 14 full-attention executions that each need their own K/V. That is 56 KiB per token at fp16, or 3.5 GiB at 64K and 14 GiB at 256K. The vendor's own memory table (about 10, 12 and 15 GiB for 64K, 128K and 256K at 8-bit KV) matches this arithmetic to within a nearly constant 3 to 4 GiB of overhead.

SenseNova-Loop-9B GGUF file sizes

Sources: the official GGUF repo (file sizes from the Hugging Face tree API, model card text), and the BF16 repo config.json. The cache figures are our own arithmetic from the config, with the formula printed below so you can redo it.

What is SenseNova-Loop-9B, in terms an edge builder cares about?

The model card describes a looped transformer: layers 0 to 3 run once, layers 4 to 27 form a shared block that runs twice, and layers 28 to 31 run once before the output head. In the card's notation the looped part is B(B(h)). Storage holds 32 layers of weights, compute performs 56 layer executions, and the card quotes roughly 14.6B inference-equivalent parameters for about 9B stored.

Other facts from the card and config that matter for deployment:

  • Two-stream mHC: manifold-constrained hyper-connections carry two residual streams through the looped block, with Sinkhorn normalization at 20 iterations. A runtime must reproduce this order, which is why the repo points to a dedicated llama.cpp fork rather than mainline.
  • Hybrid attention: three linear-attention layers then one full-attention layer, repeated. The loop boundaries (4 and 28) align with whole four-layer groups, so both passes keep the same pattern.
  • Long context: up to 512K tokens (max_position_embeddings 524,288), with text and image input.
  • License: Apache 2.0.
  • Reported results: the card lists Terminal-Bench 2.1 at 59.55, GAIA at 69.90, AutomationBench at 36.67 and AIDABench at 65.31 against 65.01 for Qwen3.8-27B. These are vendor-reported numbers, and this article is about memory, so we use them only as context for why you might want to run the model.

The practical reading: a model that behaves like a larger one while storing 9B parameters is attractive on a 16 GB or 24 GB machine, as long as you budget the cache correctly.

Which GGUF file should you download?

The tree API gives exact bytes:

File Bytes GiB
Q4_K_M 5,818,631,072 5.419
Q5_K_M 6,668,501,920 6.211
Q8_0 9,798,648,736 9.126
BF16 18,419,909,536 17.155
mmproj F16 918,165,984 0.855

Q4_K_M is 31.6 percent of the BF16 file, and Q8_0 is 53.2 percent. Because the model is looped, the file size reflects only the 32 distinct layers. Looping costs compute, not storage.

For most laptops and 12 to 16 GB GPUs, Q4_K_M leaves the most room for context. Q5_K_M costs 0.79 GiB more. Q8_0 is the choice when you have 24 GB and want the least quantization error on tool-use and coding work.

How big is the KV cache when layers run twice?

Start from the config: num_hidden_layers 32, full_attention_interval 4, num_key_value_heads 4, head_dim 256, and a layer_types list that marks layers 3, 7, 11, 15, 19, 23, 27 and 31 as full attention. The other 24 are linear attention, which keep a fixed-size recurrent state instead of a growing cache.

The cache per token per full-attention execution at fp16 is:

2 (K and V) x 4 KV heads x 256 head_dim x 2 bytes = 4,096 bytes
Enter fullscreen mode Exit fullscreen mode

Now count executions. Looped layers 4 to 27 contain full-attention layers 7, 11, 15, 19, 23 and 27, which is 6 layers. Layer 3 and layer 31 sit outside the loop. A second pass through layer 7 sees a different hidden state than the first pass, so its keys and values differ and cannot reuse the first pass's cache entries. That gives 1 + 6 x 2 + 1 = 14 executions that need cache, not 8.

KV_HEADS, HEAD_DIM, BYTES = 4, 256, 2
per_exec = 2 * KV_HEADS * HEAD_DIM * BYTES        # 4096 B per token

def kv_gib(tokens, execs=14, bytes_scale=1.0):
    return per_exec * execs * tokens * bytes_scale / 2**30

for ctx in (8192, 32768, 65536, 131072, 262144):
    print(ctx, round(kv_gib(ctx), 3), round(kv_gib(ctx, bytes_scale=0.5), 3))
Enter fullscreen mode Exit fullscreen mode

SenseNova-Loop-9B KV cache by context

Context fp16, 8 layers (naive) fp16, 14 executions 8-bit, 14 executions
8K 0.25 GiB 0.44 GiB 0.22 GiB
32K 1.00 GiB 1.75 GiB 0.88 GiB
64K 2.00 GiB 3.50 GiB 1.75 GiB
128K 4.00 GiB 7.00 GiB 3.50 GiB
256K 8.00 GiB 14.00 GiB 7.00 GiB

If you size a machine by counting only the 8 distinct full-attention layers, you under-provision by a factor of 1.75 at every context length. That is the main edge takeaway of this model: the parameter count is the stored count, and the cache follows the executed count.

The linear-attention layers add a context-independent state. With 32 value heads and 128 by 128 key and value dimensions held in fp32 (the config sets mamba_ssm_dtype to float32), one layer's recurrent state is 2 MiB. Across the 42 linear-layer executions (24 distinct, 18 repeated in the loop) that is about 84 MiB, or 0.08 GiB per sequence. It does not grow with context. This is our estimate from the config shapes, so read the cache size your runtime prints to confirm the exact layout.

Does the vendor memory table agree with the arithmetic?

The card's low-memory section lists estimated minimum GPU memory with 4-bit weights (about 4.9 GB) and an 8-bit KV cache: about 10 GiB at 64K, 12 GiB at 128K and 15 GiB at 256K. Subtract the 4.9 GB weights and our 8-bit cache from each row:

Context Vendor total 4.9 weights + 8-bit KV (14 exec) Left for everything else
64K ~10 GiB 6.65 GiB ~3.4 GiB
128K ~12 GiB 8.40 GiB ~3.6 GiB
256K ~15 GiB 11.90 GiB ~3.1 GiB

The remainder stays near 3 to 4 GiB across all three rows, which is what you would expect from a fixed overhead made of the vision tower, activation buffers and the recurrent state. Using 8 executions instead of 14 gives remainders of 4.1, 4.9 and 6.1 GiB, which drift upward with context and are harder to explain. The match supports the 14-execution reading, and the card does not publish its formula, so we call it consistent rather than confirmed.

What does the full stack cost at each context?

For a llama.cpp style local run with Q4_K_M (5.419 GiB), the vision projector (0.855 GiB), the recurrent state (0.08 GiB) and an fp16 cache:

SenseNova-Loop-9B full stack at 64K

Context Weights mmproj KV fp16 State Total before compute buffers
32K 5.42 0.86 1.75 0.08 8.11 GiB
64K 5.42 0.86 3.50 0.08 9.86 GiB
128K 5.42 0.86 7.00 0.08 13.36 GiB
256K 5.42 0.86 14.00 0.08 20.36 GiB

Two practical rules follow. A 12 GB device fits 32K comfortably and 64K with a quantized cache. A 24 GB GPU fits the full 256K window with an 8-bit cache (about 13.4 GiB for weights, projector, cache and state), which leaves headroom for compute buffers. Add 1 to 2 GiB for compute buffers in your own planning and read the number the runtime logs at startup.

How do you run it?

The model card documents a dedicated llama.cpp build with the loop and mHC support, pinned to a specific commit:

llama serve -hf sensenova/SenseNova-Loop-9B-GGUF:Q4_K_M \
  -ngl 99 -c 4096 --port 8000
Enter fullscreen mode Exit fullscreen mode

Start with -c 4096 to confirm the model loads, then raise the context while watching the KV line in the server log. If you add a quantized cache, change one setting at a time and rerun your own prompts, because cache quantization trades accuracy for memory and the right setting depends on your task. A second route is the official AWQ 4-bit repo with its matching MTP draft for GPU serving.

What should an on-device team do with this?

  1. Budget by executions, not layers. For any looped model, multiply cache-bearing layers by the number of passes before sizing RAM.
  2. Pick the file by headroom. Q4_K_M for 12 to 16 GB, Q8_0 for 24 GB.
  3. Test the long-context path you will ship. The card claims 512K training context, and your device decides how much of it you can afford.
  4. Gate the release. A quantized agentic model that calls tools needs a safety and behavior check on the exact GGUF you ship, not on the BF16 original.

FAQ

How much memory does SenseNova-Loop-9B need at Q4_K_M?
The file is 5.419 GiB. With the 0.855 GiB projector and an fp16 cache, about 8.1 GiB at 32K and 9.9 GiB at 64K before compute buffers.

Why is the KV cache bigger than the layer count suggests?
Six full-attention layers sit inside the block that runs twice, and each execution needs its own keys and values, so 14 executions cache instead of 8.

Does the looped design make the GGUF larger?
No. The file stores 32 distinct layers. Looping adds compute per token, not file size.

Can mainline llama.cpp run it?
The card points to a dedicated OpenSenseNova llama.cpp build at a pinned commit, because the loop and mHC routing must be reproduced exactly.

Which context length fits 24 GB?
About 128K with an fp16 cache and the full 256K with an 8-bit cache, before compute buffers.

Further reading

Top comments (0)