Papers
Topics
Authors
Recent
Search
2000 character limit reached

Bayesian LoRA via Mean-Field VI

Updated 10 February 2026
  • The paper's main contribution is introducing a Bayesian framework that applies mean-field variational inference to Low-Rank Adaptation (LoRA) for uncertainty-aware fine-tuning.
  • It employs a low-rank plus diagonal covariance structure with SWAG-inspired updates to achieve efficient calibration and reduced computational overhead.
  • Experimental results on GLUE tasks demonstrate that the method delivers strong predictive performance with energy savings while robustly quantifying uncertainty.

Bayesian LoRA by Mean-Field Variational Inference is an approach that unifies parameter-efficient fine-tuning and uncertainty quantification in LLMs by applying Bayesian principles to Low-Rank Adaptation (LoRA) using mean-field variational inference (VI). This methodology emphasizes low-dimensional parameterization and storage efficiency, enabling strong predictive performance, calibration, and energy savings in downstream adaptation scenarios.

1. Probabilistic Model Formulation

The foundation of Bayesian LoRA is the adaptation of a frozen pre-trained weight matrix W0∈Rm×nW^0 \in \mathbb{R}^{m\times n} through a low-rank update: ΔW=ARB,\Delta W = A R B, where A∈Rm×rA \in \mathbb{R}^{m \times r} and B∈Rr×nB \in \mathbb{R}^{r \times n} are fixed projection matrices constructed from a truncated SVD of W0W^0: W0≈UrSrVr⊤W^0 \approx U_r S_r V_r^\top with A=UrSrA = U_r S_r and B=Vr⊤B = V_r^\top. The core trainable (and stochastic) component is the small inner matrix R∈Rr×rR \in \mathbb{R}^{r \times r} for each LoRA module.

The parameters of interest θ\theta are defined as the vectorization of all ΔW=ARB,\Delta W = A R B,0 matrices: ΔW=ARB,\Delta W = A R B,1 A zero-mean isotropic Gaussian prior is imposed: ΔW=ARB,\Delta W = A R B,2 The likelihood over data ΔW=ARB,\Delta W = A R B,3 is given by the standard model output, e.g., softmax loss for classification tasks: ΔW=ARB,\Delta W = A R B,4 where ΔW=ARB,\Delta W = A R B,5 denotes the network with weight ΔW=ARB,\Delta W = A R B,6 at each layer. The stochasticity in the weight matrix resides strictly in ΔW=ARB,\Delta W = A R B,7, confining all learning and uncertainty modeling to a small low-dimensional subspace (Marszałek et al., 17 Feb 2025).

2. Variational Family and Posterior Structure

Mean-field VI is employed to approximate the intractable posterior ΔW=ARB,\Delta W = A R B,8. In the B-LoRA-XS framework, the variational distribution ΔW=ARB,\Delta W = A R B,9 is taken as a Gaussian with a low-rank plus diagonal covariance structure: A∈Rm×rA \in \mathbb{R}^{m \times r}0 with A∈Rm×rA \in \mathbb{R}^{m \times r}1 (A∈Rm×rA \in \mathbb{R}^{m \times r}2) capturing a low-dimensional subspace of correlations and A∈Rm×rA \in \mathbb{R}^{m \times r}3 providing per-parameter variance. Unlike standard mean-field where all correlations are ignored, this construction retains aggregate global dependencies in a rank-A∈Rm×rA \in \mathbb{R}^{m \times r}4 subspace while maintaining linear storage cost in A∈Rm×rA \in \mathbb{R}^{m \times r}5.

The mean A∈Rm×rA \in \mathbb{R}^{m \times r}6 is tracked as a running average of A∈Rm×rA \in \mathbb{R}^{m \times r}7 during post–burn-in epochs, and A∈Rm×rA \in \mathbb{R}^{m \times r}8 is constructed from the latest A∈Rm×rA \in \mathbb{R}^{m \times r}9 deviation vectors (denoted B∈Rr×nB \in \mathbb{R}^{r \times n}0 with B∈Rr×nB \in \mathbb{R}^{r \times n}1), following the SWAG moment-matching prescription. Per-parameter variance B∈Rr×nB \in \mathbb{R}^{r \times n}2 is estimated in parallel (Marszałek et al., 17 Feb 2025).

This approach can be conceptually reconciled with a mean-field variational family whose marginal posterior for each B∈Rr×nB \in \mathbb{R}^{r \times n}3 parameter is (up to low-rank cross-covariances) an independent Gaussian, while cross-layer correlations are captured in B∈Rr×nB \in \mathbb{R}^{r \times n}4.

3. ELBO Objective and Low-Dimensional Projections

Although the empirical procedure in B-LoRA-XS utilizes SWAG, the underlying optimization closely corresponds to implicit maximization of the evidence lower bound (ELBO): B∈Rr×nB \in \mathbb{R}^{r \times n}5 In practice, no explicit backpropagation is performed through the KL; instead, the second moments are tracked in SWAG fashion. The fixed SVD projection (B∈Rr×nB \in \mathbb{R}^{r \times n}6, B∈Rr×nB \in \mathbb{R}^{r \times n}7) ensures that all Bayesian inference occurs in the subspace spanned by B∈Rr×nB \in \mathbb{R}^{r \times n}8, and the posterior covariance is constrained to be low rank plus diagonal at scale, minimizing parameter and computational overhead.

The low-rank structure appears both in the weight update and in the construction of B∈Rr×nB \in \mathbb{R}^{r \times n}9. These two factors—explicit subspace parameterization of W0W^00 and low intrinsic dimensionality of posterior uncertainty—enable the approach to outperform or match alternatives at a fraction of the memory and compute footprint (Marszałek et al., 17 Feb 2025).

4. Training Algorithm and Gradient Estimation

The training protocol, as aligned with mean-field VI, supports unbiased gradient estimation for W0W^01's parameters via the reparameterization trick: W0W^02 Gradients with respect to W0W^03 are in principle estimated by: W0W^04 However, in B-LoRA-XS, SGD is used to update W0W^05 directly, and after a burn-in period, low-rank covariances for posterior approximation are accumulated according to SWAG: second moments are constructed from the empirical deviations as model parameters traverse the solution landscape with a fixed learning rate. These statistics define the variational distribution used for Bayesian predictive inference (Marszałek et al., 17 Feb 2025).

A high-level algorithmic loop is as follows:

A=UrSrA = U_r S_r9

5. Covariance Structure and Parameter Efficiency

For a concatenated W0W^06 vector of dimension W0W^07, a dense covariance would cost W0W^08 in storage. B-LoRA-XS' low-rank plus diagonal approach requires only W0W^09 parameters (W0≈UrSrVr⊤W^0 \approx U_r S_r V_r^\top0), achieving linear scaling. The induced covariance of the actual weight update, with W0≈UrSrVr⊤W^0 \approx U_r S_r V_r^\top1, is

W0≈UrSrVr⊤W^0 \approx U_r S_r V_r^\top2

where W0≈UrSrVr⊤W^0 \approx U_r S_r V_r^\top3 is the covariance in W0≈UrSrVr⊤W^0 \approx U_r S_r V_r^\top4–space. Given W0≈UrSrVr⊤W^0 \approx U_r S_r V_r^\top5 is W0≈UrSrVr⊤W^0 \approx U_r S_r V_r^\top6 and W0≈UrSrVr⊤W^0 \approx U_r S_r V_r^\top7 is rank W0≈UrSrVr⊤W^0 \approx U_r S_r V_r^\top8, W0≈UrSrVr⊤W^0 \approx U_r S_r V_r^\top9's covariance is low rank with at most A=UrSrA = U_r S_r0 nonvanishing directions. This property ensures not only memory efficiency but also that almost all uncertainty mass is confined to a tractable, easily sampled region of parameter space (Marszałek et al., 17 Feb 2025).

6. Practical Settings, Empirical Results, and Comparative Context

Empirical validation in (Marszałek et al., 17 Feb 2025) is conducted on four GLUE tasks (RTE, MRPC, CoLA, SST-2) using RoBERTa-large as the backbone, with B-LoRA-XS adapters injected into all major transformer projection submodules (Query, Value, Attention-Output, Output-FC). Typical parameter settings include adaptation ranks A=UrSrA = U_r S_r1, covariance rank A=UrSrA = U_r S_r2, AdamW optimization, 10–25 burn-in epochs, and inference via A=UrSrA = U_r S_r3 posterior samples.

Key observed outcomes:

  • B-LoRA-XS matches or exceeds SWAG-LoRA on calibration (ECE) and NLL, with 5–15× fewer Bayesian parameters.
  • The SVD-based low-rank projection effectively disentangles adapted directions, enabling strong uncertainty quantification with A=UrSrA = U_r S_r4 as low as 2–5.
  • Training is more stable and less sensitive to random seed than SWAG-LoRA.

A related approach, Bayesian-LoRA (Meo et al., 2024), incorporates mean-field VI for both rank and quantization selection via discrete Bayesian gates with Gumbel-sigmoid relaxations, thereby offering flexible per-layer adaptation and further reducing bit-operations required. However, in contrast to B-LoRA-XS, (Meo et al., 2024) does not focus on uncertainty quantification metrics such as ECE or NLL, but rather on adaptive rank/quantization and compute efficiency.

7. Extensions to Quantization and Rank Adaptation

The Bayesian-LoRA framework (Meo et al., 2024) extends mean-field VI in LoRA to include not only Gaussian uncertainty over continuous low-rank factors but also discrete latent variables governing quantization levels and effective ranks. This is achieved by:

  • Factorizing the variational posterior over low-rank matrices (A=UrSrA = U_r S_r5, A=UrSrA = U_r S_r6), quantization gates (A=UrSrA = U_r S_r7), and rank-selection gates (A=UrSrA = U_r S_r8).
  • Employing continuous relaxations (straight-through Gumbel-sigmoid) for the Bernoulli gates, enabling end-to-end training with reparameterized gradients.
  • Penalizing KL divergence of quantization/rank gates in the objective, balancing compression and accuracy.

Empirical results in (Meo et al., 2024) show that Bayesian-LoRA achieves competitive or superior task performance to baseline LoRA variants at markedly lower memory and operation counts, with learned adaptations tailored per layer and module. A plausible implication is that the Bayesian VI perspective enables simultaneous adaptation, selective precision allocation, and energy-aware deployment in large-scale LLM fine-tuning.


For technical readers seeking full Bayesian fine-tuning recipes, the B-LoRA-XS framework rigorously specifies the probabilistic model, variational approximation, training regimen, and inference algorithm, realizing both uncertainty quantification and efficiency through judicious low-dimensional projection and mean-field modeling (Marszałek et al., 17 Feb 2025).

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Bayesian LoRA by Mean-Field VI.