Taming AI Bots: Controllability of Neural States in Large Language Models

Stefano Soatto, Paulo Tabuada, Pratik Chaudhari, Tian Yu Liu

Abstract

This research addresses whether an agent can, through a strategic choice of prompts, steer a Large Language Model (LLM) into any arbitrary state. We introduce a formal definition of "meaning" as an equivalence class within a quotient space, allowing for a rigorous analysis of LLM behavior. By characterizing "well-trained" LLMs as discrete-time stochastic dynamical systems, we demonstrate that while these models construct Euclidean embedding spaces, the reachable meanings within them are subject to specific controllability conditions. We show that an "attentive" AI bot is controllable, meaning it can be steered toward any state—a property that presents both a vulnerability to adversaries and an opportunity for control-theoretic safeguards. Finally, we propose barrier methods and functional characterizations of the End-of-Sentence (EOS) token to counteract adverse steering and ensure model alignment.

Introduction

As Large Language Models (LLMs) become increasingly integrated into complex workflows, the phenomenon of bots "going rogue" or exhibiting unexpected behaviors has highlighted a critical gap in our understanding. While these behaviors are often described using anthropomorphic terms like "state of mind," the field has lacked a rigorous analytical framework to describe the internal transitions of an LLM. This paper bridges the gap between linguistics and control theory, treating the autoregressive generation loop as a dynamical system to determine if an adversary can force a bot into any arbitrary state.

Formalizing Meaning and the Neural State

To analyze LLMs mathematically, we must first define what they process. We define meaning not as a specific string of text, but as an equivalence class of sentences. If a model's internal discriminant treats two distinct sentences as representing the same underlying concept, they occupy the same position in a "meaning" quotient space.

The neural state of the bot is defined by its sliding window of context (the last $C$ tokens). By viewing the LLM as a discrete-time stochastic dynamical system, we can track how each new input prompt shifts the model from one state to another within the embedding space.

Controllability and Attentiveness

Using tools from non-linear control theory, we derive the conditions under which a bot is "steerable." A key finding is the role of attentiveness: if a bot is designed to remain responsive to user inputs rather than ignoring them, it is inherently controllable.

We distinguish between two types of reachability:

  1. Probabilistic Reachability: A well-trained bot can reach any meaning, though potentially with a very small probability.
  2. Almost Certain Reachability: A stronger notion of controllability where an agent can guarantee the bot reaches a specific region of the meaning space through a sequence of prompts.

Our analysis proves that when restricted to the space of meanings, an attentive AI bot is controllable. This is a double-edged sword: it explains why "jailbreaking" is possible through clever prompting, but it also provides the mathematical foundation for robust safety measures.

Control-Theoretic Safeguards

Instead of relying on simple keyword filters, we propose using barrier methods—a concept borrowed from robotics and obstacle avoidance. By defining "toxic" regions within the meaning space, we can design the sampling process to ensure the bot’s state never crosses the boundary into undesirable regions.

Furthermore, we identify the End-of-Sentence (EOS) token as a functional switch. Before the EOS token, the model acts as a token predictor; after the EOS token, the model can be utilized as a meaning attributor or a reward model. This allows the LLM to effectively "score" its own output, providing a path toward in-context reward modeling that reduces the need for external RLHF (Reinforcement Learning from Human Feedback) pipelines.

Empirical Results and Model Evaluation

We validated our framework using several human preference and safety datasets, including Anthropic’s HH-RLHF, WebGPT, and the Stanford Human Preferences (SHP) dataset. We evaluated a range of models from GPT-2-XL to GPT-3 (text-davinci-003) and LLaMA-7B.

  • The Impact of Fine-Tuning: Pre-trained base models (like LLaMA-7B) performed only marginally better than chance at identifying human-defined "meaning." However, instruction-tuned models (Alpaca, Vicuna) showed a significant increase in alignment, approaching the accuracy of dedicated reward models.
  • Scaling In-Context Learning: Larger models like GPT-3 demonstrated emergent reward modeling capabilities. On the Harmless dataset, GPT-3’s accuracy as a reward model improved from 60.5% (with 2 examples) to 64.5% (with 16 examples), nearing the 70.5% gold standard of specialized models.

Discussion and Future Work

While controllability allows for steering, it also introduces risks of instability. "Self-learning" loops, where a model rewards its own outputs, could lead to limit cycles or mode collapse. Additionally, the computational cost of solving optimal control problems in real-time remains a hurdle for consumer-grade applications.

Future research will focus on expanding this framework to multimodal models. True "meaning" requires grounding in the physical world; by linking text to images and actions, we can move closer to AI bots that possess a grounded understanding of the states they inhabit.

Summary updated

BibTeX
@misc{soatto2023taming,
  author = {Stefano Soatto and Paulo Tabuada and Pratik Chaudhari and Tian Yu Liu},
  title = {{Taming AI Bots: Controllability of Neural States in Large Language Models}},
  year = {2023},
  eprint = {2305.18449},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2305.18449},
}
Figure