Manuscript Offprint
arXiv:2610.38598Two-Stage Clipping: Linear-Time Approximate and Exact Mixed-Norm Projections for Transformers
Abstract
Large Language Models (LLMs) based on Transformer architectures have achieved remarkable performance across artificial intelligence tasks, but their computational cost remains a major bottleneck. Structured sparsification provides a promising approach to reducing this cost. In particular, projections can induce column-wise sparsity in model matrices, but existing proximal methods (Prox) typically require operations for matrices in , limiting their computational and energy efficiency.
In this paper, we introduce Two-Stage Clipping (TSC), an efficient structured sparsification operator inspired by bilevel optimization. Rather than solving a bilevel optimization problem in the strict sense, TSC decomposes the computation into two successive stages. First, group-level quantities are projected to allocate the global sparsity budget and identify active groups. Second, the resulting values are used as group-wise clipping thresholds for the matrix coefficients. For square attention matrices (), the complexity of our TSC method is , which is linear in the number of matrix coefficients.
We establish a theoretical bound on the discrepancy between TSC and the exact proximal projection and show on synthetic data that the additional Euclidean approximation cost remains small in practice. Extensive benchmarks demonstrate substantial runtime improvements over proximal baselines and validate the theoretical norm identities underlying the proposed construction.
We derive exact mixed-norm decomposition identities for both the proximal projection and TSC operators. These identities establish an exact norm conservation and decomposition property shared by the classical Euclidean projection and the proposed two-stage clipping operator.
We further extend the two-stage framework to the structured sparsity constraint. Remarkably, in this case, we prove that the two-stage construction coincides exactly with the Euclidean projection onto the ball. Consequently, the proposed framework provides two complementary situations: for , TSC is a computationally efficient approximation of the exact proximal projection with a quantitative error bound, whereas for , TSC recovers the exact Euclidean projection.
Experiments on biomedical datasets show that TSC achieves classification accuracy and sparsity levels comparable to those of the exact proximal approach when applied to Transformer attention matrices. Experiments on Image dataset show that TSC achieves better PSNR than classical Pruning methods when applied to Transformer attention matrices.
Overall, TSC provides a computationally efficient alternative to exact proximal projection for structured sparsification, combining linear complexity, theoretical guarantees, and competitive empirical performance.
1 Introduction
Modern deep neural networks achieve state-of-the-art performance across vision, language, and biomedical applications, but this success comes at the cost of massive parameterization and significant computational overhead. As models continue to scale, enforcing structured sparsity has become a central challenge for improving efficiency, interpretability, and deployability Alvarez and Salzmann [2016], Han et al. [2015], Sanh et al. [2020], Zhou et al. [2019], Nakkiran et al. [2020]. These approaches yield empirical sparsity but do not enforce explicit geometric constraints. Unstructured sparsity induced by regularization often fails to translate into real computational gains on modern hardware Tibshirani [1996], Hastie et al. [2015], Duchi et al. [2008], Condat [2016].
Among structured sparsity-inducing norms, the norm plays a central role Bejar et al. [2021]. It promotes column-wise sparsity by coupling entries within columns while encouraging entire groups to vanish. However, projection onto the ball remains computationally expensive. State-of-the-art projection algorithms rely on proximal formulations and the Moreau identity, leading to a worst-case complexity of for matrices in due to sorting operations across matrix entries. This complexity becomes prohibitive for large-scale neural networks and Transformer architectures.
The authors in Perez et al. [2024] improved the proximal algorithm for computing the exact Euclidean projection onto the ball, achieving near-linear complexity , where decreases as sparsity increases. However, the main drawback is that its computational complexity remains sparsity-dependent.
Recently, bilevel optimization has become popular because it provides a powerful framework for modeling problems involving nested objective functions Colson et al. [2007], Zhang et al. [2022, 2024]. Bilevel optimization (BLO) involves two levels of hierarchy (i.e., upper and lower levels), where obtaining the solution to the upper-level problem requires solving the lower-level problem.
Inspired by this bilevel framework, we propose a two-stage clipping (TSC) operator that replaces the proximal Euclidean projection.
Transformer architectures Vaswani et al. [2017] were proposed for learned image compression Liu et al. Liu et al. [2023]. Of particular relevance to the work in Zaheer et al. [2020] recently investigated sparse attention. In their work sparsity is induced by the attention architecture itself.
These works motivate the evaluation of the proposed TSC operators for Biomedical Transformer based classification and Transformer-based image compression. In our experiments, attention matrices are sparsified using TSC- , TSC- , and the corresponding Euclidean proximal projection. The resulting methods are evaluated on Classification of biomedical datasets. We provide attention Sparsity-Reconstruction Trade-off on large image datasets. In particular, we report Delta-PSNR as function of the attention sparsity.
Contributions. The main contributions of this work are:
-
New two-stage clipping (TSC) operators for the and structured norms.
-
A single-level convex characterization of the lower-stage clipping operator for the radius vector generated by the upper-stage projection.
-
New norm identities for the TSC and structured operators.
-
A bound on the difference between the PROX and TSC approaches for , together with a proof that TSC coincides exactly with the Euclidean projection.
-
Empirical validation on Transformer architectures demonstrating improved computational efficiency and structured sparsity.
https://www.deeplearningbook.org/contents/notation.html
Projection onto the norm ball is a standard tool for enforcing structured sparsity Quattoni et al. [2009], Bejar et al. [2021].
For a matrix , the mixed norm is defined as
For a given radius , the corresponding convex ball is
The Euclidean projection of onto this ball is defined by
The dual norm of is , defined as
The proximity operator associated with the dual norm is defined by
Therefore, Moreau's decomposition Moreau [1962], Combettes and Pesquet [2011] yields
Thus, the same parameter defines both the projection radius and the regularization weight in the dual proximal operator. Efficient algorithms for computing the exact projection are described in Bejar et al. [2021], with further computational improvements reported in Perez et al. [2024]. The proximal projection algorithm is provided in appendix A.
3 A new two-stage structured clipping operator
3.1 A single-level convex formulation
In this paper, we propose a two-stage approach inspired by bilevel optimization methods, rather than a bilevel optimization problem in the strict sense Colson et al. [2007], Zhang et al. [2022, 2024]. In the first stage, the group-level quantities are projected to identify the active groups, while in the second stage, the resulting projected values are used to constrain or rescale the coefficients within each group. We propose these two-stage method for enforcing -structured sparsity. We provide a single-level convex characterization of the proposed two-stage operator.
Let with columns . Define the vector of column norms
Let define the specific two-stage optimization problem as follows:
and define the two-stage operator column-wise as
Proposition 3.1 (Exact single-level convex optimality). Let be defined by equation 8. Then the matrix defined by equation 9 is the unique minimizer of the following single-level convex optimization problem:
Proof. Since is fixed, the constraint set in equation 10 is a Cartesian product of convex sets: . Therefore, the minimization problem equation 10 decouples across columns:
For each column , the problem is a Euclidean projection onto the closed convex set . Thus its unique minimizer is , which is exactly equation 9. Uniqueness follows from strict convexity of the objective in each column. Proposition 3.1 provides an explicit single-level convex characterization of the second stage of the proposed TSC operator. For the radius vector determined by the first stage, TSC is the exact Euclidean projection onto the Cartesian product of the corresponding column-wise balls. This characterization does not imply that TSC coincides with the Euclidean projection onto the global ball.
3.2 A clipping operator algorithm
Remark 3.2. As a consequence of the non-expansiveness and positivity of the projection: ; the components of satisfy
These bounds hold regardless of the magnitude of the column norms.
Each column is thus computed as the projection of onto the ball of radius :
This projection admits the closed-form expression
Remark 3.3 (Clipping interpretation). The mapping can be interpreted as a column-wise clipping operator, where acts as a vector of clipping thresholds. Indeed,
Using Remark 3.2, we obtain
Since by construction, this yields
Algorithm 1 summarizes a possible implementation of the TSC clipping.
Algorithm 1 TSC clipping
Input: ,
Output:
Remark 3.4. A vector is a feasible clipping operator if a feasible radius vector satisfies
Equality holds when the constraint is active.
3.3 An norm Identity
The purpose of this section is to compare the structural properties of the classical projection and the proposed two-stage clipping. In particular, we study the relationship between the norm of the clipping solution in the spirit of classical -curve analysis Hansen and O'Leary [1993]. Recall the triangle inequality for the Frobenius norm, which follows from the Cauchy–Schwarz inequality:
However, for the norm, we obtain a stronger identity for our TSC.
Proposition 3.5 (Exact norm decomposition). For the TSC clipping, the projected matrix and the residual satisfy the exact identity
Proof. The result follows directly by summing over the columns the identity
which holds for the TSC clipping. Summing over yields
which is exactly equation 20.
Proposition 3.6 (Exact identity for the proximal projection). The standard projection satisfies
Proof. The proof follows exactly the same argument as for Proposition 3.5, using the clipping structure of .
Remark 3.7 (Exact mixed-norm decomposition). Equations (18) and (20) reveal a common structural property of the exact Euclidean projection and the proposed two-stage clipping operator. Both operators provide an exact additive decomposition of the original mixed norm into a retained component and a residual component.
In particular, when the constraint is active, both methods preserve the same mixed-norm budget and yield identical residual norms:
Thus, although TSC and the exact projection generally produce different matrices, they achieve exactly the same global mixed-norm reduction. Their difference lies in how this reduction is distributed among the matrix coefficients, rather than in the total mixed-norm budget.
3.4 Relationship between Euclidean Projection and Two-Stage Clipping
Let
denote, respectively, the exact Euclidean projection and the proposed two-stage clipping operator.
Since
and TSC is feasible, i.e.,
the optimality of the Euclidean projection immediately gives
The following result provides a quantitative bound on the discrepancy between the two solutions.
Proposition 3.8 (Distance between exact projection and two-stage clipping). The exact Euclidean projection P and the two-stage clipping solution TSC satisfy
Proposition 3.8 shows that the excess squared Euclidean approximation error of two-stage clipping directly controls its distance to the exact projection. Hence, when the two approximation errors are close, the corresponding solutions are also close.
Moreover, both operators admit a column-wise clipping representation. Let and denote their respective clipping thresholds. Since scalar clipping is 1-Lipschitz with respect to its threshold,
Summing over all entries gives the deterministic bound
Equivalently,
This bound is distribution-free and therefore holds for arbitrary input data.
Proposition 3.9 (Refined deterministic bound). Let and denote the exact Euclidean projection and the two-stage clipping operator, respectively.
For each column , define
and
Since both clipping operators coincide whenever , their difference satisfies
For each coefficient, the difference between the two clipping operators is zero when and is bounded by otherwise. Therefore,
Summing over all coefficients gives
Finally, yields the previous deterministic bound.
Refined deterministic bound using actual threshold exceedances. The deterministic bound can be further refined by exploiting the fact that the exact Euclidean projection and TSC coincide for coefficients whose absolute values do not exceed the smaller clipping threshold.
Summing equation 27 over all coefficients gives
Using the elementary inequality , we obtain the refined deterministic bound
This yields the hierarchy
(32)
Unlike the previous worst-case estimate, this refined bound accounts for both the number of coefficients exceeding the clipping thresholds and the magnitude of their exceedances. It is deterministic and distribution-free.
3.5 Computational complexity
The proposed two-stage clipping operator is particularly well suited to GPU architectures. Its computation consists of three steps (see Algorithm 1):
-
Column-wise norm computation with complexity .
-
Projection of the resulting vector onto the ball with complexity .
-
Element-wise clipping of the matrix columns with complexity .
The computational complexity of the proposed TSC operator is
For sufficiently large matrices satisfying , the dominant term is . Consequently,
In particular, for square attention matrices , the complexity is , which is linear in the number of matrix coefficients. These operations involve parallel reductions, a single vector projection, and element-wise transformations, making TSC particularly efficient on GPUs.
In contrast, classical exact projection algorithms require more elaborate optimization procedures, involving sorting, threshold computations, and active-set updates Quattoni et al. [2009], Bejar et al. [2021].
Although Algorithm 2 of Perez et al. Perez et al. [2024] provides an efficient CPU implementation of the exact projection, its heap-based structure involves sequential dependencies and irregular memory access patterns that are not naturally suited to massively parallel GPU execution. This limitation is related to the algorithmic structure rather than to the C++ programming language itself, which can also support efficient GPU implementations through CUDA. An important distinction between the proposed TSC operator and Algorithm 2 of Perez et al. is their dependence on the induced sparsity level where denotes the number of heap-update operations. This quantity is data-dependent and may vary with the projection radius and the resulting sparsity level.
Table 1: Computational complexity of different projection methods.
| Method | Complexity | Main operations |
|---|---|---|
| Original Bejar et al | Sorting and threshold updates | |
| Perez et al. (Algorithm 2) | Inverse ordering and heaps | |
| Proposed TSC | projection and clipping |
4 A two-stage clipping operator
In this section, we extend the proposed TSC framework to the norms, yielding additional forms of structured sparsity.
Let be a matrix with column vectors . Define the aggregation vector
which collects the norms of the columns of . We define the TSC clipping as the solution of the following optimization problem:
and define the two-stage operator column-wise as
Obviously, propositions 1 holds and provides also an explicit single-level convex optimality principle for the proposed two-stage operator.
Algorithm 2 Two-stage clipping ()
Input:
Output:
4.1 The TSC is an exact Euclidean projection
Proposition 4.1. For any and , the proposed two-stage clipping operator coincides with the exact Euclidean projection onto the norm ball:
Proof. Let and .
By construction, TSC first computes
and then performs column-wise Euclidean projections onto the balls of radii :
For any matrix satisfying , let . By the reverse triangle inequality,
Since , the TSC construction attains this lower bound:
Thus, TSC minimizes the Euclidean projection objective over the ball. By uniqueness of the Euclidean projection,
Unlike the case, the proposed two-stage construction introduces no approximation error for the norm.
The TSC- and Prox- algorithms are mathematically identical and share exactly the same implementation. Consequently, they produce identical solutions with identical computational complexity and execution time.
4.2 A unified two-stage framework for mixed-norm projections
The proposed Two-Stage Clipping (TSC) framework provides a unified computational approach to enforcing mixed-norm constraints. Its main advantage is that it separates the projection into two stages: first, a low-dimensional projection of column-wise norms onto an ball, followed by a column-wise reconstruction satisfying the prescribed constraint.
Interestingly, the resulting operator exhibits different optimality properties depending on the underlying mixed norm.
The case: a fast feasible approximation. For a matrix , let
where denotes the Euclidean projection onto the ball of radius .
The TSC operator is defined by
By construction,
However, this operator does not generally minimize the Frobenius distance to over the feasible set. It therefore provides a computationally efficient feasible approximation to the exact Euclidean projection.
The case: recovery of the exact projection. Consider now the mixed norm
Let
The second stage consists of the radial reconstruction
Since the projection of onto the ball satisfies
for some , we obtain
with the convention that zero columns remain zero.
This expression coincides with the classical group soft-thresholding formula for the Euclidean projection onto the ball. Consequently,
Interpretation and contribution. These results highlight an important structural property of the proposed framework. While TSC provides a fast feasible approximation for the constraint, it recovers the exact Euclidean projection for the constraint.
The exact projection is a well-established result in proximal optimization and structured sparsity. Therefore, the contribution is not the introduction of a new projection algorithm, but rather the identification of a common two-stage formulation that encompasses both approximate and exact projections.
This unified perspective clarifies how the geometry of the mixed-norm constraint determines whether the two-stage construction is exact or approximate, while retaining a computational structure suitable for vectorized implementations.
Remark 4.2 (Exact norm identity). The two-stage clipping satisfies the identity
Consequently, the exact mixed-norm identity also holds for the Euclidean projection:
This exact additive decomposition is specific to the mixed norm and does not, in general, extend to the Frobenius norm.
5 Experimental results
Both TSC and the exact projection are evaluated on the same synthetic matrices, using identical projection radii, hardware, and timing protocols. This comparison therefore evaluates the computational advantage of TSC over a Prox exact projection on a GPU implementation. While the Prox exact projection minimizes the Euclidean distance to the input matrix, TSC provides a computationally efficient feasible approximation. We consequently report both execution times and approximation errors to characterize the trade-off between computational efficiency and projection accuracy.
5.1 Comparison of classical Euclidean projection vs proposed two-stage clipping operator
We compared our two-stage method against the proximal projection algorithm on synthetic Gaussian data. Figure 1 reports the normalized additional Euclidean cost of the two-stage clipping operator relative to the exact projection, as a function of the size n (Bottom) (for r= 0.3) and the sparsity (Top) for n = 1000 for Gaussian input matrices.

Figure 1: Relative difference between the classical Euclidean projection and the proposed two-stage clipping operator for i.i.d. Gaussian matrices, as a function of the size and the sparsity.
Empirical results on Gaussian data in Figure 1 show that:
-
The normalized distance between the exact proximal projection (Prox) and the proposed two-stage clipping operator (TSC) remains very small;
-
This distance decreases as the matrix dimension n and the sparsity level increase;
-
The theoretical upper bounds exhibit a similar behavior with respect to both matrix dimension and sparsity.
-
Furthermore, the refined bounds in Eq. 32 provide significantly tighter estimates of the actual distance than the coarse upper bound.
These experimental results empirically support the similarity between TSC and Prox in terms of classification accuracy.
5.2 Time comparison between the proximal projection and our two-stage clipping operator methods on GPU device
Both TSC and the classical proximal projection (Prox) were implemented in PyTorch and evaluated on an NVIDIA A100 GPU. The proximal algorithm is detailed in Appendix A. Both methods were tested on the same square matrices using identical projection radii. Execution times are reported in milliseconds as a function of the matrix dimension, and the speedup is defined as the ratio between Prox and TSC execution times.

Figure 2: Comparison of two-stage Clipping versus proximal. U: Processing time in PyTorch using an NVIDIA A100 GPU as a function of the size of the square matrix . Bottom: Logarithm fitting of the speedup of our two-stage clipping operator versus the proximal algorithm.
Figure 2 shows the runtime comparison between the proposed two-stage clipping operator and the classical proximal projection on GPU. Note that runtime of two-stage clipping operator is identical to the runtime of the two-stage clipping operator . and the classical proximal
The horizontal axis represents the matrix dimension for square matrices , while the vertical axis (log scale) shows the runtime in milliseconds. The two-stage method relies only on reductions and element-wise clipping operations, which are highly parallelizable on GPU architectures. In contrast, the proximal method requires repeated simplex projections involving sorting operations, leading to significantly higher runtime. The results shown in Figure 2 (left) indicate that the proposed two-stage clipping algorithm outperforms the proximal method by a factor ranging up to 540 when the size of the attention matrix is . Figure2 (Bottom) show that the measured speedup increases approximately logarithmically over the considered matrix-size range, consistently with the different computational structures of the two algorithms.
5.3 Classification on biomedical dataset with sparse Transformer Architectures
Criterion. We define the optimisation problem on transformer architectures. Let denote the attention matrix, where is the number of tokens. Let represent the true labels, and the estimated labels obtained from a softmax classifier. To sparsify the weights of the attention matrix, we compare the classical projection and the two-stage clipping method as a constraint to enforce structured sparsity in the model. The global optimization criterion is defined as:
where is the cross-entropy loss.
The optimization problem is solved using a masked double-descent gradient algorithm Zhou et al. [2019]. We implemented the proposed two-stage clipping method in PyTorch, including the model architecture, optimizer, learning-rate schedulers, and loss functions. We use the Adam optimizer Kingma and Ba [2015] and the smooth SiLU activation function.
We compare our two-stage clipping operator with the classical proximal projection for matrix sparsification on transformer architectures Vaswani et al. [2017]. We use a lightweight Transformer architecture with two layers and two heads.
Classification on ECG Dataset Accurate classification and interpretability are critical requirements in biomedical applications such as ECG-based heart failure diagnosis. We evaluate our method on the PhysioNet PTB Diagnostic ECG Database Goldberger et al. [2000]. The classification task is formulated as a binary problem with 10,505 abnormal and 4,045 normal ECG recordings. The signals are preprocessed and segmented, with each segment corresponding to a heartbeat represented by 187 tokens. Note that we use a reshape for inducing a diagonal-wise structured sparsity.
ECG dataset

Figure 3: ECG dataset. Proximal projection versus two-stage clipping operator — sparsity-accuracy trade-off.
Fig 3 shows that, on this biomedical ECG dataset, the proposed two-stage clipping operator and the proximal method achieve very similar classification accuracy, with a difference of less than 1%.
The sepsis dataset The Sepsis dataset focuses on early warning detection for sepsis, a critical and potentially fatal medical condition. It includes anonymized vital signs, lab results, and clinical indicators of patients admitted to the hospital, structured for real-time monitoring and predictive modeling. The total number of patients were 40,336 including 2 932 sepsis patients and 37,404 patients non-sepsis. We performed balanced sampling at the patient level. All SEPSIS patients were retained and 7.27% of the non-sepsis patients were randomly selected, using a fixed random seed to ensure reproducibility. For the considered dataset, this resulted in approximately 2,932 SEPSIS patients and 2,719 non-sepsis patients, yielding a nearly balanced dataset with a 48-hour temporal sequence length Tokens = 48) and 40 clinical variables per hour.
Fig 4 shows that, on this biomedical SEPSIS dataset, the proposed two-stage clipping operator and the proximal method achieve very similar classification accuracy, with a difference of less than 1%.
https://www.kaggle.com/datasets/olagokeblissman/sepsis-dataset
SEPSIS dataset

Figure 4: SEPSIS dataset. Proximal projection versus two-stage clipping operator — sparsity-accuracy trade-off.
5.4 Attention Sparsity–Reconstruction Trade-off (ASRT)
Let define the optimisation problem on transformer architectures. Let be the original image, and the reconstructed image,
where is the quadratic loss. The mixed-norm constraint is imposed on the sparsified core of each attention matrix, excluding the first row and column, with an adaptive radius , where denotes the original attention submatrix before sparsification and .
In our implementation, the sparsification operator is applied independently to the post-softmax attention matrix of each Transformer layer and attention head.
The TSC projection is applied to each mini-batch during every forward pass, and therefore multiple times per epoch.
The first row and column are preserved to maintain global attention connections, while TSC is applied to the remaining attention sub-matrix using an adaptive radius proportional to its mixed norm.
The training loss is the mean squared reconstruction error.
The objective of this experiment is to demonstrate that TSC-based attention sparsification preserves image reconstruction quality while increasing attention sparsity, without significantly affecting the compression bit-rate. A comprehensive investigation of image compression using sparse Transformers is left for future work.
We compare the proposed TSC method with the widely used structured pruning approach Wen et al. [2016]. We do not include BigBird in this comparison, as it was primarily designed for large attention matrices. Furthermore, the proximal projection method is excluded because of its prohibitive computational cost on large-scale datasets.
Reconstruction quality is evaluated using the peak signal-to-noise ratio (PSNR). Sparsity levels are matched based on the nominal sparsity parameters while effective attention sparsity is measured as the proportion of zero-valued attention coefficients.
Both experiments employ the same Transformer-based image reconstruction architecture. The architectural parameters are summarized in Table 2 in Appendix C.
5.4.1 Evaluation of ASRT on the Kodak image dataset
We evaluate the proposed structured sparsification operators on the Kodak image dataset using a lightweight Transformer-based image autoencoder. The dataset is randomly partitioned into disjoint training and test subsets, containing and images, respectively, using a fixed random seed.
The resulting sparse model is subsequently evaluated on previously unseen images using the same operator and constraint.

Figure 5: Kodak dataset. Two-stage clipping operator versus Two-stage clipping operator and structured pruning: sparsity–Delta-PSNR trade-off.
The figure shows the PSNR loss as a function of attention sparsity. The figure 5 shows that TSC-based methods preserve PSNR better than structured pruning at comparable sparsity levels. In particular, TSC- exhibits the best reconstruction performance.
5.4.2 Evaluation of ASRT using Flickr for training and kodak for testing
We trained the transformer on 473 2048 × 2048 images obtained from Flickr, divided into 256 × 256 patches. The dataset contains 473 images, with 30,272 available patches. At each epoch, 3,784 patches are sampled, corresponding to 8 patches per image. Over 30 epochs, this amounts to 113,520 parameter updates, assuming that each patch constitutes a separate batch. We use the 24-image Kodak dataset for testing. We report Sparsity-Delta-PSNR trade-off.

Figure 6: Training on Flickr and testing on Kodak dataset. Two-stage clipping operator versus Two-stage clipping operator and structured pruning: sparsity-Delta-PSNR trade-off.
The figure 6 shows that TSC-based methods preserve PSNR better than structured pruning at comparable sparsity levels. In particular, TSC- exhibits the best reconstruction performance.
6 Discussion
We could also consider extending TSC to the constraint, which preserves the same matrix norm identity. However, this extension presents three limitations: (i) it induces unstructured sparsity within columns; (ii) we cannot establish a quantitative error bound relating TSC to the exact proximal projection; and (iii) the additional projections on individual columns introduce a logarithmic computational overhead.
Future work will focus on extending the proposed TSC framework to image compression and comparing its performance with standard codecs, such as
JPEG 2000, as well as recent Transformer-based image compression methods Ma et al. [2026].
7 Conclusion
Classical projection methods are typically derived from proximal formulations resulting in algorithms with worst-case complexity. In contrast, our approach avoids computing the projection via dual proximal mappings. In this paper, we introduce the Two-Stage Clipping (TSC) framework for enforcing structured sparsity constraints. The proposed framework provides two complementary approaches: for , TSC offers a computationally efficient approximation of the exact Euclidean projection, supported by a quantitative error bound, whereas for , TSC coincides exactly with the Euclidean projection.
For square attention matrices , the complexity of our TSC method is , which is linear in the number of matrix coefficients.
Experiments show that our two-stage clipping algorithm outperforms the proximal algorithm in a range of 143 to 554 when the size of the attention matrix varies within a range of 1000 to 10000. By exploiting the intrinsic structure of the constraint, the proposed approach connects convex analysis with practical neural network sparsification, enabling scalable structured regularization in modern deep learning models.
References
J. M. Alvarez and M. Salzmann. Learning the number of neurons in deep networks. In Advances in Neural Information Processing Systems, pages 2270–2278, 2016.
B. Bejar, I. Dokmanić, and R. Vidal. The fastest prox in the West. IEEE transactions on pattern analysis and machine intelligence, 44(7): 3858–3869, 2021.
B. Colson, P. Marcotte, and G. Savard. An overview of bilevel optimization. Annals of Operations Research, 153(1):235–256, 2007.
P. L. Combettes and J.-C. Pesquet. Proximal splitting methods in signal processing. In Fixed-point algorithms for inverse problems in science and engineering, pages 185–212. Springer, 2011.
L. Condat. Fast projection onto the simplex and the l1 ball. Mathematical Programming Series A, 158(1):575–585, 2016.
J. Duchi, S. Shalev-Shwartz, Y. Singer, and T. Chandra. Efficient projections onto the l 1-ball for learning in high dimensions. In Proceedings of the 25th international conference on Machine learning, pages 272–279. ACM, 2008.
A. Goldberger, L. Amaral, L. Glass, P. Ivanov, and R. Mark. Physiobank, physiotoolkit, and physionet: Components of a new research resource for complex physiologic signals. RRID:SCR, 2000.
S. Han, J. Pool, J. Tran, and W. Dally. Learning both weights and connections for efficient neural network. In Advances in neural information processing systems, pages 1135–1143, 2015.
P. C. Hansen and D. P. O'Leary. The use of the l-curve in the regularization of discrete ill-posed problems. SIAM Journal on Scientific Computing, 14, 1993.
T. Hastie, R. Tibshirani, and M. Wainwright. Statistical learning with sparsity: The lasso and generalizations. CRC Press, 2015.
D. Kingma and J. Ba. a method for stochastic optimization. International Conference on Learning Representations, pages 1–13, 2015.
J. Liu, H. Sun, and J. Katto. Learned image compression with mixed transformer-cnn architectures. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 14388–14397, June 2023. doi: 10.1109/CVPR52729.2023.01383.
H. Ma, X. Shi, H. Sun, X. Yue, X. Liu, G. Wang, and W. Cai. Learned image compression via sparse attention and adaptive frequency. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 41278–41287, June 2026.
J. J. Moreau. Fonctions convexes duales et points proximaux dans un espace hilbertien. Comptes Rendus de l'Académie des Sciences de Paris, A255 (22):2897–2899, Nov 1962.
G. Nakkiran, G. Gal Kaplun, Y. Bansal, and T. Yang. Deep double descent: Where bigger models and more data plurt. arXiv stat.ML, 2020.
G. Perez, L. Condat, and M. Barlaud. Near-linear time projection onto the l1,infty ball application to sparse autoencoders. IEEE International Conference on Tools with Artificial Intelligence Washington USA, 2024.
A. Quattoni, X. Carreras, M. Collins, and T. Darrell. An efficient projection for regularization. In Proceedings of the 26th International Conference on Machine Learning, pages 857–864, 2009.
V. Sanh, T. Wolf, and A. Rush. Movement pruning: Adaptive sparsity by fine-tuning. In H. Larochelle, M. Ranzato, R. Hadsell, M. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 20378–20389. Curran Associates, Inc., 2020.
R. Tibshirani. Regression shrinkage and selection via the lasso. Journal of the Royal Statistical Society. Series B (Methodological), pages 267–288, 1996.
A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, L. Kaiser, and I. Polosukhin. Attention is all you need. Advances in Neural Information Processing Systems, 2017.
W. Wen, C. Wu, Y. Wang, Y. Chen, and H. Li. Learning structured sparsity in deep neural networks. In Advances in Neural Information Processing Systems 29, pages 2074–2082, 2016.
M. Zaheer, G. Guruganesh, A. Dubey, J. Ainslie, C. Alberti, S. Ontanon, P. Pham, A. Ravula, Q. Wang, L. Yang, and A. Ahmed. Big bird: transformers for longer sequences. In Proceedings of the 34th International Conference on Neural Information Processing Systems, NIPS '20. Curran Associates Inc., 2020.
Y. Zhang, Y. Yao, P. Ram, P. Zhao, T. Chen, M. Hong, Y. Wang, and S. Liu. Advancing model pruning via bi-level optimization. Advances in Neural Information Processing Systems, 2022.
Y. Zhang, P. Khanduri, I. Tsaknakis, Y. Yao, M. Hong, and S. Liu. An introduction to bilevel optimization: Foundations and applications in signal processing and machine learning. IEEE Signal Processing Magazine, 41 (1):38–59, 2024.
H. Zhou, J. Lan, R. Liu, and J. Yosinski. Deconstructing lottery tickets: Zeros, signs, and the supermask. Advances in Neural Information Processing Systems 32, pages 3597–3607, 2019.
A Proximal algorithm
Recall the proximal projection algorithm:
Algorithm 3 Proximal Projection
1: 2: 3: 4: 5: while changed do 6: for do 7: if then 8: 9: continue 10: end if 11: 12: 13: end for 14: 15: end while 16: 17:
B Relationship between Euclidean Projection and Two-Stage Clipping
Proof. Let
Since is the Euclidean projection of onto the closed convex set , its variational characterization gives
Taking yields
Using
we obtain
which proves equation 25.
C Attention sparsity-reconstruction trade-off (ASRT) evaluation framework
Table 2: Transformer architecture shared by the Kodak-to-Kodak and Flickr-to-Kodak experiments.
| Architecture parameter | Value |
|---|---|
| Input image channels | 3 (RGB) |
| Training image size | |
| Patch size | |
| Number of tokens | 256 |
| Embedding dimension | 256 |
| Number of Transformer layers | 4 |
| Number of attention heads | 8 |
| Dimension per attention head | 32 |
| Attention matrix size (per head) | |
| Feed-forward hidden dimension | 1024 |
| Feed-forward activation | GELU |
| Normalization | LayerNorm (Pre-LN) |
| Residual connections | Yes |
| Latent dimension | 64 |
| Encoder | Patch embedding (Conv2D) |
| Decoder | Transposed convolution (ConvTranspose2D) |
| Latent quantization step |

Figure 7: Vertical architecture of the attention sparsity-reconstruction trade-off (ASRT) evaluation framework. Attention sparsification is performed using TSC or structured pruning within the Transformer encoder. Reconstruction quality is evaluated on the Kodak dataset using PSNR and SSIM relative to the dense baseline. No entropy coding is considered.