Abstract
As large language models (LLMs) increasingly rely on massive, unstructured text datasets for training and evaluation, the task of "sensemaking"—understanding the underlying semantic structure and distribution of these datasets—has become critical. Traditional methods, such as manual inspection or generic metric analysis, fail to scale or capture domain-specific nuances. This paper introduces AutoHistograms, a visualization tool that integrates LLMs and text embeddings to automatically surface the latent structure of text corpora. By clustering entities and generating descriptive labels via LLMs, AutoHistograms enables researchers to identify data imbalances, safety risks, and outliers through domain-specific histograms. An observational study with ten industry professionals demonstrates that the tool significantly enhances the speed and depth of dataset exploration.
Introduction
The rapid proliferation of LLMs has shifted the bottleneck of AI development from model architecture to data quality and understanding. Data workers often struggle to grasp the contents of large-scale text datasets, typically oscillating between high-level, dataset-agnostic metrics (e.g., text length, toxicity) and labor-intensive manual reading. Neither approach effectively reveals the semantic categories specific to a dataset—such as specific medical symptoms in a clinical corpus or musical instruments in a hobbyist forum. AutoHistograms addresses this gap by automating the extraction and visualization of these semantic distributions.
System Design and Methodology
AutoHistograms utilizes a two-stage pipeline to transform raw text into interactive, navigable histograms.
1. Preprocessing and Semantic Clustering
The pipeline begins with Entity Extraction, using NLTK to identify the most frequent nouns and numerical values. These entities are then mapped into a high-dimensional vector space using Embedding-based Clustering (via the PaLM API). Hierarchical clustering groups semantically related terms—for instance, grouping "SARS," "COVID," and "flu"—even in the absence of shared keywords. Finally, an LLM provides a high-level Category Label for each cluster (e.g., "Infectious Diseases"), creating a human-readable taxonomy for the dataset.
2. Interactive Exploration and Real-time Synthesis
The tool provides an interactive interface where users can engage with the data at multiple levels of granularity:
- Interactive UI: Users can click on specific histogram bars to filter raw data, allowing for immediate transition from global distributions to local examples.
- Semantic Search: Natural language queries (e.g., "illness") can be used to locate relevant histograms (e.g., "Diseases").
- On-the-fly Histograms: For categories not captured during preprocessing, users can generate new histograms in real-time. The LLM generates "prototype" entities for a user-defined query, which are then matched against actual dataset entities using embedding similarity.
Evaluation and Key Insights
The tool was evaluated using a dataset of sample chatbot responses to medical queries. Ten data professionals (researchers, scientists, and developers) participated in an observational study to perform sensemaking tasks.
Sensemaking via Synthesis
Participants demonstrated a clear preference for the synthesized histograms over raw text. Nine out of ten users utilized the histograms to successfully hypothesize the dataset's subject matter before reading a single row of data. This suggests that LLM-generated labels provide an effective "mental map" for rapid orientation.
Entropy and Discovery
Users were particularly drawn to "long-tailed" or high-entropy histograms. These distributions often revealed significant data imbalances. For example, one participant discovered that the "cancer" token appeared 144 times, while the next most frequent disease appeared only 14 times, indicating a potential bias in the model's training or evaluation data.
Safety and Red-Teaming
AutoHistograms proved effective for safety analysis. By filtering for clusters such as "Advice" or "Treatment," participants were able to quickly identify "borderline unsafe" content, such as instances where a chatbot provided specific medical prescriptions instead of the required safety disclaimers.
Discussion and Future Work
While AutoHistograms represents a significant step forward in dataset exploration, several areas for improvement remain:
- Intersectional Analysis: Users expressed a need for complex boolean filtering (e.g., "Symptom AND Treatment") to find specific data intersections.
- Numerical Integration: Future iterations should integrate semantic histograms with traditional numerical metadata, such as token counts and sequence lengths.
- Hallucination Mitigation: In the "on-the-fly" mode, LLMs occasionally suggest entities not present in the dataset. While embedding-based mapping mitigates this, further refinement is needed to ensure strict data fidelity.
Conclusion
AutoHistograms demonstrates that LLMs can serve as powerful "brainstorming partners" for data exploration. By automating the categorization and visualization of unstructured text, the tool reduces the cognitive load on researchers and enables the discovery of critical data skews and safety risks that might otherwise remain hidden in the noise of large-scale corpora.
Summary updated