riceboy26 commited on
Commit
df454b5
·
verified ·
1 Parent(s): 1bee797

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +27 -63
README.md CHANGED
@@ -27,81 +27,50 @@ configs:
27
  path: qrels.jsonl
28
  ---
29
 
30
- # GitBench: Real-World GitHub Pull Request Benchmark for AI Coding Agents
31
 
32
- **GitBench** (originally *GitState-Bench*) is an open evaluation benchmark developed by the **Knot AI** team ([@Knot-Repo](https://github.com/Knot-Repo)) to rigorously evaluate how AI coding assistants, code search systems, and Retrieval-Augmented Generation (RAG) engines handle **temporal code evolution, obsolete logic, draft proposals, and deployment secrets**.
33
 
34
  ---
35
 
36
  ## Benchmark Motivation
37
 
38
- Most coding benchmarks (e.g. HumanEval, MBPP, SWE-bench) evaluate whether a model can synthesize code from a static snapshot. However, in production engineering environments, developer context is constantly evolving through Git commits and Pull Requests.
39
 
40
- AI agents regularly fail in three subtle, high-severity ways:
41
- 1. **Temporal Obsolescence (Recency Trap)**: Retrieving legacy code that was active last week instead of the newly merged refactor.
42
- 2. **Brainstorm / Draft Contamination**: Treating unmerged draft RFCs or rejected PR proposals as authoritative production behavior.
43
- 3. **Confused Deputy Secret Leakage**: Accidentally surfacing sensitive CI/CD deployment tokens or internal keys embedded in repository histories.
44
-
45
- GitBench benchmarks these failure modes on real merged Pull Requests scraped from **25 top Python (pip) & AI engineering repositories**.
46
 
47
  ---
48
 
49
  ## Dataset Scale & Repository Coverage
50
 
51
- - **Total Corpus Documents:** `1,788` (`447` merged active gold implementations, `447` superseded legacy baselines, `447` unmerged draft proposals, `447` synthetic CI/CD secret traps)
52
- - **Developer Queries:** `447` natural multi-condition retrieval queries
53
  - **Relevance Judgments (`qrels`):** `1,788` graded relevance pairs (`4,023` total records across splits)
54
  - **25 Sampled Repositories:**
55
  `fastapi/fastapi`, `pydantic/pydantic`, `anthropics/anthropic-sdk-python`, `vercel/ai`, `encode/httpx`, `psf/requests`, `pallets/flask`, `tiangolo/sqlmodel`, `openai/openai-python`, `langchain-ai/langchain`, `run-llama/llama_index`, `astral-sh/uv`, `huggingface/transformers`, `vllm-project/vllm`, `pandas-dev/pandas`, `numpy/numpy`, `scikit-learn/scikit-learn`, `pytorch/pytorch`, `sqlalchemy/sqlalchemy`, `celery/celery`, `pytest-dev/pytest`, `Textualize/rich`, `streamlit/streamlit`, `gradio-app/gradio`, `BerriAI/litellm`.
56
 
57
  ---
58
 
59
- ## Dataset Structure
60
-
61
- The benchmark is split into three standard Information Retrieval (IR) tables:
62
-
63
- ### 1. `corpus`
64
- Contains repository documentation, PR snippets, and baseline descriptions:
65
- - **`id`**: Unique document identifier (e.g., `fastapi_fastapi_pr_11520_active_gold`).
66
- - **`repo`**: Source GitHub repository (e.g., `fastapi/fastapi`, `pydantic/pydantic`).
67
- - **`pr_number`**: GitHub Pull Request number.
68
- - **`pr_url`**: Verifiable public link to the original GitHub PR.
69
- - **`doc_type`**: One of four semantic classes:
70
- - `active_v2_gold`: Real merged PR implementation (the ground-truth current behavior).
71
- - `superseded_v1`: Pre-PR legacy implementation superseded by this PR.
72
- - `brainstorm_unconfirmed`: Unmerged / draft proposal on the same repository.
73
- - `admin_secret_trap`: Synthetic CI/CD deploy token config designed to test leakage prevention.
74
- - **`title`**: Descriptive title.
75
- - **`text`**: Full context snippet.
76
-
77
- ### 2. `queries`
78
- Natural developer questions targeting specific features:
79
- - **`query_id`**: Unique query identifier.
80
- - **`repo`**: Repository under question.
81
- - **`pr_number`**: Targeted PR.
82
- - **`text`**: Developer question (e.g., *"In fastapi/fastapi, what is the current merged implementation and behavior regarding: Add OpenAPI schema validation...?"*).
83
- - **`gold_id`**: Ground truth active document ID.
84
- - **`superseded_id`**: Obsolete distractor ID.
85
- - **`draft_id`**: Unmerged proposal distractor ID.
86
- - **`secret_id`**: Secret trap distractor ID.
87
-
88
- ### 3. `qrels`
89
- Standard TREC/BEIR relevance judgments:
90
- - **`query_id`**: Query ID.
91
- - **`corpus_id`**: Document ID.
92
- - **`score`**: Relevance rating:
93
- - `2`: Primary Ground Truth (`active_v2_gold`).
94
- - `0`: Distractor (`superseded_v1` or `brainstorm_unconfirmed`).
95
- - `-1`: Security Penalty (`admin_secret_trap`).
96
 
97
  ---
98
 
99
- ## Evaluation Metrics
100
 
101
- When evaluating a retrieval model or coding agent:
102
- - **Active Policy Hit@1 (%)**: Proportion of queries where the newly merged implementation is ranked #1.
103
- - **Superseded Contamination Rate (%)**: Frequency where obsolete legacy behavior is chosen over merged logic.
104
- - **Unauthorized Leak Rate (%)**: Percentage of runs that surface the secret trap document.
 
 
105
 
106
  ---
107
 
@@ -110,27 +79,22 @@ When evaluating a retrieval model or coding agent:
110
  ```python
111
  from datasets import load_dataset
112
 
113
- # Load GitBench directly from Hugging Face
114
- dataset = load_dataset("knot-ai/gitbench")
115
-
116
- print(dataset["corpus"][0])
117
- print(dataset["queries"][0])
118
  ```
119
 
120
  ---
121
 
122
  ## Citation & Attribution
123
 
124
- If you use GitBench in your research or evaluation, please cite:
125
-
126
  ```bibtex
127
  @misc{knot_ai_gitbench_2026,
128
  author = {Knot AI Team},
129
  title = {GitBench: Evaluating Temporal Causal Freshness and Secret Containment in AI Coding Agents},
130
  year = {2026},
131
  publisher = {Hugging Face},
132
- howpublished = {\\url{https://huggingface.co/datasets/knot-ai/gitbench}}
133
  }
134
  ```
135
-
136
- Developed by the **Knot AI Team** — context continuity and governance across autonomous AI agents.
 
27
  path: qrels.jsonl
28
  ---
29
 
30
+ # GitBench (v2): Real-World GitHub Pull Request State & Security Benchmark for AI Coding Agents
31
 
32
+ **GitBench** (originally *GitState-Bench*) is an open evaluation benchmark developed by the **Knot AI** team ([@Knot-Repo](https://github.com/Knot-Repo)) to rigorously evaluate how AI coding assistants, code search systems, and Retrieval-Augmented Generation (RAG) engines handle **temporal code evolution, obsolete baseline specifications, unmerged RFC proposals, and 12 families of production credentials**.
33
 
34
  ---
35
 
36
  ## Benchmark Motivation
37
 
38
+ Most coding benchmarks (e.g., HumanEval, MBPP, SWE-bench) evaluate whether a model can synthesize code from a static snapshot. However, in production engineering environments, developer context evolves continuously through Git commits and Pull Requests.
39
 
40
+ AI agents and vector retrieval layers regularly fail in three high-severity ways:
41
+ 1. **Temporal Obsolescence (The "Verbose Legacy vs. Concise Update" Trap):** Retrieving a verbose legacy architecture specification (`superseded_v1`) instead of a concise newly merged PR (`active_v2_gold`) because both share $>85\%$ of their domain vocabulary.
42
+ 2. **Brainstorm / Draft RFC Contamination:** Treating unmerged draft RFCs or exploratory proposals (`brainstorm_unconfirmed`) as authoritative production behavior.
43
+ 3. **High-Entropy Secret Leakage vs. False-Positive Over-Quarantine:** Leaking unprefixed HMAC keys or authenticated database/Redis DSN URIs into prompts (`admin_secret_trap`)—or conversely, falsely quarantining benign engineering notes that contain high-entropy Git commit SHAs and UUIDv4 trace IDs.
 
 
44
 
45
  ---
46
 
47
  ## Dataset Scale & Repository Coverage
48
 
49
+ - **Total Corpus Documents:** `1,788` (`447` merged active specifications, `447` superseded baseline specifications, `447` unmerged RFC/draft proposals, `447` multi-family runtime secret configurations)
50
+ - **Developer Queries:** `447` natural active implementation queries + `447` paired historical audit queries (`historical_text`)
51
  - **Relevance Judgments (`qrels`):** `1,788` graded relevance pairs (`4,023` total records across splits)
52
  - **25 Sampled Repositories:**
53
  `fastapi/fastapi`, `pydantic/pydantic`, `anthropics/anthropic-sdk-python`, `vercel/ai`, `encode/httpx`, `psf/requests`, `pallets/flask`, `tiangolo/sqlmodel`, `openai/openai-python`, `langchain-ai/langchain`, `run-llama/llama_index`, `astral-sh/uv`, `huggingface/transformers`, `vllm-project/vllm`, `pandas-dev/pandas`, `numpy/numpy`, `scikit-learn/scikit-learn`, `pytorch/pytorch`, `sqlalchemy/sqlalchemy`, `celery/celery`, `pytest-dev/pytest`, `Textualize/rich`, `streamlit/streamlit`, `gradio-app/gradio`, `BerriAI/litellm`.
54
 
55
  ---
56
 
57
+ ## 12-Family Credential & Benign High-Entropy Design
58
+
59
+ Unlike synthetic benchmarks that test only a single hardcoded token prefix (such as `ghp_`), GitBench v2 distributes `447` secret traps across **12 realistic credential families** while embedding benign high-entropy **Git commit SHAs** and **UUIDv4 trace identifiers** into normal engineering documents:
60
+ - **50% Unprefixed High-Entropy Secrets (6 Families):** `WEBHOOK_SIGNING_SECRET`, `JWT_HS256_PRIVATE_KEY`, `MASTER_ENCRYPTION_KEY`, `OAUTH_CLIENT_SECRET`, `INTERNAL_AUTH_TOKEN`, `SESSION_HMAC_SECRET` ($H \ge 3.85\text{ bits/char}$, no vendor prefix—missed completely by prefix regexes).
61
+ - **25% Authenticated Service & Database DSN URIs (3 Families):** PostgreSQL (`postgresql://...`), Redis Cluster (`redis://:...`), and AMQP/Celery (`amqp://...`) connection strings with high-entropy embedded passwords ($H \ge 3.10\text{ bits/char}$).
62
+ - **25% Vendor-Prefixed Tokens & Private Key Headers (3 Families):** AWS (`AKIA...`), Anthropic (`sk-ant-...`), and `OPENSSH PRIVATE KEY` blocks.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
  ---
65
 
66
+ ## Empirical Baseline Results (`all-MiniLM-L6-v2`, 384D)
67
 
68
+ | Architecture | Scoped Active `v2` (Invariant) | Global Multi-PR Top-1 | Historical Audit Recall@1 | Credential Leak @ 5 | Benign Code False Quarantines | In-Memory Latency |
69
+ | :--- | :---: | :---: | :---: | :---: | :---: | :---: |
70
+ | **Standard Vector RAG (HNSW Cosine)** | `60.2%` | `56.8%` | `43.0%` | `65.1%` | `0 / 1,341` | `0.013 ms` |
71
+ | **Hybrid Lexical + Vendor-Prefix Regex Only** | `63.5%` | `61.5%` | `43.0%` | `49.7%` (Misses unprefixed) | `0 / 1,341` | `0.070 ms` |
72
+ | **Hybrid Lexical + Unconditioned Shannon Entropy** | `7.6%` | `8.5%` | `43.0%` | `1.3%` | `1,020 / 1,341` (SHAs/UUIDs) | `0.068 ms` |
73
+ | **Knot CARMA-16 Engine + UCS Protocol** | **`100.0%`** (0 Stale/Draft) | **`89.5%`** | **`86.4%`** | **`0.0%`** (12/12 Families) | **`0 / 1,341`** (`0.0%` FPR) | **`0.079 ms`** |
74
 
75
  ---
76
 
 
79
  ```python
80
  from datasets import load_dataset
81
 
82
+ # Load GitBench v2 directly from Hugging Face (4,023 records)
83
+ corpus = load_dataset("knot-ai/gitbench", split="corpus") # 1,788 PR state documents
84
+ queries = load_dataset("knot-ai/gitbench", split="queries") # 447 active + historical queries
85
+ qrels = load_dataset("knot-ai/gitbench", split="qrels") # 1,788 TREC/BEIR relevance judgments
 
86
  ```
87
 
88
  ---
89
 
90
  ## Citation & Attribution
91
 
 
 
92
  ```bibtex
93
  @misc{knot_ai_gitbench_2026,
94
  author = {Knot AI Team},
95
  title = {GitBench: Evaluating Temporal Causal Freshness and Secret Containment in AI Coding Agents},
96
  year = {2026},
97
  publisher = {Hugging Face},
98
+ howpublished = {\url{https://huggingface.co/datasets/knot-ai/gitbench}}
99
  }
100
  ```