Explaining Data Patterns in Natural Language with Language Models

Chandan Singh, John X. Morris, Jyoti Aneja, Alexander M. Rush, Jianfeng Gao

Introduction

Traditionally, large language models (LLMs) are used by providing a human-written instruction (a prompt) to generate a specific output. While researchers have developed "autoprompting" techniques to automatically find the most effective prompts, these methods typically result in sequences of "gibberish" tokens that are mathematically optimized but nonsensical to humans.

This research introduces iPrompt (interpretable autoprompting), a method that inverts this relationship. Instead of using a prompt to generate an answer, iPrompt analyzes data examples to generate a human-readable natural language string that explains the underlying pattern. This effectively turns LLMs into automated tools for scientific discovery and data interpretation.

The iPrompt Method

iPrompt is an iterative local search algorithm that treats prompt discovery as a discrete search problem. It follows a three-step cycle to refine explanations:

  1. Proposal: Given a few data examples (e.g., Input: 3 1, Output: 4), the LLM is asked to complete a suffix to explain the pattern, generating several candidate explanations like "Add the numbers" or "Sum the inputs."
  2. Reranking: Each candidate is tested as a prompt on the rest of the dataset. Candidates are ranked based on how accurately they allow the LLM to predict correct outputs for new inputs.
  3. Iteration with Exploration: The top-performing candidates are truncated at random positions and fed back into the proposal stage to be refined and expanded.
The iPrompt workflow: an LLM analyzes input-output pairs to generate a natural language explanation of the underlying pattern.

Unlike previous gradient-based methods, iPrompt is more efficient and ensures that the resulting prompts remain fluent and interpretable.

Experimental Evaluation

The researchers evaluated iPrompt across a diverse range of benchmarks, moving from simple logic to complex scientific data:

  • Synthetic Math: 10 tasks requiring the inference of functions like addition, squaring, or finding the maximum.
  • Natural Language Understanding: 10 Allen NLI tasks and 20 "Instruction Induction" tasks (e.g., identifying a country's capital).
  • Scientific Discovery: The method was applied to identify functional keywords from protein sequences and to explain fMRI brain activity by mapping which words excite specific regions of the human neocortex.

Key Insights: Emergent Alignment and Portability

A critical finding of the study is the concept of Emergent Alignment. The researchers observed that larger models (such as GPT-J 6B) exhibit a "diagonal" alignment—they perform well only when given the correct semantic prompt. In contrast, smaller models like GPT-2 are often "brittle," sometimes performing well even with incorrect or off-base prompts, which makes them less reliable for discovering true underlying patterns.

Comparison of task alignment between GPT-2 (1.5B) and GPT-J (6B). Larger models exhibit a clear diagonal, indicating they perform well only when the prompt matches the semantic task.

Furthermore, because iPrompt produces natural language, the discovered prompts are highly portable. A prompt discovered using one model (e.g., GPT-J) often works remarkably well when plugged into a completely different model (e.g., OPT or GPT-3), whereas gibberish-based autoprompts fail to transfer across different architectures.

Key Results and Impact

  • Accuracy: On math tasks, iPrompt achieved a 60% correctness rate in finding the exact ground-truth explanation, vastly outperforming AutoPrompt (13%).
  • Human Interpretability: Human evaluators rated iPrompt’s explanations significantly higher for clarity and accuracy than baseline methods.
  • Scientific Utility: In fMRI experiments, iPrompt successfully identified semantic categories like "material" or "color" for different brain regions, producing spatially smooth "brain maps" that suggest the LLM captured genuine biological patterns.

Conclusion and Future Work

iPrompt demonstrates that an LLM's ability to follow instructions can be flipped to discover instructions. While the method is currently limited by the underlying capability of the LLM (a model cannot explain a pattern it cannot solve), it opens new doors for using AI in scientific hypothesis generation. Future work may expand this to multi-sentence hypotheses and other modalities like computer vision to explain what specific neural filters "see" in images.

Summary updated

BibTeX
@inproceedings{singh2023explaining,
  author = {Chandan Singh and John X. Morris and Jyoti Aneja and Alexander M. Rush and Jianfeng Gao},
  title = {{Explaining Data Patterns in Natural Language with Language Models}},
  booktitle = {BlackboxNLP @ EMNLP},
  year = {2023},
  doi = {10.18653/v1/2023.blackboxnlp-1.3},
}
Figure