riceboy26 commited on
Commit
d5edfb1
·
verified ·
1 Parent(s): a437bfd

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +136 -0
README.md ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ task_categories:
4
+ - question-answering
5
+ - information-retrieval
6
+ language:
7
+ - en
8
+ tags:
9
+ - code
10
+ - github
11
+ - git
12
+ - benchmark
13
+ - coding-agents
14
+ - temporal-reasoning
15
+ - rag
16
+ - security
17
+ size_categories:
18
+ - 1K<n<10K
19
+ configs:
20
+ - config_name: default
21
+ data_files:
22
+ - split: corpus
23
+ path: corpus.jsonl
24
+ - split: queries
25
+ path: queries.jsonl
26
+ - split: qrels
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
+
108
+ ## Quickstart
109
+
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.