--- license: cc-by-4.0 language: - en size_categories: - n<10K task_categories: - text-classification - text-generation tags: - automated-prompt-optimization - apo - failure-mode-taxonomy - llm-evaluation - dspy - mipro - opro - gepa - reliability-audit pretty_name: APO Failure-Mode Dataset --- # APO Failure-Mode Dataset A labelled dataset of failure modes from Automated Prompt Optimization (APO) methods. Each record is one (run, held-out evaluation trace) tuple from a sweep cell where the optimised prompt **underperformed** the manual baseline by at least 0.5 standard deviations (the **D1b** inclusion criterion described below). Records carry one *primary* failure-mode tag from a locked 5-tag taxonomy plus zero or more secondary tags. This dataset is the primary deliverable of an ongoing USTH Master's thesis (defence target September 2026) titled *Automated Prompt Optimization for Large Language Model Applications Using DSPy and OPRO*. The dataset is the empirical substrate for **Claim 1** of the thesis (descriptive — *when APO underperforms, what kind of failed prompt does it produce?*). ## Dataset Summary - **Records**: 1,695 per-trace labels across 27 included runs from 27 sweep cells. - **Sweep substrate**: 32 realised cells (`optimiser × dataset × model`) at N=5 seeds — the complete Path-B grid, closed out 2026-08-02/03 — across 3 optimisers, 5 datasets, and 3 model families (see *Dataset Structure* below). - **Annotation pipeline**: a locked LLM-as-judge classifier (DeepSeek V4-flash) running the prompt at `prompts/failure_mode_judge.txt` of the source repository, with a deterministic short-circuit for `trivial_restatement` cases (similarity ≥ 0.95 to the manual baseline). - **Inclusion criterion**: D1b (effect-size). A run is included iff `optim_acc < baseline_acc − 0.5 × baseline_std` where `baseline_std` is the std across the N=5 seeds of the matching `optimizer="none"` cell. Fallback to D1a (point estimate) when the baseline cell has fewer than 3 successful seeds; `threshold_fallback` flags these records. - **Total judge cost** for the labels: $0.98 USD (DeepSeek V4-flash, max_tokens=4096). - **Status**: v0.2, public release (2026-08-30). Label validity is measured four ways (see *Annotators*): test–retest decoding stability κ = 0.925 (passes the pre-registered κ ≥ 0.7 gate), score-blind κ = 0.650, a 79% false-positive anchoring disposition, and the pre-registered seal — a **blind human annotation of the frozen 50-trace audit form, measured 2026-08-02 at author–judge κ = 0.925** (47/50 agreement; author-rater under a blind protocol, judge labels withheld). The human audit that gated public release is cleared. See *Considerations*. ## Supported Tasks - **Failure-mode classification.** Given an (optimised prompt, baseline prompt, held-out trace, question, gold) tuple, predict the primary failure-mode tag from {`trivial_restatement`, `instruction_collapse`, `exemplar_leak`, `over_specification`, `format_break`}. - **APO reliability auditing.** Each cell's underperformance pattern is a within-cell descriptive statistic; the dataset can be used to compare optimiser families' failure-mode profiles (e.g.\ MIPROv2's `instruction_collapse + format_break` vs.\ GEPA's `trivial_restatement + instruction_collapse + exemplar_leak` vs.\ OPRO's 100% `trivial_restatement`). ## Languages English (`en`) only. All prompts, traces, and rationales are English; the underlying APO benchmarks (GSM8K, HotpotQA, SST-5, AG News, HumanEval) are English-only. ## Dataset Structure ### Data Fields | field | type | description | |---|---|---| | `run_id` | string | Cell run identifier (`cell____seed_`). | | `cell_id` | string | Cell identifier without timestamp (groups the 5 seeds of one cell). | | `trace_index` | int32 | Position of this trace within the run's held-out evaluation slice. | | `task_name` | string | One of `gsm8k`, `hotpotqa`, `sst5`, `ag_news`, `humaneval`. | | `target_model` | string | The held-out evaluator model id (e.g.\ `deepseek-v4-flash`). | | `actual_model` | string | The provider-returned model id per the X.PIN.1 audit trail. | | `optimizer` | string | One of `dspy_mipro`, `opro`, `gepa`. (Baseline `none` cells are not in the dataset.) | | `seed` | int32 | Seed from {42, 43, 44, 45, 46}. | | `baseline_prompt_file` | string | Path of the frozen baseline file (`prompts/wei2022_gsm8k.txt` for GSM8K; `prompts/_baseline.txt` for the others, per X.BASELINE.1). | | `optimized_prompt` | string | The optimised prompt template the held-out evaluation ran with. | | `trace` | string | The model's raw completion on this held-out example. | | `completion_tokens` | int32 | Token count of the completion (per the provider's tokenizer). | | `is_correct` | bool | Did the trace score correct on this example under the task's primary metric? | | `inclusion_threshold` | string | Either `d1b` (effect-size) or `d1a` (fallback). | | `threshold_fallback` | string | `d1a` iff the baseline cell had < 3 seeds; null otherwise. | | `baseline_acc` | float64 | Mean accuracy across the matching `none` cell's N=5 seeds. | | `baseline_std` | float64 | Std across the matching `none` cell's N=5 seeds. | | `optimized_acc` | float64 | This run's accuracy on the held-out slice. | | `gap_std` | float64 | `(baseline_acc − optimized_acc) / baseline_std`. | | `primary_tag` | string | The primary failure-mode tag. One of {`trivial_restatement`, `instruction_collapse`, `exemplar_leak`, `over_specification`, `format_break`} or null. | | `all_tags` | list | Multi-label tag set (subsumes `primary_tag`). | | `rationale` | string | The judge's natural-language explanation. | | `confidence` | float64 | Judge's reported confidence in `primary_tag` ∈ [0, 1]. | | `source` | string | `deterministic` (similarity short-circuit), `llm_judge` (real LLM call), `judge_parse_failure` (empty / malformed JSON), or `excluded_dspy_serialization_bug` (substrate-level exclusion). | | `judge_actual_model` | string | Provider-returned judge model id, null for deterministic / excluded paths. | | `judge_cost_usd` | float64 | Per-record API cost in USD. | | `manual_label_subset` | string | Null in the parquet. The blind human audit's 50 labels (§ *Annotators*) are versioned in the source repository as a keyed sidecar (`outputs/audits/2026-07-28/labels.csv`, keyed by audit-form row id with the mapping in `form.md`). | ### Data Splits This is a single-split dataset (no train/val/test partition); records are organised by (cell, seed) provenance rather than by inference split. The dataset is intended as labelled evaluation material for downstream APO-reliability research, not for training. ### Per-source breakdown | `source` | count | % | |---|---:|---:| | `llm_judge` | 1004 | 59.2% | | `deterministic` | 691 | 40.8% | ### Per-primary-tag breakdown | `primary_tag` | count | % | |---|---:|---:| | `trivial_restatement` | 708 | 41.8% | | `format_break` | 376 | 22.2% | | `over_specification` | 308 | 18.2% | | `exemplar_leak` | 253 | 14.9% | | `instruction_collapse` | 49 | 2.9% | | `(none)` | 1 | 0.1% | ### Per-task breakdown | task | count | |---|---:| | `sst5` | 660 | | `hotpotqa` | 484 | | `ag_news` | 434 | | `gsm8k` | 117 | ### Per-optimiser breakdown | optimiser | count | |---|---:| | `gepa` | 1652 | | `opro` | 22 | | `dspy_mipro` | 21 | ### Per-model breakdown | model | count | |---|---:| | `Qwen/Qwen2.5-7B-Instruct-Turbo` | 847 | | `claude-haiku-4-5-20251001` | 610 | | `deepseek-v4-flash` | 238 | ## Dataset Creation ### Curation Rationale Two concurrent works frame the gap this dataset fills: - **Coin Flip** (Zhang et al., 2026; arXiv:2604.14585) reports that 49% of APO runs on Claude Haiku 4.5 underperform zero-shot, but releases only ANOVA results, not labelled failure traces. - **ETGPO** (Singh, Yadav & Blanco, 2026; arXiv:2602.00997) uses an error taxonomy to *drive* APO optimisation but does not release a labelled dataset of optimiser-side failures. The labelled-dataset deliverable in this dataset is, to our knowledge, the first published collection of multi-method × multi-task × multi-model APO failures with a fixed taxonomy and per-record provenance metadata. ### Source Data The held-out evaluation traces are model completions on standard NLP benchmarks (GSM8K, HotpotQA, SST-5, AG News, HumanEval), produced by three APO methods (DSPy MIPROv2, OPRO, GEPA) and one baseline (`none` — the manual baseline prompt). Each trace's underlying dataset is publicly available under its original license: - **GSM8K**: MIT License (Cobbe et al., 2021). Source: . - **HotpotQA**: CC BY-SA 4.0 (Yang et al., 2018). Source: . - **SST-5**: derived from the Stanford Sentiment Treebank (Socher et al., 2013) via the SetFit redistribution. Source: . - **AG News**: CC BY-SA 3.0 / public domain headlines. Source: . - **HumanEval**: MIT License (Chen et al., 2021). Source: . Only the model's completions and the gold/predicted scoring are reproduced in this dataset; the underlying questions / inputs are referenced by `(task_name, seed, trace_index)` so the upstream datasets can be reloaded deterministically. ### Annotations The annotation pipeline is a hybrid deterministic + LLM-as-judge classifier: 1. **Deterministic short-circuit** (`source == "deterministic"`). If the optimised prompt has cosine similarity ≥ 0.95 (whitespace-normalised) or is byte-identical to the manual baseline, the record is tagged `trivial_restatement` without an LLM call. This accounts for ~30% of dataset records. 2. **LLM-as-judge** (`source == "llm_judge"`). The remaining records are scored by DeepSeek V4-flash running the locked judge prompt at `prompts/failure_mode_judge.txt` (max_tokens=4096 to accommodate the model's hidden reasoning channel, see *Limitations*). The judge returns a JSON object with `tags`, `primary`, `rationale`, `confidence`. 3. **Parse-failure fallback** (`source == "judge_parse_failure"`). Records where the judge returned malformed JSON or empty content are tagged with a null `primary_tag` and a rationale preserving the raw response for human follow-up. 4. **Substrate exclusion** (`source == "excluded_dspy_serialization_bug"`). Records affected by the X.DSPY-SERIAL.1 substrate bug were excluded from the dataset pre-v0.1; the bug was fixed on 2026-06-02 and the affected cells re-classified, so v0.1 has 0 records in this bucket. #### Annotation Procedure - **Annotator**: DeepSeek V4-flash (versioned id `deepseek-v4-flash`, pinned per the X.PIN.1 audit). `judge_actual_model` records the provider-returned id per record. - **Prompt**: frozen at `prompts/failure_mode_judge.txt` once the production sweep started on 2026-06-02. Editing the prompt invalidates the inter-rater κ measurement per `AGENTS.md §2 rule 6`. - **Taxonomy**: 5 base tags (`trivial_restatement`, `instruction_collapse`, `exemplar_leak`, `over_specification`, `format_break`) — locked. Up to 2 reserved slots may be populated from an open-coding pass (`P4.OPENCODE.1`) before sweep lock; v0.1 ships with the 5 base tags only. #### Who are the annotators? The primary annotator is the DeepSeek V4-flash model running the locked judge prompt. Label reliability was measured four ways, in increasing order of independence: 1. **Test–retest decoding stability** (locked fallback): the judge re-labelled a 50-trace stratified subsample of its own judge-assigned traces (10 per primary tag; deterministic `trivial_restatement` labels excluded as reproducible by construction). **κ = 0.925** (observed 0.940, chance 0.200; PABAK 0.88) — passes the κ ≥ 0.7 gate. This is self-agreement at temperature 0, not inter-rater agreement. 2. **Score-blind re-judge**: masking the accuracy gap and the underperformance premise drops blind-vs-dataset agreement to **κ = 0.650** — the judge's labels partly depend on seeing the scores. 3. **Anchoring false-positive arm**: shown traces from runs that did *not* underperform, the judge still assigned a failure mode 79% of the time — an upper bound on its premise-following disposition. 4. **Blind human audit** (the pre-registered seal): **author–judge κ = 0.925** (measured 2026-08-02; observed 0.940, chance 0.200; PABAK 0.88) — **passes the κ ≥ 0.7 gate**. A human rater labelled the frozen 50-trace stratified form blind (judge labels withheld until all 50 labels were committed). Per-tag agreement: `exemplar_leak` 10/10, `format_break` 10/10, `instruction_collapse` 9/10, `over_specification` 9/10, `trivial_restatement` 9/10; all three disagreements lie within the interpretive trio (`instruction_collapse` ↔ `over_specification`/`trivial_restatement`). Two caveats: the rater is the source-thesis author (blind to labels, but not independent of the rubric — a second, independent rater would be the strongest version), and the audited sample is drawn from the two-family (DeepSeek + Qwen) dataset build, so traces contributed by the Haiku family after the audit carry judge labels only. Net verdict: the judge is internally consistent, the deterministic backbone plus the content-visible categories survive score-blinding, and a blind human rater concurs at κ = 0.925 — so the labels carry measured author–judge agreement, one step short of independent inter-rater confirmation. `instruction_collapse` remains the most score-anchored category (both raters saw the underperformance premise). ### Personal and Sensitive Information None. The underlying benchmarks are pre-existing public NLP datasets; model completions do not contain personal information. Prompt content is purely task instructions plus optimisation artefacts. ## Considerations for Using the Data ### Social Impact The dataset may be useful for researchers studying: - when automated prompt optimisation fails and why (Claim 1 / RQ1 of the source thesis), - whether published APO reliability benchmarks are reproducible across optimiser families (the cross-task profiles in this dataset answer this for the 32-cell substrate), - whether human evaluators agree with LLM-as-judge classification of optimisation failures (judge-internal bounds plus a blind human audit at κ = 0.925 are reported — see *Annotators*). It is **not suitable** for training stronger APO methods directly — the dataset is small (≈1k records), single-language, and was not constructed for generative training. ### Discussion of Biases The dataset reflects the substrate's biases: - **Task coverage** is limited to 5 well-studied APO benchmarks. There is no evidence that the failure-mode profile generalises to alignment, dialogue, or multilingual tasks. - **Model coverage** spans 3 model families (DeepSeek V4-flash, Claude Haiku 4.5, Qwen-2.5-7B-Instruct-Turbo); the Haiku tier was completed 2026-08-02/03 and carries GEPA runs only (see *Optimiser coverage* below). Haiku traces postdate the blind human audit and carry judge labels only. - **Optimiser coverage** is asymmetric: GEPA runs at full 5 × 3 grid; DSPy MIPROv2 and OPRO run only on `gsm8k × DeepSeek V4-flash` (Path B narrowing per `P4.MULTITASK.1` partial port). The full grid is a thesis-development item. - **Judge bias**: DeepSeek V4-flash labels the dataset. It has not been independently audited for systematic bias toward particular taxonomy tags. The M2 concurrent-validity pilot (planned) will quantify this. ### Other Known Limitations - **Human audit is author-rater, not independent**: the blind human audit (author–judge κ = 0.925, § *Annotators*) was annotated by the source-thesis author under a blind protocol. Blinding removes label leakage but not shared training on the rubric, so this is author–judge agreement under blinding rather than independent inter-rater reliability; the score-anchored `instruction_collapse` should still be read with the anchoring caveat in mind. - **DeepSeek V4-flash hidden reasoning** (X.PIN.2): V4-flash defaults to thinking-mode-on at the API layer, costing ~8pp accuracy on a GSM8K seed-42 probe. This dataset was produced from the **reasoning-disabled** substrate: all DeepSeek V4-flash cells were re-run with `extra_body={"thinking": {"type": "disabled"}}` (the `D-NEW-2` re-run), and this rebuild deduplicates to those thinking-off runs. Earlier thinking-on aggregates are superseded. - **Open-coding pass** (`P4.OPENCODE.1`): the 2 reserved taxonomy slots have not been populated. v0.1 ships with the 5 base tags only. - **Coin Flip replication cell** (`P4.REPLICATE.1`): not included in v0.1. It will appear in v0.2 as a separate `replication_cell` subset. ## Comparison to Concurrent Corpora | dataset | unit of analysis | size | release | |---|---|---:|---| | **APO Failure-Mode Dataset (this dataset)** | optimiser-output failure (prompt + trace) | ~1,695 | HF Hub | | **ETGPO** (Singh et al., 2026; arXiv:2602.00997) | task-error (LLM output failure) | not released as dataset | (paper only) | | **Tian et al.** (arXiv:2509.14404) | manually-written prompt defect | not released | (paper only) | | **MemAPO** (arXiv:2603.21520) | optimiser-internal memory artefact | not released | (paper only) | | **Coin Flip** (Zhang et al., 2026; arXiv:2604.14585) | ANOVA variance decomposition | aggregate only | (paper only) | This dataset is the first publicly-released dataset that is keyed on **(optimiser-output, failure-mode label)** tuples with per-record provenance. ## Reproducibility The dataset is fully reproducible from the source repository (private during thesis development; public release with thesis defence): 1. Run the 32-cell sweep via `scripts/run_sweep.py --config configs/sweep_main.yaml`. Cost: ≈ $16 USD across all cells (the Anthropic tier dominates). 2. Classify the failure modes via `scripts/classify_failures.py --all --concurrency 4 --judge-max-tokens 4096`. Cost: ≈ $2 USD. 3. Rebuild this card via `scripts/build_dataset_card.py`. Every record's parent run carries a `run_metadata.json` with git SHA, resolved cell config, provider-returned `actual_model`, and per-call cost. The substrate is git-pinned to `deepseek-v4-flash` (versioned id) per the X.PIN.1 audit and frozen baselines per X.BASELINE.1 (`prompts/_baseline.txt` for each task). ## Citation **TODO (defence September 2026)**: replace this placeholder with the thesis citation + an arXiv companion link. ```bibtex @misc{apo_failure_modes_2026, title = {APO Failure-Mode Dataset: A Labelled Dataset of Automated Prompt Optimization Failures}, author = {Dang Vu Son Tung}, year = {2026}, note = {USTH Master's thesis, v0.2}, howpublished = {Hugging Face Hub, \url{https://huggingface.co/datasets/tungdvs/apo-failure-modes}}, } ``` ## License This dataset is released under **CC BY 4.0**. The underlying benchmark datasets remain under their original licenses (see *Source Data*); each record's task field identifies the upstream license that applies to that record's underlying input.