ODESteer: A Unified ODE-Based Steering Framework for LLM Alignment
Organizations: University of Illinois Urbana-Champaign · Northwestern University · William & Mary · University of Washington ·
Abstract
Activation steering, or representation engineering, offers a lightweight approach to align large language models (LLMs) by manipulating their internal activations at inference time. However, current methods suffer from two key limitations: (i) the lack of a unified theoretical framework for guiding the design of steering directions, and (ii) an over-reliance on one-step steering that fail to capture complex patterns of activation distributions. In this work, we propose a unified ordinary differential equations (ODEs)-based theoretical framework for activation steering in LLM alignment. We show that conventional activation addition can be interpreted as a first-order approximation to the solution of an ODE. Based on this ODE perspective, identifying a steering direction becomes equivalent to designing a barrier function from control theory. Derived from this framework, we introduce ODESteer, a kind of ODE-based steering guided by barrier functions, which shows empirical advancement in LLM alignment. ODESteer identifies steering directions by defining the barrier function as the log-density ratio between positive and negative activations, and employs it to construct an ODE for multi-step and adaptive steering. Compared to state-of-the-art activation steering methods, ODESteer achieves consistent empirical improvements on diverse LLM alignment benchmarks, a notable improvement over TruthfulQA, over UltraFeedback, and over RealToxicityPrompts. Our work establishes a principled new view of activation steering in LLM alignment by unifying its theoretical foundations via ODEs, and validating it empirically through the proposed ODESteer method.
Figures & tables
| Category | Method | Barrier Function |
| Input Reading | Difference-in-Means | Log-density ratio (Gaussian assumption) |
| Linear Probes | Log-density ratio (logistic regression) | |
| Output Optimization | – | Scoring function with threshold |
| Method | Model | Helpfulness (Ultrafeedback) | Truthfulness (TruthfulQA) | Detoxification (Real Toxicity Prompts) | ||||||
| Win (%) | RM | RM | T I (%) | True (%) | Info (%) | Toxic | PPL | Dist-2 | ||
| Original | Falcon-7B | 50.0 ±0.000 | -15.298 ±0.194 | -5.465 ±0.628 | 29.0 ±0.220 | 30.2 ±0.153 | 96.0 ±0.462 | 0.257 ±0.007 | 15.980 ±0.360 | 0.948 ±0.003 |
| RepE | 50.1 ±0.014 | -15.354 ±0.120 | -5.337 ±0.501 | 24.4 ±0.395 | 25.7 ±0.550 | 95.1 ±0.602 | 0.246 ±0.004 | 15.440 ±0.260 | 0.940 ±0.001 | |
| ITI | 50.5 ±0.013 | -15.291 ±0.153 | -4.704 ±0.417 | 34.7 ±0.713 | 36.0 ±0.608 | 96.4 ±0.493 | 0.243 ±0.010 | 15.880 ±0.690 | 0.935 ±0.006 | |
| CAA | 52.8 ±0.011 | -14.998 ±0.157 | -5.100 ±0.481 | 35.0 ±0.390 | 36.4 ±0.321 | 96.3 ±0.252 | 0.244 ±0.003 | 15.920 ±0.530 | 0.950 ±0.002 | |
| MiMiC | 47.8 ±0.016 | -15.469 ±0.092 | -5.333 ±0.250 | 37.2 ±0.712 | 42.2 ±1.058 | 88.0 ±1.385 | 0.244 ±0.007 | 15.780 ±0.640 | 0.941 ±0.002 | |
| Model | Method | Win (%) | T I (%) | Toxic |
| Falcon-7B | ITI | 50.5 ±0.013 | 34.7 ±0.713 | 0.243 ±0.010 |
| One-step ODESteer | 54.0 ±0.028 | 40.8 ±0.819 | 0.199 ±0.005 | |
| ODESteer (Ours) | 56.3 ±0.018 | 42.2 ±0.115 | 0.188 ±0.006 | |
| Mistral-7B | ITI | 51.8 ±0.010 | 46.4 ±1.249 | 0.165 ±0.007 |
| One-step ODESteer | 54.1 ±0.027 | 58.1 ±0.734 | 0.113 ±0.001 | |
| ODESteer (Ours) | 56.1 ±0.028 | 59.9 ±0.237 | 0.109 ±0.006 |
Appendix figures & tables12 assets
Supplementary material from the paper’s appendix.
Appendix
| Notation | Definition |
| , | Scalars |
| Vectors | |
| Matrices | |
| Sets | |
| Derivative of w.r.t. time | |
| Activation/hidden states of an LLM at a given position |
| Model | Range of |
| tiiuae/falcon-7b | 20–23 |
| mistralai/Mistral-7B-v0.3 | 3–4 |
| meta-llama/Llama-3.1-8B | 4–6 |
| Qwen/Qwen2.5-7B | 13 – 16 (48 for detoxification task) |
| Method | Model | Detoxification (Real Toxicity Prompts) | ||
| Dist-1 | Dist-2 | Dist-3 | ||
| Original | Falcon-7B | 0.810 ±0.003 | 0.948 ±0.003 | 0.972 ±0.002 |
| RepE | 0.797 ±0.001 | 0.940 ±0.001 | 0.966 ±0.001 | |
| ITI | 0.796 ±0.004 | 0.935 ±0.006 | 0.960 ±0.004 | |
| CAA | 0.810 ±0.002 | 0.950 ±0.002 | 0.974 ±0.001 | |
| MiMiC | 0.801 ±0.000 | 0.941 ±0.002 | 0.967 ±0.002 | |
| Method | Falcon-7B | Mistral-7B | LLaMA3.1-8B |
| Original | 117.69 ±0.45 | 116.26 ±0.24 | 114.82 ±0.18 |
| RepE | 117.69 ±0.27 | 115.82 ±0.08 | 114.71 ±0.3 |
| ITI | 117.54 ±0.12 | 115.78 ±0.07 | 114.82 ±0.29 |
| CAA | 117.46 ±0.44 | 115.76 ±0.03 | 114.57 ±0.48 |
| MiMiC | 105.62 ±0.36 | 109.66 ±0.16 | 108.73 ±0.38 |
| HPR | 116.09 ±0.04 | 115.07 ±0.12 | 114.42 ±0.11 |
| CommonsenseQA (%) | MMLU (%) | ARC-Challenge (%) | |
| LLaMA3.1-8B | 68.0 | 61.8 | 74.7 |
| LLaMA3.1-8B + ODESteer | 68.3 | 60.9 | 74.5 |
| ODE Solver | Falcon-7B | Mistral-7B | LLaMA3.1-8B |
| Euler | 42.2 ±0.115 | 59.9 ±0.237 | 63.2 ±0.823 |
| RK4 | 42.8 ±0.555 | 60.2 ±0.237 | 63.3 ±0.923 |
Language Model Steering
Language model steering controls a model’s behavior at inference time by intervening in its representations, components, or decoding process.
See all 278 papers