Datasets:
File size: 9,967 Bytes
7d3600d bfbf128 7d3600d 39ebca0 7d3600d 39ebca0 7d3600d 39ebca0 7d3600d 39ebca0 7d3600d 39ebca0 7d3600d 39ebca0 7d3600d bfbf128 7d3600d ca3c11b 7d3600d e590186 7d3600d 3136e63 7d3600d bfbf128 7d3600d 39ebca0 7d3600d 3136e63 7d3600d 3136e63 7d3600d 3136e63 7d3600d bfbf128 7d3600d ca3c11b 7d3600d 8079d89 7d3600d 3e78093 7d3600d bfbf128 7d3600d 39ebca0 7d3600d ca3c11b 7d3600d 8079d89 7d3600d e8bf471 | 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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | ---
pretty_name: DeepSkill
language:
- en
task_categories:
- text-retrieval
tags:
- agent-skills
- relevance-judgments
- qrels
size_categories:
- 1K<n<10K
source_datasets:
- WeihangSu/SRA-Bench
- Shiyu-Lab/Skill-Usage
# license: TODO
configs:
- config_name: labels
default: true
data_files:
- split: bigcodebench
path: flags/bigcodebench-flags.tsv
- split: champ
path: flags/champ-flags.tsv
- split: logicbench
path: flags/logicbench-flags.tsv
- split: medcalcbench
path: flags/medcalcbench-flags.tsv
- split: theoremqa
path: flags/theoremqa-flags.tsv
- split: skill_usage
path: flags/skill_usage-flags.tsv
- config_name: queries
data_files:
- split: bigcodebench
path: queries/bigcodebench.jsonl
- split: champ
path: queries/champ.jsonl
- split: logicbench
path: queries/logicbench.jsonl
- split: medcalcbench
path: queries/medcalcbench.jsonl
- split: theoremqa
path: queries/theoremqa.jsonl
- split: skill_usage
path: queries/skill_usage.jsonl
---
# DeepSkill
Graded relevance labels for evaluating agent skill retrieval on **SRA-Bench** (50 tasks, 26,262-skill corpus)
and **Skill-Usage** (25 tasks, 34,396-skill corpus). Three annotators graded each task's candidate skills from
0 to 3 and flagged skills that are malicious, contain incorrect information or are not actionable. The qrels
work with standard IR tools and the queries are included, so a retriever can be scored in a few lines (see
[Evaluate a retriever](#evaluate-a-retriever)).
The skills themselves are not included: they come from
[WeihangSu/SRA-Bench](https://huggingface.co/datasets/WeihangSu/SRA-Bench) and
[Shiyu-Lab/Skill-Usage](https://huggingface.co/datasets/Shiyu-Lab/Skill-Usage).
**Code:** [https://github.com/Jdh235/DeepSkill](GitHub)
| | SRA-Bench | Skill-Usage |
|---|---|---|
| Tasks | 50 (10 per dataset) | 25 |
| Judged task–skill pairs | 1,525 | 750 |
| Skills in the corpus | 26,262 | 34,396 |
SRA-Bench's tasks come from five datasets: BigCodeBench, CHAMP, LogicBench, MedCalc-Bench and TheoremQA.
Report the two benchmarks separately.
## Evaluate a retriever
The qrels are in TREC format, so `ir_measures`, `trec_eval` and PyTerrier read them directly. This example
scores BM25 on SRA-Bench with PyTerrier (`pip install python-terrier huggingface_hub`; needs Java 11 or
later). It downloads the qrels and queries from this dataset and the skills from SRA-Bench:
```python
import json, re
import pandas as pd
import pyterrier as pt
from huggingface_hub import hf_hub_download
from ir_measures import nDCG, P, R, Judged
LABELS = "jdh235/DeepSkill"
DATASETS = ["bigcodebench", "champ", "logicbench", "medcalcbench", "theoremqa"] # SRA-Bench
def download(repo, path):
return hf_hub_download(repo, path, repo_type="dataset")
qrels = pd.concat(pt.io.read_qrels(download(LABELS, f"qrels/{ds}-relevance.qrels")) for ds in DATASETS)
queries = pd.concat(pd.read_json(download(LABELS, f"queries/{ds}.jsonl"), lines=True) for ds in DATASETS)
queries = queries.rename(columns={"query_id": "qid"})
skills = json.load(open(download("WeihangSu/SRA-Bench", "corpus/corpus.json")))
# BM25 as in the judgment pool: lowercased, punctuation removed, no stemming or stopwords. Tokens over 100
# characters (base64 strings and the like) are dropped, which keeps the index small.
def tokenize(text):
return " ".join(w for w in re.sub(r"[^\w\s]", " ", text.lower()).split() if len(w) <= 100)
index = pt.IterDictIndexer("./skills_index", overwrite=True, meta={"docno": 128}, tokeniser="WhitespaceTokeniser",
stemmer=None, stopwords=None, properties={"max.term.length": "150"}).index(
{"docno": s["skill_id"], "text": tokenize("\n".join(s[k] for k in ("name", "description", "content") if s.get(k)))}
for s in skills)
bm25 = pt.apply.query(lambda q: tokenize(q["query"])) >> pt.terrier.Retriever(
index, wmodel="BM25", controls={"termpipelines": ""})
# Swap bm25 for your own retriever: any PyTerrier pipeline that returns skill_ids as docno
print(pt.Experiment([bm25], queries, qrels, eval_metrics=[nDCG@5, P(rel=2)@5, R(rel=2)@5, Judged@5], names=["BM25"]))
```
BM25 scores nDCG@5 0.276, P(rel=2)@5 0.176, R(rel=2)@5 0.246 and Judged@5 1.0: it was one of the pool
retrievers, so all of its top 5 is judged. A retriever outside the pool will have some unjudged skills.
**Skill-Usage.** Set `DATASETS = ["skill_usage"]` and load the skills from Skill-Usage's archive (788 MB)
instead. BM25 then scores nDCG@5 0.578.
```python
import io, zipfile
archive = zipfile.ZipFile(download("Shiyu-Lab/Skill-Usage", "skills-34k/skills.zip"))
skills = []
for line in open(download("Shiyu-Lab/Skill-Usage", "skills-34k/skills_meta.jsonl")):
meta = json.loads(line)
try:
text = io.TextIOWrapper(archive.open(f"{meta['skill_id']}/SKILL.md"), encoding="utf-8", errors="replace").read()
except KeyError: # no SKILL.md
text = ""
content = re.sub(r"^---\s*\n.*?\n---\s*\n", "", text, count=1, flags=re.DOTALL).strip() # drop the frontmatter
skills.append({"skill_id": meta["skill_id"], "name": meta.get("name", ""),
"description": meta.get("description", ""), "content": content})
```
**A run file.** To score a run you already have in TREC format:
```python
import ir_measures
from huggingface_hub import hf_hub_download
from ir_measures import nDCG, P, R, Judged
qrels = list(ir_measures.read_trec_qrels(hf_hub_download(
"jdh235/DeepSkill", "qrels/skill_usage-relevance.qrels", repo_type="dataset")))
run = list(ir_measures.read_trec_run("my_run.trec"))
print(ir_measures.calc_aggregate([nDCG@5, P(rel=2)@5, R(rel=2)@5, Judged@5], qrels, run))
```
Its query IDs must be the `query_id`s here and its document IDs the corpus's `skill_id`s. Ten Skill-Usage
`skill_id`s contain spaces (e.g. `benchflow-ai--FFmpeg Media Info`), which break the space-separated TREC
format. None of them is judged, so if your run includes one, replace its spaces with `_`. It still counts as
non-relevant, and every other skill keeps its rank.
**How to measure.** A skill counts as relevant when graded 2 or 3, so set `rel=2` in binary measures.
## Queries
`queries/{dataset}.jsonl` has the query text every retriever was given (some dense models prepend their own
instruction, as their model cards recommend), one `{"query_id", "query"}` per line.
For SRA-Bench this is the agent's prompt for the task: the dataset's prompt template around the question,
followed by the system prompt. For Skill-Usage it is the task's `instruction.md`.
The queries are optional. The grades judge each skill against the task, not against a particular query, so
you can write your own queries from the source benchmarks instead. A `query_id` is the `instance_id` in
SRA-Bench's `instances/{dataset}.json`, or the task's folder name in the
[Skill-Usage repository](https://github.com/UCSB-NLP-Chang/Skill-Usage)'s `tasks/` (we used commit
`03446d16f7b659ccc93ac5bd512f62e9b7fabb45`). To download the labels without them:
```bash
hf download jdh235/DeepSkill --repo-type dataset --exclude "queries/*"
```
## Files
`{dataset}` is `bigcodebench`, `champ`, `logicbench`, `medcalcbench` or `theoremqa` (SRA-Bench), or
`skill_usage`.
| Path | Contents |
|---|---|
| `qrels/{dataset}-relevance.qrels` | Final grade per pair: `query_id 0 skill_id grade` (0–3) |
| `flags/{dataset}-flags.tsv` | Final grade and quality flags per pair (tab-separated, header row; flag 1 = flagged). The dataset viewer shows these as the `labels` config |
| `queries/{dataset}.jsonl` | The query for each task (see [Queries](#queries)); the `queries` config in the viewer |
## How the labels were made
**Judgment pool.** Each task's pool is the union of 12 retrievers' top 5, plus any reference skill none of
them returned. Every task–skill pair in it was graded.
**Final grade.** The re-annotation grade if the pair was re-annotated (its first-round grades differed by two
or more), otherwise the median of the three first-round grades.
**Final flags.** Flags are given per skill, so a skill's flags repeat on each of its pairs. A flag any
annotator marked in the first round was re-annotated by all three, and is final if two of the three
second-round answers mark it; any other flag is final as not flagged.
**Malicious skills.** The annotators flagged 4 skills as malicious on SRA-Bench and 1 on Skill-Usage. Flags
were annotated by eye: the annotators read each skill but did not run it or check it with security tools. A
flag is therefore a reader's judgement, and an unflagged skill is not known to be safe, all the more because
the flags cover only the judged skills. A skill can also change what it does over time, for example by
installing a package or downloading a file whose contents later change. Run agents that use skills from these corpora in an isolated environment.
## Licence
MIT License
Copyright (c) 2026 Jdh235
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
|