← Latest papers
💬 NLP

Disentangling Direction and Magnitude in Transformer Representations: A Double Dissociation Through L2-Matched Perturbation Analysis

This paper demonstrates a double dissociation in Transformer models where vector direction primarily governs attentional routing and language modeling, while vector magnitude modulates processing intensity for syntactic judgments, a distinction revealed through L2-matched perturbation analysis and dependent on architectural choices like LayerNorm versus RMSNorm.

Original authors: Mangadoddi Srikar Vardhan, Lekkala Sai Teja

Published 2026-02-13
📖 5 min read🧠 Deep dive

Original authors: Mangadoddi Srikar Vardhan, Lekkala Sai Teja

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine a Transformer (the brain behind AI chatbots) as a massive, high-tech library where every piece of information is stored as a 3D arrow.

For a long time, scientists believed that only the direction the arrow was pointing mattered. If the arrow pointed "North," it meant "Cat." If it pointed "East," it meant "Dog." They thought the length of the arrow (how long it was) was just background noise, like the size of the font on a page—it didn't change the meaning.

This paper says: "Wait a minute. Both the direction AND the length are doing very different, specific jobs."

Here is the breakdown of their discovery using simple analogies.

1. The Experiment: The "Equal Push" Test

To figure out what matters, the researchers had to be very fair. If they pushed an arrow slightly to the side (changing direction) and stretched another arrow a tiny bit (changing length), they couldn't compare them because one push was physically bigger than the other.

So, they invented a new rule: The L2-Matched Push.
Imagine you have two identical arrows.

  • Test A: You rotate the first arrow slightly.
  • Test B: You stretch the second arrow slightly.
  • The Rule: You make sure that the distance the tip of the arrow moves is exactly the same in both cases.

Now, they watched what happened to the AI's brain when they did this.

2. The Big Surprise: A "Cross-Over" Breakdown

The results were shocking. The two types of changes broke the AI in completely different ways.

  • Changing the Direction (The Compass):

    • Effect: The AI's ability to write fluent sentences (Language Modeling) crashed hard. It started making gibberish.
    • Analogy: Imagine a GPS navigation system. If you rotate the "North" arrow slightly, the GPS thinks you are in a different country. It sends you down the wrong highway. The whole trip fails.
    • Result: Direction is the Compass. It tells the AI where to look next.
  • Changing the Length (The Volume Knob):

    • Effect: The AI's ability to follow grammar rules (like "The dog runs" vs. "The dog run") crashed hard. But its ability to write sentences stayed mostly okay.
    • Analogy: Imagine a conductor leading an orchestra. If you turn the volume knob up or down on the violins, the music doesn't change its melody (direction), but the intensity and balance of the performance get messed up. The violins might drown out the drums, or the music might sound too quiet to hear the rhythm.
    • Result: Length is the Volume/Intensity. It tells the AI how strongly to process the grammar.

3. The "Double Dissociation" (The Smoking Gun)

In science, when you find that Thing A breaks Function X but Thing B breaks Function Y, it proves they are separate systems.

  • Direction is critical for Routing (Deciding which word comes next).
  • Length is critical for Structure (Deciding if the sentence is grammatically correct).

The researchers found that the AI uses two different "wiring systems" for these tasks:

  1. The Attention Wires: When the direction is messed up, the "Attention" system (which decides which words to focus on) gets confused. This is why writing breaks.
  2. The LayerNorm Wires: When the length is messed up, the "LayerNorm" system (which normalizes the signal strength) gets confused. This is why grammar breaks.

4. Why Does Length Matter? (The Secret Code)

The researchers dug deeper and found a hidden code. They discovered that the length of the arrow actually tells the AI how deep a word is in the sentence structure.

  • Words at the bottom of a sentence tree (like the main subject) have longer arrows.
  • Words at the top have shorter arrows.

When they messed with the length, the AI forgot the "map" of the sentence structure. It knew the words were nouns and verbs, but it didn't know which noun was the subject of which verb. That's why grammar failed.

5. The Twist: It Depends on the Model

Here is the most important catch: This only happens in certain types of AI models (specifically the Pythia family).

When they tested a different model (TinyLlama) that uses a slightly different internal architecture (RMSNorm instead of LayerNorm), the rules flipped!

  • In that model, changing the length broke the writing.
  • Changing the direction broke the grammar.

This proves that the "job" of direction and length isn't a universal law of physics; it's a design choice made by the engineers who built the model.

Summary: What Does This Mean for Us?

Think of the AI's brain as a complex machine.

  • Direction is the steering wheel. If you turn it, you go off the road.
  • Length is the gas pedal. If you press it too hard or too soft, the engine sputters and the rhythm breaks.

Why should we care?

  1. Better AI Editing: If we want to teach an AI a new fact without breaking its grammar, we should only tweak the "steering wheel" (direction) and leave the "gas pedal" (length) alone.
  2. Understanding AI: It shows that AI isn't just a "black box." It has specific, separable parts for different jobs, just like our own brains have different areas for language and logic.
  3. Future Design: Engineers building the next generation of AI need to be careful. If they change how the model measures "length," they might accidentally break the model's ability to write or speak correctly.

In short: Direction points the way; Length sets the pace. Both are essential, but they do very different jobs.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →