File size: 2,552 Bytes
101f064
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
license: apache-2.0
language:
  - en
tags:
  - rag
  - code-retrieval
  - verified-ai
  - constitutional-halt
  - bft-consensus
  - aevion
size_categories:
  - 10K<n<100K
task_categories:
  - question-answering
  - document-retrieval
---

# Aevion Codebase RAG Benchmark

**Verified structured-retrieval benchmark** extracted from a real Python codebase (968 source files, 21,149 chunks) with cryptographically signed partition proofs.

## What's in this dataset

| File | Description |
|------|-------------|
| `codebase_corpus.jsonl` | 21,149 Python code chunks with 6-field structural metadata |
| `codebase_queries.jsonl` | 300 enterprise query-decomposition pairs |
| `partition_proofs.jsonl` | XGML-signed proof bundles per query |
| `benchmark_results.csv` | Precision/recall/F1 per retrieval method (60 eval queries) |
| `benchmark_summary.json` | Aggregate metrics and auto-tuning parameters |
| `tuning_summary.json` | Grid-search results across 10K synthetic docs |

## Corpus Schema

Each chunk in `codebase_corpus.jsonl` has:

```json
{
  "doc_id": "chunk_000000",
  "text": "module.ClassName (path/to/file.py:20)",
  "layer": "core",
  "module": "verification",
  "function_type": "class",
  "keyword": "hash",
  "complexity": "simple",
  "has_docstring": "yes",
  "source_path": "core/python/...",
  "source_line": 20
}
```

## Benchmark Results (60 eval queries)

| Method | Precision | Recall | F1 | Exact Match |
|--------|-----------|--------|----|-------------|
| naive | 0.516 | 0.657 | 0.425 | 11.7% |
| instructed | 1.000 | 0.385 | 0.463 | 23.3% |
| verified_structural | 1.000 | 0.385 | 0.463 | 23.3% |
| verified_consensus | 1.000 | 0.437 | 0.503 | 31.7% |
| **verified_structural_ensemble** | **1.000** | **0.459** | **0.527** | **33.3%** |

Key finding: Structural + ensemble retrieval achieves **100% precision** (zero irrelevant chunks) vs. 51.6% for naive keyword search.

## Method

1. **AST extraction**: Python files parsed with `ast` module → class/function/method chunks
2. **6-field structural metadata**: layer, module, function_type, keyword, complexity, has_docstring
3. **Constitutional Halt labeling**: VarianceHaltMonitor (σ > 2.5x threshold) as automatic quality gate
4. **XGML proof bundles**: Ed25519-signed proof chain on every partition plan

## Related

- [Aevion Verifiable AI](https://github.com/aevionai/aevion-verifiable-ai) — source codebase
- Patent US 63/896,282 — Variance Halt + Constitutional AI halts

## License

Apache 2.0 — freely use for research and commercial applications.