HybridLink: Bridging Latent Reasoning and Text
Hybrid agents need to move between continuous internal steps and readable text; HybridLink maps hidden states back into the model’s input-embedding space while learned anchors mark entry and exit.
Read the paper ↗What it is
- HybridLink A small residual adapter turns the model’s internal state into the kind of vector it can use as the next input, so it can take another internal step without first producing a word.
- Mode anchors A special marker starts internal reasoning; an exit marker lets the model return to ordinary text generation, where it can continue a response or interact with tools.
- Inspectable latent readout Internal steps can be displayed afterward as nearby words, giving a readable clue to their meaning without making word generation part of every internal step.
Why it matters
The design connects two useful behaviors: continuous internal steps and readable text interaction. It offers a way to switch between them during generation, while keeping latent steps available for inspection.
Before getting into the mechanics, here is the short version: HybridLink gives an agent a way to take another internal step without turning that step into a word first. Special markers let generation move between that internal mode and ordinary text, so the agent can still produce readable output and tool calls.
-
Representation mismatch: A model’s internal state and its input word vectors are not interchangeable just because they have the same width. The canonical example is feeding the final hidden state straight back in as the next input: it may carry useful meaning, but it comes from a different representational space than the one the model was trained to accept at its input. HybridLink makes this handoff a learned adjustment rather than assuming the spaces already match. The analogy is handing someone a useful note rewritten in the format their notebook accepts; unlike a literal format conversion, the learned mapping can also change the representation.
-
Avoiding the text round trip: In ordinary text generation, a step becomes a vocabulary choice, then an input embedding on the next pass. Hybrid reasoning can skip that decoding-and-re-embedding loop for its internal steps. The model instead carries a continuous vector forward, like keeping a thought in working notation rather than writing and rereading a sentence each time. That analogy stops short of human thought: the vector is a model representation, not a private sentence.
-
Keeping an exit to interaction: Purely internal steps are not enough for an agent that must answer in text or call tools. The model emits an entry marker to begin latent mode; a learned exit anchor lets it return to text. So the mode boundary is part of generation, rather than a fixed rule saying “take this many hidden steps.”
What does the bridge actually do? It keeps the original hidden state’s contribution and adds a learned correction, so the next vector is nudged toward the input space without throwing away the state’s semantics. In symbols, means “keep , then add a two-layer learned adjustment.” The adapter’s output becomes the next latent input, and the backbone produces the next hidden state. The model stays on that loop until the exit condition is met.
So the real question was never just whether internal steps can avoid decoding. It was whether you could keep the latent span inspectable. Each latent step can be mapped to its nearest input-token embedding and shown as readable pseudo-text. That is a view for inspection, not a claim that the model generated an ordinary word at that step. The bridge supports the internal loop; what carries the complete hybrid context across later turns is a separate mechanism.
Read the deep dive
Why People Wanted It
A model can reason by generating text, or it can take recurrent steps through continuous hidden states. Text is inspectable and can carry tool calls, but each step must be decoded and embedded again. A latent step avoids that round trip, yet feeding a last-layer hidden state directly back as an input embedding creates a representation mismatch with the pretrained input space. So the real question is not simply how to add more internal steps: how can the model move between latent reasoning and ordinary text without making either mode an awkward guest in the other’s interface?
The Core Move
HybridLink is a lightweight residual adapter that maps a hidden state into a next-step input embedding, while special entry and exit anchors let generation switch between latent and text modes.
The residual keeps the hidden state’s semantics in the result; the learned projections adjust it toward the input-embedding space.
Why the Residual Link Bridges Two Spaces
Now the version for readers who want more of the machinery: the key constraint is that the adapter has to change the hidden state’s distribution without discarding what the state means. Let be the backbone’s last-layer state, and let and be linear projections with an activation between them. The adapter’s output is : the learned branch supplies a correction, while the skip connection carries the original state forward. This makes the module a residual alignment step, not a fresh projection that must reconstruct the full representation from scratch.
The resulting vector is used as the next input in latent mode. That gives the model a recurrent sequence of continuous representations without decoding each one into a token and embedding it again. The exact projection dimensions and activation are implementation choices; the defining structure is the residual correction. What does that buy—and where does the model decide to use it?
Why Anchors Make Mode Changes Part of Generation
Here is the part that gets technical: text mode follows the usual token-generation path until the model emits the special entry anchor <latent>. The next forward pass switches paths: instead of taking a vocabulary token through the embedding layer, it takes the preceding hidden state through HybridLink. In latent mode, this hidden-to-input update repeats at each step.
The exit decision is also tied to generation state: the latent span ends when the last-layer hidden state aligns with the exit anchor </latent>. The model then returns to text generation. Entry and exit are therefore not a fixed schedule imposed from outside; the mode can continue or switch as generation proceeds. This describes the interface and its stated alignment condition, not a particular numerical similarity threshold. How can a span stay latent yet still be inspected?
Why a Latent Step Can Still Be Read Out
Now for the interpretability detail: latent generation need not decode a token at every step, but a latent step can be inspected afterward by mapping its HybridLink output to the nearest token embedding. That nearest-embedding readout gives a readable pseudo-text view of the latent state; it is an inspection route, not a requirement that the recurrent computation itself pass through token decoding.
The distinction matters: the model can continue its internal computation in continuous space while a person uses the readout to examine what a span appears to express. The resulting pseudo-text is a view into the representation, not a claim that the latent trajectory was generated as ordinary text. What do you trade for combining these paths?
Minimal Causal Code
This loop isolates the latent update: each last-layer state is corrected by the adapter and used directly as the next input. A real model also needs the text-mode path and its entry/exit decisions.
import torch
import torch.nn as nn
class HybridLink(nn.Module):
def __init__(self, d):
super().__init__()
self.w1 = nn.Linear(d, d)
self.w2 = nn.Linear(d, d)
self.act = nn.GELU()
def forward(self, h):
return h + self.w2(self.act(self.w1(h)))
# `backbone_step` consumes one input-space vector and returns its last-layer state.
link = HybridLink(d=hidden_size)
state = first_hidden_state
for _ in range(latent_steps):
next_input = link(state) # visible hidden -> input-space update
state = backbone_step(next_input) # next recurrent latent step
What You Gain, and What You Lose
You gain recurrent latent steps without token decoding and re-embedding at every step, plus explicit transitions back to ordinary text generation. The residual adapter is designed to preserve state semantics while aligning it toward the input space, and nearest-token-embedding readout offers a way to inspect latent spans.
You also add a learned interface and a mode-transition mechanism: the latent path depends on the adapter, and interpretation depends on a nearest-embedding view that is not itself the latent computation. Text remains useful for tool interaction and readable output; latent steps are not automatically text just because they can be read out. HybridLink addresses the within-generation bridge, while other parts of the system handle carrying hybrid context across turns and training reliable mode behavior.
HybridLink keeps the thought continuous, gives it an input-space bridge, and lets anchors decide when it becomes text again.