Review the prerequisites
Suitable for: Readers who can follow a request and its resulting state.
- Postcondition
- Facts that the business world must satisfy at the end of the task, such as that the report exists and has been published with approved content.
- Hard constraints
- Conditions that must be met individually, such as authorization, number of effects, and budget, are not averaged with language quality.
- Trajectory
- Key actions and their order during execution, used to check process constraints. They do not necessarily prescribe one fixed path.
- Held-out test set
- Samples excluded from tuning, used to evaluate changes on cases the tuning process has not been tailored to.
How does the mechanism work?
- 1Task contract
Fix inputs, required evidence, prohibited actions, and budgets. Keep labels out of model input.
- 2Run record
Bind prompt/model/data versions; retain tool events, artifacts, and business receipts.
- 3Hard gates
Check authorization, structure, citations, budgets, and effect counts separately. An average score cannot offset a dangerous failure.
- 4Semantic review
Check each free-form claim. Mark this dimension not_scored when review has not been performed.
- 5Comparison
Keep all attempts; report task counts, repetitions, denominators, failures, and unscored dimensions.
This experiment contains 8 authored tasks × 3 trials per version. It reports task/trial denominators and rule-gate results; semantic quality, model effects and production reliability are not measured.
Step-by-step explanation
- Define the task contract
Inputs, allowed actions, artifacts, and prohibited behaviors.
- Collect trusted facts
Observe business effects, permissions, usage, and key events.
- Evaluate each dimension
Handle rule checks and semantic review separately.
- Analyze and run regression checks
Report specific failure conditions, then retest changes and different valid paths.
Foundation · Understand the concepts
Define success before reading fluent answers
Objectives of this level: Separate business outcomes, hard constraints, semantic review and repeated-attempt questions.
Visual guide · Independent evidence, separate gates
Authorization, effect count and budget are hard gates. Good prose cannot cancel violations; an unscored dimension remains explicitly unscored. Select the figure to open it at full size.
An agent can say 'refund completed' without an effect receipt. It can also produce an attractive report after reading a forbidden tenant document. Outcome and process constraints therefore need different evidence: inspect authoritative state for the business result, permission/effect events for prohibited behavior, and review open text for claim quality.
Define the initial task, permitted actions, expected outcome and hard limits before running it. In this lab pass means business_ok and no authorization, duplicate-effect or budget violation. A high narration_score cannot offset a forbidden effect. Two valid trajectories, lookup→verify→finish and cache→verify→finish, may both pass when the same required facts hold.
Separate tasks from trials. Eight tasks run three times produce 24 trial records but only eight distinct task contexts. Single-trial success asks about one attempt. At-least-one observed success asks whether a correct candidate appeared in a group. Every-attempt success asks whether all observed attempts worked. These answer different operational questions; an oracle finding a successful attempt does not model a real selector that might accept a wrong one. Task/trial and outcome distinctions.
Authored fixtures let us test metric definitions and evaluator errors deterministically. They cannot measure real model quality, learning outcomes or production reliability. Keep that provenance attached to every reported ratio.
One record and the meaning of a gate
A trial records business_ok, authorized, effect_count/max_effect_count and budget_units/max_budget_units. business_ok must eventually be derived from an authoritative business artifact or receipt; these teaching records supply authored labels. The evaluator does not observe a live refund.
- A fluent but unauthorized attempt has business_ok=True, authorized=False and effect_count=1. It fails the authorization gate despite narration_score=0.95.
- A harmless attempt with business_ok=False, authorized=True, effect_count=0 and budget_units=0 violates no hard constraint but still fails its business task.
- A different allowed cache→verify→finish path may pass if it has the same required facts. Exact reference-step matching is not the acceptance contract.
The repaired summary reports hard_constraint_gate, quality_gate, quality_threshold and release_gate separately. Hard screening alone is not release. This lab defaults minimum_trial_success=1.0, so every observed trial must pass the business/rule contract. That is an explicit teaching threshold, not a universal production requirement; actual release needs declared quality thresholds and the other relevant reviewed dimensions. A dataset with zero successes and no violations has hard allow, quality block and release block.
An outcome oracle means a source or procedure that decides the expected business result; an oracle selector in the retry discussion is a hypothetical perfectly correct selector, which a real verifier is not.
Run experiments and observe counterexamples
Actual local calculations over authored trial/reference/judge fixtures. No live model, human calibration, measured latency/cost or independent deployment sample.
Python 3.10+ · Runs by default using only the standard library · Runs on your computer
- Compute A/B trial and task ratios.
- Inspect hard-gate slices and narration-only false accepts.
- Inspect the authored judge confusion matrix and assumption-based interval illustrations.
python3 -B evaluation_deep_dive.pyView the entry-point script
"""Actual statistics over authored trial and grader fixtures, Python 3.9+.
No model or human rater was run. Trials are correlated within tasks. This
file demonstrates metric definitions, false acceptance and release gates.
"""
import json
import math
TASKS = ['happy', 'alternative_path', 'timeout', 'permission', 'duplicate', 'citation', 'cancel', 'unanswerable']
PATTERNS = {
'A': [[1,1,1], [1,1,1], [1,0,1], [0,0,0], [1,0,1], [1,1,0], [1,0,0], [1,1,1]],
'B': [[1,1,1], [1,1,1], [1,0,1], [1,1,1], [1,0,1], [1,1,0], [1,0,1], [1,1,1]],
}
def fixtures(version):
records = []
for task, pattern in zip(TASKS, PATTERNS[version]):
for attempt, passing in enumerate(pattern, 1):
row = {'task_id': task, 'attempt': attempt, 'origin': 'authored_trial_fixture',
'business_ok': bool(passing), 'authorized': True, 'effect_count': 0,
'max_effect_count': 1, 'budget_units': 10 + attempt, 'max_budget_units': 20,
'narration_score': 0.95, 'trajectory': ['lookup','verify','finish']}
if task == 'alternative_path':
row['trajectory'] = ['cache','verify','finish']
if task == 'permission' and not passing:
row.update(business_ok=True, authorized=False, effect_count=1)
if task == 'duplicate' and not passing:
row.update(business_ok=True, effect_count=2)
if task == 'cancel' and not passing:
row.update(business_ok=True, budget_units=25)
records.append(row)
return records
def grade(row):
violations = []
if not row['authorized']:
violations.append('authorization')
if row['effect_count'] > row['max_effect_count']:
violations.append('duplicate_effect')
if row['budget_units'] > row['max_budget_units']:
violations.append('budget')
return {'pass': bool(row['business_ok']) and not violations, 'hard_violations': violations}
def trial_identities(records):
if not records:
raise ValueError('empty_dataset')
identities = [(r['task_id'], r['attempt']) for r in records]
if len(set(identities)) != len(identities):
raise ValueError('duplicate_trial_identity')
return set(identities)
def summary(records, minimum_trial_success=1.0):
# This lab's default is deliberately strict. A product must choose its own
# quality threshold and sampling plan before observing candidate scores.
trial_identities(records)
if type(minimum_trial_success) not in (int, float) or not math.isfinite(minimum_trial_success) or not 0 <= minimum_trial_success <= 1:
raise ValueError('quality_threshold')
grouped = {}
for row in records:
grouped.setdefault(row['task_id'], []).append(grade(row))
tasks = [{'task_id': task, 'passed': sum(r['pass'] for r in rows), 'attempts': len(rows),
'any_attempt_passed': any(r['pass'] for r in rows), 'every_attempt_passed': all(r['pass'] for r in rows)}
for task, rows in grouped.items()]
violations = {kind: sum(kind in grade(r)['hard_violations'] for r in records)
for kind in ('authorization','duplicate_effect','budget')}
hard_gate = sum(violations.values()) == 0
passed = sum(grade(r)['pass'] for r in records)
quality_gate = passed / len(records) >= minimum_trial_success
return {'trial_success': {'numerator': passed, 'denominator': len(records)},
'tasks_with_any_success': {'numerator': sum(t['any_attempt_passed'] for t in tasks), 'denominator': len(tasks)},
'tasks_with_all_success': {'numerator': sum(t['every_attempt_passed'] for t in tasks), 'denominator': len(tasks)},
'hard_violations': violations, 'hard_constraint_gate': 'allow' if hard_gate else 'block',
'quality_gate': 'allow' if quality_gate else 'block', 'quality_threshold': minimum_trial_success,
'release_gate': 'allow' if hard_gate and quality_gate else 'block', 'task_results': tasks,
'boundary': 'Descriptive fixture ratios; any-attempt success assumes an oracle chooses a correct attempt and is not a deployed retry policy.'}
def calibration(gold, judge):
if not gold or len(gold) != len(judge) or any(type(v) is not bool for v in gold + judge):
raise ValueError('calibration_shape')
tp = sum(g and j for g,j in zip(gold,judge))
tn = sum(not g and not j for g,j in zip(gold,judge))
fp = sum(not g and j for g,j in zip(gold,judge))
fn = sum(g and not j for g,j in zip(gold,judge))
return {'tp': tp, 'tn': tn, 'fp': fp, 'fn': fn, 'agreement': (tp+tn)/len(gold),
'precision': tp/(tp+fp) if tp+fp else None, 'recall': tp/(tp+fn) if tp+fn else None,
'origin': 'authored_reference_labels_and_judge_verdicts'}
def wilson(successes, total, z=1.959963984540054):
if type(successes) is not int or type(total) is not int or not 0 <= successes <= total or total < 1:
raise ValueError('binomial_counts')
p = successes / total
denom = 1 + z*z/total
center = (p + z*z/(2*total))/denom
radius = z*math.sqrt(p*(1-p)/total + z*z/(4*total*total))/denom
return [max(0, center-radius), min(1, center+radius)]
def zero_failure_upper(n, alpha=0.05):
if type(n) is not int or n < 1 or not 0 < alpha < 1:
raise ValueError('zero_failure_parameters')
return 1 - alpha**(1/n)
def paired_task_deltas(a, b):
attempts_a, attempts_b = trial_identities(a), trial_identities(b)
def group(rows):
result = {}
for r in rows:
result.setdefault(r['task_id'], []).append(grade(r)['pass'])
return result
left, right = group(a), group(b)
if left.keys() != right.keys() or attempts_a != attempts_b:
raise ValueError('unpaired_tasks')
return [{'task_id': t, 'A': sum(left[t])/len(left[t]), 'B': sum(right[t])/len(right[t]),
'delta': sum(right[t])/len(right[t])-sum(left[t])/len(left[t])} for t in left]
def demo():
a, b = fixtures('A'), fixtures('B')
gold = [True,True,True,True,False,False,False,False]
judge = [True,True,False,True,True,False,False,True]
swapped = [True,False,False,True,False,False,False,True]
return {'origin': 'authored_trials_and_judgments_actual_local_statistics', 'versions': {'A': summary(a), 'B': summary(b)},
'narration_only_evaluator': {'accepted': len(a), 'false_accepts': sum(not grade(r)['pass'] for r in a)},
'calibration': calibration(gold, judge),
'order_swap_fixture': {'disagreements': sum(x != y for x,y in zip(judge,swapped)), 'pairs': len(judge)},
'paired_task_deltas': paired_task_deltas(a,b),
'independent_sample_illustration': {'successes': 16, 'n': 24, 'wilson_95': [round(v,6) for v in wilson(16,24)],
'applies_to_trial_fixture': False, 'reason': 'Repeated authored trials are not independent sampled tasks.'},
'zero_failure_illustration': {'n': 30, 'one_sided_95_failure_upper': round(zero_failure_upper(30),6),
'assumption': 'Independent representative Bernoulli trials, stationary failure probability; not established by these fixtures.'},
'boundary': 'No measured model accuracy, latency, monetary cost, human agreement or deployment reliability.'}
if __name__ == '__main__':
print(json.dumps(demo(), indent=2, sort_keys=True))
Expected output when running locally
{
"boundary": "No measured model accuracy, latency, monetary cost, human agreement or deployment reliability.",
"calibration": {
"agreement": 0.625,
"fn": 1,
"fp": 2,
"origin": "authored_reference_labels_and_judge_verdicts",
"precision": 0.6,
"recall": 0.75,
"tn": 2,
"tp": 3
},
"independent_sample_illustration": {
"applies_to_trial_fixture": false,
"n": 24,
"reason": "Repeated authored trials are not independent sampled tasks.",
"successes": 16,
"wilson_95": [
0.467063,
0.820278
]
},
"narration_only_evaluator": {
"accepted": 24,
"false_accepts": 8
},
"order_swap_fixture": {
"disagreements": 2,
"pairs": 8
},
"origin": "authored_trials_and_judgments_actual_local_statistics",
"paired_task_deltas": [
{
"A": 1.0,
"B": 1.0,
"delta": 0.0,
"task_id": "happy"
},
{
"A": 1.0,
"B": 1.0,
"delta": 0.0,
"task_id": "alternative_path"
},
{
"A": 0.6666666666666666,
"B": 0.6666666666666666,
"delta": 0.0,
"task_id": "timeout"
},
{
"A": 0.0,
"B": 1.0,
"delta": 1.0,
"task_id": "permission"
},
{
"A": 0.6666666666666666,
"B": 0.6666666666666666,
"delta": 0.0,
"task_id": "duplicate"
},
{
"A": 0.6666666666666666,
"B": 0.6666666666666666,
"delta": 0.0,
"task_id": "citation"
},
{
"A": 0.3333333333333333,
"B": 0.6666666666666666,
"delta": 0.3333333333333333,
"task_id": "cancel"
},
{
"A": 1.0,
"B": 1.0,
"delta": 0.0,
"task_id": "unanswerable"
}
],
"versions": {
"A": {
"boundary": "Descriptive fixture ratios; any-attempt success assumes an oracle chooses a correct attempt and is not a deployed retry policy.",
"hard_constraint_gate": "block",
"hard_violations": {
"authorization": 3,
"budget": 2,
"duplicate_effect": 1
},
"quality_gate": "block",
"quality_threshold": 1.0,
"release_gate": "block",
"task_results": [
{
"any_attempt_passed": true,
"attempts": 3,
"every_attempt_passed": true,
"passed": 3,
"task_id": "happy"
},
{
"any_attempt_passed": true,
"attempts": 3,
"every_attempt_passed": true,
"passed": 3,
"task_id": "alternative_path"
},
{
"any_attempt_passed": true,
"attempts": 3,
"every_attempt_passed": false,
"passed": 2,
"task_id": "timeout"
},
{
"any_attempt_passed": false,
"attempts": 3,
"every_attempt_passed": false,
"passed": 0,
"task_id": "permission"
},
{
"any_attempt_passed": true,
"attempts": 3,
"every_attempt_passed": false,
"passed": 2,
"task_id": "duplicate"
},
{
"any_attempt_passed": true,
"attempts": 3,
"every_attempt_passed": false,
"passed": 2,
"task_id": "citation"
},
{
"any_attempt_passed": true,
"attempts": 3,
"every_attempt_passed": false,
"passed": 1,
"task_id": "cancel"
},
{
"any_attempt_passed": true,
"attempts": 3,
"every_attempt_passed": true,
"passed": 3,
"task_id": "unanswerable"
}
],
"tasks_with_all_success": {
"denominator": 8,
"numerator": 3
},
"tasks_with_any_success": {
"denominator": 8,
"numerator": 7
},
"trial_success": {
"denominator": 24,
"numerator": 16
}
},
"B": {
"boundary": "Descriptive fixture ratios; any-attempt success assumes an oracle chooses a correct attempt and is not a deployed retry policy.",
"hard_constraint_gate": "block",
"hard_violations": {
"authorization": 0,
"budget": 1,
"duplicate_effect": 1
},
"quality_gate": "block",
"quality_threshold": 1.0,
"release_gate": "block",
"task_results": [
{
"any_attempt_passed": true,
"attempts": 3,
"every_attempt_passed": true,
"passed": 3,
"task_id": "happy"
},
{
"any_attempt_passed": true,
"attempts": 3,
"every_attempt_passed": true,
"passed": 3,
"task_id": "alternative_path"
},
{
"any_attempt_passed": true,
"attempts": 3,
"every_attempt_passed": false,
"passed": 2,
"task_id": "timeout"
},
{
"any_attempt_passed": true,
"attempts": 3,
"every_attempt_passed": true,
"passed": 3,
"task_id": "permission"
},
{
"any_attempt_passed": true,
"attempts": 3,
"every_attempt_passed": false,
"passed": 2,
"task_id": "duplicate"
},
{
"any_attempt_passed": true,
"attempts": 3,
"every_attempt_passed": false,
"passed": 2,
"task_id": "citation"
},
{
"any_attempt_passed": true,
"attempts": 3,
"every_attempt_passed": false,
"passed": 2,
"task_id": "cancel"
},
{
"any_attempt_passed": true,
"attempts": 3,
"every_attempt_passed": true,
"passed": 3,
"task_id": "unanswerable"
}
],
"tasks_with_all_success": {
"denominator": 8,
"numerator": 4
},
"tasks_with_any_success": {
"denominator": 8,
"numerator": 8
},
"trial_success": {
"denominator": 24,
"numerator": 20
}
}
},
"zero_failure_illustration": {
"assumption": "Independent representative Bernoulli trials, stationary failure probability; not established by these fixtures.",
"n": 30,
"one_sided_95_failure_upper": 0.095034
}
}- A=16/24 and B=20/24; both release gates block.
- A any/all-success tasks=7/8 and 3/8; B=8/8 and 4/8.
- Calibration TP/TN/FP/FN=3/2/2/1; false narration accepts=8.
code example
Business failure without a dangerous effect
A read-only answer can be wrong while authorized, within budget and free of duplicate effects. Its safety screening may allow, but its quality verdict must fail. This is why the repaired release decision combines both gates instead of using absence of dangerous writes as task success.
Acceptance task for this level
Write a release contract using the three fixed record cases and separate outcome, authorization, effect-count, budget and semantic-review dimensions. State a quality threshold before evaluation; classify the valid alternate path and the harmless business failure.
Reading this browser’s record…
Hide the answer and check your understanding
If version B improves the mean pass count but still executes one duplicate refund, may the average justify release?
Expand reference derivation
No under this contract. Duplicate effect is a hard gate. A quality average and a constraint failure remain separate facts; the violation must be resolved or the contract explicitly reconsidered with justified risk ownership.
Further explanations and practice
When encountering unfamiliar principles, first read the implementation, continuous questioning and migration cases, and then independently explain the premise and boundaries. Answers and notes are saved to the original account record.
All linked explanations and exercises (5 )
- Acceptance is an evidence contract, not a prose impression · answer independently
- Evaluate both outcomes and execution traces · answer independently
- Independent and representative evaluation samples · answer independently
- A judge is a fallible measurement component · answer independently
- The success metric must match the allowed execution policy · answer independently
Sources and verification scope
The principles are based on public information; the numbers, cases and tasks are the teaching design of this website. Offline experiments verify the range noted on this page, and the learning effect still needs to be judged through independent tasks and feedback.
- Anthropic: agent evaluation task/trial/outcome distinctions
- NIST: binomial proportion intervals
- Local evaluation statistics and actual results
- Core experiments: download and run on a computer
- Complete after-sales Agent project: run on a computer
- Same-project evaluation, fault decisions and requirement changes
- Frozen traces, grading and budget evidence
- Atomic facts and rule derivations
- Versioned evidence contracts and preserved raw records
- Human semantic review practice
- Zero-request rubric, forms and trace-grounded cases
- Same-task review and repair cycle
- Zero-request cycle execution evidence
- Source-based review practice
- Learner exercise execution evidence