kv_cache_decode — LLMCORE decode op

• Data kinds: tokens × tokens × tokens → tokens

• Call: import fullseye as fs; fs.ledger.kv_cache_decode(query_step, key_cache, value_cache, scale=None) -> 'np.ndarray' (to call the implementation directly, import llmcore; llmcore.kv_cache_decode(query_step, key_cache, value_cache, scale=None) -> 'np.ndarray'; from the registry, opsllmcore.get("kv_cache_decode"))

Usage

Inference that advances by only 1 token (KV Cache) → tokens (1, dv).

Under a causal mask, rewriting the future does not move the earlier outputs by even 1 bit (measured 0.0e+00), so you can keep the finished key/value and compute just 1 row — advancing sequentially 1 row at a time gives the same result as passing the whole sequence at once (relative difference 1.6e-16). The cost for 1 step is O(T d), equal to the batch O(T² d) divided over T steps.

Args:

query_step: (1, d) float. The 1 token about to be generated.

key_cache: (T, d) float. The keys seen so far (including itself).

value_cache: (T, dv) float. Values of the same length.

scale: score multiplier. None means 1/√d.

Returns:

tokens (1, dv) float: matches the last row of the batch pass.

Detailed usage guide

• llmcore family guide

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

• The canonical algorithm (author, year) and its uses are named in the family usage guide above.

Runnable examples (verified samples that actually call this op)

• poc_attention_identities — py -3.11 examples/poc_attention_identities.py

Ops the type connects to (they accept tokens as input)

rms_norm · rope_rotate · attention_scores · attention_apply · attention_softmax · attention_tiled · attention_linear · attention_grouped

Same category (decode)

—


*Provenance: llmcore.py — LLMCORE operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.