[Paper Review] What's the Magic Word? A Control Theory of LLM Prompting
The paper formalizes LLM prompting as a discrete stochastic control problem, proving an upper bound on the reachable outputs from self-attention and empirically showing substantial prompt-length dependent controllability across Falcon-7b, Falcon-40b, and Llama-7b. Short prompts can dramatically steer outputs, including making unlikely tokens most likely.
Prompt engineering is crucial for deploying LLMs but is poorly understood mathematically. We formalize LLM systems as a class of discrete stochastic dynamical systems to explore prompt engineering through the lens of control theory. We offer a mathematical analysis of the limitations on the controllability of self-attention as a function of the singular values of the parameter matrices. We present complementary empirical results on the controllability of a panel of LLMs, including Falcon-7b, Llama-7b, and Falcon-40b. Given initial state $\mathbf x_0$ from Wikitext and prompts of length $k \leq 10$ tokens, we find that the "correct" next token is reachable at least 97% of the time, and that the top 75 most likely next tokens are reachable at least 85% of the time. Intriguingly, short prompt sequences can dramatically alter the likelihood of specific outputs, even making the least likely tokens become the most likely ones. This control-theoretic analysis of LLMs demonstrates the significant and poorly understood role of input sequences in steering output probabilities, offering a foundational perspective for enhancing language model system capabilities.
Motivation & Objective
- Motivate prompt engineering as a controllability problem in LLMs.
- Formally define LLMs as control systems with inputs (prompts) and states (token sequences).
- Derive analytic bounds on the reachable output set for self-attention.
- Empirically assess controllability across models using short prompts and Wikitext-derived states.
Proposed method
- Define LLMs as autoregressive systems with control inputs and a readout mapping (Definition 1–3).
- Derive a bound on the reachable output set for self-attention in terms of the singular values of Wq and Wk (Theorem 1, Equations 5–7).
- Use k-short prompt optimization (greedy back-generation and greedy coordinate gradient) to find prompts that steer outputs (Section 5.1).
- Empirically measure k-ε controllability on datasets with x0 from Wikitext and y from model outputs across Falcon-7b, Falcon-40b, and Llama-7b (Section 5.2).
- Assess reachability for ground-truth next tokens and top-75 Likely outputs (Figure 1).

Experimental results
Research questions
- RQ1Is the next-token output reachable from a given state with a short prompt under k-token input constraints?
- RQ2How does self-attention bound the reachable output set, and how do singular values of weight matrices influence controllability?
- RQ3What is the empirical extent of controllability across different LLMs for ground-truth and high-likelihood outputs?
- RQ4Does short prompting allow steering from low-likelihood to high-likelihood tokens within k tokens?
- RQ5How does controllability vary with prompt length and model scale?
Key findings
- The correct next Wikitext token following x0 is reachable over 97% of the time with prompts of k ≤ 10 tokens.
- The top 75 most likely next tokens are reachable at least 85% of the time with prompts of k ≤ 10 tokens.
- Short prompts can make least likely tokens become most likely ones within k ≤ 4 prompts.
- For ground-truth Wikitext targets, reachability is demonstrated across Falcon-7b, Falcon-40b, and Llama-7b.
- Results indicate a nontrivial role for input sequences in steering output probabilities beyond prior likelihoods.
- There is a log-linear relationship between prompt length k and controllability fraction ε in the studied regime.

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.