AletheiaFact / AletheiaFact/agencia

Instrumentation & research phase: benchmark pipeline against human reviews

Open
#24 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2
Forks
0
PR merge metrics
No merged PRs in 30d

Description

## Context

Before Phase 4 (MCP plugin architecture), we need proper metrics to measure pipeline quality and establish a benchmark against human fact-checkers. PR #23 delivered the LLM provider abstraction and gazette harness pattern — this issue defines the next phase.

## Data Source

`reviewtasks.csv` — 154 human-reviewed fact-checks from AletheiaFact with:
- **135 complete records** (claim + report + sources + verification)
- **9 classification categories**: trustworthy (33), trustworthy-but (34), false (27), misleading (22), exaggerated (9), unsustainable (6), not-fact (2), arguable (1), unverifiable (1)
- **96% human cross-check agreement** (104/108)
- **Inferred search type**: 133 online, 2 gazette
- All Portuguese language

## Part 1: Pipeline Instrumentation

### 1.1 Classification Taxonomy Normalization
- Normalize pipeline output to use slugs (`trustworthy-but`) instead of display names (`Trustworthy, but`)
- Create a mapping module shared between pipeline output and benchmark comparison
- Apply normalization in `report.py`, `gazette_reporter.py`, and `cross_checker.py`

### 1.2 Per-Node Metrics Collection
- Token usage (input/output) per LLM call
- Latency per node (wall clock)
- Cost per claim breakdown (by node and model tier)
- Store as part of `reasoning_log` or a new `metrics` state field

### 1.3 Harness-Specific Metrics
- **Contradiction detection quality**: Is `contradictory_evidence` finding real contradictions or boilerplate "no contradictions found"?
- **Raw-vs-analyzed agreement**: Does the AI analysis in `gazette_analysis` faithfully represent `raw_gazette_passages`?
- **Confidence extraction**: Parse the confidence decomposition from `cross_checker` output (evidence quality, analysis accuracy, overall confidence)

## Part 2: Benchmark Research

### 2.1 Dataset Preparation
- Load `reviewtasks.csv`, filter to 135 complete records
- Normalize classification slugs
- Infer search type from sources (gazette URLs vs web)
- **Filter out time-sensitive claims** — claims referencing specific dates/political events that may have different evidence today (need heuristic: mentions of specific years, election cycles, COVID dates)
- Output: `tests/fixtures/benchmark_claims.json`

### 2.2 Pipeline Benchmark Run
- Run each claim through the pipeline with `search_type=online` (since 133/135 are online)
- Save full execution results with metrics
- Compare pipeline classification vs human classification
- Compute: accuracy, per-category precision/recall/F1, confusion matrix

### 2.3 Cross-Check Feature Exploration
Use the pipeline itself to cross-check human reports — a potential product feature where:
- Input: a human-written fact-check report + claim
- Pipeline: runs independent verification and compares
- Output: agreement/disagreement with explanation

This mirrors the existing human cross-check workflow (96% agreement rate is the target to match).

### 2.4 Analysis Deliverables
- Classification accuracy vs human reviewers (overall + per-category)
- Systematic bias identification (which categories does the pipeline over/under-predict?)
- Confidence calibration (does "high confidence" correlate with correct classifications?)
- Cost analysis (cost per claim by category and pipeline path)
- Comparison: OpenAI vs Anthropic (once credits are available)

## Decisions Made

| Question | Decision |
|----------|----------|
| Claim extraction | New `data_hash_lookup_sentences.content` column added to CSV |
| Classification taxonomy | Normalize to slugs (e.g., `trustworthy-but`) |
| Cross-check disagreements | Use original classification as ground truth; explore cross-check as a feature |
| Incomplete records | Exclude (filter to 135 complete records) |
| Language coverage | Portuguese only |
| Gazette vs online | Infer from source URLs |
| Temporal validity | Filter out time-sensitive claims |

## Implementation Order

1. Classification normalization module
2. Per-node metrics collection
3. Benchmark dataset preparation (with temporal filtering)
4. Benchmark run + analysis
5. Cross-check feature prototype

## Success Criteria

- Pipeline accuracy >= 70% on the benchmark (human agreement is 96%)
- Per-category precision/recall identified for all 9 categories
- Cost per claim documented
- Temporal filter reduces dataset to a stable, reproducible benchmark

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.