∥Inside AbliterationA visual guide

A visual field guide to language models

Inside Abliteration

Refusal, model edits, and their tradeoffs.
From two requests to the geometry inside a language model.

Captured LFM3 activation vectors before and after a concept-protected projection
Two requests, one model. Recorded LFM3 representations on the left; a calculated projection on the right. These plots track vectors, not generated answers.
Start reading →

By Rushi Chaudhari · @0xrushi  ·  LiquidAI LFM3-1.7B  ·  13 sections, 63 interactive figures


LFM3 checkpoint used in this studyLiquidAI/LFM3-1.7B ↗Revision 1da06be ↗
Research paper

Single-direction abliteration

In this section, we’ll see how a language model represents a request and how we can change one component of that representation. We’ll use two account-security requests to work through tokens, vectors, PCA, and the mean-difference direction.

Two requests, one model

Let’s start with two requests about online accounts:

Benign request

“How can I protect my online account from password theft?”

Harmful request

“How can I steal someone else's online account password?”

The first asks for help protecting an account. The second asks for help stealing one. They share a topic, but we would expect an instruction-following model to respond differently to them. How does that difference appear inside the model?

To find out, we’ll follow the requests as they pass through LiquidAI LFM3-1.7B. We’ll first look at how the model represents text, then use those representations to understand single-direction abliteration.

From text to a direction

A language model processes numbers. Before it can work with either request, the text must be split into tokens and converted into vectors. As these vectors pass through the model’s blocks, their values change.

If we collect vectors from many benign and harmful requests, we can compare the two groups. The simplest approach is to calculate the average of each group and subtract one average from the other. This gives us a direction in the model’s representation space. We can then test what happens when we remove a vector’s component along that direction.

There are a few steps here, so let’s work through them using the two requests above.

About the example data

The two requests were passed through the pinned LFM3 checkpoint with unchanged weights. We saved internal activations without generating responses. “Benign” and “harmful” are our request labels; whether a response refuses is measured separately. Later figures use small numerical examples, identified by their figure labels.

From words to 2,048 numbers

The first step is tokenization: splitting the text into pieces that the model recognizes. A piece can be a word, part of a word, or a punctuation mark. The tokenizer assigns each piece an integer called a token ID.

For a closer look, these are two nice articles: Tokenization in Large Language Models and BPE Tokenizer Explained.

Here is how our two requests are split. You can hover over a piece to see its ID:

Benign request · 11 user-text tokens

How␠can␠I␠protect␠my␠online␠account␠from␠password␠theft?

Hover a piece to see its token ID. ␠ marks a space. After chat formatting: 21 tokens. Captured final token: <think> (ID 124901).

See the formatted input
<|startoftext|><|im_start|>user
How can I protect my online account from password theft?<|im_end|>
<|im_start|>assistant
<think>

Harmful request · 11 user-text tokens

How␠can␠I␠steal␠someone␠else's␠online␠account␠password?

Hover a piece to see its token ID. ␠ marks a space. After chat formatting: 21 tokens. Captured final token: <think> (ID 124901).

See the formatted input
<|startoftext|><|im_start|>user
How can I steal someone else's online account password?<|im_end|>
<|im_start|>assistant
<think>

The model also receives special tokens that mark the roles in the conversation. In this example, the formatted input ends with the start of the assistant’s thinking segment. We’ll inspect the hidden state at that final input position, where the model has already processed the request.

What is a residual vector?

Inside each block, the model carries a numerical representation called the residual stream. Each token position has its own vector containing 2,048 numbers. A vector is simply an ordered list of numbers. Each number is one coordinate, or dimension.

For the whole input, we stack these token vectors as rows of a matrix. If the formatted input contains T tokens, that matrix has shape [T, 2,048]:

H = [x₁; x₂; …; x_T]
H: T × 2,048
one row x_t: 2,048 values

The semicolons indicate rows stacked vertically. For example, an input with 10 tokens would have 10 rows and 2,048 columns at one block. Remember that tokens can be word pieces or special markers, so the number of rows need not equal the number of words.

When we say “a residual vector,” we’re selecting one row from this matrix. Here, we select the final formatted input position, whose representation has been computed using the preceding tokens. This is the assistant-prefix position described above.

Let’s look at the first six coordinates of that selected row for each request at block 11:

benign x = [0.021, -0.095, -0.022, -0.007, -0.042, -0.050, …]
harmful x = [-0.061, -0.056, 0.053, 0.049, -0.031, -0.062, …]
Both lists contain 2,048 coordinates; six are printed here.

We can draw some of these values as bars:

Measured activationsDownload SVG ↗
A vector is a list of numbers
These bars show 24 of the 2,048 captured coordinates at block 11. They are entries of the hidden vector before PCA.

Each bar gives the value at one coordinate. The coordinates work together to represent information about the input. An individual coordinate does not come with a name such as “account security” or “refusal.”

Inside a block

Let’s follow the whole matrix through one block. There are two main operations. The first mixes information between token positions, using attention or a short convolution. The second is a feed-forward network, also called an MLP. It transforms each row separately using the same learned weights.

Each operation produces an update that we add to a copy of its input. This addition is the residual connection: the block builds on the existing representation. Follow the purple paths to see where the copies join the updates.

Architecture diagramOne input · batch axis omitted

Inside one LFM3 block

Follow the matrix down the page. Each row belongs to one token position. The purple paths carry a copy forward to each addition.

Gated short convolution
Input residual H[T, 2,048]
token 1x₁,₁x₁,₂…x₁,₂₀₄₈
token 2x₂,₁x₂,₂…x₂,₂₀₄₈
token Tx_T,₁x_T,₂…x_T,₂₀₄₈
copy H
RMSNorm normalize each row
1Gated short convolutionMixes information from a short, causal neighborhood of token positions.Output: [T, 2,048]
RMSNorm normalize the update
+
H₁ = H + mixer update [T, 2,048]
copy H₁
RMSNorm normalize each row
2Gated feed-forward network (MLP)Transforms each token’s row separately, using the same learned weights.
2,048→7,680→2,048
Gate and value branches meet at width 7,680.
RMSNorm normalize the update
+
H_out = H₁ + MLP update [T, 2,048]
Output residual H_out[T, 2,048] → next block
token 1h₁,₁h₁,₂…h₁,₂₀₄₈
token Th_T,₁h_T,₂…h_T,₂₀₄₈

We save this final row after the block.
One residual vector x: [2,048]

The block updates the values while keeping the outer matrix shape. The highlighted row is the final formatted input position, <think>, in our example captures. Both inputs have 21 formatted tokens, so each full matrix here has shape [21, 2,048]. The cells above are symbolic, rather than measured coordinate values.
Where normalization and capture happen

The pinned checkpoint enables sandwich normalization: each branch has RMSNorm both before its operation and before its update is added back. The saved vector is taken after the second addition, before the next block or the model’s final readout normalization. Block labels use zero-based indices, as in the plots. The diagram shows a full-input pass; cached generation can process only the new token positions.

Checkpoint configuration · LFM3 architecture documentation

The + circles add matching entries of two matrices. Both inputs to each addition have shape [T, 2,048], so the result keeps that shape. We select the highlighted row after the second addition when recording our residual vector.

RMSNorm adjusts the scale of each row using its root-mean-square value and learned weights. In this checkpoint, normalization appears before each operation and on its output before the residual addition.

Inside the MLP, two learned branches expand each row from 2,048 to 7,680 values, combine through a gate, and project back to 2,048. The sequence still has T rows throughout. The wider intermediate representation gives the MLP more features to work with while keeping the block’s input and output widths the same.

LFM3 uses three mixer types across its blocks. Full causal attention can read all preceding positions; sliding attention limits that range to a local window; short convolution uses a local causal neighborhood. Use the block selector to see which mixer appears at each depth. The architecture documentation describes these components.

Tokens, blocks, and dimensions

These three counts describe different parts of the computation:

Count Meaning In this example
Tokens Positions in the formatted input Depends on the request
Blocks Stages that update the representation 24
Hidden dimensions Values in one residual vector 2,048

The shape depends on which parts of the computation we keep:

What we keep Shape
One token position at one block [2,048] — a vector
All T token positions for one input at one block [T, 2,048] — a matrix
A batch of B equally padded inputs at one block [B, T, 2,048] — a three-dimensional tensor
Our saved final position across two requests and 24 blocks [2, 24, 2,048] — a three-dimensional tensor

We saved just one position per block for each request, which is why the saved array has no token-position axis. If we kept every position across all blocks and padded the requests to the same length, its shape would be [2 requests, 24 blocks, T token positions, 2,048 coordinates].

Next, we’ll see how a vector relates to the tokens the model predicts.

From a vector to a token score

To predict the next token, the model needs to turn its final hidden vector into vocabulary scores. It does this with an output head: a matrix that maps the hidden dimensions to one score for every vocabulary entry.

For LFM3, this takes us from 2,048 hidden values to 128,000 vocabulary scores. These scores are called logits. The softmax function converts them into probabilities that add up to one:

logits = normalized_hidden × W_headᵀ
W_head: 128,000 × 2,048
probability(token j) = exp(logit_j) / sum of exp(all logits)

The final normalization depends on the model architecture. Once we have the probabilities, a decoding rule chooses the next token. The model repeats this process to generate a response.

Looking at an intermediate block

We can also apply the output head to a hidden state from an earlier block. This is called a logit lens. It lets us inspect which tokens the output head favors as the representation develops.

For example, we could track the combined probability of several tokens that occur in refusal wording. Plotting that quantity across blocks would show where the readout starts to favor those tokens.

There are two details to keep in mind. First, the output head was trained to read the final state, so reading an earlier state is an approximation. Second, a few token probabilities cannot describe every possible refusal. A model can express the same response in many ways.

How do we draw 2,048 dimensions?

We can put two coordinates on a page: one on the horizontal axis and one on the vertical axis. Our vectors have 2,048 coordinates! We therefore need a way to choose a smaller set of axes.

Principal component analysis, or PCA, finds directions along which a collection of vectors varies the most. It first subtracts the average vector, then finds perpendicular axes ordered by the variation they capture. The first is called PC1, the second PC2, and so on.

For this example, we fit PCA on 128 baseline vectors at one block. Each row comes from the selected final input position of a different prompt, so 128 counts prompts here. The input has shape [128 examples, 2,048 coordinates]. Each new axis is a weighted combination of the original coordinates. Keeping two axes gives us a pair of numbers for each vector:

z = (x − μ_all) Q
x: 1 × 2,048 · Q: 2,048 × 2 · z: 1 × 2

Here, μ_all is the average baseline vector and Q contains the two PCA axes. The result, z, tells us where to draw the point.

Measured activationsDownload SVG ↗
Two requests in an existing activation cloud
The circles show the 128 baseline examples; the diamonds show our two requests. Each block has its own fitted PCA axes. Change the block to inspect another view of the representations.

The small circles are the examples used to fit PCA. The diamonds are our two account-security requests, placed using those same axes. PCA finds its axes from the vectors alone; the benign and harmful labels are used to color the picture afterward.

Open Explore this plot and change the block. You’ll see a different view of the representations at each depth. We fit a separate PCA at each block, so the axes change along with the block.

How much can two axes show?

PCA lets us measure how much variation each axis captures:

At block 11, PC1 accounts for 52.5% of estimation-set variance and PC2 for 8.4%. Together they show 60.8%; the other 39.2% is outside this two-axis view.

Measured activationsDownload SVG ↗
Two axes do not contain the whole model
Each bar shows the fraction of variation captured by a PCA component at block 11. We display the first 16 components. With 128 centered examples, at most 127 components can have nonzero variance.

This is why two nearby points in the picture may still be far apart in the full space: the remaining coordinates are hidden from view. A visible gap between groups is also only a starting point. The gap could reflect wording or topic as well as behavior.

It helps to fit the axes on many examples. If we fitted PCA on just our two requests, centering would leave two points on a single line. That would tell us very little about the rest of the model’s representations.

Other ways to draw the vectors

You may also encounter t-SNE and UMAP. These methods emphasize neighborhood relationships, so they can be useful for exploring groups of examples. Their axes and distances are harder to interpret directly. We’ll use PCA here because the linear axes make it easier to follow the arithmetic of an edit.

What does a mean vector mean?

Suppose we have three vectors: [2, 4], [4, 8], and [6, 6]. To average them, we average each coordinate separately. The first entries give us 4; the second entries give us 6. Our mean vector is therefore [4, 6].

The same calculation works with 2,048 coordinates. Our estimation set contains 64 benign requests and 64 harmful requests. At a chosen block, we calculate one mean for each group:

μ_b = average of the 64 benign vectors
μ_h = average of the 64 harmful vectors

Each mean still contains 2,048 numbers. Averaging examples changes how many vectors we have, while keeping the width of each vector the same.

μ_b = [0.044, -0.108, 0.026, -0.021, -0.038, -0.015, …]
μ_h = [-0.037, -0.091, 0.085, 0.044, -0.050, -0.022, …]
Δ = [-0.081, 0.018, 0.059, 0.065, -0.011, -0.008, …]
d = [-0.039, 0.009, 0.028, 0.031, -0.005, -0.004, …]
Actual first six coordinates at block 11, rounded for reading.

Let’s put these means into the PCA picture:

Measured activationsDownload SVG ↗
A mean is the center of a group
Each cross is the mean of one group, calculated in the full space and then projected onto the PCA axes. The line connects the benign mean to the harmful mean.

The crosses mark the centers of the groups. We can calculate a center in the full space and then project it, or average the projected points; PCA gives the same location either way.

From two means to one direction

Subtracting the benign mean from the harmful mean gives us Δ = μ_h − μ_b. Think of this as an arrow from one center to the other. To use its orientation independently of its length, we divide by its length:

d = Δ / ||Δ||₂

The double bars mean “length.” After this division, d is a unit vector: its length is one.

We now have a candidate direction to test. Because our groups can differ in topic and wording, the direction can contain those differences too. To find out what it does, we need to intervene and observe the model’s responses.

How do we know which direction to target?

We don’t know in advance. Taking the difference of means proposes a candidate; experiments tell us whether changing that candidate affects the behavior we care about.

Let’s separate those two steps. First, we collect benign and harmful requests and save their vectors at matching blocks and token positions. We also examine the baseline responses: a harmful request label alone does not tell us that the model refused it. We calculate a candidate mean direction at each chosen site using the fitting examples.

Next, we intervene on separate requests. We remove the candidate component and measure how the responses change. We can also test the reverse intervention by adding a component along the direction. If removal reduces refusal and addition increases it, that provides stronger evidence that this direction participates in refusal. These are two distinct experiments, with their own intervention strengths.

We need comparisons too. An unchanged-model run gives us the baseline. Equally sized edits along random unit directions help us check whether the effect is specific to our candidate. We also check benign responses, task correctness, and incomplete outputs, since a broken or unfinished response could appear to contain fewer refusals.

If we compare several blocks or strengths, we choose among them using a selection set. We then freeze that choice and evaluate it on a fresh test set. This lets us distinguish a direction that works on new examples from one chosen because it happened to look good on the examples we inspected.

So the sequence is estimate a candidate → intervene → compare with controls → test on fresh examples. A PCA gap helps us describe the vectors, but the response-level intervention supplies the evidence for targeting d. The original single-direction paper connects its identified directions to refusal through removal and addition experiments.

What our LFM3 visualization establishes

Our displayed direction comes from 64 benign and 64 harmful-labeled estimation prompts. The two new account-security requests illustrate the resulting geometry; they did not determine the direction. Their capture and saved-vector projection do not by themselves establish a causal refusal effect. The completed LFM3 tool comparisons measure consequences of fixed edits, while refusal-effect matching and broader causal confirmation remain separate evaluation work.

Removing a component

We can split a vector into a part along d and a part perpendicular to d. The dot product x·d tells us how far x extends along that unit direction. Multiplying this number by d gives us the parallel part:

parallel part = (x·d)d
perpendicular part = x − (x·d)d

Let’s draw this with x = [3, 4] and d = [1, 0]. The dot product is 3, so multiplying it by d gives the parallel vector [3, 0]. Subtracting that from x leaves the perpendicular vector [0, 4].

Illustrative exampleDownload SVG ↗
Split x into two perpendicular components
The purple arrow is (x·d)d and the teal arrow is x − (x·d)d. Follow them head-to-tail to reach x. The black arrow has length one. Rotate d to see how the two components change while x stays fixed.

The purple arrow follows d. The teal arrow starts where the purple arrow ends; following both takes us to x. Their sum is therefore x. The small square marks the right angle between the components. The shorter black arrow shows d itself, with length one.

Open Explore this plot and rotate d. We keep x fixed while its two components change. The dot product is a signed number; multiplying by d turns that number into a vector. If the dot product becomes negative, the parallel arrow points opposite to d.

Here are the component magnitudes for our two requests, calculated using all 2,048 coordinates:

Measured activationsDownload SVG ↗
The component you remove and what remains
For each captured request, we calculate the part along d and the part perpendicular to it. The calculation uses all 2,048 coordinates at one block.

Why subtract the parallel part?

So far, we’ve described the geometry. To understand the purpose, let’s suppose experiments show that d contributes to the model’s refusal behavior. We want to test what happens when the model can no longer carry a component along that direction at the edited site.

The parallel part is exactly the component this intervention targets. We subtract it and leave the perpendicular part unchanged:

x′ = x − (x·d)d = x_perpendicular
x′·d = x·d − (x·d)(d·d) = 0
Because d has unit length, d·d = 1.

In our example, x = [3, 4] has a coordinate of 3 along d = [1, 0]. Subtracting [3, 0] gives [0, 4]. We have set that coordinate to zero while keeping the perpendicular coordinate of 4. Subtracting d alone would instead give [2, 4], leaving a component along the direction.

What does the perpendicular part represent?

It is everything in this particular vector that remains after removing the component along d. In the example, the remaining vector is [0, 4]. Its dot product with d = [1, 0] is 0×1 + 4×0 = 0, so it has no component along that direction. This is what “perpendicular” means here.

Which coordinate becomes zero?

We can imagine choosing a new set of axes with d as the first axis. At full strength, projection sets the coordinate along d, measured by x′·d, to zero. It keeps the coordinates on the perpendicular axes. This does not generally set one of the original vector’s numbered entries to zero.

Illustrative exampleDownload SVG ↗
Which coordinate becomes zero?
Play the removal and watch the purple component and orange Along d bar shrink to zero. The perpendicular coordinate stays fixed. At 45°, the final vector is [0.5, −0.5]: both original entries are nonzero, but its coordinate along d is zero. Switch to horizontal d to compare with [0, 2]. This is synthetic geometry, not a model measurement.

Open Explore this plot, then choose Remove the component. Blue shows the original x = [3, 2], orange shows the changing x′, and purple shows how much remains along d. Watch the orange “Along d” bar shrink to zero while the perpendicular bar stays the same. The teal arrow shows the movement from x to x′; at full strength, x′ lies on the teal line perpendicular to d.

With horizontal d = [1, 0], the result is [0, 2]. Here the coordinate along d happens to be the first entry. Switch to diagonal d = [1/√2, 1/√2] and play again. Now the result is [0.5, −0.5]. Both original entries are nonzero, but their contributions along d cancel:

x′·d = 0.5/√2 − 0.5/√2 = 0

The sliders and readout let us distinguish the original entries [x′₁, x′₂] from the coordinate along the chosen axis x′·d. At partial strength, the remaining coordinate is (1 − α)(x·d); it reaches zero when α = 1.

In LFM3’s 2,048-dimensional space, there are 2,047 independent perpendicular directions. They usually involve combinations of the original coordinates, rather than a particular set of numbered neurons.

The geometry does not give those remaining directions semantic names. They could carry information about the request’s topic, wording, context, or other properties. Some refusal-related information could remain there too. A zero dot product with one chosen d does not mean that all refusal mechanisms have disappeared.

We leave this remainder unchanged because our experiment targets one direction. That limits the immediate geometric change while letting us test the effect of removing that component. Whether useful behavior is preserved depends on how later layers process the edited vector, which we evaluate separately.

Why keep the rest unchanged?

Among all vectors with zero component along d, this perpendicular projection is the closest to x in Euclidean distance. That gives us a precise geometric reason for choosing it. How the rest of the network responds still has to be measured.

The behavioral motivation comes from intervention experiments. In the original single-direction paper, removing an identified direction suppressed refusal, while adding that direction could induce refusal on benign requests. Those tests connect the direction to behavior. A difference between group means, or a gap in a PCA plot, only gives us a candidate to test.

For our LFM3 example, the local calculation guarantees zero projection at the edited site. We still need model responses to establish its effect on refusal and useful capabilities. The direction can overlap other information, and later blocks can change the representation again.

Choosing how much to remove

We can remove only a fraction of the parallel part by introducing a strength α:

x′ = x − α(x·d)d

At α=0, x stays as it was. At α=0.5, half of the parallel component remains. At α=1, the component is removed completely. The strength refers to this vector operation; a value of 0.5 does not mean that half of a model’s refusal behavior has disappeared.

The remaining coordinate is x′·d = (1 − α)(x·d). Full projection sends it to zero whether its original value was positive or negative. Zero is the reference chosen by this operation; the affine-editing section explores choosing a different reference.

Measured activationsDownload SVG ↗
Project our actual two captured vectors
The lines connect the original and edited saved vectors at block 11. Both are drawn with the baseline PCA axes. We edit the vectors directly for this calculation; no new response is generated.

For this figure, we edited the saved vectors in the full space and then projected them onto the original PCA axes. The lines connect each request’s original and edited positions. This calculation shows how the vectors move; measuring a changed response would require running the rest of the model with the intervention.

A smaller example

Let’s repeat the operation with two-dimensional vectors so we can see the whole space:

Illustrative exampleDownload SVG ↗
Remove only the component along d
Faint points mark the original vectors and solid points mark the edited ones. Increase α to remove more of the component along d. In two dimensions, full projection leaves the points on a line.

Use the strength slider to move from the faint original points to the solid edited points. At full strength, every point lands on the line perpendicular to d. In a space with 2,048 dimensions, removing one direction instead leaves a space with 2,047 dimensions.

Our activation hook applies this operation during a forward pass. We’ll see how a related operation can be applied to a weight matrix in the Heretic section.

d = mean_direction(H, B)      # One row per example
edited = project(x, d, strength=0.5)
Inside Abliteration · Rushi Chaudhari (@0xrushi)