chrisjcc commited on
Commit
e3f3c8f
·
verified ·
1 Parent(s): c296967

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. README.md +117 -27
  2. adapter_config.json +4 -4
  3. adapter_model.safetensors +1 -1
  4. training_args.bin +2 -2
README.md CHANGED
@@ -1,48 +1,138 @@
1
  ---
2
- language: en
3
- license: mit
 
 
 
 
 
 
 
4
  tags:
5
- - reinforcement-learning
6
- - dpo
7
- - sft
8
- - qwen2.5
9
  - clarification
10
- datasets:
11
- - chrisjcc/ask-before-answer-data
 
 
 
12
  ---
13
 
14
- # AskBeforeAnswer 🤖
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
- This model is a Qwen 2.5 7B Instruct model fine-tuned using a two-stage pipeline (Supervised Fine-Tuning followed by Direct Preference Optimization) on the AmbigNQ dataset.
 
 
 
 
 
 
 
 
 
 
17
 
18
- ## Model Description
19
- The **AskBeforeAnswer** model exhibits "clarification-seeking" behavior. When presented with an ambiguous question, rather than hallucinating or blindly assuming an intent, the model:
20
- 1. Detects the ambiguity.
21
- 2. Explains the reasoning behind the ambiguity.
22
- 3. Identifies the missing facets of information.
23
- 4. Asks a targeted clarification question to the user.
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
- `sft_dpo`.
29
 
 
 
30
 
 
31
 
32
- **GitHub Release:** [v0.1.3](https://github.com/chrisjcc/ask-before-answer/releases/tag/v0.1.3)
33
 
34
  ## Usage
35
- ```python
36
  from transformers import AutoModelForCausalLM, AutoTokenizer
37
  from peft import PeftModel
38
 
39
  base_model_name = "Qwen/Qwen2.5-7B-Instruct"
40
  adapter_model_name = "chrisjcc/ask-before-answer"
41
 
42
- # Load Base
43
- model = AutoModelForCausalLM.from_pretrained(base_model_name)
44
- tokenizer = AutoTokenizer.from_pretrained(base_model_name)
 
 
 
 
45
 
46
- # Attach AskBeforeAnswer Adapters
47
- model = PeftModel.from_pretrained(model, adapter_model_name)
 
 
48
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+ - en
4
+ license: apache-2.0
5
+ library_name: transformers
6
+ pipeline_tag: text-generation
7
+ base_model:
8
+ - Qwen/Qwen2.5-7B-Instruct
9
+ datasets:
10
+ - chrisjcc/ask-before-answer-dataset
11
  tags:
 
 
 
 
12
  - clarification
13
+ - ambiguity-detection
14
+ - question-answering
15
+ - qwen2.5
16
+ - sft
17
+ - reinforcement-learning
18
  ---
19
 
20
+ # AskBeforeAnswer
21
+
22
+ The **AskBeforeAnswer** model is a clarification-seeking language model
23
+ based on **Qwen2.5-7B-Instruct**.
24
+
25
+ Instead of immediately answering an ambiguous question, the model is trained
26
+ to determine whether clarification is required and, when necessary, identify
27
+ the missing information and ask a targeted clarification question.
28
+
29
+ ## Production Model
30
+
31
+ This repository contains the exact W&B artifact approved by the project's
32
+ model promotion procedure.
33
+
34
+ - **Training method:** Supervised Fine-Tuning (SFT)
35
+ - **Model variant:** `sft`
36
+ - **W&B Registry alias at promotion:** `production`
37
+ - **W&B artifact:** `wandb-registry-Model/AskBeforeAnswer-Models:v0`
38
+ - **W&B artifact digest:** `8dd12fd8a79a7f5be7eac5d94def44c1`
39
+ - **Release:** `v0.1.5`
40
+ - **Base model:** `Qwen/Qwen2.5-7B-Instruct`
41
+ - **Dataset:** `chrisjcc/ask-before-answer-dataset`
42
+
43
+ The model was obtained directly from the immutable W&B artifact recorded in
44
+ the promotion record.
45
+
46
+ The DVC-managed training output is not modified during deployment.
47
+
48
+ ## Behavior
49
+
50
+ The model produces structured responses containing:
51
+
52
+ 1. **Action**: whether to `Clarify` or `Answer`
53
+ 2. **Reasoning**: why clarification is or is not required
54
+ 3. **Facets**: missing information required to disambiguate the question
55
+ 4. **Response**: either a clarification question or a direct answer
56
+
57
+ Expected format:
58
 
59
+ ```text
60
+ Action: Clarify|Answer
61
+ Reasoning: <reasoning>
62
+ Facets: <list of missing facets>
63
+ Response: <clarifying question or direct answer>
64
+ ```
65
+
66
+ ## Training
67
+
68
+ The production winner was selected through the project's experiment
69
+ selection, verification, and promotion procedure.
70
 
71
+ The training pipeline supports:
 
 
 
 
 
72
 
73
+ - Supervised Fine-Tuning (SFT)
74
+ - Direct Preference Optimization (DPO)
75
+ - Group Relative Policy Optimization (GRPO)
76
+ - Odds Ratio Preference Optimization (ORPO)
77
 
78
+ This repository corresponds specifically to the model variant recorded in
79
+ the promotion record.
80
 
81
+ ## Evaluation
82
 
83
+ Evaluation results are maintained in the project evaluation artifacts.
84
 
85
  ## Usage
86
+ ```
87
  from transformers import AutoModelForCausalLM, AutoTokenizer
88
  from peft import PeftModel
89
 
90
  base_model_name = "Qwen/Qwen2.5-7B-Instruct"
91
  adapter_model_name = "chrisjcc/ask-before-answer"
92
 
93
+ tokenizer = AutoTokenizer.from_pretrained(
94
+ base_model_name,
95
+ )
96
+
97
+ model = AutoModelForCausalLM.from_pretrained(
98
+ base_model_name,
99
+ )
100
 
101
+ model = PeftModel.from_pretrained(
102
+ model,
103
+ adapter_model_name,
104
+ )
105
  ```
106
+
107
+ ## Dataset
108
+
109
+ The training datasets are available from:
110
+
111
+ chrisjcc/ask-before-answer-dataset
112
+
113
+ The repository contains separate sft and dpo configurations.
114
+
115
+ ## Intended Use
116
+
117
+ This model is intended for research into clarification-seeking behavior in
118
+ language models, particularly for systems that should distinguish between
119
+ answerable and underspecified user questions.
120
+
121
+ ## Limitations
122
+
123
+ The model may incorrectly classify questions as ambiguous or unambiguous.
124
+
125
+ Its generated reasoning and answers should not be treated as authoritative.
126
+
127
+ The model was trained on English-language data and may not generalize
128
+ reliably to other languages or domains.
129
+
130
+ ## Reproducibility
131
+
132
+ The model published here was selected through the project's experiment
133
+ selection, verification, and promotion procedure.
134
+
135
+ The promotion record identifies the exact W&B artifact version and digest
136
+ used for deployment.
137
+
138
+ The local DVC training artifact is treated as immutable during deployment.
adapter_config.json CHANGED
@@ -35,13 +35,13 @@
35
  "rank_pattern": {},
36
  "revision": null,
37
  "target_modules": [
 
 
38
  "gate_proj",
39
- "up_proj",
40
- "o_proj",
41
  "k_proj",
 
42
  "v_proj",
43
- "down_proj",
44
- "q_proj"
45
  ],
46
  "target_parameters": null,
47
  "task_type": "CAUSAL_LM",
 
35
  "rank_pattern": {},
36
  "revision": null,
37
  "target_modules": [
38
+ "q_proj",
39
+ "down_proj",
40
  "gate_proj",
 
 
41
  "k_proj",
42
+ "o_proj",
43
  "v_proj",
44
+ "up_proj"
 
45
  ],
46
  "target_parameters": null,
47
  "task_type": "CAUSAL_LM",
adapter_model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:8730e5a37e3df071b5da452c0ffaf1863062aec888f38e01adf1afd099ea3721
3
  size 161533192
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:44531fd80e249b7cbf4fc124522fc7f6be0b0202382eb865bb0e2c1590b469c1
3
  size 161533192
training_args.bin CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:f80303518705dcb84090e851e58a8ab093d94eaa41dc357e4f553c5130633140
3
- size 6584
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1d5e8814a1cbbbf820e4191c98a514605ae36e48454ddd9eb02b6e69b79b2049
3
+ size 6008