Table of Contents
Fetching ...

Semantic Regexes: Auto-Interpreting LLM Features with a Structured Language

Angie Boggust, Donghao Ren, Yannick Assogba, Dominik Moritz, Arvind Satyanarayan, Fred Hohman

TL;DR

This work tackles the challenge of translating LLM feature activations into precise, human‑understandable descriptions. It introduces semantic regexes, a structured language built from primitives (symbols, lexemes, fields) and modifiers (context, composition, quantification) to describe activation patterns, enabling both feature‑level descriptions and model‑wide analyses. Empirical results show semantic regexes achieve accuracy comparable to natural language while offering greater conciseness and consistency and revealing feature complexity as depth increases. A user study further demonstrates that semantic regex descriptions support more accurate mental models of LLM features, underscoring their value for interpretability and safety applications.

Abstract

Automated interpretability aims to translate large language model (LLM) features into human understandable descriptions. However, these natural language feature descriptions are often vague, inconsistent, and require manual relabeling. In response, we introduce semantic regexes, structured language descriptions of LLM features. By combining primitives that capture linguistic and semantic feature patterns with modifiers for contextualization, composition, and quantification, semantic regexes produce precise and expressive feature descriptions. Across quantitative benchmarks and qualitative analyses, we find that semantic regexes match the accuracy of natural language while yielding more concise and consistent feature descriptions. Moreover, their inherent structure affords new types of analyses, including quantifying feature complexity across layers, scaling automated interpretability from insights into individual features to model-wide patterns. Finally, in user studies, we find that semantic regex descriptions help people build accurate mental models of LLM feature activations.

Semantic Regexes: Auto-Interpreting LLM Features with a Structured Language

TL;DR

This work tackles the challenge of translating LLM feature activations into precise, human‑understandable descriptions. It introduces semantic regexes, a structured language built from primitives (symbols, lexemes, fields) and modifiers (context, composition, quantification) to describe activation patterns, enabling both feature‑level descriptions and model‑wide analyses. Empirical results show semantic regexes achieve accuracy comparable to natural language while offering greater conciseness and consistency and revealing feature complexity as depth increases. A user study further demonstrates that semantic regex descriptions support more accurate mental models of LLM features, underscoring their value for interpretability and safety applications.

Abstract

Automated interpretability aims to translate large language model (LLM) features into human understandable descriptions. However, these natural language feature descriptions are often vague, inconsistent, and require manual relabeling. In response, we introduce semantic regexes, structured language descriptions of LLM features. By combining primitives that capture linguistic and semantic feature patterns with modifiers for contextualization, composition, and quantification, semantic regexes produce precise and expressive feature descriptions. Across quantitative benchmarks and qualitative analyses, we find that semantic regexes match the accuracy of natural language while yielding more concise and consistent feature descriptions. Moreover, their inherent structure affords new types of analyses, including quantifying feature complexity across layers, scaling automated interpretability from insights into individual features to model-wide patterns. Finally, in user studies, we find that semantic regex descriptions help people build accurate mental models of LLM feature activations.

Paper Structure

This paper contains 51 sections, 1 equation, 12 figures, 4 tables.

Figures (12)

  • Figure 1: The semantic regex language consists of a set of primitives (top) that can be applied independently or combined with modifiers (bottom) to express diverse feature activation patterns.
  • Figure 2: Semantic regexes perform on par with natural language feature descriptions across evaluations on , , and , suggesting that the semantic regex language is appropriately expressive to describe LLM features.
  • Figure 3: Semantic regexes are often more concise (top), more consistently describe equivalent features (middle), and better reflect feature complexity (bottom) than natural language descriptions.
  • Figure 4: Semantic regexes encode feature complexity. The number (top) and abstraction (middle, bottom) of components increase across model layers, indicating increasingly complex features.
  • Figure 5: With semantic regexes, user study participants generated strongly activating positive examples and non-activating counterfactuals, indicating their understanding of the feature.
  • ...and 7 more figures