Skip to main content

QSTN: A Modular Framework for Robust Questionnaire Inference with Large Language Models

Overview

QSTN is a Python framework designed to facilitate the creation of robust inference experiments with Large Language Models based around questionnaires. It provides a full pipeline from perturbation of prompts, to choosing Response Generation Methods, inferencing and finally parsing of the output. QSTN supports both local inference with vllm and remote inference via the OpenAI API.

Detailed information and guides are available in our documentation. Tutorial notebooks can also be found in this repository.

Installation

Make sure that the python version in your environment is at least 3.12

We support two type of installations:
1. The base version, which only installs the dependencies neccessary to use the OpenAI API.
2. The full version, which supports both API and local inference via vllm.

To install both of these version you can use pip or uv.

The base version can be installed with the following command:

pip install qstn

The full version can be installed with this command:

pip install "qstn[vllm]"

You can also install this package from source:

pip install git+https://github.com/dess-mannheim/QSTN.git

Getting Started

Below you can find a minimum working example of how to use QSTN. It can be easily integrated into existing projects, requiring just three function calls to operate. Users familiar with vllm or the OpenAI API can use the same Model/Client calls and arguments. In this example reasoning and the generated response are automatically parsed. For more elaborate examples, see the tutorial notebooks.

import qstn
import pandas as pd
from vllm import LLM

# 1. Prepare questionnaire and persona data
questionnaires = pd.read_csv("hf://datasets/qstn/ex/q.csv")
personas = pd.read_csv("hf://datasets/qstn/ex/p.csv")
prompt = (
    f"Please tell us how you feel about:\n"
    f"{qstn.utilities.placeholder.PROMPT_QUESTIONS}"
)
interviews = [
    qstn.prompt_builder.LLMPrompt(
        questionnaire_source=questionnaires,
        system_prompt=persona,
        prompt=prompt,
    ) for persona in personas.system_prompt]

# 2. Run Inference
model = LLM("Qwen/Qwen3-4B", max_model_len=5000)
results = qstn.survey_manager.conduct_survey_single_item(
    model, interviews, max_tokens=500
)

# 3. Parse Results
parsed_results = qstn.parser.raw_responses(results)

Citation

If you find QSTN useful in your work, please cite our paper:

@inproceedings{kreutner-etal-2026-qstn,
    title = "{QSTN}: A Modular Framework for Robust Questionnaire Inference with Large Language Models",
    author = "Kreutner, Maximilian  and
      Rupprecht, Jens  and
      Ahnert, Georg  and
      Salem, Ahmed  and
      Strohmaier, Markus",
    editor = "Croce, Danilo  and
      Leidner, Jochen  and
      Moosavi, Nafise Sadat",
    booktitle = "Proceedings of the 19th Conference of the {E}uropean Chapter of the {A}ssociation for {C}omputational {L}inguistics (Volume 3: System Demonstrations)",
    month = mar,
    year = "2026",
    address = "Rabat, Marocco",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2026.eacl-demo.37/",
    doi = "10.18653/v1/2026.eacl-demo.37",
    pages = "537--549",
    ISBN = "979-8-89176-382-1"
}

Metadata

Release files for qstn 0.5.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qstn 0.5.4
File Size Uploaded Provenance Actions
qstn-0.5.4.tar.gz 515.3 kB Without provenance Details for qstn-0.5.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for qstn 0.5.4
File Interpreter ABI Platform Actions
qstn-0.5.4-py3-none-any.whl Python 3 none any Details for qstn-0.5.4-py3-none-any.whl

Total release size: 594.4 kB

Release files / qstn-0.5.4.tar.gz

Download URL qstn-0.5.4.tar.gz
Size 515.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1e6df45a7a63ca3fe0a42600b20bd7f2af130ae4691465d1c10caaedb3e0816e
BLAKE2b-256 checksum
How to use checksums
f7a11c2e36f68ded6f753324b351e3ab5cf8ee6145b503904c5d2296088d9f5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Release files / qstn-0.5.4-py3-none-any.whl

Download URL qstn-0.5.4-py3-none-any.whl
Size 79.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
220dbc0195cae43b577b04e2c93d7c9497dd557cd43cd0986a230e6514371a7f
BLAKE2b-256 checksum
How to use checksums
ad7adc2ffa7d85f830b2090cab440c643a3bf0292b39d54b245e2c5dea3860a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Security for qstn 0.5.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page