Concepts · Level 4 · Note 15

RoPE, attention sinks, ring attention and mixture of experts: the security view

Four LLM architecture ideas in plain words, what the original papers claim, and an honest account of which ones have real security research behind them.

12 min read

Short answer

Four ideas explain how language models read very long inputs and stay fast: RoPE marks each word's position by rotating it, attention sinks are where a model parks spare attention, ring attention spreads one long input across many chips, and mixture of experts runs only part of the model per word. The security picture is uneven. Long context has a proven attack, many-shot jailbreaking, with up to 256 fake dialogs. Mixture of experts has two lab attacks across users who share a batch. Attention sinks have early research. For RoPE scaling and ring attention we found no attack research.

Some AI concepts come with a clear security story. Others are engineering ideas that people attach scary claims to. This note takes four architecture ideas, explains each one, checks the popular one-line summary against the original paper, and says plainly how much security research exists.

How much security research we found for each idea

1Long context (the goal of RoPE scaling and ring attention)many-shot jailbreaking, shown on production modelsshown on real products
2Mixture of expertstwo Google DeepMind papers, lab conditions onlylab only
3Attention sinksone peer-reviewed attack on image models, two early papersearly papers
4RoPE scaling itselfnothing specific foundno research found
5Ring attention itselfnothing foundno research found
Our summary of the searches done for this note on 23 November 2026. How to read the labels: "shown on real products" means the attack worked against models people use. "Lab only" means it worked in a controlled setup the researchers built. "Early papers" means a few studies with narrow conditions. "No research found" means we found no paper, which is different from proof that no weakness exists.

RoPE, in plain words

A model needs to know word order, because “dog bites man” and “man bites dog” use the same words.

Picture each word carrying a small clock. The first word’s hand points to twelve, and each later word’s hand is turned a little further. To judge how far apart two words are, the model compares the angles of their hands. In the real thing each word carries many hands turning at different speeds. That is RoPE, rotary position embedding.

Animated: position as a clock hand, and what stretching does

word 1
word 2
word 3
word 9,000

Positions the model practiced on during training

The input it is given now

angles never seen in trainingpositions squeezed into the known range
  1. Every word carries a small clock hand. The model reads word order from these hands.
  2. Each later word's hand is turned a little further. The gap between two hands tells the model how far apart the words are.
  3. Now feed in a text far longer than anything in training. Real models use many hands at different speeds, and the slow ones reach angles the model has never seen.
  4. Attention goes wrong at those unseen angles, and the output falls apart.
  5. RoPE scaling squeezes the positions so that even the last word's hand stays within the range the model knows.
  6. After a short round of extra training, the model can read much longer inputs. Longer inputs are also more room for an attacker's text, which is where the security cost comes in.
Our animation of rotary position embedding and position interpolation (Su et al.; Chen et al., Meta). Angles are for illustration.

How far past its training a stretched model reads

  • 2,048 tokens, the original LLaMA training window
  • 32,768 tokens after Position Interpolation
Source: Chen, Wong, Chen and Tian (Meta), 2023. The bar is drawn to scale.

RoPE and RoPE scaling, technically

The 2021 paper that introduced RoPE describes it as a way to “encode relative position by multiplying the context representations with a rotation matrix”. Each word’s vector, the list of numbers that stands for it inside the model, is split into pairs, and each pair is rotated by an angle that depends on the word’s position, with different pairs turning at different speeds. When two rotated vectors are compared, only the difference between their angles survives, so the score depends on how far apart the words are.

The trouble starts when a model meets a longer input than it was trained on. The original LLaMA models were trained with a window of 2,048 tokens (a token is a word or a piece of one). Past that, the slowest hands, which never complete a turn during training, reach angles and combinations of angles the model has never seen. A Meta paper warns that this “may lead to catastrophically high attention scores that completely ruin the self-attention mechanism”.

RoPE scaling is the family of fixes:

  • Position Interpolation (Meta, 2023) squeezes the new, longer range of positions back into the range the model knows. It “linearly down-scales the input position indices to match the original context window size”. With that, LLaMA models were extended “up to 32768 with minimal fine-tuning (within 1000 steps)”.
  • YaRN (2023) points out that squeezing every clock equally blurs fine detail, and scales the fast and slow clocks by different amounts. Its authors report extending Llama 2 models to a 128k context.

Think of a model trained on a 2,000-page book that is handed a 32,000-page one. Instead of learning new page numbers, it’s taught to read the old numbering more finely.

Attention sinks, in plain words

In a meeting, when nobody is saying anything relevant, people’s eyes drift to the whiteboard at the front. Nothing important is written there. It’s just where eyes go.

A model’s attention works the same way. For each word it has 100% of attention to hand out and must spend all of it. When nothing earlier in the text is relevant, the spare attention lands on the very first token.

Animated: where spare attention goes

The model is working on the last word. How much does it look at each earlier word?

first token
"report"
"is"
"due"
attention must add up to 100%long stream: oldest notes dropped from the cachefix: keep the first few tokens
  1. When an earlier word matters, the model looks mostly at that word.
  2. Often nothing earlier matters. But attention is a budget that must add up to 100%, so it has to be spent somewhere.
  3. The spare attention lands on the very first token. That token is visible from everywhere, so the model learned to park attention there.
  4. When a model streams for hours, the oldest notes are dropped from its cache to save memory. Drop the first token's notes and the parking spot is gone. Attention scatters and the output breaks.
  5. Keep the first few tokens and slide the rest, and the model stays stable over millions of tokens.
  6. This is about stability, not memory: the model still only sees what is in its window. Security research on attention sinks is early.
Our animation of the finding in "Efficient Streaming Language Models with Attention Sinks" (Xiao et al.). Bar lengths are for illustration.

Attention sinks, technically

The term comes from a 2023 paper by researchers at MIT, Meta AI, Carnegie Mellon and NVIDIA. They explain that attention weights must add up to one, so the model “still needs to allocate these unneeded attention values somewhere”. The first tokens become the dumping spot because “initial tokens are visible to almost all subsequent tokens”.

It is the position that matters. The authors replaced the first four tokens with meaningless line breaks and the model worked nearly as well. What counts is the “absolute position of the starting tokens, rather than their semantic value”.

This matters for models that run a long time. If a model streams for hours and the oldest tokens are dropped from its cache (its short-term working memory) to save memory, the sink goes with them and output quality collapses. Keep those first few tokens and it stays stable. The paper reports stable output for up to 4 million tokens this way. It also states the limit: the technique “does not extend the models’ context window or enhance their long-term memory capabilities”.

Ring attention, in plain words

Eight people sit around a table with a document too long for any one of them to hold. Each takes one section. Then everyone passes their section to the person on their left, compares it against their own notes, and passes it on again. After one full lap, every section has been compared with every other.

Animated: passing sections around a ring of devices

Device 1own questions: section 1
section 1section 4section 3section 2
Device 2own questions: section 2
section 2section 1section 4section 3
Device 3own questions: section 3
section 3section 2section 1section 4
Device 4own questions: section 4
section 4section 3section 2section 1
each device passes its section to the nextevery section has met every other
Longest input, 4 devices
Longest input, 16 devices
  1. The text is too long for one chip, so it is cut into sections. Each device holds one.
  2. Every device compares its own section with the one it holds, then passes that one to its neighbor.
  3. A new section arrives at each device. Compare again, pass again.
  4. Pass once more.
  5. After a full lap every section has been compared with every other. The result is exact, with nothing approximated.
  6. More devices means a longer input, though the total work still grows with the square of the length. "No limit" really means "as long as you keep adding hardware". We found no security research on this method.
Our animation of the method in "Ring Attention with Blockwise Transformers for Near-Infinite Context" (Liu, Zaharia, Abbeel).

Ring attention, technically

In the 2023 paper, the long input is cut into blocks, one per device. As the computation runs, “each device sends a copy of its key-value blocks” to “the next device in the ring”, and the sending overlaps with the computing so little time is lost. The result is exact attention, “without resorting to approximations”.

The popular summary is “context window = no limit”. The paper claims less. It handles sequences “up to device count times longer” than earlier memory-saving methods. More length needs more hardware, and the total work still grows with the square of the length. The paper uses the phrase “near-infinite”, but its own largest fine-tuning experiment stopped at 512K tokens “due to constraints on our cloud compute budget”.

Mixture of experts, in plain words

A hospital with eight specialists doesn’t send every patient to all eight. A triage desk looks at each patient and sends them to the two who fit best. The hospital has eight specialists’ worth of knowledge but each visit uses only two. Here the patient is a single token, and it is triaged again at every layer.

Mixture of experts, technically

The clearest public description is the Mixtral paper. In that model “each layer is composed of 8 feedforward blocks (i.e. experts)”, and for every token “a router network selects two experts to process the current state and combine their outputs.” The effect on cost: “each token has access to 47B parameters, but only uses 13B active parameters during inference.”

Animated: how a mixture of experts handles each word

arrives at one layer
Router: scores all 8 experts for this word
E1E2E3E4E5E6E7E8
outputs blended, passed to the next layer
Parameters stored
Parameters used per word
some routing schemes let users in one batch affect each other
  1. A word arrives at one layer of the model.
  2. A small router looks at the word and scores all eight experts.
  3. Only the top two do any work. The other six sit idle for this word.
  4. The two results are blended and handed to the next layer, which has its own router and its own eight experts.
  5. The next word gets its own pair. Experts are picked per word, and the paper found no clear pattern by subject.
  6. The payoff: the model stores 47 billion parameters and uses about 13 billion per word. Big-model knowledge at closer to a smaller model's computing cost, though memory still has to hold all 47 billion.
  7. The security angle: servers process several users' words together in a batch. With some routing schemes, lab tests showed one user's words could affect, or reveal, another's.
Our animation of Mixtral (Jiang et al., 2024): 8 experts per layer, 2 used per token, 47B stored and 13B active. The batch attacks are lab results from Google DeepMind.

Mixture of experts, one token at a time

1. Token arrivesOne piece of a word reaches the layer
input
2. Router scoresA small network scores all 8 experts for this token
gate
3. Top two runOnly 2 of the 8 experts do any work
13B of 47B
4. CombineTheir outputs are blended and passed to the next layer
output
Source: Jiang et al., "Mixtral of Experts", January 2024. The layout is ours.

Two things that circulate online need correcting. The experts are not subject specialists. The Mixtral authors “do not observe obvious patterns in the assignment of experts based on the topic”. And the “8 models, 2 active” figure is Mixtral’s. You’ll see it offered as the reason GPT-4 is fast, but OpenAI has not published that. Its GPT-4 technical report says it “contains no further details about the architecture”.

The security side

Long context: a proven attack

RoPE scaling and ring attention exist to make inputs longer, and longer inputs are where the demonstrated risk is.

Anthropic published many-shot jailbreaking in April 2024. A jailbreak is a prompt that gets a model to break its own rules. Here the attacker fills a long prompt with fake dialogs in which an assistant happily answers harmful questions, then asks the real one. The study used “up to 256” such dialogs and found that its effectiveness grows with the number of dialogs “according to a scaling trend known as a power law”. It worked on models from several companies. This only became possible as context windows grew from about 4,000 tokens to a million or more.

Fine-tuning the model (giving it extra training) to refuse “merely delayed the jailbreak”. What helped more was checking and modifying the prompt before the model saw it, which in one case cut the success rate “from 61% to 2%”.

A second long-context finding is about reliability. The Stanford-led paper “Lost in the Middle” found that performance “is often highest when relevant information occurs at the beginning or end of the input context” and “significantly degrades” for information in the middle. Our reading is that the same may apply to instructions placed in the middle of a huge prompt, so test it.

We go through what changes at each context size in Context windows explained: from 10K tokens to 1,000 trillion.

Mixture of experts: lab attacks on shared batches

Model servers process several users’ requests together in a batch. Some routing schemes cap how many tokens each expert takes per batch. Under those schemes, one user’s tokens can push another user’s tokens to a different expert, and that is a channel between users. Plain per-token top-two routing, as described above, has no such dependency.

Google DeepMind researchers showed two versions. In “Buffer Overflow in Mixture of Experts”, “malicious queries can be sent to a model and can affect a model’s output on other benign queries if they are grouped in the same batch.” In “Stealing User Prompts from Mixture of Experts”, an attacker in the same batch as a victim could read the victim’s prompt, and in a restricted test they could “fully extract 996 out of 1,000 secret messages”.

Keep the qualifiers attached. The second attack was shown “on a two-layer Mixtral model”, assumes the attacker has the model’s weights and can control where requests sit in the batch, and the authors themselves say this “makes it infeasible at present to use our attack against real world systems”. The first is described as a “proof-of-concept attack in a toy experimental setting”. The first paper’s recommended mitigation is simple: “Model owners should always randomize the order of inputs in a batch.”

Attention sinks: early research

We found three papers. The strongest is peer-reviewed at USENIX Security 2025: “Mirage in the Eyes” uses attention sinks to make image-reading models describe things that aren’t in the picture, tested on six such models. A 2025 preprint plants a backdoor, a hidden behavior that waits for a trigger, in the “unlearning” step that is meant to make a model forget something: the model looks like it forgot, and a trigger placed at sink positions brings the knowledge back. It assumes the attacker has full access to that unlearning process. A 2026 workshop paper reports that jailbreak suffixes tend to create attention sinks. For text-only apps there is nothing here to act on today. If your app describes images from strangers, treat crafted images as an input risk.

RoPE scaling and ring attention: nothing found

We searched for attacks on position scaling and on ring-style distributed attention and found none. The nearest work is a May 2026 paper, MetaBackdoor, which hides a backdoor trigger in positional information such as input length. That needs an attacker who can poison the model’s training data, and it targets positional encoding in general, not RoPE scaling.

Saying “no known attack” describes the state of the research. It shows where the evidence is thin, and so which claims to distrust.

RoPE scaling and ring attention: our own threat model

A missing paper doesn’t prove there’s no risk, so we worked through both methods ourselves. What follows is our own reasoning from how the two methods work. None of it is a reported attack, and nobody has measured it.

RoPE scaling.

Safety was tested at the old length. A model refuses harmful requests and obeys its system prompt (the standing instructions from whoever built the app) because it was trained to. Both habits were trained and checked inside the original window. Stretch the window and the model works at positions it saw rarely or never, so its behavior at those lengths is untested. Run your safety tests at the length you serve, with the system prompt at the far end of a full window.

The scaling factor is a setting, and settings can be wrong. The number that says how far to stretch lives in the model’s configuration, next to the weights (the learned numbers that are the model itself). If that value is wrong, by mistake or because someone tampered with it, nothing crashes. The model reads on with a bent sense of word order and gives worse answers that look normal. Pin the configuration to a known version along with the weights, keep a hash of each (a fingerprint that changes if the file does), and compare the configuration with the publisher’s values.

More room is also more attack surface. Scaling exists to allow a longer input, and a longer input holds more pasted documents, more retrieved pages and more fake dialog turns, so an attacker has more places to put something. The many-shot result above is what that room buys them.

Ring attention.

Every device in the ring handles the whole input. Sections of the input are passed from device to device until each has met every other. So if an attacker takes over a single machine in the ring, that machine gets the model’s internal form of the full prompt, even the sections it was never assigned. Keep every device in the ring inside one trust boundary, meaning one group of machines you control and trust equally, and protect the links between them like any network that carries customer data.

One job also holds many machines. A very long input occupies the whole ring for its full run, and one slow or failed device stalls the lap for all the others. A user who can submit maximum-length inputs at will can tie up hardware and run up cost. Cap input length per user and set a time limit per job.

Leftovers between jobs are the last thing to ask about. If the same devices serve different customers back to back, each device’s memory held another customer’s data a moment ago. Ask whether that memory is cleared between jobs, the same question you’d ask about any shared GPU.

What to check, with an example

Suppose you run an open model with an extended context window on shared GPU servers, serving several internal teams.

  1. Cap what users can paste. A million-token window is an opportunity for many-shot attacks. Set a limit that fits the job, and count the number of dialog-shaped turns in a single user message.
  2. Put instructions at the edges. Keep system rules at the start, repeat the critical ones at the end, and test that they still hold when the prompt is full.
  3. Screen prompts before the model. The measure that worked against many-shot jailbreaking sat in front of the model.
  4. Ask how batching works. If you serve a mixture of experts model to more than one tenant, find out whether requests from different tenants share a batch, whether batch order is randomized, and whether routing depends on what else is in the batch.
  5. Treat community context extensions as new models. A fine-tune that stretches a model from 4K to 128K was changed by someone. Our reading is that it needs its own safety testing at the new length, since the original testing never covered it.
  6. Test safety at the length you serve, and pin the scaling settings. This one is our own reasoning: no paper has measured it. The model was checked at its original window. If you stretch it, repeat your refusal and system-prompt tests on a full window, and keep a hash of the configuration that holds the scaling factor.
  7. Don’t repeat “unlimited context”. No paper here shows unlimited context. Length costs hardware, and the longer the input, the more room an attacker has.

Sources (all checked 23 November 2026)

  • Su et al., “RoFormer: Enhanced Transformer with Rotary Position Embedding”, 2021: arxiv.org/abs/2104.09864
  • Chen, Wong, Chen, Tian (Meta), “Extending Context Window of Large Language Models via Positional Interpolation”, 2023: arxiv.org/abs/2306.15595
  • Peng, Quesnelle, Fan, Shippole, “YaRN: Efficient Context Window Extension of Large Language Models”, 2023: arxiv.org/abs/2309.00071
  • Xiao, Tian, Chen, Han, Lewis, “Efficient Streaming Language Models with Attention Sinks”, ICLR 2024: arxiv.org/abs/2309.17453
  • Liu, Zaharia, Abbeel, “Ring Attention with Blockwise Transformers for Near-Infinite Context”, 2023: arxiv.org/abs/2310.01889
  • Jiang et al., “Mixtral of Experts”, 2024: arxiv.org/abs/2401.04088
  • OpenAI, “GPT-4 Technical Report”: arxiv.org/html/2303.08774v6
  • Anthropic, “Many-shot jailbreaking”, 2 April 2024: anthropic.com
  • Liu et al., “Lost in the Middle: How Language Models Use Long Contexts”, 2023: arxiv.org/abs/2307.03172
  • Hayes, Shumailov, Yona (Google DeepMind), “Buffer Overflow in Mixture of Experts”, 2024: arxiv.org/abs/2402.05526
  • Yona, Shumailov, Hayes, Carlini (Google DeepMind), “Stealing User Prompts from Mixture of Experts”, 2024: arxiv.org/abs/2410.22884
  • Wang et al., “Mirage in the Eyes: Hallucination Attack on Multi-modal Large Language Models with Only Attention Sink”, USENIX Security 2025: arxiv.org/abs/2501.15269 and usenix.org
  • Shang et al., “Forgetting to Forget: Attention Sink as A Gateway for Backdooring LLM Unlearning”, 2025: arxiv.org/abs/2510.17021
  • Mackey, Zhang, Papyan, “LLM Jailbreaks Exploit Attention Sinks”, ICML 2026 workshop: icml.cc
  • Wen et al., “MetaBackdoor: Exploiting Positional Encoding as a Backdoor Attack Surface in LLMs”, 2026: arxiv.org/abs/2605.15172