Skip to content

feat: compaction quality benchmark suite - #4

Draft
TheArchitectit wants to merge 1 commit into
masterfrom
worktree-benchmark-suite
Draft

feat: compaction quality benchmark suite#4
TheArchitectit wants to merge 1 commit into
masterfrom
worktree-benchmark-suite

Conversation

@TheArchitectit

Copy link
Copy Markdown
Owner

What

Adds a deterministic benchmark suite that measures compaction quality across multiple compactors using a shared, format-agnostic fact extractor — no compactor gets a parsing advantage.

Structure

File Purpose
scripts/benchmark/facts.ts Fact model, weights, metrics
scripts/benchmark/extract.ts Symmetric fact extractor (applied to all compactors)
scripts/benchmark/compactors.ts Pluggable adapters: raw-truncate, mega-compact, pi-vcc-baseline, pi-vcc-ranked
scripts/benchmark/corpus.ts Synthetic (deterministic PRNG) + real session loaders
scripts/benchmark/score.ts Paired per-session scoring + honest aggregation
scripts/benchmark/run.ts CLI runner
docs/BENCHMARKS.md Methodology, reproduce steps, current results

200-session synthetic results (seed=42)

Compactor Recall (median) Density (median) Size (median)
mega-compact 56.4% 4.11 6.1k
pi-vcc-ranked 37.9% 4.08 4.1k
raw-truncate 41.8% 3.80 4.6k
pi-vcc-baseline 30.8% 4.69 2.9k

mega-compact leads on recall (+17.7% over raw-truncate baseline). pi-vcc-baseline leads on density (value per char).

Honesty notes

  • Published the full table — wins AND losses
  • Symmetric extraction: same regex parser on every brief
  • Paired deltas (per-session), not marginal medians
  • Caveats section documents what the benchmark does NOT measure
  • Real-session results deferred until ~/.pi/agent/sessions is populated

Reproduce

npm run build
npx tsx scripts/benchmark/run.ts --corpus=synthetic --seed=42 --limit=200

🤖 Generated with Claude Code

- scripts/benchmark/{facts,extract,compactors,corpus,score,run}.ts
- docs/BENCHMARKS.md with methodology, reproduce steps, and synthetic results
- Pluggable Compactor interface: raw-truncate, mega-compact, pi-vcc-baseline, pi-vcc-ranked
- Symmetric scoring via shared format-agnostic fact extractor (pi-vcc §3.1)
- Paired deltas vs baseline, not marginal medians (pi-vcc §3.4)
- Synthetic corpus: deterministic mulberry32 PRNG, configurable dup fraction
- Real corpus: reads ~/.pi/agent/sessions/*.jsonl (privacy: no transcript text in out/)
- All fully local, zero network (PREVENT-PI-004), deterministic

200-session synthetic results (seed=42):
  mega-compact: 56.4% recall, 4.11 density, 6.1k size
  pi-vcc-baseline: 30.8% recall, 4.69 density, 2.9k size
  pi-vcc-ranked: 37.9% recall, 4.08 density, 4.1k size
  raw-truncate: 41.8% recall, 3.80 density, 4.6k size

mega-compact leads on recall (+17.7% over baseline).
pi-vcc-baseline leads on density (value per char).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant