TL;DR
InFerActive is an interactive, tree-based visualization system designed to streamline human safety evaluation of LLMs under stochastic sampling conditions. By combining a novel "breadth-first sampling" algorithm with phrase-level token aggregation, it reduces the required sample size for safety testing by up to 5x and accelerates human edge-case discovery by 15% compared to traditional spreadsheet workflows.
What Problem Does This Paper Address?
Evaluating whether a Large Language Model (LLM) is truly safe is notoriously difficult due to the stochastic nature of text generation. A model might refuse a harmful prompt 99.9% of the time, but a rare, low-probability sample could still result in a severe safety violation when deployed at scale.
To catch these elusive safety failures, red-teamers typically generate hundreds or thousands of random samples per prompt. Currently, the industry standard is to review these outputs in static spreadsheets. This workflow scales poorly: human evaluators waste immense time repeatedly rereading identical or near-duplicate prefixes (e.g., "I'm sorry, I cannot fulfill this request because...") just to find the rare points where a generation diverges into harmful territory.
While representing LLM outputs as a token-level tree could theoretically expose these divergence points, raw token trees branch at every single step. This leads to exponential growth that quickly overwhelms standard user interfaces, and subword token fragmentation makes the text completely unreadable for humans.
Methods
The authors introduce InFerActive, a system that reimagines LLM safety evaluation through two core components:
- Breadth-First Sampling (BFS): A novel tree-construction algorithm that systematically enumerates early branching points in the generation space up to a specified depth $d$, rather than relying on independent random draws. Once the early frontier is established, the system stochastically completes the remaining text using standard nucleus sampling.
- Interactive Tree Interface: To make the tree human-readable, InFerActive applies big-token aggregation, merging consecutive single-child tokens into cohesive, natural phrases.
The interface supports several dynamic operations:
- Top-N Filtering: Limits the visible tree size to a manageable number of paths based on probability thresholds.
- Re-rooting: Allows evaluators to select any intermediate phrase node as a new local root, instantly collapsing irrelevant branches and focusing compute/attention on a specific generation trajectory.
- On-Demand Exploration: Evaluators can click unexplored leaf nodes to dynamically stream new completions from that specific prefix.
- Hierarchical Evaluation: Safety labels (e.g., "Good" or "Bad") assigned to a node automatically propagate down to its descendants, saving manual labeling effort.
Datasets
The system and its underlying algorithm were evaluated using the test split of HarmBench, a standardized benchmark for automated red-teaming and robust refusal evaluation. The authors utilized 159 direct-request harmful prompts from the dataset. To evaluate the algorithm automatically, completions were judged using the fine-tuned HarmBench LLM classifier.
Key Insights and Ideas
- Shallow Safety Alignment: The core reason breadth-first sampling works so efficiently is that an LLM's safety trajectory (whether it complies or refuses) is heavily determined within the first few tokens. By forcing the model to branch early, BFS systematically uncovers rare compliance pathways that independent random sampling frequently misses.
- Deduplication as a Cognitive Multiplier: Structuring text generation as a tree inherently deduplicates shared prefixes. Shifting human effort from passive, repetitive reading to active, intentional exploration drastically reduces cognitive load and changes how red-teaming compute is allocated.
Key Results
- 5.0× Sample Efficiency: On models like Llama 3.2 3B, the BFS algorithm matched the Attack Success Rate (ASR) of 1,000 random samples while requiring 5.0× fewer completed responses ($N=200$). Similar efficiency gains were observed for Llama 3.1 8B (3.8×) and Gemma 3 12B (4.1×).
- 15% Faster Discovery: In a controlled user study comparing InFerActive to a spreadsheet baseline, participants discovered harmful responses 15% faster using the tree-based interface.
- Higher Edge-Case Detection: In a second study comparing InFerActive to a basic tree visualization (without phrase aggregation and advanced layout features), participants using InFerActive successfully completed the evaluation tasks at a significantly higher rate (11/12 vs 7/12) within the time limit and discovered more distinct edge cases while reporting lower cognitive load.
Limitations and Future Work
- Short-Form Constraints: The user studies bounded response lengths to 2–3 sentences to keep evaluation sessions tractable. The scaling behavior of this interface on long-form text generation remains an open question.
- Logit Access Dependency: The BFS algorithm requires direct access to token-level logits. Consequently, it cannot be used out-of-the-box with closed-source, API-only models (like OpenAI's GPT-4 or Anthropic's Claude), though the visualization interface itself can still display trees generated by other proxy methods.
- Complex Harms: The automated technical evaluation relied on a binary classifier, which does not capture more nuanced, context-dependent harms, or subtle algorithmic biases where human judgment is uniquely required.
Summary updated