Knowledge Discovery
Session 05

Optimizing in the Dark: What Everybody Gets Wrong — but Not You

4 hours · Week 5

DRAFT: This content is under development. Check back closer to the course start date.

Learning Objectives

  • Interpret experimental results critically: what “statistically significant” actually means
  • Understand the winner’s curse: why your best result is probably wrong
  • Identify data leakage and its devastating effects on evaluation
  • Recognize the multiple comparisons problem and apply correction methods
  • Estimate required sample sizes using effect size and statistical power
  • Understand the organizational cost of bad measurement
  • Write pre-specified analysis plans before running experiments
  • Choose appropriate experimental designs: units of analysis, controls, and threats to validity
  • Build metric trees with north-star metrics, drivers, diagnostics, and guardrails
  • Design fair baselines and informative ablation studies
  • Handle variance correctly: choose repetition counts, statistical tests, and avoid multiple comparison traps
  • Conduct systematic error analysis to identify root causes of failure
  • Calibrate LLM judges and oracles against human labels
  • Report experiments reproducibly with full transparency

Topics

Materials

1. Experiments Are Tools for Learning and Deciding

An experiment is successful if it reduces uncertainty—whether that means making a concrete decision or simply deepening your understanding of a system, a dataset, or a phenomenon.

Decision-oriented experiments answer “what should we do?”:

  • Choose between Approach A vs B
  • Ship a change (because it improves the north-star and respects guardrails)
  • Iterate (because it improves one slice but fails on another)
  • Stop (because gains are too small relative to cost/complexity)

Understanding-oriented experiments answer “how does this work?” or “what is going on?”:

  • Characterize — how does the system behave under different conditions?
  • Discover — what patterns or structure exist in the data?
  • Explain — why does the system fail on this slice? What drives the variance?
  • Calibrate — how reliable is this metric / oracle / judge?

Both types benefit from the same rigor—clear questions, careful measurement, and honest reporting. The difference is what you do with the answer: act on it, or learn from it.

Before you run anything, write:
  • Question or decision: What will we learn or decide from this experiment?
  • Success threshold: What improvement is “worth it”? (for decision-oriented experiments)
  • Guardrails: What must not get worse (latency, cost, safety, human effort)?

Not every experiment needs a ship/no-ship decision. Curiosity-driven experiments—“what happens if…?”, “how does X relate to Y?”—are legitimate and important. Just be clear about which mode you’re in, so you don’t retrofit a decision onto an exploration or treat an exploration as confirmation.

1. Why Experiment Design Matters

Building a system is not the same as evaluating it. You can write elegant code, design clever prompts, and wire together powerful LLMs—but none of that tells you whether your approach works, why it works, or when it breaks.

Good experiment design lets you make defensible claims:

  • “Our interaction strategy converges in fewer turns than the baseline.”
  • “Embedding similarity improves recall of KB gaps at fixed precision.”
  • “This improvement persists across datasets/oracles and isn’t a seed artifact.”
Without careful design, you risk…
  • Confusing noise for signal
  • Mistaking bugs for research findings
  • Overfitting to your own benchmark
  • Drawing conclusions that don’t generalize

This guide walks through the full arc: problem framing → hypotheses → pre-specification → data → metrics → baselines → ablations → variance/statistics → interpretation → reporting.

2. From Research Questions to Hypotheses

2.1 Start with a Research Question (Broad)

A research question frames what you want to learn.

Conversational Clustering

How can a conversational system efficiently converge to a clustering that satisfies an oracle whose preferences are initially unknown and emerge through interaction?

KB Gap Detection

Can we automatically identify missing facts in a knowledge base by analyzing structural patterns and textual evidence?

2.2 Convert to a Testable Hypothesis (Falsifiable)

A hypothesis is a specific claim with measurable outcomes.

Conversational clustering hypotheses:

  • H1: Pairwise “should X and Y be together?” questions converge in fewer turns than full-clustering proposals.
  • H2: Modeling contradictory feedback (memory + resolution) improves final clustering quality vs treating feedback as independent.
  • H3: LLM-oracle behavior matches key human-oracle distributions (feedback types, convergence turns) well enough to be a valid simulator.

KB gap detection hypotheses:

  • H1: Embedding-based link prediction finds more valid missing triples than rule-based path mining at fixed precision.
  • H2: Structural + textual fusion outperforms either alone.
  • H3: Performance degrades gracefully as KB completeness increases (fewer true gaps).

2.3 Make Hypotheses “Specific Enough to Fail”

Bad

“Our system works well.”

Good

“Within 10 turns, our method achieves ≥ 0.75 pairwise F1 vs the oracle’s final clustering and ≥ 4/5 satisfaction, without increasing tokens-per-session by > 30%.”

Include:

  • Target metric(s)
  • Expected direction and magnitude
  • Failure condition: what result would falsify the hypothesis?

3. Pre-Specification: Write the Analysis Plan Before You Run

Pre-specification is the single most effective guard against fooling yourself. Write it down before you see any results. Once you’ve seen the numbers, every “clarification” risks becoming rationalization.
Pre-Spec Template (copy and fill in)
EXPERIMENT PRE-SPECIFICATION
============================

Primary hypothesis:
  [One sentence. Specific. Falsifiable.]

Primary metric:
  [Name, formula, unit, aggregation method.]

Primary slice (if applicable):
  [e.g., "per oracle persona," "per relation type"]

Conditions:
  [List all conditions including baselines.]

Stopping rule:
  [How many seeds/runs. When to stop a session.
   e.g., "5 seeds per condition; session stops at 15 turns
   or satisfaction ≥ 4 stable for 2 turns."]

Statistical method:
  [e.g., "paired bootstrap CI for Δ(turns), 10K resamples,
   α = 0.05." or "Wilcoxon signed-rank test, paired by dataset."]

Ship threshold:
  [e.g., "Ship if Δ(turns) ≥ 30% AND satisfaction does not
   decrease AND cost/session increases ≤ 20%."]

Secondary / exploratory metrics:
  [List. Label clearly as exploratory — not used for ship decision.]

Date: ___________

3.2 Why This Matters

Without a pre-spec, it’s tempting to:

  • Switch your “primary” metric to whichever one looks best
  • Add conditions after seeing partial results
  • Report a subset of runs that tell a cleaner story
  • Redefine “convergence” to favor your method

None of this is intentional dishonesty—it’s how human pattern-matching works. The pre-spec protects you from yourself.

Exploratory work is fine—just label it. Not every experiment starts with a crisp hypothesis. Early exploration (“let’s see what happens with different question types”) is legitimate and important. Just be honest about what’s exploratory vs. confirmatory. When an exploratory finding looks promising, write a pre-spec and run a clean confirmatory experiment.

4. Types of Experiments (Offline → Online)

Think of evaluation as a ladder:

  1. Offline (fastest): fixed dataset + labels/judges
  2. Replay: run on logged inputs with a stable scoring harness
  3. Shadow: run on real traffic, no user-visible impact
  4. Online A/B: randomize users/sessions; measure user outcomes

Use cheaper rungs to iterate and detect regressions, and expensive rungs to validate real-world impact.

Interactive systems note: Offline metrics may not capture usability (cognitive load, turn efficiency), so add protocol-based measures even in offline studies.

5. Experimental Design Fundamentals

5.1 Unit of Analysis and Randomization

Pick the “thing” that gets assigned to conditions. The right choice depends on where your independent variable acts:

UnitWhen to UseExample
Query / turn Testing per-turn decisions where turns are approximately independent Compare retrieval methods per query in KB gap detection
Session Testing end-to-end interaction strategies where turns depend on each other Compare two conversational clustering strategies across full conversations
Oracle / user When persistent individual differences dominate Measure whether oracle personality affects convergence speed
Dataset When the research question is about task properties Compare system performance across easy vs ambiguous datasets

For conversational clustering, session-level is usually the right unit: each session is one full conversation between the system and an oracle about one dataset.

5.2 Controls and Confounds

A confound is anything that differs across conditions besides your intended change:

  • Different LLMs (or different temperatures)
  • Different prompt budgets or context windows
  • Different compute/time limits
  • Different preprocessing or chunking
  • Different random seeds (run-to-run variance)
Rule: keep everything identical except the independent variable.

5.3 Threats to Validity

Include a threat assessment in every write-up. Use these checklists to self-audit:

Internal Validity — did X cause Y, or did a confound?
  • Same model version (pinned, not floating) across all conditions
  • Equal token / compute / turn budgets
  • No data leakage across splits (check for duplicates, near-duplicates)
  • Prompt text identical across conditions (except the intended change)
  • No silent model-provider updates mid-experiment (check canary inputs)
  • Random seed variance accounted for (multiple runs, not cherry-picked)
External Validity — will it generalize?
  • Tested on more than one dataset / domain
  • Tested with more than one oracle type (deterministic, LLM, human)
  • Not limited to a single time window or KB snapshot
  • Stress-tested on hard / ambiguous / adversarial cases, not just easy ones
Construct Validity — does the metric measure what you claim?
  • Metric directly relates to the goal (not a proxy three steps removed)
  • Checked for metric gaming (e.g., silhouette score ≠ human interpretability)
  • Oracle satisfaction not inflated by verbose/flattering system output
  • LLM-judge scores validated against human judgment on a calibration set
  • Downstream task metric included if claiming practical usefulness

6. Thinking About Data

6.1 What Role Does Data Play?

RoleDescriptionExample
Input dataWhat the system processesItems to cluster; KB triples
Reference / ground truthKnown-correct answersHuman-labeled clusters; known missing links
Interaction tracesDialogue logsOracle feedback and system actions
Held-out testUnseen evaluationNew items; new KB slices
Stress testsHard/edge casesAmbiguous items; adversarial feedback

6.2 Dataset Characterization (Mini “Dataset Card”)

For each dataset, document:

  • Domain, size, time range
  • How it was collected
  • Known biases / missingness
  • What “labels” mean and how reliable they are
  • Privacy constraints and redactions

6.3 Splits and Leakage (Especially with LLMs)

Common Leakage Sources
  • Duplicates across splits
  • Tuning prompts on the test set
  • LLM-oracle or LLM-judge having seen benchmark data during training
  • KB version drift (evaluating against a KB that changed)

Controls:

  • Maintain a strict separation: dev vs final evaluation
  • Use time-based or group-based splits when appropriate
  • Snapshot your KB and record the version/date

6.4 Synthetic vs Real Data: Tiered Evaluation

Synthetic setups accelerate iteration but can mislead. A good tiering strategy:

TierDataOracle TypePurpose
Tier 1 (synthetic) Planted clusters / planted KB gaps Deterministic oracle: LLM with ground truth + scripted rules Fast iteration, debugging, sanity checks
Tier 2 (semi-real) Real datasets (IMDB, Amazon, Wikidata) LLM oracle: LLM with preference specification, no ground truth Robustness testing, interaction diversity
Tier 3 (real) Real datasets Human oracle: actual people Final validation, calibrating LLM oracles
Report which tier you’re using and what claims it supports. Tier 1 can validate that your system converges at all; it cannot validate that LLM oracles behave like humans. Tier 3 is the only tier that supports claims about real-world usability.

7. Metrics: Measuring What Matters

7.1 Build a Metric Tree

Use this template for every experiment. Fill in all six rows before running.

Metric Tree Template
METRIC TREE
============

North-star (the one metric that defines success):
  [What ultimately matters. One metric.]

Driver metrics (levers that move the north-star):
  [2–4 metrics that contribute to the north-star.]

Diagnostics (explain *why* drivers move):
  [Metrics that help debug, not decide.]

Guardrails (must not regress):
  [Hard constraints. Experiment fails if these get worse.]

Slices (must report separately):
  [Subgroups where performance may differ.]

Budgets (operational constraints):
  [Tokens, latency, cost, human time.]
Filled Example: Conversational Clustering
Metric Tree — Conversational Clustering

North-star: Oracle satisfaction (1–5 scale, per session, mean across sessions)

Driver metrics:

  • Pairwise F1 vs oracle’s preferred clustering
  • Cluster description accuracy (oracle rates 1–5)
  • Stability (% of items that don’t change cluster in last 3 turns)

Diagnostics:

  • Contradiction rate (oracle corrections that reverse a prior correction)
  • “Misc/other” cluster size (% of items in catch-all clusters)
  • Merge/split frequency per turn

Guardrails: Turns ≤ 15 · Items shown per turn ≤ 40 · Tokens per session ≤ 60K

Slices: Per oracle persona (deterministic / LLM / human) · Per dataset difficulty (clear structure / ambiguous)

Budgets: Cost per session (USD) · Latency per turn (p50, p95)

Filled Example: KB Gap Detection
Metric Tree — KB Gap Detection

North-star: Precision@50 (top 50 predicted gaps, human-verified)

Driver metrics:

  • Recall of true gaps (at fixed review budget)
  • MRR across all candidate gaps
  • Relation-weighted precision (accounts for relation frequency)

Diagnostics:

  • Per-relation precision breakdown
  • Entity popularity bias (precision on rare vs frequent entities)
  • Candidate generation recall (before reranking)

Guardrails: False gap alert rate ≤ 15% (at review budget of 100) · No hallucinated entities (entities not in KB)

Slices: Per relation type · Per entity frequency bucket (head / torso / tail) · Per KB region

Budgets: Inference time per 1K candidates · Cost per 1K queries (if using LLM reranker) · Reviewer hours per 100 candidates

7.2 Intrinsic vs Extrinsic Metrics

  • Intrinsic: evaluates output in isolation (NMI, ARI, Hits@10, MRR)
  • Extrinsic: evaluates usefulness downstream (deflection rate, triage time)

Interactive clustering often needs oracle-based / extrinsic metrics because there may be no single ground truth.

7.3 Define Metrics Precisely (Formula + Unit + Aggregation)

Write:

  • Unit: per session / per dataset / per oracle
  • Aggregation: mean, median, p95
  • Meaningful difference: what Δ matters?
Pairwise F1

For each pair (i, j), check “same cluster?” in prediction vs reference.

  • Precision: predicted-same that are truly-same.
  • Recall: truly-same that are predicted-same.

7.4 Add Operational Metrics for LLM Systems

For every experiment that uses LLM calls, track:

  • Tokens in/out, calls/session
  • Latency (p50/p95)
  • Cost estimate
  • Failure rates (timeouts, tool errors)
These often determine what can ship.

8. Baselines and Controls

8.1 Baselines You Should Always Have

  • Trivial floor: random / all-in-one / all-separate
  • Reasonable non-interactive: k-means on embeddings; one-shot LLM clustering
  • Your system (full)
  • Ablations (next section)
8.2 Baseline Fairness (Avoid “Unfair Wins”)

If your method uses more compute/tokens, compare also under:

  • Equal token budget
  • Equal turn budget
  • Equal latency budget

Otherwise your result may just be “more resources helps.”

9. Ablation Studies (And Why They’re Non-Negotiable)

9.1 What Is an Ablation?

Remove or simplify one component to estimate its contribution. The term comes from medicine (removing tissue to understand its function). In systems work, it means: what happens when I take this piece out?

Ablations answer:

  • What matters
  • What is redundant
  • What is expensive but useless
  • Where improvements actually come from

9.2 How to Design Ablations

  1. Draw a block diagram: each block is a candidate ablation.
  2. Replace one block with a neutral/simple version.
  3. Change one thing at a time.
  4. Measure with the same harness and data.
Example Ablations: Conversational Clustering
ComponentFull VersionAblated Version
Question selectionInformation-gain-basedRandom selection
MemoryFull conversation history + summaryLast turn only
Contradiction handlingDetect + ask for clarificationIgnore contradictions
Uncertainty estimationCalibrated confidence scoresAlways confident
HierarchyHierarchical soft clusteringFlat hard clustering

9.3 Interaction Tests (When Components May Synergize)

If you suspect A and B interact, run a small factorial:

  • baseline
  • +A
  • +B
  • +A+B

This reveals synergy vs redundancy.

9.4 Cost Ablations (Highly Recommended)

Ablate expensive components first and plot quality against cost. This is often the real story—a component might contribute a 2% quality improvement at 40% of the total cost, which changes whether you’d actually use it.

Cost Ablation Example: Conversational Clustering
ConditionQuestion Selection ModelTokens/SessionTurns to ConvergeFinal F1Cost/Session
Full systemGPT-4 (multi-step reasoning)48K8.20.83$0.96
− Cheap selectionGPT-3.5 for selection, GPT-4 for rest31K9.10.81$0.41
− No selectionRandom questions22K14.70.79$0.28

Interpretation: Switching to GPT-3.5 for just the question-selection step saves 57% of cost with only a 1-turn slowdown and 2-point F1 drop. Whether that tradeoff is worthwhile depends on your deployment constraints—but you can only make that decision if you’ve measured both axes.

Cost Ablation Example: KB Gap Detection
ConditionRerankerInference TimePrecision@50Cost/1K Queries
Full pipelineCross-encoder reranker4.2s0.52$1.80
− RerankerEmbedding similarity only0.3s0.47$0.12

Interpretation: The reranker buys 5 points of precision but costs 14× more and is 14× slower. For a batch offline workflow, worth it. For an interactive tool, probably not.

10. Protocol Design for Interactive / Human-in-the-Loop Experiments

Interactive systems need a protocol that makes runs comparable.

10.1 Define the Session Contract

A session contract specifies the rules of engagement so that every run follows the same structure and results are comparable.

Example Session Contract: Conversational Clustering
Session Contract

System actions per turn. The system may do exactly one of:

  • Ask a pairwise question: “Should items X and Y be in the same cluster?”
  • Ask a cluster-level question: “Does this group make sense? Should it be split?”
  • Ask a global question: “Are you looking for broad themes or fine-grained categories?”
  • Present a clustering (full or partial) for feedback.

Oracle responses. The oracle may respond with:

  • Agreement / disagreement (yes/no + optional explanation)
  • Correction (“X should be in cluster B, not A”)
  • Redirect (“I care more about topic than sentiment”)
  • Satisfaction signal (“This looks good” / “Not there yet”)

Stopping rule. The session ends when the oracle rates satisfaction ≥ 4/5 and that rating is unchanged for 2 consecutive turns, or after a maximum of 15 turns.

Display constraints. The system shows at most 8 clusters and 5 example items per cluster per turn.

Without a contract like this, you’ll find that run-to-run differences in session structure make it impossible to tell whether outcome differences are due to your intervention or due to protocol drift.

10.2 Define the Instrumentation Schema (What Gets Logged)

Decide what to log before running. If you forget to log something, you can’t recover it.

Logging Schema Examples

Per-session fields:

{
  "session_id": "exp03-dataset02-oracle_llm-seed42",
  "condition": "strategic_selection",
  "seed": 42,
  "dataset_id": "imdb_500",
  "oracle_type": "llm_oracle",
  "oracle_persona": "detail_oriented_analyst",
  "model_id": "gpt-4-0613",
  "temperature": 0.2,
  "max_tokens": 800,
  "prompt_hash": "a3f8c1d2"
}

Per-turn fields:

{
  "turn_number": 4,
  "system_action": "pairwise_question",
  "displayed_items_count": 2,
  "displayed_clusters_count": 0,
  "oracle_response_type": "correction",
  "oracle_response_length_tokens": 34,
  "oracle_response_time_ms": 1200,
  "llm_calls": 2,
  "tokens_in": 3400,
  "tokens_out": 280,
  "latency_ms": 1850
}

End-of-session fields:

{
  "total_turns": 9,
  "convergence_reason": "satisfaction_stable",
  "final_satisfaction": 4,
  "final_pairwise_f1": 0.81,
  "total_tokens": 31200,
  "total_cost_usd": 0.41,
  "total_duration_s": 142
}

10.3 Convergence Criteria

Pick one and justify:

  • Oracle declares “done”
  • No cluster changes for N turns
  • Satisfaction ≥ threshold and stable
  • Pairwise disagreement < ε (if you can compute it)

10.4 Avoid Order Effects and Carryover

If the same human oracle sees multiple conditions:

  • Randomize condition order
  • Counterbalance across participants
  • Avoid showing the same dataset twice if learning carryover matters

10.5 Measure Cognitive Load (Don’t Just Claim It)

Proxies:

  • Items shown per turn
  • Words shown per turn
  • Response time
  • Self-reported effort (1–5)
  • Dropouts / fatigue signals

11. Handling Variance and Statistics (LLM-Aware)

11.1 Run Multiple Repetitions

LLMs are stochastic; clustering can be seed-sensitive. Run each condition ≥ 3–5 times (more if variance is high).

Report:

  • Mean ± std and/or median + IQR
  • Confidence intervals for differences (bootstrap is robust)

11.2 How Many Runs Do I Need? (Power and MDE Intuition)

Common Mistake

Students routinely run 3 seeds, see a 5% difference, and call it a finding.

Minimum Detectable Effect (MDE)

The smallest real difference your experiment can distinguish from noise. If your MDE is 15% but the true effect is 5%, you’ll miss it—not because the effect isn’t real, but because your experiment isn’t sensitive enough.

Practical approach using bootstrap (no formulas needed):

  1. Run a small pilot (3–5 seeds) of your baseline on one dataset.
  2. Compute your primary metric for each seed. Note the standard deviation.
  3. Use this rule of thumb: to detect an effect of size Δ, you need roughly N ≥ (2 × std / Δ)² runs per condition.
  4. Alternatively, bootstrap your pilot data: resample with replacement, compute the CI width for the mean. If the CI width is larger than the effect you care about, you need more runs.
Worked Example

You run 5 seeds of your baseline. Turns-to-convergence has mean 11.4, std 3.2. You want to detect a 30% improvement (≈ 3.4 turns).

Rule of thumb: N ≥ (2 × 3.2 / 3.4)² ≈ 3.5. So 5 seeds is probably adequate.

But if the std were 6.0, you’d need N ≈ 12—and your 5-seed experiment would be underpowered.

Key intuition for LLM pipelines: Variance across seeds is often much larger than students expect, especially for interactive systems where small early differences compound across turns. When in doubt, run more seeds. Five is a minimum; ten is better; three is almost never enough to be confident.

11.3 Choose Tests That Match Your Design

  • Paired tests (paired t / Wilcoxon) when runs are matched by dataset/oracle
  • Bootstrap CI for metric differences as the default
  • Report effect size (not just p-values)

11.4 Multiple Comparisons: Why Testing Many Things Inflates False Positives

If you run 20 experiments and use p < 0.05 as your significance threshold, you’d expect about 1 “significant” result purely by chance—even if none of your interventions actually work.

Practical mitigations:

  • Pre-specify primary comparisons (see Section 3). Before running, write down which 2–3 comparisons are your main claims.
  • Hold out a frozen test set. Use dev data to screen many ideas. Only evaluate your final 2–3 candidates on the held-out test set.
  • Validate winners on fresh data. If variant B “won” in your main experiment, run it once more on a new dataset or new oracle set.
  • Apply formal corrections when needed. Bonferroni divides your significance threshold by the number of tests. Benjamini-Hochberg controls the false discovery rate and is less conservative. For most student projects, pre-specifying and validating is sufficient.

12. Error Analysis: The Highest-Leverage Skill

12.1 Why Error Analysis Matters More Than Aggregate Metrics

An aggregate metric like “0.71 F1” tells you how well your system does. Error analysis tells you why it fails and what to try next. Without error analysis, improving a system is guesswork—you’re trying random things and hoping the number goes up.

12.2 How to Do Error Analysis (Step by Step)

  1. Collect failures. Gather all cases where the output was wrong or the oracle was unsatisfied.
  2. Sample and inspect. Sample 30–50 representative cases. Read them carefully—the actual items, the oracle’s words, the system’s choices.
  3. Categorize. Group failures into types. Don’t decide categories in advance—let them emerge from the data, then consolidate.
  4. Quantify. Count how many failures fall into each category. This is your error taxonomy.
  5. Prioritize. The largest category is usually your best next intervention.
12.3 Worked Example: Conversational Clustering Error Analysis

You run 30 sessions. 12 don’t reach satisfaction ≥ 4 within 15 turns. You inspect all 12:

Error CategoryCount% of FailuresExample
Memory loss after turn 5542% Oracle said “I care about topic, not sentiment” in turn 3; system asked sentiment-based questions in turns 7–9
Oracle overload325% System showed 12 clusters with 8 examples each; oracle responded “I can’t process all this”
Wasted turns on settled clusters217% Oracle confirmed clusters A and B twice; system kept asking about them
Ambiguous item handling217% Items that genuinely fit two clusters; system flip-flopped instead of asking
What this tells you: The biggest problem (42%) is memory loss—the system forgets earlier oracle guidance. This points directly at your state management component. You now have a concrete, evidence-based reason to invest in better memory, and you can measure whether the fix reduces this specific failure mode.
12.4 Worked Example: KB Gap Detection Error Analysis

Your system proposes 200 candidate missing triples. A human reviewer labels 104 as false positives. You inspect a sample of 50:

Error CategoryCount% of SampleExample
Entity ambiguity1836% “Paris” (city) confused with “Paris” (mythology); predicted (Paris, born_in, France)
Relation confusion1428% Predicted “authored” when the relation should be “edited”
Already in KB (version mismatch)1020% Triple was added to KB after the snapshot used for evaluation
Genuinely plausible but unverifiable816% Triple is plausible but no source confirms it
What this tells you: Entity disambiguation is the single biggest source of false positives (36%). Improving entity linking would likely have more impact than tuning the scoring model. The version mismatch category (20%) isn’t a system failure at all—it’s an evaluation artifact that you need to fix in your experimental setup.
12.5 Error analysis as a loop. Error analysis is not a one-time activity. After each improvement, re-run, re-analyze. The taxonomy will shift: old categories shrink, new ones emerge. This is the optimization loop in action (see Section 16).

13. LLM-as-Judge and LLM-as-Oracle: Calibration and Failure Modes

When you use an LLM to simulate an oracle or to judge output quality, that LLM becomes part of your measurement instrument. An uncalibrated instrument produces unreliable measurements.

13.1 Calibrate Against Human Labels

Before trusting LLM-judge or LLM-oracle outputs at scale, validate on a small human-labeled set:

  • Have humans perform the same task on 50–100 cases.
  • Run the LLM on the same cases.
  • Compute agreement: Cohen’s kappa, correlation, or accuracy on the human-labeled subset.
  • If agreement is low, your LLM proxy is not measuring what you think.

13.2 Test Self-Consistency (Reliability)

Run the same LLM-judge on the same inputs multiple times (3–5 repetitions). Measure how often it gives the same answer. If self-consistency is low (e.g., the LLM rates the same clustering 3/5 one time and 5/5 another time), then your “metric” has high measurement noise—and you need either more repetitions (averaged) or a better prompt.

13.3 Known LLM-Judge Biases

Watch For These Failure Modes
  • Verbosity preference: LLM judges tend to rate longer, more detailed outputs higher—even when the content is no better.
  • Positional bias: In pairwise comparisons, LLMs often prefer whichever option is presented first. Mitigate by randomizing order and averaging.
  • Citation / authority bias: LLM judges may rate outputs higher when they contain citations or authoritative-sounding language.
  • Sycophancy: An LLM oracle may agree with the system too readily, producing unrealistically easy conversations.

13.4 Practical Mitigations

  • Always calibrate on a human-labeled subset before trusting LLM judgments at scale.
  • Run self-consistency checks and report the variance.
  • Randomize presentation order in any pairwise LLM evaluation.
  • For LLM oracles: compare feedback type distributions (correction rate, redirect rate) against human data. If the LLM oracle almost never disagrees, it’s too easy.

14. Sanity Checks and Negative Controls

Run these before trusting results:

  • Random label test: if you randomize labels/feedback, performance should collapse.
  • Permutation invariance: renaming cluster IDs should not change metrics.
  • Leakage scan: duplicates across splits; near-duplicate items.
  • Budget sensitivity: if you halve token budget, does quality degrade smoothly?
  • Canary cases: a few hand-crafted examples that must behave predictably.
These turn silent bugs into obvious failures.

15. Worked Experiment Templates

15.1 Conversational Clustering: Interaction Strategy

Hypothesis: Information-gain question selection converges in fewer turns than random selection at equal token budget.

ElementSpecification
Independent variableQuestion selection strategy
Dependent variablesTurns, tokens, oracle satisfaction, pairwise F1 (when reference exists)
UnitSession
ControlsSame LLM (pinned version), same temperature, same max tokens, same initial clustering
Data5 datasets × 3 oracle personas (deterministic, LLM, human where feasible) × 2 conditions
Repetitions3 seeds each
Stopping ruleMax 15 turns or oracle satisfaction ≥ 4 and unchanged for 2 turns
Expected≥ 30% fewer turns at no worse satisfaction

Interpreting possible outcomes:

  • Fewer turns AND equal/better satisfaction: Ship it. The hypothesis is confirmed.
  • Fewer turns BUT lower satisfaction: Efficiency gain comes at quality cost. Investigate why. Consider a hybrid approach.
  • No significant difference in turns: Question selection strategy may not matter as much as expected. Run error analysis—perhaps the bottleneck is elsewhere.
  • Strategic selection is WORSE: Information-gain heuristic may be miscalibrated. Debug the heuristic before concluding strategic selection is a bad idea in general.
15.2 KB Gap Detection: Feature Fusion

Hypothesis: Structural+text fusion improves Precision@K at fixed review budget.

ElementSpecification
Independent variableFeatures (structural / textual / fusion)
Dependent variablesPrecision@50, Recall@K (if possible), MRR/Hits@10
ControlsSame model family, same training budget, same negative sampling strategy
DataStandard benchmark + realistic “patterned removals”
Repetitions5 seeds
ExpectedFusion wins across relation slices, not just globally

Interpreting possible outcomes:

  • Fusion wins globally and across most relation types: Strong result. Report per-relation breakdown.
  • Fusion wins globally but loses on some relation types: Report slice-level results honestly. This is a finding itself.
  • Fusion and structural-only indistinguishable: Textual features may not add useful signal. Check if the fusion mechanism is the problem, not the features.
  • Textual-only wins: Surprising—investigate data characteristics before drawing general conclusions.

16. Scaling and the Optimization Loop

16.1 The Optimization Loop

  1. Establish baseline + instrumentation
  2. Run error analysis → pick the biggest bottleneck
  3. Generate 2–5 targeted variants
  4. Screen offline → promote to shadow → confirm online (if applicable)
  5. Lock in, add regression tests, repeat

16.2 Error Taxonomies (Turn Failures into Next Steps)

Conversational clustering failures:

  • Poor question selection (wasted turns)
  • Memory loss / contradiction mishandling
  • Oracle overload (too much info)
  • Unstable clusters (flip-flopping)

KB gap detection failures:

  • Retrieval / candidate generation misses
  • False positives due to entity ambiguity
  • Relation-specific weaknesses
  • Evaluation leakage (easy negatives)

See Section 12 for how to build and use these taxonomies in practice.

17. Prompting and Chaining Are Interventions

When your “system” is an LLM pipeline—prompts, chains, retrieval steps, tool calls—every change is an intervention that needs the same rigor as a code change. Students often treat prompt tweaking as informal exploration. This is how you end up with a system that “works” on the three examples you checked and fails on everything else.

17.1 Prompt Changes Are Interventions

Changing a system prompt can shift behavior across your entire test set. Treat every prompt edit as a candidate that must be evaluated:

  • Save the exact prompt text (version it in git, or at minimum log it with a hash and timestamp)
  • Run the full evaluation harness, not just a few spot checks
  • Compare against the previous prompt version, not just your memory of how it worked

17.2 LLM Version Updates Can Silently Break Things

Model providers update endpoints without notice. A pipeline that worked last month may behave differently today.

Mitigations:

  • Pin model versions in experiments (e.g., gpt-4-0613, not gpt-4)
  • Include a few canary inputs with known-correct outputs; check these before trusting a full run
  • Log the model identifier returned in API responses, not just what you requested

17.3 Determinism Is Harder Than in Classical ML

Even at temperature 0, LLM outputs can vary across API calls due to batching, quantization, and infrastructure changes. This means:

  • Variance across runs is real and must be measured, even with “deterministic” settings
  • Caching exact LLM outputs for ablation studies (so you isolate your change from LLM variance) is a valid and recommended practice
  • When comparing two prompts, run them on the same inputs in the same session if possible

18. Common Traps (Consolidated Reference)

TrapWhat HappensWhere to Read More
No pre-specYou unconsciously pick the metric / slice / subset that looks bestSection 3
Too few seedsYou report noise as signal; a 5% difference on 3 seeds is meaninglessSection 11.2
Unfair baselineYour method uses 3× the tokens; “improvement” is just more computeSection 8.2
Metric ≠ goalYou optimize silhouette but claim “interpretable clusters”Section 5.3
Prompt driftYou tweak prompts on the test set and don’t version themSection 17.1
Model driftProvider updates the model; your results silently changeSection 17.2
Uncalibrated LLM judgeLLM judge prefers verbose output or agrees too easilySection 13
No error analysisYou see 0.71 F1 but have no idea what to fixSection 12
Multiple comparisonsYou test 20 things, report the 2 that “worked”Section 11.4
LeakageDuplicates across splits, or LLM was trained on your benchmarkSection 6.3
Single dataset / oracleResults don’t generalize; you’ve overfit to one scenarioSection 5.3
No cost reportingYour method “wins” but costs 10× more; nobody can use itSection 7.4, 9.4

19. Reporting and Reproducibility

19.1 What to Include in the Write-Up

  • Hypothesis + decision
  • Pre-spec (or label as exploratory)
  • Dataset card(s)
  • Metrics (definitions + why they match goals)
  • Baselines + fairness budgets
  • Ablations
  • Variance + CIs
  • Qualitative examples (2–3)
  • Limitations + failure cases
  • LLM-judge calibration results (if applicable)

19.2 Reproducibility Checklist

  • Exact model names/versions (pinned, not floating)
  • Prompts (in full, in an appendix) + prompt hashes
  • Temperature, top_p, max_tokens
  • Seeds + number of repetitions
  • Dataset versions / KB snapshots
  • Code commit hash
  • Logging schema for runs (see Section 10.2)
  • Cost per run (tokens + dollars)

20. Final Checklist (Before You Run)

Open the full pre-flight checklist
  • Pre-spec written (hypothesis, primary metric, stopping rule, ship threshold)
  • Hypotheses are specific and falsifiable
  • Unit of analysis + stopping rule defined
  • Metrics fully specified (formula, unit, aggregation) via metric tree
  • Baselines include trivial + reasonable
  • Ablations planned for key components and cost drivers
  • Controls prevent confounds (same LLM, same budgets, pinned model versions)
  • Multiple runs planned; checked that N is sufficient for expected effect size
  • Primary comparisons pre-specified (multiple comparisons awareness)
  • Sanity checks / negative controls included
  • Error analysis plan in place (not just aggregate metrics)
  • Instrumentation schema defined (per-session, per-turn, end-of-session)
  • LLM-judge/oracle calibrated against human labels (if applicable)
  • Reporting plan includes variance + qualitative examples
  • Privacy/ethics considered (esp. for human studies)
  • Prompts and model versions are logged and versioned

Summary

Experiment design is not bureaucracy—it’s how you turn exploration into knowledge.

  1. Start from a decision and a pre-specified, falsifiable hypothesis.
  2. Measure what you care about with a metric tree and guardrails.
  3. Compare against fair baselines and run ablations to understand causality.
  4. Do error analysis to understand why, not just how much.
  5. Treat variance as first-class—run enough seeds and report CIs.
  6. Calibrate your instruments (especially LLM judges and oracles).
  7. Treat every prompt and chain change as an intervention that needs evaluation.
  8. Log everything; version everything; report everything—including failures.