EverMind-AI commited on
Commit
ddacd50
·
verified ·
1 Parent(s): 2be7f84

Initial upload

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: Qwen/Qwen3-Reranker-0.6B
4
+ library_name: transformers
5
+ pipeline_tag: text-ranking
6
+ tags:
7
+ - reranker
8
+ - cross-encoder
9
+ - retrieval
10
+ - agent-skills
11
+ - skill-routing
12
+ - skillcorpus
13
+ language:
14
+ - en
15
+ ---
16
+
17
+ # skillcorpus-reranker-0.6b
18
+
19
+ A cross-encoder for **agent-skill retrieval**: given a task and a candidate skill
20
+ document, judge whether the skill helps. Fine-tuned from
21
+ [Qwen/Qwen3-Reranker-0.6B](https://huggingface.co/Qwen/Qwen3-Reranker-0.6B).
22
+
23
+ Reranks the candidates recalled by
24
+ [skillcorpus-embedding-0.6b](https://huggingface.co/EverMind-AI/skillcorpus-embedding-0.6b).
25
+ Because scoring is one forward pass per (task, skill) pair, run it on a shortlist
26
+ — typically the encoder's top 10–20 — not the whole corpus.
27
+
28
+ | | |
29
+ |---|---|
30
+ | Parameters | 596M |
31
+ | Layers | 28 |
32
+ | Precision | bfloat16 |
33
+ | Output | `P("yes")` in `[0, 1]` |
34
+
35
+ ## Usage
36
+
37
+ The model answers a yes/no question; the relevance score is the softmax over the
38
+ `yes` and `no` logits at the final position.
39
+
40
+ ```python
41
+ import torch
42
+ from transformers import AutoModelForCausalLM, AutoTokenizer
43
+
44
+ MODEL = "EverMind-AI/skillcorpus-reranker-0.6b"
45
+ tok = AutoTokenizer.from_pretrained(MODEL, padding_side="left")
46
+ model = AutoModelForCausalLM.from_pretrained(MODEL, dtype=torch.bfloat16).cuda().eval()
47
+
48
+ PREFIX = ('<|im_start|>system\nJudge whether the Document meets the requirements '
49
+ 'based on the Query and the Instruct provided. Note that the answer can '
50
+ 'only be "yes" or "no".<|im_end|>\n<|im_start|>user\n')
51
+ SUFFIX = '<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\n'
52
+
53
+ YES, NO = tok.convert_tokens_to_ids("yes"), tok.convert_tokens_to_ids("no")
54
+
55
+
56
+ def score(pairs, max_length=4096):
57
+ prompts = [PREFIX + p + SUFFIX for p in pairs]
58
+ enc = tok(prompts, padding=True, truncation=True,
59
+ max_length=max_length, return_tensors="pt").to(model.device)
60
+ with torch.no_grad():
61
+ logits = model(**enc).logits[:, -1, :]
62
+ pair = torch.stack([logits[:, NO], logits[:, YES]], dim=-1)
63
+ return torch.softmax(pair, dim=-1)[:, 1].float().tolist()
64
+
65
+
66
+ INSTRUCT = ("Given a task description, judge whether the skill document "
67
+ "is relevant and useful for completing the task")
68
+
69
+
70
+ def pair(task, name, description, body):
71
+ return (f"<Instruct>: {INSTRUCT}\n\n"
72
+ f"<Query>: {task}\n\n"
73
+ f"<Document>: {name} | {description} | {body}")
74
+
75
+
76
+ task = "resolve conflicts after a git merge"
77
+ print(score([
78
+ pair(task, "resolve-conflicts", "Resolve git merge conflicts.", "..."),
79
+ pair(task, "sourdough", "Bake sourdough bread.", "..."),
80
+ ]))
81
+ # -> [0.98, 0.01]
82
+ ```
83
+
84
+ Two things to keep intact: the `PREFIX` / `SUFFIX` template, since the score is
85
+ read off the final-position logits, and the `<Instruct>` / `<Query>` /
86
+ `<Document>` layout with blank lines between the parts. Truncate the document
87
+ body, not the template.
88
+
89
+ ## Intended use
90
+
91
+ Second-stage reranking over a shortlist recalled by
92
+ [skillcorpus-embedding-0.6b](https://huggingface.co/EverMind-AI/skillcorpus-embedding-0.6b)
93
+ — typically its top 20–50. Scoring is one forward pass per (task, skill) pair,
94
+ so it does not scale to a whole registry. Scores are calibrated per pair;
95
+ compare them within one candidate list, not across different tasks.
96
+
97
+ ## Citation
98
+
99
+ ```bibtex
100
+ @article{wang2026skillcorpus,
101
+ title = {SkillCorpus: Consolidating and Evaluating the Open Skill Ecosystem for Real-World LLM Agents},
102
+ author = {Wang, Yanze and Yao, Pengfei and Sun, Tianyi and Hu, Chuanrui and Xiao, Yan and Luo, Xiaotian and Han, Yunyun and Chen, Yifan and Sun, Jun and Deng, Yafeng},
103
+ year = {2026},
104
+ eprint = {2607.15557},
105
+ archivePrefix = {arXiv},
106
+ url = {https://arxiv.org/abs/2607.15557}
107
+ }
108
+ ```
109
+
110
+ ## License
111
+
112
+ Apache-2.0, inherited from the base model. Skills in the corpus keep their own
113
+ upstream licenses.
chat_template.jinja ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- set instruction = messages | selectattr("role", "eq", "system") | map(attribute="content") | first | default("Given a web search query, retrieve relevant passages that answer the query") -%}
2
+ {%- set query_text = messages | selectattr("role", "eq", "query") | map(attribute="content") | first -%}
3
+ {%- set document_text = messages | selectattr("role", "eq", "document") | map(attribute="content") | first -%}
4
+ <|im_start|>system
5
+ Judge whether the Document meets the requirements based on the Query and the Instruct provided. Note that the answer can only be "yes" or "no".<|im_end|>
6
+ <|im_start|>user
7
+ <Instruct>: {{ instruction }}
8
+ <Query>: {{ query_text }}
9
+ <Document>: {{ document_text }}<|im_end|>
10
+ <|im_start|>assistant
11
+ <think>
12
+
13
+ </think>
14
+
15
+
config.json ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3ForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 151643,
8
+ "dtype": "bfloat16",
9
+ "eos_token_id": 151645,
10
+ "head_dim": 128,
11
+ "hidden_act": "silu",
12
+ "hidden_size": 1024,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 3072,
15
+ "layer_types": [
16
+ "full_attention",
17
+ "full_attention",
18
+ "full_attention",
19
+ "full_attention",
20
+ "full_attention",
21
+ "full_attention",
22
+ "full_attention",
23
+ "full_attention",
24
+ "full_attention",
25
+ "full_attention",
26
+ "full_attention",
27
+ "full_attention",
28
+ "full_attention",
29
+ "full_attention",
30
+ "full_attention",
31
+ "full_attention",
32
+ "full_attention",
33
+ "full_attention",
34
+ "full_attention",
35
+ "full_attention",
36
+ "full_attention",
37
+ "full_attention",
38
+ "full_attention",
39
+ "full_attention",
40
+ "full_attention",
41
+ "full_attention",
42
+ "full_attention",
43
+ "full_attention"
44
+ ],
45
+ "max_position_embeddings": 40960,
46
+ "max_window_layers": 28,
47
+ "model_type": "qwen3",
48
+ "num_attention_heads": 16,
49
+ "num_hidden_layers": 28,
50
+ "num_key_value_heads": 8,
51
+ "pad_token_id": null,
52
+ "rms_norm_eps": 1e-06,
53
+ "rope_parameters": {
54
+ "rope_theta": 1000000,
55
+ "rope_type": "default"
56
+ },
57
+ "sliding_window": null,
58
+ "tie_word_embeddings": true,
59
+ "transformers_version": "5.2.0",
60
+ "use_cache": true,
61
+ "use_sliding_window": false,
62
+ "vocab_size": 151669,
63
+ "rope_theta": 1000000
64
+ }
generation_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 151645,
6
+ 151643
7
+ ],
8
+ "pad_token_id": 151643,
9
+ "temperature": 0.6,
10
+ "top_k": 20,
11
+ "top_p": 0.95,
12
+ "transformers_version": "5.2.0"
13
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1faa5f3c2c305cc63b2eaaadb95cbafd50163faf717f0adc15de018fef305a40
3
+ size 1191588280
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9a01676060aa035ffebeb8a78c23b1074c2ca1b57082f8839255317a4108309e
3
+ size 11422749
tokenizer_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "is_local": true,
9
+ "model_max_length": 131072,
10
+ "pad_token": "<|endoftext|>",
11
+ "padding_side": "left",
12
+ "split_special_tokens": false,
13
+ "tokenizer_class": "Qwen2Tokenizer",
14
+ "unk_token": null
15
+ }