google-deepmind/disco
Python
Captured source
source ↗google-deepmind/disco
Language: Python
License: Apache-2.0
Stars: 0
Forks: 0
Open issues: 0
Created: 2026-11-16T18:49:09Z
Pushed: 2026-11-16T20:39:13Z
Default branch: main
Fork: no
Archived: no
README:
DISCO: Reliable Behavior Discovery via False Discovery Rate Control
This codebase implements the DISCO (*Discovery through Iterative Search with COarsened $e$-processes*) algorithm and baselines from the paper *Reliable Behavior Discovery via False Discovery Rate Control* (Madras et al., 2026).
---
Installation & Setup
1. Create a Virtual Environment & Install Dependencies
From the root of this repository:
python3 -m venv .venv source .venv/bin/activate pip install -e . # Optional: install open-source Google Vizier and dev/test dependencies pip install -e ".[bandit,dev]"
For rendering CJK, Greek, and Latin glyphs in the Visual Symmetry task suite, install a CJK-capable system font (such as fonts-noto-cjk) or point DISCO_FONT_PATH to a TrueType/OpenType font file:
# Ubuntu / Debian sudo apt-get update && sudo apt-get install -y fonts-noto-cjk # macOS (Homebrew) brew install --cask font-noto-sans-cjk # Or specify a custom font path directly: export DISCO_FONT_PATH="/path/to/NotoSansCJK-Regular.ttc"
2. Run Unit Tests & Smoke Check (No API Key Required)
You can verify your installation immediately using the hermetic test suite and synthetic bandit runner:
pytest python -m disco.bandit.run_bandit_disco \ --env_type=bernoulli \ --runner_type=all \ --budget=90 \ --chunk_size=15 \ --num_mc_runs=3
3. Configure Gemini API Key
All generative model experiments use the official `google-genai` SDK. Export GEMINI_API_KEY (or GOOGLE_API_KEY) before running discovery, baseline, or verification scripts:
export GEMINI_API_KEY="your-gemini-api-key" # Alternatively: export GOOGLE_API_KEY="your-gemini-api-key"
---
Directory Structure
- Repository Root:
run_disco.py: Main CLI entry point for running DISCO, BUW-eBH
(method: ebh_baseline in the YAML config), and Type-I error control (method: type1_baseline) on generative model tasks.
eval_disco.py: End-to-end discovery + out-of-sample precision/FDR
verification wrapper around run_disco.py.
standalone_precision_verifier.py: Out-of-sample single-batch $p$-value
verification runner for evaluating candidate hypotheses from any discovery method.
apply_fdr_control.py: Post-hoc multi-method FDR control (BH, BY,
unboosted/boosted e-BH) and Storey $\hat{\pi}_0$ / thresholded FDR estimation on verification outputs.
compute_disco_bound_values.py: Monte Carlo utility for computing pre-hoc
and post-hoc DISCO FDR bounds ($\epsilon$, $\delta$, $\mathcal{V}^*(N)$, and $\alpha^\star$).
configs/: Single-run YAML configuration files for the paper's benchmark
experiments (recipes_disco.yaml, hedging_disco.yaml, t2i_cat_bias_disco.yaml, t2i_handedness_bias_disco.yaml, visual_symmetry_broad_disco.yaml, visual_symmetry_contrastive_disco.yaml, and recipes_baselines.yaml).
example_hypotheses.json: Example candidate hypotheses file for standalone
verification.
runners.py: CoreDiscoRunnerorchestrating the iterative bandit-style
discovery loop.
backbone_client.py&models/: Gemini client (google-genai) and model
registry (gemini-3.8-flash for text tasks, gemini-3.1-flash-image for image tasks).
core/: Configuration (config.py,flag_specs.py,run_config.py),
checkpoints, round execution, task execution, and finalizers (DISCO pre-hoc/post-hoc, BUW-eBH, Type-I).
stats/: $p$-to-$e$ calibrators, $e$-value boosting, e-BH / BH / BY
multiple testing procedures, statistical tests (binomial, Fisher's exact, McNemar's, Student's $t$), Storey $\hat{\pi}_0$ and thresholded FDR estimators, BCa bootstrap confidence intervals, and stats/coarsened/ null random-walk tables and certificates.
agent/,prompting/,parsing/: Discovery agent loop, taxonomy-based
query generation, structured output schemas, and fault-tolerant target scraping.
verification/,eval/: Hypothesis I/O, task resolution, FDR/precision
scoring, and evaluation result schemas.
testing/: Hermetic unit, golden, and smoke test suites.- [`tasks/`](tasks/README.md): Benchmark task suites for generative model
behavior discovery: 1. Word Count (`recipes`): Cross-lingual recipe response length comparisons (English vs. French). 2. Epistemic Hedging (`hedging`): Unhedged controversial claims and epistemic calibration. 3. T2I Cat Coat Color Bias (`t2i_cat_bias`): Distributional coat-color bias in text-to-image generation. 4. T2I Handedness Bias (`t2i_handedness_bias`): Right-handedness representation skew in text-to-image generation. 5. Visual Symmetry (`visual_symmetry`): Bilateral spatial reflection completion across 22 pattern categories and 10 background colors.
- [`baselines/`](baselines/README.md): The 5 heuristic LLM discovery
baselines and their e-BH wrappers:
- Self-Report (
direct_asking) - Uniform Probing (
simple_probing) - Repeated-Sample Probing (
looped_multisample) - Adaptive Red Teaming (
red_team) - Investigator Agent (
looped_investigator) - [`bandit/`](bandit/README.md): Contextual bandit synthetic environment
(bandit_env.py), bandit DISCO / BUW-eBH / Type-I runners (bandit_disco.py, run_bandit_disco.py), and Bayesian hyperparameter optimization via open-source Vizier (tune_bandit_disco.py).
---
Quick Start
1. Synthetic Contextual Bandit Experiments (Section 5)
Run a Monte Carlo comparison across DISCO (--alpha_calibration_mode=post_hoc by default, or pre_hoc), BUW-eBH (offline_ebh), and Type-I error control (type1). Use --runner_type=sxs for BUW-eBH vs. DISCO or --runner_type=all to include Type-I:
python -m disco.bandit.run_bandit_disco \ --runner_type=all \ --env_type=contextual \ --alpha=0.10 \ --budget=900 \ --chunk_size=30 \ --num_mc_runs=100 \ --output_path=./outputs/bandit_all.json
Run Bayesian hyperparameter optimization using google-vizier:
python -m disco.bandit.tune_bandit_disco \ --runner_type=disco \ --alpha=0.10 \ --budget=900 \ --chunk_size=30 \ --num_trials=200 \ --output_dir=./outputs/bandit_vizier_tuning
See [bandit/README.md](bandit/README.md) for full details.
---
2. Generative Model Behavior Discovery with DISCO (Section 6)
You can...
Excerpt shown — open the source for the full document.