Forward-Only Rank Adaptation for Large Language Model Inference: Test-Time Self-Evolution
This article explains how large language models can adapt during inference without relying on backpropagation. It introduces a forward-only rank adaptation method that uses SVD decomposition and angular concentration to identify weight matrices and rank components that can be compressed with minimal performance loss. The article covers the geometric basis of the method, a four-step forward-only search workflow, experimental boundaries, and production deployment practices, including calibration data, safe rollout, monitoring, and integration with other compression techniques.
1. Introduction: Self-Evolution During Inference
Most large language model inference services follow a “frozen training, fixed inference” paradigm: once weights are deployed, they remain unchanged, and all requests share the same parameters. However, real traffic is not static:
- Input distributions drift. Prompt styles, domain terminology, and the proportion of long-text requests can change over time, causing the offline training distribution to diverge from the online serving distribution.
- Fine-grained adaptation conflicts with cost reduction. For specialized scenarios such as financial customer service or medical question answering, training a complete model for every scenario is expensive and difficult to scale.
- Resource utilization can be improved. Peak GPU memory and long-tail latency limit single-device concurrency, even though many requests do not require full-precision or full-width weights.
As a result, the industry is paying more attention to test-time adaptation: without modifying the original training result as a prerequisite, the model can adjust its parameters according to the runtime input distribution, allowing its weight structure to evolve with traffic.
Most mainstream approaches focus on low-rank adaptation, where a low-rank increment is added to a weight matrix and continuously updated. These methods are stable to train and deterministic in effect, but they rely on backpropagation and require retaining the computation graph and optimizer state, leading to high peak memory usage and tuning costs. Rank-reduction approaches directly modify the weight structure and can balance effectiveness with compression ratio. However, deciding which weight matrix to modify and what rank to reduce it to is a typical combinatorial selection problem, often requiring extensive trial and error with considerable overhead.
A recent academic approach offers a new perspective: enabling continuous adaptation during inference using only forward propagation. Its core insight is that the rank components produced by singular value decomposition (SVD) do not contribute equally to activations. By using a geometric metric called angular concentration, it is possible to measure the contribution direction of each component to hidden states and identify the weight matrices that are most worth compressing at very low cost. This article breaks down the principles and workflow of this method and explains the key points for practical deployment.
2. Principles: Measuring SVD Component Contributions with Angular Concentration
2.1 From SVD to a Component View
For any weight matrix W, SVD decomposes it into W = UΣVᵀ. Taking the top r singular values in descending order and reconstructing the matrix yields a rank-r approximation Wᵣ. According to the classic matrix approximation result, the Eckart–Young theorem, Wᵣ is the best rank-r approximation of W in terms of Frobenius norm error. In other words, truncating components corresponding to small singular values is the theoretical optimum for structured compression. This is also the foundation of low-rank compression methods.
However, minimizing global norm error does not necessarily mean minimizing loss in language modeling performance. Each row and column of a matrix may serve a specific semantic function, and the actual sensitivity can vary greatly. Common approaches either use a uniform rank for all matrices or evaluate sensitivity layer by layer through backpropagation. The method discussed here observes a different object: instead of looking only at weights, it also looks at activations.
2.2 Angular Concentration: A Geometric Tool for Measuring Component Contributions
Suppose an input activation passes through the i-th SVD component of a weight matrix, producing a contribution vector aᵢ to the output, i.e., the hidden state. The sum of contributions from all n components is the complete output:
h = Σᵢ₌₁ⁿ aᵢ
Based on this, angular concentration can be defined as the ratio of the norm of the summed contribution vectors to the sum of their individual norms:
C = ‖Σᵢ aᵢ‖₂ / Σᵢ ‖aᵢ‖₂
The value of C ranges from 0 to 1 and is determined by the angles between vectors rather than activation magnitude:
- When
Cis close to 1, the contribution directions of the components are highly aligned and reinforce each other. The output of the matrix is mainly determined by a few dominant directions. - When
Cis low, the contribution directions are dispersed and may partially cancel each other. The information carried by a rank component may be diluted when combined into the hidden state, and truncating it may have limited impact on the final representation.
By comparing the angular concentration of different SVD components, one can determine whether their contributions are concentrated or dispersed, and then identify the optimal compression target:
- Measure the angular concentration for each candidate weight matrix.
- Select the matrix with the lowest angular concentration, meaning the most dispersed component contributions, as the first pruning target.
- Analyze the contribution of each rank component within that matrix: if a component’s contribution vector is nearly collinear with the complete hidden state, it is an important carrier of the main direction and should be retained; components with divergent directions and limited contribution to the output are candidates for pruning.
In this way, the question of “where to compress and what to retain” is transformed from an expensive numerical optimization problem into a geometric measurement.
2.3 Why Forward Propagation Is Sufficient
This approach relies on two key conditions.
First, the contribution of SVD components to the output is naturally decomposable. Matrix multiplication is a linear operation. After decomposing W into UΣVᵀ, the contribution of each component to the output is the product of the corresponding U column and the input vector, scaled by the corresponding singular value. Summing over all components exactly yields the complete output. Therefore, a single standard forward pass can obtain h, and the contribution vector of each component can be derived using the corresponding U columns and singular values. The entire process does not require saving the computation graph or invoking backpropagation.
Second, angular concentration is a purely geometric quantity. Computing it only requires inner products and norms of contribution vectors. On mainstream hardware such as GPUs, these reduction operations are highly mature and parallelizable, with negligible overhead. For memory usage, input and output tensors can be released after batch processing. SVD results can be kept as small matrices in GPU memory or host memory, without requiring any gradient buffers. Compared with backpropagation-based tuning methods, this approach is more economical in both computation and memory.
3. Method Breakdown: A Four-Step Forward-Only Search Process
3.1 Step 1: SVD Decomposition and Candidate Matrix Selection
Not every weight matrix needs to participate in the search:
- Matrices such as token embeddings and output vocabulary projections are narrow and often have relatively high redundancy.
- Up-projection and down-projection matrices in the feed-forward network (FFN) usually contain the largest number of parameters and offer the most obvious compression benefits.
- Attention projection matrices have relatively fewer parameters and are responsible for positional and relational modeling, so they are more sensitive and can be handled in later stages.
Therefore, the first candidate set can focus on FFN projection matrices and then be expanded gradually. SVD only needs to be computed once, and the results (U, Σ, Vᵀ) can be cached and reused according to matrix shapes and partitioning schemes. For extremely large matrices, blocked SVD or randomized SVD approximations can be used, with reconstruction error serving as a quality check threshold.
3.2 Step 2: Forward Propagation and Additivity of Components
Use a batch of calibration samples that are not used for model training but whose distribution is as close as possible to online traffic to perform a standard forward pass. Record the input activations of target matrices and collect the hidden states on the output side. At this point:
- The complete forward result is the sum of the contributions of all SVD components.
- The contribution of each rank component equals the product of the corresponding
Ucolumn, singular value, and the projection of the input activation along theVᵀdirection.
This means that a single forward pass produces both the complete output and all component contributions, without needing to repeatedly run forward passes for each component.
3.3 Step 3: Angular Concentration Calculation
For each candidate matrix, compute angular concentration based on the collected activation statistics. To reduce variance caused by individual samples, the metric can first be computed per sample or per token and then aggregated, for example by taking the batch mean or using robust statistics such as the median. The resulting metric can then be used for ranking and search. The following code is illustrative:
# Pseudocode: implemented using tensor operations; relies only on activations collected in one forward passimport torch # Syntax illustration only; can be replaced with tensor APIs from any deep learning frameworkdef angular_concentration(components):"""Compute angular concentration for a set of contribution vectors (dimensionless).components: [k, d], where k is the number of SVD components (rank), and d is the output dimension.A value close to 1 means component directions are highly aligned; a lower value means contributions are more dispersed."""summed = components.sum(dim=0) # h = Σ a_inorm_sum = components.norm(dim=1).sum() # Σ ||a_i||return (summed.norm() / (norm_sum + 1e-12)).item()def svd_components(weight, x, k):"""Offline SVD plus one forward pass, computed equivalently.weight: candidate weight matrix W with shape [d_out, d_in]x: input activation for this matrix, with shape [batch, seq, d_in]Returns U_k [d_out, k], S_k [k], and projection P [batch, seq, k].Summing over all ranks gives the standard forward result, which can be checked against the original output."""U, S, _ = torch.linalg.svd(weight, full_matrices=False)U_k, S_k = U[:, :k], S[:k]P = x @ x.new_empty(x.shape[-1], k).copy_(torch.linalg.svd(weight, full_matrices=False)[2][:k].T)return U_k, S_k, Pdef screen_matrices(model, calib_batch, max_rank=128):"""Compute angular concentration for each candidate matrix; lower scores are higher-priority pruning targets."""results = {}for name, layer in model.target_layers():x = layer.capture_input(calib_batch) # Hook captures the layer inputU_k, S_k, P = svd_components(layer.weight, x, max_rank)# Contribution of each rank component: U_k[:, i] * S_k[i] * P[:, :, i]comp = (U_k[None, None, :, :] * S_k[None, None, None, :]* P[:, :, None, :]).flatten(0, 1) # [batch*seq*k, d_out]results[name] = angular_concentration(comp)return sorted(results.items(), key=lambda kv: kv[1]) # Ascending: most dispersed first
It is worth noting that computing angular concentration for a single rank component has limited meaning: with only one vector, the value is always 1 and cannot reflect contribution strength. What matters is its relative position with respect to the full set of components. Therefore, in practice, two types of comparisons are more useful:
- Angular concentration across candidate matrices.
- Within the same matrix, the angle between each rank component’s contribution vector and the complete hidden state.
Combined with the search workflow below, these metrics can be accumulated continuously as traffic arrives.
3.4 Step 4: Search, Pruning, and Validation
After selecting the matrices most worth pruning, the process moves to search and pruning:
- Construct a set of candidate ranks, for example by reducing the current rank to 25%, 50%, or 75%.
- For the first few candidates, such as 2 or 3, run a forward pass layer by layer using the reconstructed weights, and compute task metrics and perplexity on a validation set.
- Select the largest rank whose metric drop is within a tolerated threshold as the pruning result for that matrix. If none of the candidates meet the requirement, fall back to no pruning.
- Repeat this process layer by layer until the overall compression target or search budget is reached.
True “evolution” happens after deployment. Online inference naturally generates requests continuously, so requests consistent with the production distribution can be periodically selected as new calibration samples. The model can then repeat the loop of “collect activations → compute angular concentration → search and prune.” In this way, the model can dynamically adjust rank allocation across layers as the input distribution changes, without touching gradients. The following code is illustrative:
# Example: iteratively search and apply rank pruning during forward-only processing, without gradientsdef forward_only_search(model, calib_batch, max_rank=128, tol=0.01):order = screen_matrices(model, calib_batch, max_rank) # Ascending angular concentrationbudget_left = 3 # Prune at most 3 matricesfor name, score in order:if budget_left <= 0:breaklayer = model.get_layer(name)best = layer.current_rankfor r in [int(layer.current_rank * f) for f in (0.75, 0.5, 0.25)]:cand = layer.reconstruct_from_svd(r) # Reconstruct using the first r componentslayer.swap_weight(cand)with torch.no_grad(): # Forward-only; no gradientsdrop = layer.base_loss - layer.eval_loss(calib_batch)if drop <= tol and r < best: # Loss within tolerance and rank is smallerbest = rlayer.set_rank(best)budget_left -= 1return {name: model.get_layer(name).current_rank for name, _ in order}
To control overhead, a full search is typically triggered only during the early stage of service launch, during low-traffic periods, or during major version upgrades. Daily operation can continue using the rank configuration from the previous search, while periodically monitoring whether angular concentration drifts significantly using a small number of new samples. If drift occurs, a local re-search can be started, spreading the cost over an acceptable range.
4. Experimental Results and Applicability Boundaries
Relevant work has conducted a systematic evaluation based on the above workflow:
- Compared with gradient-based methods, this approach has lower peak GPU memory usage and a higher speedup. This is because it avoids the additional overhead of computation graphs, gradients, and optimizer state, and the tuning cycle is shorter.
- Compared with exhaustive search, it achieves a higher speedup with comparable accuracy. Angular concentration provides an effective heuristic ranking, narrowing the search from “trying every possible combination” to “forward validation of a small number of candidates,” reducing ineffective trial and error.
- Task coverage. The evaluated tasks include knowledge reasoning, knowledge intervention, multi-hop reasoning, fact verification, fairness and bias evaluation, hallucination detection, and information retrieval. These tasks have different requirements for parameter sensitivity and compression robustness, providing a relatively comprehensive view of the method’s applicability.
When interpreting these conclusions, three boundaries should be kept in mind:
- Different task sensitivities. Tasks such as factual memory and multi-hop reasoning are more sensitive to parameter perturbations and require more conservative tolerance thresholds.
- Hardware dependence. Speedup depends on actual hardware, batch size, and matrix shapes. Benchmarking should be performed using the target service configuration.
- Accuracy must be preserved. Angular concentration is a geometric heuristic for screening candidates. Final decisions must still be based on task metrics, and geometric indicators cannot replace effectiveness evaluation.
5. Engineering Deployment: From Inference-Time Adaptation to Production Practice
5.1 Offline Part: Making SVD and Calibration Reusable Assets
SVD decomposition is the most computationally expensive part of the workflow, but the results do not change with each request, making it suitable for offline computation. Weights and SVD factors can be stored in object storage and loaded on demand when the inference service starts. They can also be shared across multiple instances of the same model, avoiding repeated computation. Calibration samples are best drawn from real traffic samples, retained after desensitization, and cover requests of different lengths and domains to improve distribution representativeness.
5.2 Online Part: Placing Search in Low-Risk Time Windows
Search involves multiple forward passes and consumes inference compute, so it is better suited to containerized deployment environments. Search instances can be temporarily scaled out through elastic scaling during low-traffic periods and reclaimed immediately after completion. The resulting rank configuration can be delivered as a configuration item and combined with a release mechanism of “canary deployment plus fast rollback.” In addition:
- New configurations should first be validated on a small amount of traffic. Only after confirming that quality and latency meet requirements should they be switched to full traffic.
- Each change should retain a version number and corresponding validation metrics for traceability and rollback.
5.3 Quality Guardrails: Preventing “Evolution” from Going Off Track
Adaptation does not mean uncontrolled change. It is recommended to establish three layers of protection:
- Offline regression. After each search, run core tasks on a fixed evaluation set. If performance falls below a baseline threshold, reject the change.
- Online probes. Use a small portion of mirrored traffic to run both the original model and the pruned model simultaneously, comparing metrics such as output consistency and perplexity to enable rapid detection.
- Drift alerts. Continuously track input distribution features. When distribution shift exceeds a configured range, trigger recalibration instead of mechanically following a fixed schedule.
5.4 Observability: Quantifying Both Benefits and Costs
The effect of “evolution during inference” needs measurable indicators. Using cloud monitoring, alerting, and logging services, the following metrics can be closely tracked:
- Resource layer: peak GPU memory, GPU memory fragmentation rate, single-device concurrency.
- Service layer: throughput, time to first token, inter-token latency, P99 latency.
- Quality layer: perplexity, task accuracy, output consistency rate.
- Adaptation layer: rank configuration of each layer, angular concentration trends, computation per token in FLOPs.
Combining these four groups of metrics is necessary to determine whether a pruning operation is truly providing speedup or trading quality for speed.
5.5 Combining with Other Compression Techniques
Rank adaptation is not an isolated technique. A more reasonable positioning is as one component of a compression toolchain:
- Combined with quantization. First reduce weight bit-width through quantization, then reduce matrix width using rank adaptation. The two techniques act on numerical precision and parameter structure respectively, and their benefits can be stacked. However, the combined precision loss needs to be validated together.
- Combined with distillation. For the real online distribution, the original model can serve as the teacher and the pruned model as the student for distribution alignment, mitigating accuracy regression caused by direct truncation.
- Combined with dynamic inference. During token-by-token decoding, the rank configuration of each layer can also be selected dynamically according to the complexity of the current input. Simple requests can take low-rank paths, while complex requests can retain high rank. However, this introduces branch overhead and needs to be evaluated experimentally.
6. Conclusion
The key to enabling large language models to “continuously evolve” during inference is not to let weights change endlessly, but to identify the parts truly worth adjusting at extremely low cost. Forward-only rank adaptation provides a concise and effective answer: SVD decomposes weights into independently evaluable components, and angular concentration acts as a compass, indicating which components have dispersed contributions and can be safely compressed. Compared with gradient-based methods, it uses less memory and tunes faster. Compared with exhaustive search, it saves a large amount of trial and error with almost no loss in accuracy.
For developers, there are three key points for deployment:
- Calibration data must be close to real traffic. This is the prerequisite for adaptation quality.
- Search should be placed in low-risk windows, combined with canary release and rollback.
- A complete observability system should continuously validate results, ensuring that every “evolution” can withstand online testing.
General cloud capabilities such as those provided by Baidu AI Cloud, including container platforms, object storage, and monitoring/alerting, can serve as supporting infrastructure: container platforms can host elastic search tasks, object storage can store weight assets and calibration data, and monitoring systems can continuously track accuracy and performance changes. With these capabilities, teams can gradually turn “evolution during inference” from a cutting-edge research idea into a sustainable inference optimization mechanism.
