ddosdub commited on
Commit
9e032f3
·
verified ·
1 Parent(s): 13bad28

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +141 -91
README.md CHANGED
@@ -1,13 +1,16 @@
1
  ---
2
- base_model: answerdotai/ModernBERT-base
 
 
3
  library_name: peft
 
4
  ---
5
 
6
- # Model Card for Model ID
7
 
8
  <!-- Provide a quick summary of what the model is/does. -->
9
 
10
-
11
 
12
  ## Model Details
13
 
@@ -15,23 +18,24 @@ library_name: peft
15
 
16
  <!-- Provide a longer summary of what this model is. -->
17
 
 
 
 
18
 
 
19
 
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** [More Information Needed]
24
- - **Language(s) (NLP):** [More Information Needed]
25
- - **License:** [More Information Needed]
26
- - **Finetuned from model [optional]:** [More Information Needed]
27
 
28
- ### Model Sources [optional]
29
 
30
  <!-- Provide the basic links for the model. -->
31
 
32
- - **Repository:** [More Information Needed]
33
- - **Paper [optional]:** [More Information Needed]
34
- - **Demo [optional]:** [More Information Needed]
35
 
36
  ## Uses
37
 
@@ -41,37 +45,76 @@ library_name: peft
41
 
42
  <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
 
44
- [More Information Needed]
45
 
46
- ### Downstream Use [optional]
47
 
48
  <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
 
50
- [More Information Needed]
51
 
52
  ### Out-of-Scope Use
53
 
54
  <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
 
56
- [More Information Needed]
 
 
 
 
57
 
58
  ## Bias, Risks, and Limitations
59
 
60
  <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
 
62
- [More Information Needed]
63
 
64
  ### Recommendations
65
 
66
  <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
 
68
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
 
 
 
 
69
 
70
  ## How to Get Started with the Model
71
 
72
- Use the code below to get started with the model.
73
-
74
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
 
76
  ## Training Details
77
 
@@ -79,26 +122,41 @@ Use the code below to get started with the model.
79
 
80
  <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
 
82
- [More Information Needed]
83
 
84
  ### Training Procedure
85
 
86
  <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
 
88
- #### Preprocessing [optional]
89
-
90
- [More Information Needed]
91
 
 
 
 
 
 
92
 
93
  #### Training Hyperparameters
94
 
95
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
-
97
- #### Speeds, Sizes, Times [optional]
98
-
99
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
-
101
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
  ## Evaluation
104
 
@@ -108,95 +166,87 @@ Use the code below to get started with the model.
108
 
109
  #### Testing Data
110
 
111
- <!-- This should link to a Dataset Card if possible. -->
112
-
113
- [More Information Needed]
114
 
115
  #### Factors
116
 
117
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
-
119
- [More Information Needed]
120
 
121
  #### Metrics
122
 
123
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
-
125
- [More Information Needed]
 
 
 
126
 
127
  ### Results
128
 
129
- [More Information Needed]
130
-
131
  #### Summary
132
 
 
 
 
 
 
 
 
 
133
 
134
-
135
- ## Model Examination [optional]
136
-
137
- <!-- Relevant interpretability work for the model goes here -->
138
-
139
- [More Information Needed]
140
 
141
  ## Environmental Impact
142
 
143
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
-
145
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
 
147
- - **Hardware Type:** [More Information Needed]
148
- - **Hours used:** [More Information Needed]
149
- - **Cloud Provider:** [More Information Needed]
150
- - **Compute Region:** [More Information Needed]
151
- - **Carbon Emitted:** [More Information Needed]
152
 
153
- ## Technical Specifications [optional]
154
 
155
  ### Model Architecture and Objective
156
 
157
- [More Information Needed]
158
 
159
  ### Compute Infrastructure
160
 
161
- [More Information Needed]
162
-
163
  #### Hardware
164
 
165
- [More Information Needed]
 
 
 
 
166
 
167
  #### Software
168
 
169
- [More Information Needed]
170
-
171
- ## Citation [optional]
172
-
173
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
-
175
- **BibTeX:**
176
-
177
- [More Information Needed]
 
 
178
 
179
- **APA:**
180
 
181
- [More Information Needed]
182
 
183
- ## Glossary [optional]
184
 
185
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
-
187
- [More Information Needed]
188
-
189
- ## More Information [optional]
190
-
191
- [More Information Needed]
192
-
193
- ## Model Card Authors [optional]
194
-
195
- [More Information Needed]
196
 
197
  ## Model Card Contact
198
 
199
- [More Information Needed]
200
- ### Framework versions
201
-
202
- - PEFT 0.15.1
 
1
  ---
2
+ base_model:
3
+ - answerdotai/ModernBERT-base
4
+ - sentence-transformers/all-MiniLM-L6-v2
5
  library_name: peft
6
+ license: apache-2.0
7
  ---
8
 
9
+ # Model Card for ddosdub/DualEncoderModernBERT
10
 
11
  <!-- Provide a quick summary of what the model is/does. -->
12
 
13
+ This is a binary classification model that combines ModernBERT and SBERT embeddings to detect whether a piece of evidence supports a given claim (evidence detection). This is a deep learning approach underpinned by transformer architecture.
14
 
15
  ## Model Details
16
 
 
18
 
19
  <!-- Provide a longer summary of what this model is. -->
20
 
21
+ This model uses a dual embedding approach that combines contextualized embeddings from ModernBERT-base with sentence embeddings from SBERT (all-MiniLM-L6-v2). The model first processes claim-evidence pairs through both embedding models, then concatenates the embeddings and passes them through a classifier to predict whether the evidence supports the claim.
22
+
23
+ The model is fine-tuned using QLoRA (Quantized Low-Rank Adaptation) with 4-bit quantization and flash-attention for efficient training and inference.
24
 
25
+ Text preprocessing includes removing reference tags, normalizing accented characters using unidecode, cleaning up irregular spacing around punctuation, and normalizing whitespace. Data augmentation was applied to the positive class (minority) using synonym replacement to address class imbalance.
26
 
27
+ - **Developed by:** Dhruv Sharma and Tuan Chuong Goh
28
+ - **Model type:** Supervised
29
+ - **Language(s) (NLP):** English
30
+ - **License:** cc-by-4.0
31
+ - **Finetuned from model:** ModernBERT-base and SBERT (all-MiniLM-L6-v2)
 
 
32
 
33
+ ### Model Sources
34
 
35
  <!-- Provide the basic links for the model. -->
36
 
37
+ - **Repository:** https://github.com/chuongg3/NLU-EvidenceDetection
38
+ - **Paper:** https://huggingface.co/answerdotai/ModernBERT-base
 
39
 
40
  ## Uses
41
 
 
45
 
46
  <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
47
 
48
+ This model can be directly used for evidence detection tasks, where the goal is to determine whether a given piece of evidence supports a specific claim. It processes claim-evidence pairs and outputs a binary classification result.
49
 
50
+ ### Downstream Use
51
 
52
  <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
53
 
54
+ The model can be integrated into fact-checking systems, academic research tools, or information verification applications. It can also serve as a component in larger natural language understanding pipelines for tasks requiring evidence assessment.
55
 
56
  ### Out-of-Scope Use
57
 
58
  <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
59
 
60
+ This model is not designed to:
61
+ - Process non-English text
62
+ - Handle multi-class classification beyond binary evidence detection
63
+ - Serve as a standalone fact-checker without human oversight
64
+ - Generate text or provide explanations for its decisions
65
 
66
  ## Bias, Risks, and Limitations
67
 
68
  <!-- This section is meant to convey both technical and sociotechnical limitations. -->
69
 
70
+ The model uses an optimal threshold of 0.5433 determined through validation data to convert probabilities to binary predictions. The 4-bit quantization may introduce some precision loss compared to full-precision models, although the performance metrics indicate this has minimal impact on model quality. The original dataset had class imbalance which was addressed through data augmentation for the positive class.
71
 
72
  ### Recommendations
73
 
74
  <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
75
 
76
+ Users (both direct and downstream) should be aware that:
77
+ - The model works best with properly preprocessed text inputs
78
+ - Performance may vary across different domains or types of claims
79
+ - The model should be used as a decision support tool rather than the sole arbiter of evidence validity
80
+ - Regular evaluation on new data is recommended to monitor potential performance drift
81
 
82
  ## How to Get Started with the Model
83
 
84
+ Use the code below to get started with the model:
85
+
86
+ ```python
87
+ from transformers import AutoModelForSequenceClassification, AutoTokenizer
88
+ from sentence_transformers import SentenceTransformer
89
+ import torch
90
+
91
+ # Load models
92
+ modernbert_tokenizer = AutoTokenizer.from_pretrained("answerdotai/ModernBERT-base")
93
+ modernbert_model = AutoModelForSequenceClassification.from_pretrained("answerdotai/ModernBERT-base")
94
+ sbert_model = SentenceTransformer("all-MiniLM-L6-v2")
95
+
96
+ # Load the fine-tuned model
97
+ # Replace with actual path when available
98
+ model = torch.load("path/to/h25471ds-m19364tg-ED")
99
+
100
+ # Process input
101
+ def predict(claim, evidence):
102
+ # Preprocess text
103
+ # ... preprocessing code here ...
104
+
105
+ # Get ModernBERT embeddings
106
+ inputs = modernbert_tokenizer(claim, evidence, return_tensors="pt")
107
+ modernbert_output = modernbert_model(**inputs)
108
+
109
+ # Get SBERT embeddings
110
+ sbert_claim = sbert_model.encode(claim)
111
+ sbert_evidence = sbert_model.encode(evidence)
112
+
113
+ # Combine embeddings and predict
114
+ # ... model inference code here ...
115
+
116
+ return prediction
117
+ ```
118
 
119
  ## Training Details
120
 
 
122
 
123
  <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
124
 
125
+ Training data consisted of claim-evidence pairs for evidence detection tasks. Data augmentation was applied to the positive class (minority) using synonym replacement to address class imbalance.
126
 
127
  ### Training Procedure
128
 
129
  <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
130
 
131
+ #### Preprocessing
 
 
132
 
133
+ The preprocessing pipeline includes:
134
+ 1. Removing reference tags like [REF], [REF, REF]
135
+ 2. Normalizing accented characters using unidecode
136
+ 3. Cleaning up irregular spacing around punctuation
137
+ 4. Normalizing whitespace
138
 
139
  #### Training Hyperparameters
140
 
141
+ - **Training regime:** 4-bit (nf4) quantization with QLoRA
142
+ - **learning_rate:** 0.0002643238333834569
143
+ - **batch_size:** 64
144
+ - **num_epochs:** 5
145
+ - **weight_decay:** 0.048207625326781293
146
+ - **warmup_ratio:** 0.19552784843595056
147
+ - **gradient_accumulation_steps:** 4
148
+ - **lora_r:** 56
149
+ - **lora_alpha:** 40
150
+ - **lora_dropout:** 0.07644825534662132
151
+ - **classifier_dropout:** 0.2659719581055393
152
+ - **classifier_hidden_size:** 768
153
+ - **max_length:** 8192
154
+
155
+ #### Speeds, Sizes, Times
156
+
157
+ - **Model size:** The base ModernBERT model is loaded in 4-bit quantization
158
+ - **SBERT embeddings dimension:** 384
159
+ - **Memory footprint:** Reduced due to 4-bit quantization and parameter-efficient fine-tuning
160
 
161
  ## Evaluation
162
 
 
166
 
167
  #### Testing Data
168
 
169
+ Development set with claim-evidence pairs for evidence detection.
 
 
170
 
171
  #### Factors
172
 
173
+ The evaluation focused on the model's ability to correctly classify evidence as supporting or not supporting claims across various domains and claim types.
 
 
174
 
175
  #### Metrics
176
 
177
+ The following metrics were used to evaluate model performance:
178
+ - Accuracy: Proportion of correct predictions
179
+ - Precision: Proportion of positive identifications that were actually correct
180
+ - Recall: Proportion of actual positives that were identified correctly
181
+ - F1-Score: Harmonic mean of precision and recall
182
+ - Matthews Correlation Coefficient: Correlation coefficient between observed and predicted binary classifications
183
 
184
  ### Results
185
 
 
 
186
  #### Summary
187
 
188
+ - **Accuracy:** 0.87377657779278
189
+ - **Macro Precision:** 0.83764094620994
190
+ - **Macro Recall:** 0.86135532021442
191
+ - **Macro F1-Score:** 0.84790707217937
192
+ - **Weighted Precision:** 0.88028808321627
193
+ - **Weighted Recall:** 0.87377657779278
194
+ - **Weighted F1-Score:** 0.87591472842040
195
+ - **Matthews Correlation Coefficient:** 0.69859387983347
196
 
197
+ The model achieved a Macro F1-score of 0.848 (84.8%) and an accuracy of 0.874 (87.4%) on the development set.
 
 
 
 
 
198
 
199
  ## Environmental Impact
200
 
201
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. -->
 
 
202
 
203
+ - **Hardware Type:** CUDA-compatible GPU with T4 (Turing) architecture or newer
204
+ - **Hours used:** Not specified
205
+ - **Cloud Provider:** Not specified
206
+ - **Compute Region:** Not specified
207
+ - **Carbon Emitted:** Not calculated, but the use of 4-bit quantization and QLoRA significantly reduces the computational requirements compared to full-precision fine-tuning
208
 
209
+ ## Technical Specifications
210
 
211
  ### Model Architecture and Objective
212
 
213
+ The model combines ModernBERT's contextual understanding with SBERT's semantic similarity capabilities. It first extracts the [CLS] token embedding from ModernBERT, then concatenates it with SBERT embeddings before passing through the classification layers.
214
 
215
  ### Compute Infrastructure
216
 
 
 
217
  #### Hardware
218
 
219
+ - **RAM:** at least 16 GB
220
+ - **Storage:** at least 2GB
221
+ - **GPU:** CUDA-compatible GPU with T4 (Turing) architecture or newer
222
+ - **Training requirements:** T4 or newer GPU architecture to support flash-attention
223
+ - **Inference requirements:** Can be performed on less powerful GPUs with 4-bit quantization
224
 
225
  #### Software
226
 
227
+ - **torch:** 2.6.0+cu126
228
+ - **transformers**
229
+ - **peft:** 0.15.1 (for QLoRA implementation)
230
+ - **bitsandbytes:** (for 4-bit quantization)
231
+ - **flash-attn:** (for efficient attention computation)
232
+ - **sentence-transformers**
233
+ - **sklearn**
234
+ - **numpy**
235
+ - **pandas**
236
+ - **unidecode:** (for text normalization)
237
+ - **re:** (for text cleaning)
238
 
239
+ ## More Information
240
 
241
+ The model combines the strengths of ModernBERT's long context understanding with SBERT's semantic similarity capabilities. The use of QLoRA and 4-bit quantization enables efficient fine-tuning with significantly reduced memory requirements compared to full-precision fine-tuning. Flash-attention provides computational speedups during training and inference on compatible hardware.
242
 
243
+ Hyperparameters were optimized using a systematic search process to find the optimal configuration.
244
 
245
+ Important references:
246
+ - QLoRA: Efficient Finetuning of Quantized LLMs (2023) - https://arxiv.org/abs/2305.14314
247
+ - Hugging Face 4-bit Transformers with bitsandbytes - https://huggingface.co/blog/4bit-transformers-bitsandbytes
248
+ - PEFT: Parameter-Efficient Fine-Tuning Documentation - https://huggingface.co/docs/peft/en/index
 
 
 
 
 
 
 
249
 
250
  ## Model Card Contact
251
 
252
+ For inquiries about this model, please contact through the GitHub repository: https://github.com/chuongg3/NLU-EvidenceDetection