[Paper Review] A Constrained Optimization Perspective of Unrolled Transformers
The paper introduces a constrained learning framework that enforces layerwise descent in unrolled transformers using a primal–dual training scheme, improving robustness and OOD generalization without sacrificing ID performance.
We introduce a constrained optimization framework for training transformers that behave like optimization descent algorithms. Specifically, we enforce layerwise descent constraints on the objective function and replace standard empirical risk minimization (ERM) with a primal-dual training scheme. This approach yields models whose intermediate representations decrease the loss monotonically in expectation across layers. We apply our method to both unrolled transformer architectures and conventional pretrained transformers on tasks of video denoising and text classification. Across these settings, we observe constrained transformers achieve stronger robustness to perturbations and maintain higher out-of-distribution generalization, while preserving in-distribution performance.
Motivation & Objective
- Motivate training transformers to behave like descent algorithms by enforcing layerwise loss reduction.
- Develop a primal–dual optimization algorithm to train constrained unrolled transformers.
- Provide theoretical guarantees for convergence and OOD generalization under distribution shifts.
- Demonstrate robustness improvements on video denoising and text classification with perturbed inputs.
Proposed method
- Formulate a constrained learning problem where each transformer layer must reduce the expected loss by a factor (descent constraint).
- Transform the constrained problem into a dual (Lagrangian) formulation and solve via a primal–dual alternating algorithm (Algorithm 1).
- Prove that the dual problem yields near-optimal, near-feasible solutions with a small duality gap in practice; show asymptotic convergence across layers.
- Provide descent-constraints resilience by relaxing feasibility with slack variables when needed.
- Apply the approach to unrolled transformers in video denoising and to pretrained transformers for text classification with perturbed embeddings.
- Discuss out-of-distribution guarantees and robustness under perturbations.

Experimental results
Research questions
- RQ1Can layerwise descent constraints be enforced in transformer training to mimic optimization descent behavior?
- RQ2Do primal–dual constrained training methods yield monotone layerwise loss decrease and improve robustness to perturbations?
- RQ3Do constrained unrolled transformers maintain or improve ID performance while enhancing OOD generalization?
- RQ4What theoretical guarantees exist for convergence and OOD performance under distribution shifts?
- RQ5How do constrained transformers perform on video denoising and text classification with perturbed inputs?
Key findings
- Constrained transformers exhibit monotone layerwise descent, unlike unconstrained baselines.
- Descent constraints improve robustness to input perturbations and enhance OOD generalization with little to no loss in ID performance.
- Depth increases OOD robustness under the constrained training regime, with constrained models often outperforming unconstrained ones as layers grow.
- Empirical results across video denoising (CUHK Avenue, UCSD, ShanghaiTech) and text classification (IMDb, MNLI) show constrained models often reduce RMSE and maintain accuracy under perturbations.
- The approach yields theoretical guarantees: convergence to near-optimal statistical loss and preserved descent properties under distribution shifts (with quantifiable error bounds).
- The method scales to large models (e.g., Llama 8B) with maintained layerwise descent and improved robustness, while not sacrificing ID tasks.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.