Research blog
Link: Teaching Attention to Have Intention
@techreport{constructor2026link,
title = {Link: Teaching Attention to Have Intention on Long-Context Tasks},
author = {{Constructor Team}},
institution = {Constructor},
year = {2026},
url = {https://constructoragi.com/link}
}One query in one attention head
As the history grows, the read stays the same size. Schematic; chunk counts and picks are illustrative.
69.5%
Recall at 1M tokens
Full attention: 56.6%
55.5%
Recall at 4M tokens
Full attention: 36.3%
0.16%
Of a 4M-token history
read by each attention head
9.9×
Faster read at 4M tokens
on one GPU instead of three
We present Link, a learned way for a language model’s attention to choose what it reads. A model that wants to use a history of millions of tokens has two options today: attend to all of it, at a cost that grows with the square of the history, or keep a compressed memory and lose the exact words. Link adds a third. For each query it reads a small, chosen part of the history, the same amount however long the history gets, and the rest can sit in ordinary computer memory, off the GPU. After identical training on histories of one million tokens, a model reading through Link answers 23% more recall questions correctly than the same model reading everything (69.5% against 56.6%). At four million tokens, four times the length either was trained on, it answers 53% more (55.5% against 36.3%) while each attention head reads 0.16% of the history, in about a tenth of the GPU time.
1The Problem
Think of a coding agent three weeks into a migration. It has run thousands of commands, opened hundreds of files and seen the same test suite fail in a dozen different ways. Now a test fails again, and the fastest way forward is to recall the exact error that test threw the first time, somewhere in the first few days of work. Nobody wrote it down. It is one line among several million tokens of history.
Today’s models can keep that history within reach in two ways, and each has a price.
The first is full attention, which compares each new token with every earlier one. The work grows with the square of the history: double the history and the work quadruples. The model we build on, Qwen3.5-9B, shows what that means in practice. Its full-attention read of a one-million-token history fits on a single H100 GPU. We ran it on two GPUs at two million tokens and on three at four million, where a single read takes 57 minutes.
The second is a memory of fixed size, the kind of layer that modern models, the one we build on included, place beside attention. It costs the same at any length, but a memory of fixed size cannot hold every line word for word.
There is a third problem, and it surprised us more than the cost: reading everything is not the same as using everything. In our tests the model that attends to the whole history is the less accurate one, and it loses accuracy faster as the history grows. At these lengths the hard part is not reaching the right token. It is locating the few that matter.
2Let Attention Choose
Ordinary attention has no intention. Every query looks at everything and sorts it out afterwards. An experienced engineer works the other way round: they do not reread three weeks of terminal output to find one error, they go to where it is. Link gives attention that habit.
Link changes only the model’s attention layers (Figure 1). In each of them, a query still reads the start of the history and its most recent part in full. Everything in between is stored as fixed-size chunks, and a small learned router scores every stored chunk for the query and picks a fixed number of them. Attention then runs over the start, the chosen chunks and the recent part, and over nothing else. The model’s other layers are unchanged and still process the whole history.
One Link attention layer
Three successive queries; router scores are illustrative
Because the number of chosen chunks is fixed, a query reads the same amount at four million tokens as at one million: about 6,200 positions per attention head, which is 0.6% of a one-million-token history and 0.16% of a four-million-token one. The cost of attention per query no longer depends on how long the history is.
The router is cheap. It keeps one short summary of each chunk, computed once when the chunk is stored, and scoring a chunk against a query is a single small comparison. It is also blind to position by design: it judges a chunk by what it contains, not by where it sits, so a chunk three million tokens back is scored exactly as it would be a thousand tokens back. That is what lets Link work at lengths it was never trained on.
The stored chunks stay on the GPU while they fit. Once they outgrow it they move to the computer’s ordinary memory, and only the chosen chunks travel back for each query.
The router learns from the model itself. The unmodified model already shows, through its own full attention, which parts of the history each query leans on, and we train the router to predict that. No questions or answers are involved. Only then do we train the model on the task, with the router in place.
3A Fair Test
We tested exact recall. Each input is the log of a software-engineering agent working through a long run of issues from real repositories, one, two or four million tokens long. After the log comes one question about one earlier task, and the answer has to be copied out word for word: the first file the agent opened in that task, the first exception its commands printed, or the first line of code it changed. Here is a made-up example of the shape:
In the task titled "Fix crash on empty config file", what was the first exception line printed?KeyError: 'defaults'No model acts as a judge. The answer either matches the log or it does not.
A sparse read is easy to test in ways that flatter it, so the test is built against that.
- We score only questions whose answer lies outside the part Link always reads in full.
- The test tasks and their repositories are held out from the task training.
- A trained model given the questions without the log answers 0.2% of them, so the answers are not memorized.
- The baseline is the same model with its own full attention, extended to these lengths with the method its model card gives, and trained in exactly the same way on the same sessions in the same order.
- Each system is trained three times, and every score below is the average of the three.
4Results
4.1More Accurate Than Reading Everything
At one million tokens, the length both systems were trained on, Link answers 69.5% of the questions and full attention 56.6% (Figure 2). Link is ahead at every length, in every one of the 56 test sessions, and its weakest training run beats the baseline’s strongest. On test tasks that appear nowhere in any data used to train or validate Link, the lead holds at 12 to 18 points.
Recall on held-out test histories
Questions answered correctly (%), mean of three training runs
Keyword search is the other natural comparison: the same model reading the end of the log together with the passages that keyword search ranks highest for the question. With the same training it trails Link by about 20 points at every length (Table 1). Selecting inside the model, on what the model has itself computed from the whole history, beats keyword selection on the raw text.
| Measure | 1M tokens | 2M tokens | 4M tokens |
|---|---|---|---|
| Share of the history one Link attention head reads | 0.6% | 0.3% | 0.16% |
| Link | 69.5 | 65.4 | 55.5 |
| Same model, full attention | 56.6 | 46.3 | 36.3 |
| Same model, keyword retrieval | 49.5 | 44.0 | 37.3 |
| Time to read the history, Link | 61 s, 1 GPU | 156 s, 1 GPU | 345 s, 1 GPU |
| Time to read the history, full attention | 241 s, 1 GPU | 891 s, 2 GPUs | 3,398 s, 3 GPUs |
4.2Four Times Past the Training Length
Both systems were trained on one-million-token histories and then tested with the same weights at two and four million. Link keeps 80% of its accuracy at four million tokens, and full attention keeps 64%. Link at four million tokens scores about what full attention scores at one million (55.5% against 56.6%), and its lead grows from 12.9 points to about 19.
4.3The Router Finds the Answer Wherever It Lies
For every test question we recorded how many of the model’s attention layers the router’s picks included the chunk that holds the answer. Within each length, that share barely moves with distance (Figure 3). At four million tokens the router finds the answer’s chunk about as often when it lies 3.7 million tokens back as when it is nearby, almost four times farther than anything it saw in training. A random pick of the same size would rarely include it at all.
Accuracy follows the router. Link answers 76 to 80% of the questions where three quarters or more of its layers picked the right chunk, against 14 to 26% where fewer than half did.
What the router picks
Averaged over the eight attention layers and the three trained models
(a) Layers selecting the answer’s chunk (%)
(b) Link, questions answered correctly (%)
4.4A Tenth of the GPU Time
At four million tokens Link reads a history in under six minutes on one GPU. Full attention takes 57 minutes on three (Figure 4). At one million tokens, where both run on a single GPU, Link is 3.9 times faster. When the history doubles from two to four million tokens, Link’s read time roughly doubles and full attention’s nearly quadruples.
From two million tokens on, the stored chunks sit in ordinary memory and Link’s GPU memory stays near 24 GiB while the history doubles, which is why it still fits on one GPU where full attention is spread over three.
Time to read one history
Median over the test histories, log scale, on H100 GPUs
4.5Still Improving
Link was still improving when its task training ended, so we trained Link alone further, in two ways, without changing how much it reads. Reinforcement learning, which rewards the router’s choices and the model’s answers directly, lifts it to 66.3% at four million tokens. A single longer run of ordinary training lifts it to 77.0%. The size of the read was not what held Link back.
5On Public Benchmarks
We also tried Link on two public benchmarks and found that a 9B model with Link outperforms far larger models. On BABILong, a benchmark that buries key facts in a million tokens of text, four times what Qwen3.5-9B was built to read, the 9B model with Link, trained on the task, scores 66.6%, beating Google’s Gemini 3 Flash (50.6%), Gemini 1.5 Pro (35.8%) and Gemini 2.0 Flash (18.0%).
LongBench v2 asks 503 hard questions about long documents, chats and codebases. Link on the 9B model scores 61.2%, above DeepSeek-R1 (671B) and Qwen3-235B-Thinking, models 75 and 26 times its size.
Public benchmarks
Official test sets and scorers
(a) LongBench v2, accuracy (%)
(b) BABILong at 1M tokens, accuracy (%)
6Why This Matters
An agent that works for weeks cannot afford to reread its whole history before every step, and it cannot afford to forget the details either. Link suggests it does not have to choose. Because each query reads a selection of fixed size, the history can outgrow both the model’s native window and the GPU’s memory while the cost of attention per query stays where it was.
The broader lesson for us is that at these lengths the bottleneck is selection. In our tests a model that learns where to look beats the same model looking everywhere, and it keeps doing so at four times the length it was trained on.
We see long context as one of the central problems on the path to general intelligence. Unlike LLMs, humans do not reread their entire context; with experience, we learn what matters. Our work is a promising first step in that direction: it shows that a model improves when it learns where to look.
That said, LLMs still don’t learn after deployment. There are still many gains to be made from improving current LLMs. But we do not believe this is enough. Beyond their context, models themselves need to learn from experience. Continual learning will enable agents to tackle every complex task in the real world, from personal assistants and automated employees to novel breakthroughs in scientific discovery.
This is just the beginning at Constructor. We are developing a general continual learner, a new class of model. If you seek to build the technology of our future, join us.