r/MachineLearning • • 20h ago

Research Let every Transformer layer reach states at all depths (WhiteMatter) [R]

Post image

In a standard Transformer, each layer only reads the KV cache from its own depth. A shallow layer cannot use what deeper layers already computed for earlier tokens. When deep layers need to reach shallow ones, that information also has to pass through the residual stream, which has limited bandwidth.

Our recent work, WhiteMatter: All-to-All Cross-Layer Connections via KV Source Mixing, lets every layer read from every depth. Each layer's keys and values are a learned mix of hidden states from all layers. In addition, we can share KV among reader layers to reduce the KV cache size.

Main results:

- WhiteMatter matches a standard Transformer with 50% more layers (4%-8% lower perplexity vs same depth).

- With half the KV cache (or even less), it still beats matched standard Transformers.

The catch: a token's shallow layers now depend on the deep layers of earlier tokens, so training and prefill cannot process all tokens at once. Unless...

We proposed cyclic iteration, which matches token-by-token quality in 4 parallel passes, compared to 53 for the Jacobi method used in prior works (12.5x faster at matched quality). It's still slower than vanilla prefill, which is the main thing we are working on next. However, decoding has the same speed as standard transformer, or can even be faster because of the reduced GPU memory requirement.

Paper: https://arxiv.org/abs/2608.18486

Video: https://www.youtube.com/watch?v=NCjJzBGdgTU

Code: https://github.com/Cy-47/White-Matter

Strongly recommend watching our video. It should feel much easier to follow than text!

87 Upvotes

9 comments sorted by

5

u/H0lzm1ch3l 10h ago

So you are embracing the recurrence and just iteratively solving through all of it?

4

u/Cy74 9h ago

I see that I wasn't clear enough. The goal of the iteration method is actually to avoid processing tokens one by one and restore parallelism in training & prefill. I've edited the post, thanks for bringing this up!

2

u/MolassesLate4676 11h ago

I’m so confused in how this would train

You’re mixing kv made from qkv of other layers?

3

u/Cy74 10h ago

Appreciate your question 😃 So every layer has a hidden state, and KV is normally produced from that layer's own hidden state. We changed it to instead use a mixture of the hidden states from all layers to produce KV. In addition, the mixing weights can change across tokens and readers, so every layer can choose which depth to read at each token. Thus, the model can freely reuse information from all previous states regardless of depth. Hope that answers your question!

Happy to answer any additional questions. I strongly recommend watching the video, it should feel much more intuitive than reading text!

1

u/dekiwho 4h ago

This sounds like that kimi paper attention residuals …. Or some similar concept I guess.
Instead applied to layers themselves , you apply to the caching

3

u/InterstitialLove 12h ago

Why not try all deeper layers, excluding shallower ones? That maintains parallel training, which is clearly the biggest cost of this method

3

u/Cy74 11h ago

Thanks for the suggestion! Could you clarify what you mean? If you are suggesting using only states from shallower layers to produce KV (e.g. layer 4 can see states from layer 1-4), that is the depth-causal ablation in the analysis section of our paper. It can indeed bring training & prefill cost down to the same as vanilla, but also loses some of the performance gains.

2

u/Cy74 9h ago

How did you feel about the bold fonts? I added them by hand but worried that they might look AI generated, since other people don't seem to use bold font much.

1

u/jojothecircus_boy 13h ago

the title makes it sound like the stack stops being a stack, what changes during inference and what is the matched baseline