Theory / Mathematical model

Control theory

The mathematics behind sparse internal control.

Near the unpatched model, a frozen Transformer acts as a linear map from intervention strengths to behavior. Choosing drivers becomes a controllability question: can a few columns reach the requested displacement, and at what energy?

01 / Model

A frozen network.
A few handles.

An intervention adds scaled directions to a handful of internal activations during the forward pass. The parameters \(\theta\) never change, and \(\beta = 0\) recovers the original model exactly.

01 / Specify

The behavior

Choose a scalar readout \(b\), a target \(\tau_i\) for each target prompt \(x_i\), and a panel of off-target prompts \(\tilde x_j\) whose outputs must not move.

\(q_i = \tau_i - b_\theta(x_i)\)

02 / Actuate

The drivers

A candidate \(v = (s_v, u_v, c_v)\) pairs a site with a direction and a cost. Candidates with a nonzero strength form the driver set \(S_\beta = \operatorname{supp}(\beta)\).

\(h_s(x) \leftarrow h_s(x) + \textstyle\sum_{v:\, s_v = s} \beta_v\, u_v(x)\)

03 / Certify

The control

An intervention counts as control only when target error, off-target change and energy all pass in the full nonlinear model.

\(\mathrm{Rel}_{\mathrm{tar}}(\beta) \le \varepsilon,\ \ L_{\mathrm{off}}(\beta) \le \delta,\ \ E(\beta) \le \kappa\)
\(F(\beta)\)

The readout change on the target prompts, \(b(f_\theta^{\beta}, x_i) - b(f_\theta, x_i)\).

\(\mathrm{Rel}_{\mathrm{tar}} = \frac{\|q - F(\beta)\|_2}{\|q\|_2 + \xi}\)

Relative target error, the share of the requested displacement left unmet.

\(L_{\mathrm{off}} = \overline{\mathrm{KL}}\big(p_\theta \,\|\, p_\theta^{\beta}\big)\)

Mean divergence of the output distribution on the off-target panel.

\(E(\beta) = \beta^{\top} W \beta\)

Intervention energy, how hard the selected sites are pushed.

02 / Objective

One sparse program.

Pick the fewest, cheapest drivers whose intervention passes the certificate, with energy as a tie breaker.

The sparse internal control problem
\[\min_{\beta \in \mathbb{R}^{M}}\ \|\beta\|_{0,c} + \lambda_E\, E(\beta) \quad \text{subject to}\quad \beta \text{ is an } (\varepsilon, \delta, \kappa) \text{ certificate}\]
\[\begin{aligned}&\min_{\beta \in \mathbb{R}^{M}}\ \|\beta\|_{0,c} + \lambda_E\, E(\beta)\\ &\text{s.t. } \beta \text{ is an } (\varepsilon, \delta, \kappa) \text{ certificate}\end{aligned}\]
\(\|\beta\|_{0,c} = \sum_{v \in S_\beta} c_v\)

Weighted sparsity

Counts the selected sites, each at its own cost, so a residual stream position and an attention head need not be priced alike.

\(E(\beta) = \beta^{\top} W \beta\)

Energy

A quadratic budget on the strengths. It keeps the intervention near the unpatched model, where the local analysis is valid.

\((\varepsilon,\ \delta,\ \kappa)\)

Certificate

Three tolerances checked together in the nonlinear model. A proposal that misses any one of them is rejected.

03 / Local controllability

Can the drivers
reach the target?

At first order the target moves by \(\bar G_S \beta_S\). Reaching \(\bar q\) needs two things: \(\bar q\) must lie in the span of the selected columns, and the cheapest exact fit must cost no more than \(\kappa\).

Two target prompts with scalar readouts, so \(\bar q\) lives in a plane. Each candidate contributes one column of \(\bar G\), its first order effect on both prompts. Energy uses \(W = I\).

Support S

κ = 4.00
\(\operatorname{rank} \bar G_S\)
2
\(\bar q \in \operatorname{range}(\bar G_S)\)
yes
\(E_{\min}(S)\)
—
\(\chi_\kappa(S)\)
—

The reachable set \(\{\bar G_S\beta : \beta^{\top}\beta \le \kappa\}\) is an ellipse centred on the unpatched model. The lime point is the energy constrained best fit; the dashed segment is the residual that \(\chi_\kappa(S)\) normalizes.

04 / Results

Six results.

From the effect dictionary to the selectors: what the local analysis guarantees, and where the nonlinear model takes over.

Proofs, assumptions and constants are in Appendix B.

Read the appendix

05 / Selectors

Two selectors.
One pipeline.

Driver-OMP

Fits the requested displacement by sparse residual fitting: add the candidate best aligned with what is still missing, refit, repeat. In its simplest setting it reduces to orthogonal matching pursuit.

\(v_k = \arg\max_{v \notin S} \dfrac{|\langle g_v,\ \bar q - \bar G_S\beta_S \rangle|}{\|g_v\|_2}\)

Coverage-Driver

Adds candidates by saturated coverage across prompts, so the support keeps working when the prompt changes. Greedy selection carries the \(1 - 1/e\) guarantee.

\(S \leftarrow S \cup \{\arg\max_{v} C(S \cup \{v\}) - C(S)\}\)
Local proposalA selector proposes a support from the linear dictionary.
Shared refitStrengths are refit under the energy budget, Proposition 1.
Nonlinear validationThe \((\varepsilon, \delta, \kappa)\) certificate is checked in the full model.

Local results propose.
The certificate decides.