rope_rotate — LLMCORE prepare op

• Data kinds: tokens → tokens

• Call: import fullseye as fs; fs.ledger.rope_rotate(tokens, positions=None, base: 'float' = 10000.0) -> 'np.ndarray' (to call the implementation directly, import llmcore; llmcore.rope_rotate(tokens, positions=None, base: 'float' = 10000.0) -> 'np.ndarray'; from the registry, opsllmcore.get("rope_rotate"))

Usage

Rotary position encoding (RoPE) → tokens. Being a rotation, it preserves the norm.

Su et al. 2021. Each even/odd pair (x₂ᵢ, x₂ᵢ₊₁) is rotated by the angle pos · base**(−2i/d). It is a direct sum of plane rotations, so ‖RoPE(x)‖ == ‖x‖ holds exactly (measured 8.9e-16), and the inner product of 2 rotated vectors is determined only by the difference in position (shifting the absolute position 40 ways gives a spread of 8.9e-15) — the claim "relative position is embedded in the inner product" becomes the cross-check as it stands.

Args:

tokens: (T, d) float. d is even (to rotate in pairs).

positions: (T,) positions. None means 0..T−1. Non-contiguous positions (a cut-out window) can also be passed.

base: base of the angles. The larger it is, the more slowly the low axes rotate (for long contexts).

Returns:

tokens (T, d) float: rotated per pair. The norm of each row is the same as the input.

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 · attention_scores · attention_apply · attention_softmax · attention_tiled · attention_linear · attention_grouped · kv_cache_decode

Same category (prepare)

rms_norm


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