attention_weights — LLMCORE score op

• Data kinds: attnmap → attnmap

• Call: import fullseye as fs; fs.ledger.attention_weights(scores, mask=None, window=None) -> 'np.ndarray' (to call the implementation directly, import llmcore; llmcore.attention_weights(scores, mask=None, window=None) -> 'np.ndarray'; from the registry, opsllmcore.get("attention_weights"))

Usage

Row-wise softmax (with mask) → attnmap. Row sums are 1 and mask positions are exactly 0.

The maximum of each row is subtracted before taking the exponential. This is not decoration -- applying exp without subtracting, all rows become inf/NaN when scores are large (measured: 96 of 96 rows). With subtraction, 0 rows.

Args:

scores: (T, T) float raw scores (output of attention_scores).

mask: None (all pairs) / "causal" (lower triangle) / "window" (causal window of width window) /

a (T, T) bool array. True means "may look".

window: window width when mask="window" (count including itself).

Returns:

attnmap (T, T) float: each row is a probability distribution (sum 1). Positions where mask is False are exactly 0.

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 attnmap as input)

attention_apply

Same category (score)

attention_scores · attention_apply


*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.