Asking a language model to paraphrase a sentence so that it follows a specific grammatical template still works only most of the time. The best parameter-efficient method on the standard benchmark, PIP, matches the requested template on 86.20% of ParaNMT outputs, so roughly one output in seven breaks the requested structure. Two older ideas suggest a better approach. First, work on syntactic probing found that large models store dependency trees in a small linear subspace of their hidden states, about 128 of 4,096 dimensions (Polar Probe). Second, wireless engineers have long exploited a similar fact: the best beam for a set of users lies in the span of those users' channel vectors, so any energy spent outside that span is wasted.
We propose to treat syntactic control the way a base station treats beamforming. At decoding time, the model's intermediate activations are nudged only inside the syntax subspace. Each arc of the target tree gets a "price", a Lagrange multiplier, that rises whenever the generated sentence violates that arc. Prices are updated by an augmented Lagrangian loop, meaning prices plus a moderate quadratic penalty. A discrete dynamic program aligns the template to the generated tokens, and the loop is split so that this dynamic program stays exact. The bet is that confining the nudge to the syntax subspace buys template compliance at a lower cost in meaning than either unconstrained steering or hard token masking.
Core Claim
Syntactic compliance and meaning preservation compete for the same hidden state, much as communication and radar objectives compete for one beamformer in integrated sensing-and-communication design. We claim three things.
First, the component of an activation edit that is orthogonal to the probe's syntax subspace mostly changes meaning, not structure. Restricting edits to that subspace is therefore the analogue of the span theorem for multicast beamformers in Multi-group Multicast Beamforming.
Second, adapting prices per arc will reach higher template compliance than any fixed penalty weight at equal meaning preservation. The reason is that soft syntactic weights get overridden by strong statistical preferences, the failure mode of soft syntactic constraints and of PIP's auxiliary loss.
Third, a specific splitting of the augmented Lagrangian keeps the tree-alignment subproblem solvable by exact dynamic programming. This addresses the tension noted in Dual Decomposition for NLP: the quadratic stabilizer normally destroys that separability.
What is new is enforcing a rigid template through a continuous geometric constraint, with explicit dual variables. The Polar Probe only reads syntax out of the model and never uses it to control generation. Rush and Collins enforce syntax with Lagrange multipliers, but only over discrete hypergraphs and n-gram lattices, with no continuous state. PIP shapes prefix vectors with an unconstrained loss and keeps no multipliers.
Research Program
Building the syntax subspace. We fit a Polar Probe on English Web Treebank dependencies for each model we steer. We use a middle decoder layer, following the probe paper's finding that syntax peaks around layer 16 of a 32-layer model. The probe yields a basis $U$ of dimension about 128. In that space, distance between two word vectors tracks tree distance, and the angle between them encodes the relation type.
Target templates in ParaNMT are constituency skeletons. We convert each skeleton to a partial dependency skeleton with standard head rules. Constraints then apply only to arcs that the skeleton determines.
The per-input problem. Let $x$ be the source sentence, $T$ the target template, and $\delta$ an additive edit to the chosen layer's activations, restricted to $\delta = U a$ with $a \in \mathbb{R}^{128}$. Let $z$ be a discrete alignment of template nodes to generated tokens. Let $c(\delta)$ be the vector of probe-read distance and angle features, and $A z$ the features the aligned template demands. We solve
$$\min_{a,\,z}\; -\log p(y_\delta \mid x) + \mu\|a\|^2 \quad \text{s.t.}\quad c(\delta) - A z = 0,$$
where $y_\delta$ is the greedy output under the edit and $\mu$ caps edit size. The edit-size cap plays the role of a power budget.
The splitting. The augmented Lagrangian for this problem is
$$\mathcal{L}_\rho = -\log p(y_\delta\mid x) + \mu\|a\|^2 + \lambda^\top\big(c(\delta)-Az\big) + \tfrac{\rho}{2}\|c(\delta)-Az\|^2,$$
with $\lambda$ the per-arc prices and $\rho$ the penalty strength. We alternate three steps:
- Continuous step. A few gradient steps on $a$ with $z$ fixed, where the quadratic term stabilizes the non-convex landscape.
- Discrete step. Update $z$ with the quadratic term linearized at the current alignment. This turns every term into a linear cost per alignment edge, so a CKY-style dynamic program over the template finds the exact minimizer.
- Price update. Set $\lambda \leftarrow \lambda + \rho\,(c - Az)$.
Borrowing from the adaptive balanced ALM for ISAC beamforming, we rescale $\rho$ whenever syntax violations stop shrinking or the meaning term's gradient is being swamped.
The loop stops when an external parser confirms the output matches the template, or after a fixed iteration budget. If the budget runs out and some arcs carry large, still-rising prices, we report that the template is likely incompatible with this sentence. The prices themselves are a diagnostic. Each one measures how much likelihood the model must give up to honor that arc. That gives an empirical handle on the rigid-versus-soft debate in machine translation raised by Gildea and Chiang. We do not claim global optimality certificates, because the continuous side is non-convex.
Analysis. We decompose unconstrained steering edits into the in-subspace part and the orthogonal part. For each part we measure the change in probe-read syntax and the change in semantic similarity to the source. This directly tests the span-theorem analogy.
Baselines
Naive reference. The unmodified model is prompted, or conditioned, with the target template and decoded by beam search. This shows how much compliance comes for free.
PIP-Indirect. This is the strongest reported parameter-efficient method: prefix tuning with a parse-encoding loss on BART-base (PIP). It reports TMA (template matching accuracy) 86.20 and BLEU 50.82 on ParaNMT.
Full fine-tuning. Full BART-base fine-tuning reaches TMA 89.94 and BLEU 57.17 in the same paper. That is the practical upper reference.
Fair setting for the main comparison. Our main comparison runs on BART-base, with the Polar Probe refit on its decoder. We use the same ParaNMT splits, templates, and template-matching code, and we re-run PIP to confirm the reported numbers. Beating PIP means higher TMA at equal or higher BLEU. Reaching full fine-tuning's 89.94 TMA with zero trained generator parameters would be a strong result.
Because our method spends extra computation at inference, we report wall-clock time per sentence. We also give PIP an equal inference budget through best-of-k sampling with parser reranking.
Ablations. Three ablations isolate the key ingredients:
- The same augmented Lagrangian loop with edits in the full hidden space, which tests whether the subspace restriction matters.
- Subspace edits with a fixed penalty weight, swept over a grid with the same tuning budget, which tests whether adaptive prices matter.
- Pure Lagrangian updates without the quadratic term, which tests whether the stabilizer and the linearized-DP split matter.
A 7B replication on Llama-2-7b uses the probe paper's own model. Its baselines are run on the same model: template prompting, and a PIP-style prefix trained with an equal budget.
Why not just…?
Why not just mask tokens with a grammar-constrained decoder, which guarantees compliance? This is the most serious alternative. For templates expressible as incremental constraints, masking can push compliance near 100%. The open question is whether it does so without wrecking fluency and meaning. Rigid filters in machine translation produced degraded or even empty outputs when the grammar and the data disagreed (Blunsom et al.). We will implement masking with an incremental parser and compare the two methods at matched TMA, on BLEU and human meaning ratings. If masking matches our method at equal compliance, the subspace-steering claim fails, and the contribution shrinks to using prices as a diagnostic.
Why not just use a fixed syntax penalty? The fixed-penalty ablation answers this directly. Direction-level evidence points against it: static penalties need very large weights for exact satisfaction, and PIP's unconstrained auxiliary loss plateaued at 86.20 TMA.
Why not just sample many paraphrases and keep one that parses correctly? Reranking is cheap and strong when the template is plausible under the model. It fails on rare templates, where no sample complies. We will stratify results by template frequency, and we expect our advantage to concentrate in the rare tail. If reranking matches us there as well, we will report that.
Why not just steer in the full hidden space? The full-space ablation settles this. The prediction is that full-space edits achieve similar compliance with larger semantic drift, as measured in the orthogonal-component analysis.
Proposed Experiments
Main experiment. On ParaNMT we report TMA, TED-3 (tree edit distance), BLEU and ROUGE, and runtime. Quora, MRPC and PAN test transfer without retuning.
Decisive checks. Three results would settle the core claims:
- Orthogonal edit components should move semantic similarity substantially more than they move probe-read syntax.
- Adaptive pricing should dominate the fixed-penalty Pareto curve of compliance against BLEU.
- The linearized-DP split should converge on more sentences than pure Lagrangian updates, which Collins and Rush found often oscillate when constraints conflict with the data.
Secondary test. We apply the method to generating SCPN-style adversarial paraphrases on the Stanford Sentiment Treebank, where SCPN reports a 41.8% prediction-flip rate. Higher template compliance should raise the flip rate at matched human-judged validity.
Known risk. The probe's labeled attachment score on Llama-2 is only 62.9 on EWT. That caps how faithfully the continuous constraint can track real syntax. Our success criterion therefore always uses an external parser on the final text, never the probe's own readout.
References
- PIP: Parse-Instructed Prefix for Syntactically Controlled Paraphrase Generation
- A Polar coordinate system represents syntax in large language models
- Multi-Group Multicast Beamforming: Optimal Structure and Efficient Algorithms
- Soft Syntactic Constraints for Hierarchical Phrased-Based Translation
- Dual Decomposition for Natural Language Processing
- Exact Decoding of Syntactic Translation Models through Lagrangian Relaxation
- A New Adaptive Balanced Augmented Lagrangian Method with Application to ISAC Beamforming Design
- Loosely Tree-Based Alignment for Machine Translation
- Learning to Translate with Source and Target Syntax
- Probabilistic Inference for Machine Translation
- Adversarial Example Generation with Syntactically Controlled Paraphrase Networks