TL;DR
QSTN (pronounced "Question") is a new open-source Python framework designed to systematically evaluate how Large Language Models (LLMs) respond to questionnaires. By providing a modular pipeline for prompt perturbations and response generation, it helps researchers move beyond "one-off" prompts toward robust, reproducible, and cost-effective "in-silico" social science.
What Problem Does This Paper Address?
Researchers are increasingly using LLMs as "silicon subjects" to simulate human survey responses, annotate data, or probe the "values" of a model. However, LLMs are notoriously finicky. A slight change in how a question is phrased, the order of the multiple-choice options, or even whether the model is asked to provide a JSON object versus a plain-text letter can radically alter the results.
This "prompt sensitivity" creates a reliability crisis. If an LLM appears to have a specific political bias in one study but not another, is it the model's inherent "belief," or just an artifact of the prompt's formatting? QSTN addresses this by providing a standardized way to test thousands of variations (perturbations) of a questionnaire to find the most stable and human-aligned configurations.
Methods
QSTN introduces a modular pipeline that breaks the inference process into four distinct stages:
- Questionnaire Presentation: How are the questions shown to the model?
- Sequential: Questions are asked one by one in a single conversation thread.
- Battery: All questions are presented at once (like a traditional paper survey).
- Single-item: Each question is asked in a fresh, isolated context.
- Prompt Perturbation: The framework automatically generates variations to test robustness. This includes reversing answer orders, introducing typos, rephrasing questions (paraphrasing), and changing the scale (e.g., converting a 5-point Likert scale to a 6-point scale).
- Inference Model: Support for both local (via
vLLM) and remote (OpenAI API) models. - Response Generation & Parsing: QSTN supports various ways to extract answers, from "First-Token Probabilities" to "Verbalized Distribution" (asking the model to output its own confidence percentages) and "Restricted Generation" (forcing the model to output valid JSON).
Datasets
The authors evaluated QSTN by generating over 40 million survey responses. They used three major longitudinal studies to compare LLM "opinions" against real human data:
- ANES (American National Election Study): Focusing on "feeling thermometers" toward different social and political groups.
- GLES (German Longitudinal Election Study): Measuring political attitudes in Germany.
- ATP (American Trends Panel): A US-based panel by Pew Research Center.
Key Insights and Ideas
- The "Battery" Advantage: One of the most significant findings is that presenting questions in a "Battery" format (all at once) is not just faster—it’s often more accurate. For the Llama-3.3-70B model, the battery format improved alignment with human subpopulation data by roughly 8% compared to asking questions one by one.
- Context Matters: When models see previous questions and their own answers (as in Sequential or Battery modes), their response distribution shifts toward the center (more neutral), which actually aligns more closely with how humans typically answer these surveys.
- Verbalized Distributions vs. Logprobs: Instead of just looking at the raw probability of the next token, the authors found that asking the model to "verbalize" its distribution (e.g., "I am 40% likely to choose A and 60% likely to choose B") led to significant improvements in matching human population-level statistics.
- Efficiency is a Feature: QSTN utilizes prefix caching and batching. In their tests, moving from a single-item presentation to a battery format reduced inference time from over 3 hours to just 1.5 hours for the same number of respondents.
Key Results
- Alignment: The "Verbalized Distribution Method" consistently outperformed standard restricted choice methods in matching the total variation distance of human response distributions across ANES, GLES, and ATP datasets.
- Robustness: The study quantified how "fragile" certain models are. For example, reversing the order of answer options or removing a "refusal" (Don't Know) option can significantly sway the results of smaller models, while larger models like Llama-3.3-70B and Gemini-1.5-Pro are much more resilient.
- Compute Savings: By optimizing the presentation method (Battery mode), the researchers obtained responses for a fraction of the compute cost and time (Table 2 shows a reduction from 16 API calls per persona to just 1).
Limitations and Future Work
While QSTN is a powerful tool, the authors note several areas for growth:
- Structured Output Constraints: Currently, the framework does not support advanced output guidance like regex-based patterns or context-free grammars (e.g., Outlines or Guidance).
- Model Support: The current evaluation focused primarily on instruction-tuned models. The authors plan to add better support for base (non-instruct) models in the future.
- Application Scope: The evaluation was heavily focused on synthetic survey responses. Future work could explore how QSTN performs in data annotation or complex reasoning tasks.
QSTN is available as an open-source Python package and includes a no-code GUI for researchers who prefer not to write scripts.
Summary updated