Elamur Research

Surgical Feature-Space Decomposition of LLMs: Why, When and How?

Paper · 2024 · Arnav Chavan, Nahush Lele and Deepak Gupta

Summary

A trained language network can have large weight matrices even where its actual outputs use a much smaller set of directions. Chavan, Lele, and Gupta ask whether those directions can be identified from examples and used to shrink the network without retraining it. Their method, Surgical Feature-Space Decomposition (SFSD), runs calibration examples through a pretrained network and examines the outputs of individual linear projections. It preserves the directions in which those outputs vary most and replaces the contribution from discarded directions with a fixed average. A search can then choose how much to compress each projection according to its effect on a chosen performance measure.

The paper compares this activation-based approach with decomposing the weight matrices directly and with structured pruning. In a comparison on LLaMA-7B that used the same compression schedule for both kinds of decomposition, feature-space decomposition achieved an average commonsense accuracy of 64.68 at the 80% overall parameter budget. Weight-space decomposition scored 50.41, LLM-Pruner scored 59.47, and the uncompressed baseline scored 69.61. When the authors instead searched for ranks using the accuracy of a particular task, modest compression sometimes matched or improved on the pretrained baseline on held-out examples. That pattern appeared in both LLaMA-7B and Mistral-7B. With heavier compression, accuracy generally declined.

The criterion used to choose ranks changes what the compressed network is designed to preserve. The authors also select ranks using perplexity on WikiText-2, a measure of how well the network predicts text. Perplexity worsens as compression increases, while average commonsense accuracy can hold up comparatively well. A separate comparison shows that aggregate accuracy can conceal changes in individual answers. Some questions the original network answered correctly are lost, while some it missed are answered correctly after decomposition. The authors also find that the search tends to compress certain attention projections more readily than the projection that returns attention’s output to the rest of the network.

On StereoSet, the compressed variants selected using perplexity receive higher overall stereotype benchmark scores than their pretrained counterparts. This is evidence about the behavior measured by that benchmark, and the category scores show that more compression does not always produce a higher score. The paper’s detailed experiments are at the 7B scale. Producing the factors requires no gradient updates, although evaluating rank candidates can take hours. The authors make their implementation available on GitHub.

Deep dive: Surgical Feature-Space Decomposition of LLMs: Why, When and How?

Surgical Feature-Space Decomposition uses observed activations to compress language networks and tests what happens to reasoning, perplexity, and bias. · about 33 minutes to read

The problem and its context

What should survive compression?

The paper begins with a practical problem. A pretrained network can be expensive to run, and reducing its parameter count is useful only if the resulting network still performs the work for which it is needed. A compression procedure may also have substantial costs of its own. If replacing the original weights requires extensive retraining, a smaller result does little to help a team that cannot afford the adaptation stage. The authors therefore ask what can be removed from a pretrained network using its existing weights and a modest collection of examples. This is a problem in efficient models and compression.

Low-rank approximation gives the authors a way to pose the question locally. A linear projection maps an input vector to an output vector. Its weight matrix specifies what that mapping would do for every possible input. A low-rank replacement constrains the output that can vary with the input to lie in a smaller space. It can then represent the mapping by a pair of smaller matrices, with the chosen rank controlling the size of the intermediate representation. The unresolved question is how to find a smaller space that preserves the behavior of the network on real examples.

The weight matrix and the projection’s observed outputs offer different answers. A weight matrix can have a strong response to a direction that the inputs arriving at that projection rarely use. Conversely, a combination of inputs that regularly appears during an actual forward pass can make an output direction worth keeping even if a weight-only calculation gives it little priority. Examining the observed outputs lets the decomposition take account of which inputs the surrounding network supplies. It also makes the result depend on the examples used to observe those outputs. This dependence is central to SFSD, because the authors use examples for both constructing candidate projections and deciding which candidates to accept.

The term surgical describes the granularity of the intervention. Earlier work discussed by the authors selected whole layers for fine-tuning. Studies of distribution shifts found cases where changing selected layers improved adaptation. Work on language encoders reported that updating a subset of layers could outperform updating the whole encoder on downstream benchmarks. Other studies used a search over layer-specific learning rates or adjusted how much each layer could change during adaptation. The paper traces this line of work through experiments with BERT, GLUE, and SuperGLUE.

SFSD transfers that attention to the location of an intervention into a different setting. Within a block, the query projection can receive a different rank from the output projection, and the same kind of projection can receive different ranks at different depths. A rank choice can even leave a projection intact if reducing it does too much damage under the chosen criterion. The authors’ proposal is that both the location and the internal structure of a projection matter when compressing a pretrained Transformer.

What earlier compression methods offered

The paper situates its method among pruning, distillation, and quantization. Pruning removes weights or groups of parameters. Structured pruning removes groups that correspond to parts of the computation, which makes it the closest experimental comparator for SFSD’s replacement of dense operations with smaller ones. Distillation transfers behavior to a smaller predictor through training. Quantization changes the numerical precision used to represent or compute with quantities in the network. The authors treat quantization as a separate axis of compression and leave distillation out of the experiments because of the fine-tuning it would entail. Their structured-pruning comparator is LLM-Pruner.

The paper emphasizes the difficulty of preserving performance when those techniques are used without a recovery stage. It also points out that some solutions depend on particular hardware, and that a compression rule using the weights alone has no direct evidence about the examples a downstream application will present. In the authors’ framing, rank provides explicit control over the resulting parameter count, and calibration examples provide evidence about the mapping that the reduced projection needs to preserve. The proposal combines those two properties in a procedure that does not update the retained weights by gradient descent.

Low-rank compression itself has a history in convolutional networks. The paper describes earlier efforts to make such factorizations more stable and to choose ranks separately across layers. For language systems, it discusses progressive singular value decomposition of GPT-2 with retraining to recover performance, and work combining low-rank and sparse approximations with substantial downstream fine-tuning. It also discusses a closer precedent that applies singular value decomposition to both the weights and the inputs and derives a data-aware approximation. The authors see the motivation of that work as similar to theirs, while describing its evaluation as limited to discriminative language systems. SFSD studies data-aware decomposition in the generative systems used throughout this paper.

This background also explains why the authors regard a small gain after compression as plausible. They cite earlier work that treats compression as a form of regularization, meaning that reducing the freedom of a system can sometimes improve its performance on examples outside the selection data. In SFSD, the reduction comes from restricting which directions of a projection output can vary with the input. Whether that restriction helps depends on the projection, the amount of compression, and the outcome being measured. The earlier literature motivates looking for that behavior without establishing which directions should be removed.

Why study stereotypes alongside accuracy?

Compressing a projection can change the scores a language system assigns to particular answers even when a broad average stays close to its original value. That possibility gives the authors a reason to examine stereotypical associations separately. They describe earlier research on compression and social bias, including work on discriminative tasks and studies comparing bias at different sizes or stages of pretraining. They also discuss methods that explicitly remove directions associated with a protected attribute or a measured bias. A survey cited in the paper provides the broader background on bias and fairness in large language models.

The distinction between targeted attribute removal and SFSD matters to the experiment. SFSD’s factorization orders directions by the observed activations, and its general-purpose search accepts ranks using text perplexity. No stereotype category enters either criterion in that experiment. The authors ask whether stereotype benchmark behavior changes as a consequence of a compression procedure chosen for another purpose. They separately raise the possibility of deliberately searching for ranks with a debiasing objective in future work.

The method, step by step

From a network to a collection of projections

SFSD starts with a pretrained network and works on individual linear projections. In the architecture described by the authors, a repeated module combines multi-head self-attention with a multilayer perceptron. Attention projects its inputs into queries, keys, and values. Queries and keys participate in determining which information the operation draws on, values supply the information it combines, and an output projection transforms the resulting representation. In the multilayer perceptron, the authors distinguish a gate projection, an up projection, and a down projection. Each has a separate weight matrix and can receive a separate rank.

From calibration examples to a compressed network

The steps in order.

From calibration examples to a compressed networkStep 1: Run calibration examples through the pretrained network1. Run calibration examples through the pretrained networkStep 2: Collect outputs of each linear projection2. Collect outputs of each linear projectionStep 3: Find the leading directions in the outputs3. Find the leading directions in the outputsStep 4: Factor the projection at a candidate rank4. Factor the projection at a candidate rankStep 5: Add the discarded directions’ mean contribution5. Add the discarded directions’ mean contributionStep 6: Evaluate the replacement against the search criterion6. Evaluate the replacement against the search criterionStep 7: Keep the accepted rank and move backward7. Keep the accepted rank and move backward

The workflow separates the construction of a replacement from the decision to use it. Calibration produces the directions and the mean needed to construct a replacement at a given rank. A forward evaluation measures the effect of inserting that replacement in the network. In the fixed-budget experiment, the authors specify the local budgets and the modules they will change in advance. In the surgical experiments, the evaluation step chooses ranks according to the performance criterion.

The paper collects the projections under a common notation.

W = ⋃ₗ₌₁ᴸ Wₗ

W is the collection of weight matrices covered by the decomposition. L is the number of repeated modules, l indexes a module, Wₗ is its collection of projection matrices, and the union symbol combines the collections over the network’s depth.

Wₗ = {Wₗq, Wₗk, Wₗv, Wₗo, Wₗg, Wₗu, Wₗd}

The final letters identify the projection within module l. The suffixes q, k, v, and o mean query, key, value, and attention output. The suffixes g, u, and d mean gate, up, and down in the multilayer perceptron. Below, i indexes an individual projection. Its matrix Wᵢ has d₂ output coordinates and d₁ input coordinates. The paper also uses Wᵤ and W𝒹 for the factors of a replacement. In the factorization formulas, those names refer to the new matrices and can apply to any of the original projections.

What the weight-only comparison keeps

The first decomposition serves as a comparison and explains how a rank translates into a parameter budget. Singular value decomposition, or SVD, represents a matrix using orthogonal directions on its input and output sides, with singular values describing the strength of the mapping between the corresponding directions.

Wᵢ = U Σ Vᵀ

Here Wᵢ is the original projection matrix. U, of shape d₂ by d₂, contains the left singular vectors. Vᵀ, of shape d₁ by d₁, contains the transposed right singular vectors. Σ is a d₂ by d₁ matrix whose diagonal contains the singular values. The superscript ᵀ indicates a transpose, which interchanges rows and columns. The quantities d₂ and d₁ are the projection’s original output and input widths.

The paper truncates this expansion by keeping the leading singular directions and folding the retained singular values into one factor.

W̃ᵢ = Uᵣ Σᵣ Vᵣᵀ = W𝒹 Wᵤ

W̃ᵢ is the replacement for Wᵢ, and r is the retained rank. Uᵣ contains the retained left directions and has shape d₂ by r. Σᵣ contains the retained singular values and has shape r by r. Vᵣᵀ has shape r by d₁. The factor W𝒹 is the product Uᵣ Σᵣ, and Wᵤ is Vᵣᵀ. An input passes through Wᵤ first and W𝒹 second. The intermediate vector has width r, and the final output still has width d₂, so the surrounding computation receives a vector of the original width.

Both the weight-space and feature-space methods use these factor shapes. The authors relate their combined size to a desired fraction of the original projection’s weights.

d₂ × r + r × d₁ = β × d₂ × d₁

The two terms on the left count entries in the replacement matrices. The product d₂ × d₁ counts entries in Wᵢ. β is the local parameter budget, expressed as a fraction of the original matrix. A smaller β requests a smaller replacement. This count describes the matrices in the factorization and leaves the feature method’s additional bias vector outside the displayed relation.

r = β × (d₂ × d₁) / (d₂ + d₁) = β × κ

The symbol κ abbreviates the shape-dependent factor formed from d₂ and d₁. This equation converts β into a rank estimate for that particular shape. A rank is a whole number in the actual factorization. Because κ depends on the original projection’s dimensions, applying the same β to different projections specifies the same target fraction of weights while allowing different intermediate widths.

Weight-space decomposition makes its selection from Wᵢ alone. The leading singular values summarize the behavior of the matrix across its available directions. They do not tell the decomposer how often the network sends an input along each direction or how large the corresponding responses are on a particular domain. The feature-space method retains the factorization’s interface and cost calculation while changing the evidence used to choose its output directions.

How the calibration outputs determine the replacement

Imagine collecting the output vectors of a projection as it processes the calibration examples. An output direction can matter because the examples cause it to change substantially. Another direction can have a similar contribution across examples. The first type calls for a varying response from the replacement. The second type offers an opportunity to preserve much of its effect with a constant. The paper uses eigendecomposition to identify an orthogonal basis in which to make that distinction.

Yᵢ = Wᵢ Xᵢ

Xᵢ is the matrix of inputs collected for projection i, and Yᵢ is the corresponding output matrix. In the paper’s notation, Xᵢ has shape d₁ by D, where D denotes the number of calibration samples, and Yᵢ has shape d₂ by D. Each column on the input side is mapped by Wᵢ to the corresponding column on the output side. The matrix compresses the notation for many observed applications of the same projection into a single product.

Σᵧ = Yᵢ Yᵢᵀ

Σᵧ is the output matrix used for estimating important directions. The product with Yᵢᵀ accumulates joint contributions from the output coordinates over the calibration observations. It is square in the d₂ output coordinates. The paper calls this a covariance matrix. The displayed definition is an uncentered output product, a detail that matters when interpreting the relation it draws between eigenvalues and sample variance.

Σᵧ = V Λ Vᵀ

V contains the orthonormal eigenvectors of Σᵧ, and Λ is the diagonal matrix of their eigenvalues. Both have shape d₂ by d₂. Each column of V is a direction in the original output space. Its matching entry in Λ describes the weight that the calibration output product assigns to that direction. This V comes from the eigendecomposition of the observed output product. The identically named matrix in the weight SVD is defined by that separate decomposition.

The authors’ rationale is to keep directions with large eigenvalues, because discarding directions with substantial movement across the examples would erase input-dependent behavior. They use a variance notation to explain this intuition.

Sₖ = Var(Yᵢ | Vₖ)

Sₖ is the paper’s stability statistic for direction k. Vₖ is the corresponding eigenvector, and Var denotes variability across calibration observations in the output projected onto that direction. The vertical bar specifies the direction in which the variation is examined. A low value means the directional contribution is relatively stable in the authors’ account. Strictly, the uncentered product in the displayed definition of Σᵧ orders directions by their uncentered squared projections. A centered, normalized covariance is the object whose directional eigenvalues have the usual variance interpretation. Thus the stability explanation gives the motivation for the selection, while the product and its eigendecomposition give the displayed calculation.

With the basis chosen, the replacement maps the original output into the retained subspace. The authors express this without requiring the full original output to be computed at inference time.

Ỹᵢ = Vᵣ Vᵣᵀ Wᵢ Xᵢ = W𝒹 Wᵤ Xᵢ

Ỹᵢ denotes the approximated output at this stage. Vᵣ consists of the r retained eigenvectors and has shape d₂ by r. Vᵣᵀ Wᵢ is the factor Wᵤ, of shape r by d₁. Vᵣ itself is W𝒹, of shape d₂ by r. The product Vᵣ Vᵣᵀ is the orthogonal projection onto the span of the retained directions. In the implemented factorization, Wᵤ maps inputs directly to coordinates in that span, then W𝒹 maps those coordinates back to the original output width.

The two-stage representation gives a concrete meaning to choosing a rank. A candidate with a smaller r keeps fewer independent quantities that can change from example to example. Every input can still produce a different output, but the differences are constrained to the span of the retained directions. The next part of the method restores the average contribution outside that span.

How a fixed term preserves part of the discarded output

The retained and discarded eigenvectors form complementary parts of the original basis. Before approximation, the output can be written as the sum of its contributions in those parts.

Yᵢ = Ỹᵢ + Vᵣ꜀ Vᵣ꜀ᵀ Wᵢ Xᵢ

In this identity, Ỹᵢ is the projected output before bias compensation. Vᵣ꜀ contains the eigenvectors excluded from Vᵣ, with c denoting the complementary set. Vᵣ꜀ Vᵣ꜀ᵀ projects onto their span. The entire second term is the part of the original output that a plain truncation would discard. It can contain a persistent offset as well as changes from one input to another.

The authors estimate the persistent component using the mean calibration input to that projection.

bᵢ = Vᵣ꜀ Vᵣ꜀ᵀ Wᵢ X̄ᵢ

X̄ᵢ is the mean of the collected inputs Xᵢ. The product Wᵢ X̄ᵢ is the original linear mapping applied to that mean, and the complementary projection extracts its part in the discarded space. The resulting bᵢ is a single vector in the original output coordinates. Because the original mapping is linear, projecting the output of the mean input gives the mean discarded output over the calibration observations.

Ỹᵢ = W𝒹 Wᵤ Xᵢ + bᵢ

This final Ỹᵢ includes the compensation. W𝒹 and Wᵤ are the feature-derived factors, and bᵢ is added to each output observation. Variation among observations is carried by W𝒹 Wᵤ Xᵢ. The constant recovers the calibration mean in the excluded space without restoring its input-dependent variation. The term bias here refers to an additive component of a linear computation. The stereotype measurements later in the paper use the same word in its social sense.

The paper’s weight-space baseline does not use this correction. Its construction has no calibration mean from which to estimate the omitted output. Accordingly, the experimental comparison between the two methods includes both the choice of directions and the compensation term in the feature method. The feature rank and the fixed term address different parts of the approximation: the factors preserve a restricted set of varying responses, while the offset preserves a contribution that can be shared across examples.

What data the procedure uses

The typical calibration collection contains 512 samples with a maximum sequence length of 128. The authors draw examples at random from training splits of the downstream datasets. In the configuration used for the reported experiments, calibration batches give equal representation to each of the six commonsense tasks. For a given projection, the inputs and outputs gathered from these batches determine the eigenspace and the mean compensation. The calibration examples affect the parts installed in the network even though there is no gradient training on those examples.

The rank search uses a separate set of examples to measure how a candidate behaves when installed. For task-specific compression, the authors divide the task’s test partition into a 20% search subset and a disjoint 80% evaluation subset. The search can inspect the answers on its own subset to choose ranks. The final task-specific score is measured on the held-out portion. In the perplexity-guided experiments, search is based on WikiText-2. The downstream reasoning scores of those variants use the complete test splits of the respective reasoning benchmarks. This latter choice tests transfer from a text-prediction objective, although the activation calibration data still include reasoning examples.

How the rank search makes decisions

The surgical search starts at the last layer and moves toward the input. At each layer it tries retained fractions from the budget set shown below, starting with the smallest.

β ∈ {0.1, 0.2, …, 0.9}

Here β denotes a candidate local budget, and the ellipsis stands for the intervening entries in the paper’s sequence. The search converts each candidate to a rank using the shape of the corresponding weight matrix. It factorizes the projection at that rank, inserts the replacement with mean compensation, and evaluates the network against a specified performance level. It takes the first candidate that satisfies the criterion and moves on to the preceding layer. The algorithm takes a pretrained network and a performance criterion as inputs and returns a list of selected ranks.

The criterion can be task accuracy or WikiText-2 perplexity. Accuracy gives higher values to better performance, so preservation means retaining at least the required accuracy. For perplexity, lower values are preferable, so the relevant condition is staying within an acceptable perplexity level. The search therefore uses the same underlying approximation to answer distinct questions. It can seek a small network that remains accurate on a particular task, or it can seek a small network that still predicts text to the desired standard.

The backward order follows earlier observations, cited by the authors, that compression near the input can be especially disruptive. The search measures a candidate in the context of the network reached so far. A decision for a later projection can affect which replacements are viable in an earlier one. The procedure produces a depth-dependent result with straightforward local decisions, at the cost of considering a limited set of possible combinations.

The paper relates the separate local budgets to the overall budget by weighting them by the sizes of the original projections.

βoverall = (Σᵢ₌₁ᴺ βᵢ pᵢ) / (Σᵢ₌₁ᴺ pᵢ)

Here βoverall names the overall fraction estimated by the expression in the paper’s appendix. N is the number of linear layers being counted, i is the layer index, βᵢ is the local retained fraction, and pᵢ is the original number of parameters in that layer. The numerator estimates the retained weights and the denominator counts the original weights. Changes to larger matrices have more influence on this fraction than the same local budget applied to smaller matrices. An intact projection contributes its full original count. This connects the decisions made one layer at a time to the parameter budgets used to report the experiments.

Experiments and results

The systems, tasks, and measurements

Most of the evidence comes from LLaMA-7B and Mistral-7B. The authors use LLaMA-7B for their controlled comparison of weight decomposition, activation decomposition, and structured pruning. They use both pretrained networks to examine surgical rank search with task accuracy and with perplexity, and to measure StereoSet scores. The experimental progression starts by holding the pattern of decomposition fixed, then lets the search choose which projections and ranks are acceptable. The pretrained systems are described in LLaMA and Mistral 7B.

The reasoning suite uses different kinds of decisions. BoolQ asks for a yes or no answer, while PIQA concerns physical commonsense. HellaSwag tests the choice of a plausible continuation. WinoGrande uses an adversarial Winograd-style challenge. These tasks bring distinct kinds of errors into a comparison that would look quite different if it relied on a single reasoning benchmark. BoolQ · PIQA · WinoGrande

ARC contributes the ARC-e and ARC-c subsets, labeled Easy and Challenge. The paper reports task accuracy and the average of the reported accuracies across the suite. The average gives a compact comparison of settings, while the individual scores show whether an apparent advantage extends across the tasks. The split size differs substantially between tasks, which is also relevant to the cost of repeatedly evaluating candidates in the task-specific search. AI2 Reasoning Challenge · Evaluation and benchmarks

The appendix gives the exact counts for the task-specific rank-selection and evaluation subsets. These counts describe the partition of each test dataset. Calibration examples come from separate training data.

TaskRank search (20%)Final evaluation (80%)
BoolQ6542616
PIQA3671470
HellaSwag20088034
WinoGrande2531013
ARC-e4751901
ARC-c234938

For general text prediction, the paper uses WikiText-2 perplexity. Perplexity is lower when the predictor assigns higher likelihood to the observed text. It therefore measures an aspect of performance different from choosing a correct answer in a downstream benchmark. The authors also report retained parameters and multiply-accumulate operations, or MACs, in their fixed-budget comparison. A MAC count describes arithmetic in the evaluated configuration. Elapsed time for factorization and search is reported separately as the cost of making the compressed network. Pointer Sentinel Mixture Models

Fixed schedules isolate the type of decomposition

The authors first compare the two factorizations without surgical rank search. They aim for an overall budget of 80% by decomposing the final 12 of the 32 modules while holding local β at zero.46. They hold local β at zero while decomposing the final 24 of the 32 modules to aim for an overall budget of 50%.33. They choose these schedules to avoid changes near the beginning of the network. Holding the schedule fixed for the decompositions means that a difference between them cannot be attributed to one having searched for a better placement of its low-rank projections.

Average commonsense accuracy at the 80% parameter budget on LLaMA-7B

Feature-space decomposition retains the most accuracy among the compressed systems.

Average commonsense accuracy at the 80% parameter budget on LLaMA-7BPretrained baseline: 69.61Pretrained baseline69.61Weight-space decomposition: 50.41Weight-space decomposition50.41LLM-Pruner: 59.47LLM-Pruner59.47Feature-space decomposition (this paper): 64.68Feature-space decomposition (this paper)64.68
The numbers
System or settingaccuracy %
Pretrained baseline69.61
Weight-space decomposition50.41
LLM-Pruner59.47
Feature-space decomposition (this paper)64.68

At the 80% budget, each compressed system is listed at 5.4 billion parameters, compared with 6.7 billion for the pretrained baseline. The table reports a MAC count of 423.93 for the baseline, 339.99 for either decomposition, and 339.60 for LLM-Pruner. The near match in the reported arithmetic counts helps interpret the accuracy separation. In particular, the weight and feature variants have the same nominal size and arithmetic count, yet their ability to preserve answers differs considerably.

The task-level results show where the average advantage comes from. Feature decomposition records 74.34 on BoolQ, close to the original score of 75.04. The weight decomposition and LLM-Pruner scores there are 62.20 and 57.06. On WinoGrande, feature decomposition scores 67.40, weight decomposition scores 58.80, and LLM-Pruner scores 59.83, against a baseline of 70.00. On ARC-e, their respective scores are 66.33, 44.95, and 60.94, with the baseline at 72.85. These comparisons support an activation-based choice at the stated budget across several different task formats.

There are exceptions to a uniform ranking of the compressed systems. On PIQA at the same budget, LLM-Pruner reaches 75.68 and feature decomposition reaches 74.86. On HellaSwag, LLM-Pruner reports 66.80 and feature decomposition 66.72. The overall distinction is a higher suite average, with significant help from particular tasks, rather than leadership on every accuracy measure. ARC-c offers another case in which the methods differ while all remain below the original: feature decomposition scores 39.42, LLM-Pruner 36.52, and weight decomposition 30.03, compared with 44.88 for the baseline.

Average commonsense accuracy at the 50% parameter budget on LLaMA-7B

Feature-space decomposition leads the compressed systems, with a substantial drop from the pretrained baseline.

Average commonsense accuracy at the 50% parameter budget on LLaMA-7BPretrained baseline: 69.61Pretrained baseline69.61Weight-space decomposition: 41.10Weight-space decomposition41.10LLM-Pruner: 43.58LLM-Pruner43.58Feature-space decomposition (this paper): 47.25Feature-space decomposition (this paper)47.25
The numbers
System or settingaccuracy %
Pretrained baseline69.61
Weight-space decomposition41.10
LLM-Pruner43.58
Feature-space decomposition (this paper)47.25

At the 50% budget, the compressed configurations are listed at 3.4 billion parameters. The MAC counts are 215.61 for either decomposition and 206.59 for LLM-Pruner. The average accuracy still favors feature-space decomposition at this budget. The distance from pretrained performance makes clear how much more demanding this setting is. It also matters that the schedule changes both the number of affected modules and the local retained fraction, so the heavier configuration is not a comparison of the same set of interventions at a lower rank alone.

Looking at individual tasks under this heavier schedule reveals some crossovers. Feature decomposition scores 62.02 on BoolQ and weight decomposition scores 62.08. HellaSwag yields 34.64 for feature decomposition and 35.64 for LLM-Pruner, with the weight decomposition at 27.88. On PIQA, feature decomposition has the highest compressed score of 61.37, ahead of 59.63 for pruning and 53.59 for weight decomposition. On ARC-e, the corresponding order is 40.32 for feature decomposition, 33.50 for pruning, and 27.15 for weight decomposition. A practitioner interested in a particular task would therefore read its row alongside the average before choosing a method at this compression level.

Searching for ranks using task accuracy

The task-specific experiment changes the placement and rank of interventions. For each downstream task, the authors run the surgical search using accuracy on that task’s 20% subset. The resulting network is evaluated on the unseen 80% portion. The figures compare the compressed variants with a horizontal reference for the corresponding pretrained system. Because the selection subset and the final subset are disjoint, a gain on the latter gives evidence that the rank decisions transfer to other examples from that task.

The authors report that modest compression can retain or even exceed pretrained accuracy, and they observe this type of behavior in both LLaMA-7B and Mistral-7B. The curves generally worsen with more compression. This gives the search an empirical tradeoff to navigate. A small intervention may remove directions to which the observed task is insensitive or that interfere with some decisions. As the rank gets smaller across more projections, the network has fewer varying components with which to reproduce its previous behavior. The experiment records the resulting accuracy pattern. Which of those mechanisms explains any given improvement remains a separate question.

The task-specific procedure can produce a different network for each task. It can leave a projection unchanged for one benchmark and factorize it for another because the acceptance decision depends on the benchmark’s score. The parameter count is an outcome of those decisions. A task whose score tolerates interventions in several large projections can reach a smaller network than a task whose score causes the search to retain those projections. This is how the authors’ use of task accuracy links the final size to the target application.

Searching for ranks using text perplexity

The authors then use WikiText-2 perplexity as the rank-selection criterion and evaluate the resulting networks on the full test splits of the reasoning tasks. The rank decisions in this experiment do not use reasoning accuracy. The reasoning results therefore show how much downstream performance survives when the search is driven by a general language-prediction measure. Because both experiments use the same type of feature decomposition, changing the search criterion helps distinguish what the approximation can do from what a particular acceptance rule asks it to preserve.

The reported curves show that heavier compression can lead to a substantial rise in perplexity while the average downstream score falls less sharply. On LLaMA-7B at a reported parameter count of 5.4B and an 80% budget, the paper gives a reasoning average of 65.4 % for perplexity-selected SFSD versus 59.5 % for LLM-Pruner. Those values belong to the perplexity-guided analysis. The fixed-schedule comparison reports 64.68 and 59.47 for its own feature and pruning settings. Keeping the two reports in their respective contexts is important because they arise from different rank-selection setups.

Mistral-7B’s parameter count falls more slowly along the search, and the authors report higher overall performance in that progression. They describe the relative deterioration in perplexity and average accuracy as similar to LLaMA-7B once the amount of parameter reduction is considered. This comparison is about performance along each network’s compression path. Taking the same point in the progression as evidence of the same compression would overlook the fact that the search has kept different amounts of each network.

Stereotype scores after perplexity-guided compression

The authors evaluate the original and perplexity-selected networks on StereoSet. The reported metric is the Idealized Context Association Test, or ICAT. The paper interprets higher ICAT values as better behavior with respect to stereotypical bias as measured by the benchmark. The score is reported overall and separately for gender, profession, race, and religion. Because the selection criterion was perplexity, the changes in ICAT are observed consequences of the compression procedure. StereoSet · Bias, fairness and safety

StereoSet overall ICAT by retained parameter budget for LLaMA-7B and Mistral-7B

The most compressed setting shown has the highest overall ICAT for each network.

StereoSet overall ICAT by retained parameter budget for LLaMA-7B and Mistral-7BLLaMA-7B baseline (100%): 63.14LLaMA-7B baseline (100%)63.14LLaMA-7B SFSD (90%): 64.84LLaMA-7B SFSD (90%)64.84LLaMA-7B SFSD (80%) (this paper): 67.28LLaMA-7B SFSD (80%) (this paper)67.28Mistral-7B baseline (100%): 63.45Mistral-7B baseline (100%)63.45Mistral-7B SFSD (90%): 64.87Mistral-7B SFSD (90%)64.87Mistral-7B SFSD (80%): 66.90Mistral-7B SFSD (80%)66.90
The numbers
System or settingICAT
LLaMA-7B baseline (100%)63.14
LLaMA-7B SFSD (90%)64.84
LLaMA-7B SFSD (80%) (this paper)67.28
Mistral-7B baseline (100%)63.45
Mistral-7B SFSD (90%)64.87
Mistral-7B SFSD (80%)66.90

For LLaMA-7B, gender, profession, and race ICAT rise across the listed budgets. Religion ICAT is 75.02 at 100%, reaches 78.85 at 90%, and is 78.30 at 80%. For Mistral-7B, gender ICAT goes from 52.03 at 100% to 54.93 at 90% and 59.05 at 80%. Its religion scores are 79.79, 87.03, and 84.68 at the corresponding budgets. Its profession score is 68.22 at 90% and 68.12 at 80%. In both networks, then, the increase in overall ICAT coexists with categories that favor the intermediate setting. The authors’ experiment provides a measure of how StereoSet behavior changes across these compressed configurations.

The cost of producing the compressed network

The reported mean factorization time is ~13 seconds for a single LLaMA-7B projection. The paper reports roughly ~45 minutes to decompose all 224 projections on a 48 Core 128GB CPU-only machine. Performing decompositions one projection at a time makes this part of the procedure possible on that machine. Once the factors have been produced and a rank selected, the projection uses the smaller matrices in sequence. Its parameter and arithmetic counts are lower at the compressed settings reported in the paper.

The search adds a different cost. It evaluates candidate replacements on a single 24GB L4 GPU. The authors describe that GPU as 2-3× slower than a 40/80GB A100 and say it also runs with a smaller batch size. The complete search takes ~8 hours for WinoGrande, the smallest of the search datasets, and ~36 hours for HellaSwag, the largest. These are times to produce a rank configuration. The reported counts of parameters and arithmetic characterize the resulting networks, while the search times show the workload incurred before they can be used.

The fixed-schedule results put this setup cost in context. Activation-based factorization already improves average reasoning accuracy over the weight-only and pruning alternatives in the reported comparisons without the per-projection surgical search. Search provides a way to adapt rank and placement to an objective. Its additional cost depends on the data used for evaluation and on how many candidate replacements must be tried.

What the ablations show

Activation-based approximation helps before ranks are searched

The clearest controlled comparison is between feature-space and weight-space decomposition at the same fixed schedules and nominal budgets. Both use a rank bottleneck, both change projections in the selected trailing modules, and they have the same reported parameter and MAC counts at each budget. The feature method has the higher average accuracy at both settings. That result isolates the advantage of its data-aware approximation from any advantage gained by searching for better local budgets.

The difference between the methods is a package of changes. Feature decomposition builds the basis from observed outputs and uses a mean correction for the discarded directions. Weight decomposition builds its basis from the matrix and has no corresponding calibration mean. The paper does not report a numerical comparison of the same feature-space factors with and without the correction. As a consequence, the fixed-budget evidence supports the feature-space construction as implemented, while leaving the separate contribution of the correction unresolved.

The comparison with LLM-Pruner provides a check against another way of shrinking the network. The feature construction leads in average accuracy at the matched parameter counts, with some task-level exceptions and somewhat different MAC counts. It is evidence about the tested structured-pruning comparator and the tested schedules. The pair of factorization conditions gives the tighter comparison for understanding the effect of activation data, because those conditions share the same factor shapes and placement.

Calibration diversity changes which directions are visible

The appendix describes initial experiments using calibration examples from individual reasoning tasks, from WikiText-2, and from a mixed collection. The authors report better downstream generalization with the mixed reasoning collection than with task-specific calibration and use the mixture in the reported results. They suggest that its varied examples help expose a broader range of activation behavior. This is a qualitative calibration comparison. The paper gives no complete score breakdown for the alternatives.

This observation is particularly informative alongside the task-specific rank search. Tailoring the rank decisions to a task does not require estimating the basis from examples of that task alone. In the reported setup, the diverse mixture provides the output directions and the task-specific search chooses how many of them to keep. The division lets the two choices serve different purposes. A basis can reflect behavior across several kinds of inputs, while a local rank is accepted or rejected based on its effect on the target score.

The mixture also helps explain how to read the perplexity-guided analysis. The search can be independent of reasoning accuracy even though the basis reflects a mixture of reasoning examples. The experiment varies the criterion that selects ranks while retaining the data procedure used to estimate the directions. Consequently, its downstream scores show what happens when task labels are omitted from rank selection within this shared calibration setup.

The location and kind of projection matter

The authors visualize the retained parameter fractions for LLaMA-7B, averaged over the six task-specific searches. The grid shows the projection type against its location in the network. A cell at 100% represents a projection left in its pretrained form in the average reported there. Cells with low retained fractions show where the search repeatedly found small replacements compatible with its performance criterion. The resulting pattern is uneven across both depth and projection type.

Query, key, and value projections tend to tolerate more compression than the multilayer perceptron projections in this analysis. Query projections show a particularly split pattern, frequently taking substantial reductions or remaining fully intact. The output projection of attention tends to receive the least compression, and the authors describe it as staying intact nearly half the time. This difference matters because the query, key, value, and output projections belong to the same attention operation. Treating an entire attention block as equally compressible would blur the variation seen by the search.

The grid summarizes decisions that were acceptable within the search procedure. Its cell values are retained parameter fractions, which depend on shape and on the chosen rank. They are therefore a practical indicator of where lower-rank replacements were tolerated, rather than a direct measurement of the mathematical rank of the original weights. Since the search proceeds backward and keeps earlier decisions in place, the grid also reflects how projections behave in combination with changes already accepted elsewhere. It gives evidence of uneven compressibility under these conditions.

Accuracy can stay close while answers change

The paper compares the pretrained LLaMA-7B with its perplexity-guided variant at the 90% budget and examines whether they make the same predictions on individual examples. Disagreement is the percentage of examples whose predicted answers differ. The authors find that it is considerably larger than the difference in aggregate accuracy and is particularly conspicuous on ARC-c. Similar accuracy can therefore coexist with substantial changes in which items each network gets right.

The relationship follows from what each measure counts. A wrong answer turning into a right one helps accuracy. The reverse hurts it. Those changes can offset in a net score while both count towards disagreement. Where an item has several possible answers, switching from one wrong answer to another can also raise disagreement without changing accuracy. The analysis exposes behavior that the average alone would miss. It also puts gains from mild compression into perspective, since an improved total can coexist with new failures.

The authors call this pattern learning and unlearning. In their interpretation, changing the projections can let the network express some useful representations more successfully while impairing others. The measurements establish that predictions changed after a gradient-free intervention. They do not identify a hidden representation responsible for a specific recovered answer, and the result does not require new knowledge to have been acquired. A direct interpretation is that projecting away some components changes how the pretrained network arrives at its answers.

The stereotype analysis raises a related issue at the category level. Overall ICAT improves across the reported parameter budgets for both networks, while some categories achieve their highest listed score at the intermediate budget. Like the reasoning disagreement, this shows the importance of inspecting more than a single aggregate. The benchmark provides evidence of changed stereotype-related behavior, and the category results reveal that the amount of compression alone does not determine its direction.

Limitations

Limits the authors state

The authors identify experimental scale as a limitation. The extensive comparisons are on 7B systems. They mention preliminary experience on networks with more than 20B parameters, but the detailed evidence in the paper comes from LLaMA-7B and Mistral-7B. Their main experiments therefore establish the observed tradeoffs at the tested scale. Larger systems would need their own detailed comparisons to determine how far those tradeoffs generalize.

The authors also question whether the surgical rank search finds the best use of feature-space decomposition. The procedure tests a short sequence of budgets for each projection, moving through the network in a fixed order. It chooses the first candidate to satisfy a metric at that point in the search. This makes the search feasible to describe and run, but it leaves room for a strategy that chooses ranks jointly or derives them from a stronger principle. The paper does not establish how much further the network could be compressed if the rank allocation were optimized differently.

Calibration size and sequence length are additional variables the authors flag. They suggest that more calibration data or longer sequences might improve the approximation. The detailed results use 512 samples at a maximum sequence length of 128, with a mixture chosen after initial calibration comparisons. The paper leaves the behavior across other sample sizes and lengths open. It also raises the possibility that fine-tuning the retained components could recover some performance after compression and explicitly leaves that experiment outside its scope.

Limits visible in the design

The relevant separation of the data depends on the question an experiment asks. In the task-specific setup, the final 80% subset is held out from the rank search, but the choice of ranks explicitly uses correct answers in the 20% search subset from the same benchmark. The resulting held-out accuracy measures compression adapted to a task with labeled selection data. In the perplexity-guided setup, the rank search uses WikiText-2 and the commonsense evaluation uses the full task test splits. The basis still comes from the mixture of reasoning calibration examples drawn from training data. The change is the information used to accept ranks, instead of the removal of all downstream-domain information from the pipeline.

The feature directions and the bias correction are both functions of the chosen calibration distribution. The correction preserves the average discarded response on that distribution by construction. Inputs with different activation means can have different average contributions in the discarded space. Likewise, a direction that absorbs little of the squared calibration output can still matter in a situation underrepresented in the mixture. The reported superiority of the mixed set motivates using diverse calibration data in these experiments. It does not establish how representative that set is of longer inputs, different domains, or tasks outside the reasoning suite.

The paper’s explanation of stable directions also depends on how the output statistic is formed. Its displayed product uses uncentered outputs. In that form, a direction can receive a high eigenvalue because the outputs have a large common component along it, even if their variation around that component is small. The additive correction can preserve a common component if the direction is discarded, but the paper does not provide a controlled comparison of direction selection with and without centering. The evidence here is the performance of the reported method, with limited grounds for assigning its success to a specific interpretation of directional variance.

The computational measurements cover two distinct stages. The paper reports arithmetic counts for compressed configurations and execution times for the offline factorization and search. The factorization reduces the arithmetic represented by the replaced projections. End-to-end inference latency would also depend on how the sequential factors are executed and on the hardware used. The reported preparation times and MAC counts do not quantify that runtime behavior. They do show that the process exchanges one kind of work, gradient-based recovery training, for data collection, factorization, and potentially many evaluations.

The layer map and sample-level disagreement are useful diagnostics with corresponding boundaries. The layer map shows which local changes the particular backward search accepted under its given objectives and budgets. Changing the order or metric could produce a different map, so the reported pattern alone cannot establish the universal importance of a projection type. The disagreement analysis shows changes in predictions, including on a harder benchmark. It gives no direct localization of the computations responsible for each change. A claim that an intervention exposed particular hidden knowledge would require evidence linking those predictions to identified directions.

Finally, the fairness result is specific to StereoSet, ICAT, and the tested networks and budget settings. It shows that a search guided by perplexity can yield compressed variants with higher overall ICAT on the benchmark. The category results already reveal limits on a simple dose-response interpretation. The paper does not establish how measured changes carry over to other fairness benchmarks, interactions in deployment, or particular decisions affecting people. It also does not test the separate proposal of choosing ranks directly for a debiasing objective. The experiment measures a change that followed compression and leaves the causal role of individual directions open.

What came after

No later studies are documented here. The paper itself leaves open whether a different rank search could preserve performance at smaller budgets and whether a search criterion aimed directly at unlearning or debiasing could make the observed changes in predictions more selective. Its experiments establish that the choice of directions and the choice of acceptance criterion both matter, while leaving those extensions to future tests.

Cite

Cite as Arnav Chavan, Nahush Lele and Deepak Gupta. 2024. Surgical Feature-Space Decomposition of LLMs: Why, When and How?. Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers).

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.18653/v1/2024.acl-long.130

@inproceedings{chavan2024surgical,
  title = {{Surgical Feature-Space Decomposition of LLMs: Why, When and How?}},
  author = {Arnav Chavan, Nahush Lele and Deepak Gupta},
  booktitle = {Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
  year = {2024},
  doi = {10.18653/v1/2024.acl-long.130},
  url = {https://doi.org/10.18653/v1/2024.acl-long.130}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/chavan-2024-surgical-feature-space-decomposition-llms/