decode op• 数据种类:tokens × tokens × tokens → tokens
• 调用: import fullseye as fs; fs.ledger.kv_cache_decode(query_step, key_cache, value_cache, scale=None) -> 'np.ndarray'(要直接调用实现,import llmcore; llmcore.kv_cache_decode(query_step, key_cache, value_cache, scale=None) -> 'np.ndarray';从台账取用则 opsllmcore.get("kv_cache_decode"))
只前进 1 个 token 的推理(KV Cache)→ tokens (1, dv)。
在因果掩模下,改写未来不会让之前的输出变动哪怕 1 位(实测 0.0e+00), 所以只要保存已完成的 key/value,只计算 1 行即可 —— 按顺序每次推进 1 行得到的结果,与一次性通过整个序列的结果一致(相对差 1.6e-16)。每 1 步的计算量是 O(T d),等于把一次性的 O(T² d) 分摊到 T 步。
Args:
query_step: (1, d) float。现在要生成的 1 个 token。
key_cache: (T, d) float。到目前为止看到的 key(包括自己)。
value_cache: (T, dv) float。相同长度的 value。
scale: 分数的倍率。None 时为 1/√d。
Returns:
tokens (1, dv) float: 与一次性通过时的最后一行一致。
• 示例数据目录(下载 URL / 许可证) —— 2-D 用 skimage.data(BSD/公有领域)加合成图,3-D 给出真实数据源(Stanford/PDS 等)的下载 URL。
• 算子来历与参考文献 —— 该算子族所依据的研究/方法出处。
• 算法的正典(作者、年份)与用途见上面的族使用指南。
• poc_attention_identities — py -3.11 examples/poc_attention_identities.py
tokens 作为输入)rms_norm · rope_rotate · attention_scores · attention_apply · attention_softmax · attention_tiled · attention_linear · attention_grouped
decode)—
*Provenance: llmcore.py — LLMCORE 算子登记表。本条目由 tools/opdocs.py md 自动生成(请勿手工编辑)。*
© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.