Upload folder using huggingface_hub
Browse files- README.md +26 -3
- adapter_config.json +25 -7
- adapter_model.safetensors +2 -2
- chat_template.jinja +54 -0
- special_tokens_map.json +1 -1
- tokenizer_config.json +4 -3
- training_args.bin +2 -2
README.md
CHANGED
|
@@ -24,10 +24,33 @@ The **AskBeforeAnswer** model exhibits "clarification-seeking" behavior. When pr
|
|
| 24 |
|
| 25 |
## Pipeline
|
| 26 |
- **Base Model:** Qwen/Qwen2.5-7B-Instruct
|
| 27 |
-
- **
|
| 28 |
-
|
| 29 |
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
## Usage
|
| 33 |
```python
|
|
|
|
| 24 |
|
| 25 |
## Pipeline
|
| 26 |
- **Base Model:** Qwen/Qwen2.5-7B-Instruct
|
| 27 |
+
- **Ablation Winner:** The model variant promoted to Production via W&B Registry is:
|
| 28 |
+
`dpo`.
|
| 29 |
|
| 30 |
+
## LLM-as-a-Judge Evaluation Leaderboard
|
| 31 |
+
|
| 32 |
+
The following scores were computed using W&B Weave with a
|
| 33 |
+
Gemini-based judge scorer on a randomly selected
|
| 34 |
+
**50-sample** subset
|
| 35 |
+
of the `sewon/ambig_qa` (validation split).
|
| 36 |
+
|
| 37 |
+
| Metric | base | dpo_only | sft | sft_dpo | clarifier_lora |
|
| 38 |
+
|:----------------------|----------:|-----------:|---------:|----------:|-----------------:|
|
| 39 |
+
| ambiguity_detection | 0.978 | 0.964 | 0.972 | 0.976 | 0.998 |
|
| 40 |
+
| clarification_quality | 0.786 | 0.798 | 0.798 | 0.8 | 0.796 |
|
| 41 |
+
| usefulness | 0.882 | 0.896 | 0.9 | 0.9 | 0.896 |
|
| 42 |
+
| model_accuracy | 0.62 | 0.64 | 0.66 | 0.62 | 0.6 |
|
| 43 |
+
| clarify_precision | 0.617021 | 0.642857 | 0.675676 | 0.627907 | 0.6 |
|
| 44 |
+
| clarify_recall | 0.966667 | 0.9 | 0.833333 | 0.9 | 1 |
|
| 45 |
+
| clarify_f1 | 0.753247 | 0.75 | 0.746269 | 0.739726 | 0.75 |
|
| 46 |
+
| answer_f1 | 0.173913 | 0.357143 | 0.484848 | 0.296296 | 0 |
|
| 47 |
+
| macro_f1 | 0.46358 | 0.553571 | 0.615559 | 0.518011 | 0.375 |
|
| 48 |
+
| answer_accuracy | 0.05 | 0.1 | 0.1 | 0.1 | 0 |
|
| 49 |
+
| facet_generation_rate | 0.0212766 | 1 | 1 | 1 | 0 |
|
| 50 |
+
| clarify_ratio | 1.56667 | 1.4 | 1.23333 | 1.43333 | 1.66667 |
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
**GitHub Release:** [v0.0.5](https://github.com/chrisjcc/ask-before-answer/releases/tag/v0.0.5)
|
| 54 |
|
| 55 |
## Usage
|
| 56 |
```python
|
adapter_config.json
CHANGED
|
@@ -1,8 +1,18 @@
|
|
| 1 |
{
|
|
|
|
| 2 |
"alpha_pattern": {},
|
| 3 |
-
"
|
| 4 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
"bias": "none",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
"fan_in_fan_out": false,
|
| 7 |
"inference_mode": true,
|
| 8 |
"init_lora_weights": true,
|
|
@@ -10,25 +20,33 @@
|
|
| 10 |
"layers_pattern": null,
|
| 11 |
"layers_to_transform": null,
|
| 12 |
"loftq_config": {},
|
| 13 |
-
"lora_alpha":
|
|
|
|
| 14 |
"lora_dropout": 0.05,
|
|
|
|
| 15 |
"megatron_config": null,
|
| 16 |
"megatron_core": "megatron.core",
|
| 17 |
"modules_to_save": null,
|
| 18 |
"peft_type": "LORA",
|
| 19 |
-
"
|
|
|
|
|
|
|
| 20 |
"rank_pattern": {},
|
| 21 |
"revision": null,
|
| 22 |
"target_modules": [
|
| 23 |
-
"
|
| 24 |
"up_proj",
|
| 25 |
"k_proj",
|
| 26 |
-
"
|
| 27 |
"o_proj",
|
| 28 |
"gate_proj",
|
| 29 |
-
"
|
| 30 |
],
|
|
|
|
| 31 |
"task_type": "CAUSAL_LM",
|
|
|
|
|
|
|
| 32 |
"use_dora": false,
|
|
|
|
| 33 |
"use_rslora": false
|
| 34 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"alora_invocation_tokens": null,
|
| 3 |
"alpha_pattern": {},
|
| 4 |
+
"arrow_config": null,
|
| 5 |
+
"auto_mapping": {
|
| 6 |
+
"base_model_class": "Qwen2ForCausalLM",
|
| 7 |
+
"parent_library": "transformers.models.qwen2.modeling_qwen2",
|
| 8 |
+
"unsloth_fixed": true
|
| 9 |
+
},
|
| 10 |
+
"base_model_name_or_path": "unsloth/qwen2.5-7b-instruct-unsloth-bnb-4bit",
|
| 11 |
"bias": "none",
|
| 12 |
+
"corda_config": null,
|
| 13 |
+
"ensure_weight_tying": false,
|
| 14 |
+
"eva_config": null,
|
| 15 |
+
"exclude_modules": null,
|
| 16 |
"fan_in_fan_out": false,
|
| 17 |
"inference_mode": true,
|
| 18 |
"init_lora_weights": true,
|
|
|
|
| 20 |
"layers_pattern": null,
|
| 21 |
"layers_to_transform": null,
|
| 22 |
"loftq_config": {},
|
| 23 |
+
"lora_alpha": 32,
|
| 24 |
+
"lora_bias": false,
|
| 25 |
"lora_dropout": 0.05,
|
| 26 |
+
"lora_ga_config": null,
|
| 27 |
"megatron_config": null,
|
| 28 |
"megatron_core": "megatron.core",
|
| 29 |
"modules_to_save": null,
|
| 30 |
"peft_type": "LORA",
|
| 31 |
+
"peft_version": "0.19.1",
|
| 32 |
+
"qalora_group_size": 16,
|
| 33 |
+
"r": 16,
|
| 34 |
"rank_pattern": {},
|
| 35 |
"revision": null,
|
| 36 |
"target_modules": [
|
| 37 |
+
"v_proj",
|
| 38 |
"up_proj",
|
| 39 |
"k_proj",
|
| 40 |
+
"q_proj",
|
| 41 |
"o_proj",
|
| 42 |
"gate_proj",
|
| 43 |
+
"down_proj"
|
| 44 |
],
|
| 45 |
+
"target_parameters": null,
|
| 46 |
"task_type": "CAUSAL_LM",
|
| 47 |
+
"trainable_token_indices": null,
|
| 48 |
+
"use_bdlora": null,
|
| 49 |
"use_dora": false,
|
| 50 |
+
"use_qalora": false,
|
| 51 |
"use_rslora": false
|
| 52 |
}
|
adapter_model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3364d7db681c91edc6f1472dc8aadcc78c3b67818698637a5905f6b1119ed1e7
|
| 3 |
+
size 161533192
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- if tools %}
|
| 2 |
+
{{- '<|im_start|>system\n' }}
|
| 3 |
+
{%- if messages[0]['role'] == 'system' %}
|
| 4 |
+
{{- messages[0]['content'] }}
|
| 5 |
+
{%- else %}
|
| 6 |
+
{{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}
|
| 7 |
+
{%- endif %}
|
| 8 |
+
{{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
| 9 |
+
{%- for tool in tools %}
|
| 10 |
+
{{- "\n" }}
|
| 11 |
+
{{- tool | tojson }}
|
| 12 |
+
{%- endfor %}
|
| 13 |
+
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
|
| 14 |
+
{%- else %}
|
| 15 |
+
{%- if messages[0]['role'] == 'system' %}
|
| 16 |
+
{{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}
|
| 17 |
+
{%- else %}
|
| 18 |
+
{{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }}
|
| 19 |
+
{%- endif %}
|
| 20 |
+
{%- endif %}
|
| 21 |
+
{%- for message in messages %}
|
| 22 |
+
{%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %}
|
| 23 |
+
{{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
|
| 24 |
+
{%- elif message.role == "assistant" %}
|
| 25 |
+
{{- '<|im_start|>' + message.role }}
|
| 26 |
+
{%- if message.content %}
|
| 27 |
+
{{- '\n' + message.content }}
|
| 28 |
+
{%- endif %}
|
| 29 |
+
{%- for tool_call in message.tool_calls %}
|
| 30 |
+
{%- if tool_call.function is defined %}
|
| 31 |
+
{%- set tool_call = tool_call.function %}
|
| 32 |
+
{%- endif %}
|
| 33 |
+
{{- '\n<tool_call>\n{"name": "' }}
|
| 34 |
+
{{- tool_call.name }}
|
| 35 |
+
{{- '", "arguments": ' }}
|
| 36 |
+
{{- tool_call.arguments | tojson }}
|
| 37 |
+
{{- '}\n</tool_call>' }}
|
| 38 |
+
{%- endfor %}
|
| 39 |
+
{{- '<|im_end|>\n' }}
|
| 40 |
+
{%- elif message.role == "tool" %}
|
| 41 |
+
{%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}
|
| 42 |
+
{{- '<|im_start|>user' }}
|
| 43 |
+
{%- endif %}
|
| 44 |
+
{{- '\n<tool_response>\n' }}
|
| 45 |
+
{{- message.content }}
|
| 46 |
+
{{- '\n</tool_response>' }}
|
| 47 |
+
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
| 48 |
+
{{- '<|im_end|>\n' }}
|
| 49 |
+
{%- endif %}
|
| 50 |
+
{%- endif %}
|
| 51 |
+
{%- endfor %}
|
| 52 |
+
{%- if add_generation_prompt %}
|
| 53 |
+
{{- '<|im_start|>assistant\n' }}
|
| 54 |
+
{%- endif %}
|
special_tokens_map.json
CHANGED
|
@@ -22,7 +22,7 @@
|
|
| 22 |
"single_word": false
|
| 23 |
},
|
| 24 |
"pad_token": {
|
| 25 |
-
"content": "<|
|
| 26 |
"lstrip": false,
|
| 27 |
"normalized": false,
|
| 28 |
"rstrip": false,
|
|
|
|
| 22 |
"single_word": false
|
| 23 |
},
|
| 24 |
"pad_token": {
|
| 25 |
+
"content": "<|vision_pad|>",
|
| 26 |
"lstrip": false,
|
| 27 |
"normalized": false,
|
| 28 |
"rstrip": false,
|
tokenizer_config.json
CHANGED
|
@@ -195,12 +195,13 @@
|
|
| 195 |
"<|video_pad|>"
|
| 196 |
],
|
| 197 |
"bos_token": null,
|
| 198 |
-
"chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0]['role'] == 'system' %}\n {{- messages[0]['content'] }}\n {%- else %}\n {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}\n {%- endif %}\n {{- \"\\n\\n# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0]['role'] == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0]['content'] + '<|im_end|>\\n' }}\n {%- else %}\n {{- '<|im_start|>system\\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- for message in messages %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) or (message.role == \"assistant\" and not message.tool_calls) %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role }}\n {%- if message.content %}\n {{- '\\n' + message.content }}\n {%- endif %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '\\n<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {{- tool_call.arguments | tojson }}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- message.content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}\n",
|
| 199 |
"clean_up_tokenization_spaces": false,
|
| 200 |
"eos_token": "<|im_end|>",
|
| 201 |
"errors": "replace",
|
| 202 |
-
"
|
| 203 |
-
"
|
|
|
|
|
|
|
| 204 |
"split_special_tokens": false,
|
| 205 |
"tokenizer_class": "Qwen2Tokenizer",
|
| 206 |
"unk_token": null
|
|
|
|
| 195 |
"<|video_pad|>"
|
| 196 |
],
|
| 197 |
"bos_token": null,
|
|
|
|
| 198 |
"clean_up_tokenization_spaces": false,
|
| 199 |
"eos_token": "<|im_end|>",
|
| 200 |
"errors": "replace",
|
| 201 |
+
"extra_special_tokens": {},
|
| 202 |
+
"model_max_length": 32768,
|
| 203 |
+
"pad_token": "<|vision_pad|>",
|
| 204 |
+
"padding_side": "left",
|
| 205 |
"split_special_tokens": false,
|
| 206 |
"tokenizer_class": "Qwen2Tokenizer",
|
| 207 |
"unk_token": null
|
training_args.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e6a9bd126ecf9622ab5ea9a23d1c94aee8867a878b948495e4a44f5f688da737
|
| 3 |
+
size 6584
|