Rúben GalvãoThe Rabbit Hole

The Rabbit Hole / AI and machine learning / Language models / Alternative language-model architectures

Short convolution: what if a layer only mixed nearby tokens?

A short causal depthwise convolution mixes nearby tokens. Could some layers do useful work using only the current token and a few neighbours?

Hybrid models do not give every layer a growing KV cache. We have tried fixed-state mixers such as Mamba and Gated DeltaNet. Could we use something simpler in some layers: mix only a few nearby tokens?

Could a small filter be enough?

In the image convolution article, a small filter moved across neighbouring pixels. We can do the same along a sequence of token vectors.

Take the current token and the previous two. For each coordinate, multiply those three numbers by learned filter weights and add them. Here is a two-coordinate example:

A fixed three-token window slides through the sequenceTwo tokens agoToken 1242×¼¼Previous tokenToken 2422×½½Current tokenToken 3682×1123Next tokenToken 484Learned filterWeighted sum, coordinate by coordinate8.5102
A two-coordinate example. The vectors shift; the filter weights stay in place. Each result uses only the current token and its two predecessors.

As new tokens arrive, their vectors shift through the fixed filter. The oldest vector drops out and the new one enters. The learned weights stay the same, but the numbers they combine change.

Looking only backwards makes this a causal convolution. Giving each coordinate its own filter makes it depthwise: the convolution mixes positions in time, rather than mixing coordinates together. The projections around it can mix coordinates.

Should every token contribute in the same way?

The filter weights are shared across positions. But a token might contain useful information in one coordinate and little useful information in another. Could the token itself adjust what enters the filter?

We can project the token into a value vector v and another vector b, then multiply their matching coordinates: b ⊙ v. The filter now receives a token-dependent version of v.

What about the result? The current token could also control which parts of the local mixture pass through. A third projected vector c can multiply the convolution output before the final output projection.

LFM2.5 uses a three-token filter; LFM3 uses seven. The full diagram follows the selected model.

Calculated valuesLearned parameters
Calculated vectors and learned projectionsCurrent tokenEarlier context is dimmed; outlined columns are current.Current token computation.WbEarlier context is dimmed; outlined columns are current.Current token computation.bWvEarlier context is dimmed; outlined columns are current.Current token computation.vWcEarlier context is dimmed; outlined columns are current.Current token computation.c×Earlier context is dimmed; outlined columns are current.Current token computation.FilterLocal convolutiont−2×t−1×t×+Earlier context is dimmed; outlined columns are current.Current token computation.×Earlier context is dimmed; outlined columns are current.Current token computation.WoEarlier context is dimmed; outlined columns are current.Current token computation.Update+Updated token representation7,1687,1687,1687,1687,1687,1687,1687,1687,1687,1687,1687,1687,1687,168—7,1687,1687,168
The LFM-style mixer: b scales v before the local convolution; c scales its result. Inside the filter, recent b ⊙ v vectors multiply the violet filter coefficients, then add coordinate by coordinate. All vector cells are calculated data; Wb, Wv, Wc, the filter and Wo are learned parameters. All vector widths and projection dimensions follow the selected model. The filter width follows the selected model; each row filters one coordinate across those positions.

These are two different places to intervene. b changes what a token contributes to the local history. c changes how the current token uses the mixture it receives.

This is the arrangement used by LFM2-style short-convolution layers. Its b and c vectors are calculated from learned projections; they are not restricted to the range 0–1. Multiplication can reduce, amplify or reverse a coordinate. They are also not the B and C parameters of a state-space recurrence.

What must we keep for the next token?

Only the recent b ⊙ v vectors needed by the filter. A three-token filter needs two previous vectors plus the current one; a seven-token filter needs six previous vectors. An implementation may also reserve a slot for the current vector, but the buffer stays fixed in size as the conversation grows.

Unlike Mamba or DeltaNet, this convolution does not carry an accumulated summary of the distant past. At this layer, a vector stops contributing directly once it leaves the filter’s window. Its information may already have reached later token representations, and stacked layers can spread information further, but this is not a query over the full history.

That gives us another reason to mix layer types. LFM2.5 combines short-convolution layers with attention layers: many layers do local mixing, while attention supplies places to request information from more distant tokens.

Sources and assumptions

The article calls the projected vectors b, c and v to distinguish the content from the current residual-stream input. The implementation calls them B, C and x. The three projections in the drawing are slices of one combined projection. No sigmoid is implied. Optional biases, padding details, layer normalisation and the feed-forward branch are omitted. The numeric filter example uses two coordinates and shared illustrative coefficients; a depthwise convolution learns separate coefficients for each coordinate. Blue/orange cells mark calculated data rather than numerical signs; violet identifies learned parameters.

← Browse all subjectsBack to the beginning ↑