Skip to the content.
🇪🇸 Español 🇬🇧 English

Introduction

Silicon sampling refers to the use of large language models (LLMs) to simulate the responses that human participants would give in surveys, experiments, or interviews. By conditioning a model on socio-demographic profiles (age, gender, education, ideology, country, etc.), researchers generate “silicon samples”: synthetic respondents whose answers are meant to approximate those of specific human subpopulations. The approach has been proposed as a fast, low-cost complement to traditional data collection —for piloting instruments, exploring hypotheses, or approximating hard-to-reach groups— but its reliability is still under active debate: models can reproduce social biases, flatten within-group variability, and align unevenly across cultures and languages.

This repository contains materials for the Silicon Sampling workshop. To date, the workshop has been taught at

Folder structure

factor_data_silicon_tutorial/
├── form/
├── imgs/
├── input_data/
├── output_data/
├── outputs_for_analysis/
├── results/
├── results_R/
├── figures/
├── figures_R/
└── src/

The repo root also holds the licence, this README and its Spanish version (README_ES.md), the GitHub Pages configuration (_config.yml, _layouts/), and CLAUDE.md (the specification of the bias analysis).

Analyses

Beyond the tutorial itself, the repo includes two reproducible analyses of middle-point bias in silicon samples. They differ in the response scale they probe — an ordinal scale with no midpoint, and a continuous scale with one — and in whether the human baseline comes from an existing survey or is collected in the workshop.

1. Middle-point bias analysis (Q130, prompt V1 vs V2)

Beyond the tutorial, the repo includes a reproducible analysis of middle-point bias in the silicon samples for WVS Q130 (“What should the government do about people from other countries coming here to work?”, a 4-point ordinal scale with no neutral midpoint). Since the scale has no midpoint, the bias is operationalized as interior-category concentration: excess probability mass on the two interior options relative to the empirical WVS distributions in Argentina, Uruguay and the United States. Prompt V2 (first-person narrative + anti-moderation instructions) is evaluated as a mitigation of the V1 baseline.

Pipeline:

  1. src/aggregate_q130.py — aggregates the raw per-respondent results in output_data/ into the long-format distribution summaries in outputs_for_analysis/.
  2. src/analyze_q130_bias.py — computes per model × country × prompt metrics (normalized entropy, entropy ratio vs WVS, interior/extreme mass, Jensen–Shannon divergence, ordinal Wasserstein-1, per-category signed errors, mean scale position) with multinomial bootstrap CIs, and runs paired within-model tests of the mitigation hypotheses (Wilcoxon signed-rank, rank-biserial effect sizes, sign test). Outputs: results/metrics.csv, results/paired_differences.csv, the full write-up in results/report.md, and four 300-dpi figures in figures/.

Run from the repo root (requires pandas, scipy, matplotlib):

python src/aggregate_q130.py
python src/analyze_q130_bias.py

The notebook src/q130_aggregation_and_bias_analysis.ipynb unifies both steps into a single executable document (same code, same outputs), with the figures and tables rendered inline.

An independent R / tidyverse replication, src/q130_aggregation_and_bias_analysis.R (requires dplyr, tidyr, readr, purrr, stringr, ggplot2), re-derives the whole pipeline and cross-checks it against the Python outputs: the recomputed aggregations match outputs_for_analysis/ exactly and all deterministic metrics match results/metrics.csv to < 1e-9 (asserted in the script; only the bootstrap CIs differ, since R and NumPy use different random generators). It writes its outputs to results_R/ and figures_R/ (ggplot2 versions of the same four figures):

Rscript src/q130_aggregation_and_bias_analysis.R

Headline findings (details and caveats in results/report.md): under prompt V1 all three models (gpt-4o, gpt-oss-20B, gpt-oss-120B) place 99–100% of their mass on the two interior categories and are strongly compressed relative to WVS in all 9 model × country cells; prompt V2 reduces interior concentration in 9/9 cells and increases entropy and improves fidelity to WVS (lower JSD) in 8/9, with no overcorrection detected.

2. Verbal probability expressions (human baseline vs silicon sample)

Q130 uses an ordinal scale without a midpoint, so the bias has to be measured indirectly. This second analysis uses a continuous 0–100 scale that does have one, and compares the models against a human baseline collected by the workshop participants themselves.

The instrument replicates Stage 1 of the “Quizás, quizás, quizás” experiment (El Gato y La Caja, with the Decision-making Lab, University of Rochester; n > 8,000 in the original run): participants are shown verbal expressions of uncertainty and asked what probability each one conveys — 16 expressions on a 0–100 slider, a min–max range for 10 of them, and the usual regressors. The original data collection closed in October 2025, so this replication generates its own data.

Exercise materials

  1. Fill in the form — do this before opening the notebook: the human baseline is the class’s own responses.
  2. Class responses — public sheet, updated live. The notebook reads straight from it.
  3. Notebook on Google Colab — the simulation and the comparative analysis. Spanish only.
  4. Notebook en Google Colab - completo- — la simulación y el análisis comparado.

The same instrument is then put to the models, conditioned on the profiles collected from the human sample, and the two are compared on: mass at the midpoint ([45, 55]), excess of responses at exactly 50, between-participant dispersion, range width, and internal coherence (min ≤ point ≤ max, 81% in the original study).

The notebook walks through it: it reads the human response sheet, builds a first-person profile from each participant’s demographics, and issues 26 independent calls per participant — one per expression, with no context from the others, so that the model faces the same condition as the humans, who saw the items one at a time in randomised order. As in analysis 1 there are two prompt versions: a neutral v1 baseline and a v2 with an explicit anti-midpoint instruction, since measuring the bias with a prompt that already says “don’t use 50” measures nothing.

Google Colab version

You can open the tutorial notebooks directly in Google Colab:

Analysis 1 — WVS Wave 7 (Q121, Q122, Q128, Q130)

Analysis 2 — Verbal probability expressions

Slides

Stack

The tutorial runs entirely in Python 3 on Jupyter / Google Colab notebooks. The main components are:

Data sources

The tutorial uses data from the 2017-2022 wave of the World Values Survey

That said, there are many other data sources that could be used. We mention just a few

Bibliography

Despite being a new field, there is a large body of literature on the subject. As expected, no consensus has been reached regarding the reliability and viability of these tools. We present a (non-exhaustive) list of several relevant studies.