TL;DR
Analyzing the decision boundaries of Large Language Models (LLMs) has long been considered computationally impossible due to the astronomical combinatorial space of generated sequences ($V^{N_r}$). This paper introduces the Decision Potential Surface (DPS) and an efficient sampling-based algorithm, $K$-DPS, which provably approximates LLM decision boundaries with theoretical convergence guarantees using only a small, finite number of generated samples.
What Problem Does This Paper Address?
In traditional machine learning, decision boundaries—the submanifolds where a model is equally torn between two predictions—offer deep insights into robustness, generalization, and failure modes. However, applying this concept to generative LLMs faces an exponential wall:
- A standard model generating a sequence of length $N_r$ from vocabulary $V$ operates over an output space of $V^{N_r}$ potential classes (e.g., Qwen-3 has $\approx 10^{169,790}$ possible decision regions).
- Directly identifying points with equal top sequence probabilities requires evaluating $\approx (V^{N_r})^2 / 2$ pairwise comparisons per prompt, making boundary construction intractable.
Prior literature sidestepped this by either reducing tasks to toy binary classifications or invoking the term "decision boundary" purely as a loose metaphor. This paper establishes a mathematically rigorous, computationally tractable way to construct and visualize LLM decision boundaries.
Methods
The authors reframe autoregressive generation as composite multi-class classification and introduce:
-
Decision Potential Function (DPF) & Surface (DPS): For a given prompt $x$, the DPF $\Phi_f^\infty(x)$ measures the squared difference between the log-likelihoods of the top-two sequences: $$\Phi_f^\infty(x) = \left(\log P_f(y_{1^*}|x) - \log P_f(y_{2^*}|x)\right)^2$$ The authors prove that the zero-height contour (0-isohypse) of this surface corresponds exactly to the true sequence-level decision boundary (separating Voronoi-like decision cells), while higher contours ($\varepsilon$-isohypses) define confidence margins in natural units of information (nats).
-
$K$-Grained Decision Potential Surface ($K$-DPS): Instead of searching the full exponential output space, $K$-DPS draws only $K$ independent sequence samples ($K \ll V^{N_r}$) using nucleus sampling and computes $\Phi_f^K(x)$ from the top-two candidates in that finite sample.
-
Theoretical Error Bounds: The authors prove that the estimation error between $K$-DPS and ideal DPS scales at the familiar parametric rate of $\mathcal{O}(1/\sqrt{K})$:
-
Absolute error: bounded by $\mathcal{O}\left(R_K^2(x)\sqrt{\frac{\log(4/\delta)}{2K}}\right)$ with probability at least $1 - \delta - 2\varepsilon_{\text{tail}}$.
- Expected error and concentration bounds show that missing the true top sequences incurs a residual tail probability $\varepsilon_{\text{tail}}$ that decays exponentially fast with $K$.
Datasets & Models
The authors evaluated $K$-DPS across diverse models and corpora:
- Pre-training corpus: Wikipedia Mini.
- Supervised Fine-Tuning (SFT) & alignment datasets: Tulu-3-SFT-MIX, OpenO1-SFT, HH-RLHF, Stanford Alpaca, and AdvBench (for adversarial evaluation).
- Unlearning evaluation: The Harry Potter book corpus (forget set) paired with a Wikipedia subset (retain set).
- Models tested: Llama-3.2-1B (main benchmark), along with Tulu-2-7B (SFT & DPO), Mistral-7B-v0.1, Zephyr-7B, Meta-Llama-3.1-8B, and Llama-Guard-3-8B.
Key Insights and Ideas
- Boundary Equivalence via Competition: Finding the decision boundary doesn't require inspecting all outputs; it only requires tracking the margin between the runner-up and the winner. When this margin hits zero, the model sits squarely on the decision boundary.
- The Top Sequence Dominates: Because LLM probability distributions are heavily peaked, finite sampling captures the dominant candidates with near certainty, allowing a massive complexity drop from $\mathcal{O}(V^{2N_r})$ to $\mathcal{O}(K^2)$.
- Geometric Explanations for Safety & Unlearning:
- Alignment / Jailbreaks: Unaligned models exhibit sharp, high-confidence "vulnerability peaks" near harmful prompts. Post-alignment models smooth these peaks into broad, low-confidence basins that default to refusal.
- Unlearning: Naive gradient ascent shatters the decision landscape into jagged, chaotic fragments. Retention regularization (such as KL divergence) preserves a smooth, coherent boundary structure.
Key Results
- Rapid Convergence: Empirical tests show $K$-DPS swiftly converges to reference values ($K=20{,}000$). Setting $K = 10{,}000$ guarantees absolute error below $64$ with $90\%$ confidence and below $256$ with $99\%$ confidence (recalling that metric values are squared log-probability gaps).
- Semantic Divergence: Top-1 and top-2 sampled completions are not trivial token duplicates. The normalized Levenshtein distance averages $15\%$ in high-confidence regions ($<0.1$ $K$-DPS score) and reaches $30\%–32\%$ near decision boundaries, confirming meaningful semantic competition.
- 2D/3D Boundary Visualizations: Using 2D projections (via UMAP on the final hidden states), the 0-isohypse accurately traces decision regions across distinct prompt domains.
Limitations and Future Work
- Interpolation Artifacts: Grid-based visualization across low-dimensional projections suffers in sparse input regions, occasionally creating non-physical values (e.g., negative potential values under cubic interpolation).
- Near-Identical Completions: Although rare in their benchmarks, trivial surface-level variants (e.g., differing by punctuation) can artificially suppress the potential value; the authors suggest filtering near-zero edit distances or tuning temperature.
- Future Directions: Applying $K$-DPS to mechanistically trace the emergence of hallucinations, localize memorization boundaries, and study catastrophic forgetting during continual pre-training.
Summary updated