mlburnham commited on
Commit
08c98ec
·
verified ·
1 Parent(s): 655bd33

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +66 -188
README.md CHANGED
@@ -15,191 +15,69 @@ tags:
15
  ---
16
 
17
  # Model Details
18
- Political DEBATE (DeBERTa Algorithm for Textual Entailment) is an NLI classifier trained for zero-shot and few-shot classification of political documents. More detailed model information will be added soon.
19
-
20
- ### Model Description
21
-
22
- <!-- Provide a longer summary of what this model is. -->
23
-
24
- This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
25
-
26
- - **Developed by:** [More Information Needed]
27
- - **Funded by [optional]:** [More Information Needed]
28
- - **Shared by [optional]:** [More Information Needed]
29
- - **Model type:** [More Information Needed]
30
- - **Language(s) (NLP):** [More Information Needed]
31
- - **License:** [More Information Needed]
32
- - **Finetuned from model [optional]:** [More Information Needed]
33
-
34
- ### Model Sources [optional]
35
-
36
- <!-- Provide the basic links for the model. -->
37
-
38
- - **Repository:** [More Information Needed]
39
- - **Paper [optional]:** [More Information Needed]
40
- - **Demo [optional]:** [More Information Needed]
41
-
42
- ## Uses
43
-
44
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
45
-
46
- ### Direct Use
47
-
48
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
49
-
50
- [More Information Needed]
51
-
52
- ### Downstream Use [optional]
53
-
54
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
55
-
56
- [More Information Needed]
57
-
58
- ### Out-of-Scope Use
59
-
60
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
61
-
62
- [More Information Needed]
63
-
64
- ## Bias, Risks, and Limitations
65
-
66
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
67
-
68
- [More Information Needed]
69
-
70
- ### Recommendations
71
-
72
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
73
-
74
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
75
-
76
- ## How to Get Started with the Model
77
-
78
- Use the code below to get started with the model.
79
-
80
- [More Information Needed]
81
-
82
- ## Training Details
83
-
84
- ### Training Data
85
-
86
- <!-- 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. -->
87
-
88
- [More Information Needed]
89
-
90
- ### Training Procedure
91
-
92
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
93
-
94
- #### Preprocessing [optional]
95
-
96
- [More Information Needed]
97
-
98
-
99
- #### Training Hyperparameters
100
-
101
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
102
-
103
- #### Speeds, Sizes, Times [optional]
104
-
105
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
106
-
107
- [More Information Needed]
108
-
109
- ## Evaluation
110
-
111
- <!-- This section describes the evaluation protocols and provides the results. -->
112
-
113
- ### Testing Data, Factors & Metrics
114
-
115
- #### Testing Data
116
-
117
- <!-- This should link to a Dataset Card if possible. -->
118
-
119
- [More Information Needed]
120
-
121
- #### Factors
122
-
123
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
124
-
125
- [More Information Needed]
126
-
127
- #### Metrics
128
-
129
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
130
-
131
- [More Information Needed]
132
-
133
- ### Results
134
-
135
- [More Information Needed]
136
-
137
- #### Summary
138
-
139
-
140
-
141
- ## Model Examination [optional]
142
-
143
- <!-- Relevant interpretability work for the model goes here -->
144
-
145
- [More Information Needed]
146
-
147
- ## Environmental Impact
148
-
149
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
150
-
151
- 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).
152
-
153
- - **Hardware Type:** [More Information Needed]
154
- - **Hours used:** [More Information Needed]
155
- - **Cloud Provider:** [More Information Needed]
156
- - **Compute Region:** [More Information Needed]
157
- - **Carbon Emitted:** [More Information Needed]
158
-
159
- ## Technical Specifications [optional]
160
-
161
- ### Model Architecture and Objective
162
-
163
- [More Information Needed]
164
-
165
- ### Compute Infrastructure
166
-
167
- [More Information Needed]
168
-
169
- #### Hardware
170
-
171
- [More Information Needed]
172
-
173
- #### Software
174
-
175
- [More Information Needed]
176
-
177
- ## Citation [optional]
178
-
179
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
180
-
181
- **BibTeX:**
182
-
183
- [More Information Needed]
184
-
185
- **APA:**
186
-
187
- [More Information Needed]
188
-
189
- ## Glossary [optional]
190
-
191
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
192
-
193
- [More Information Needed]
194
-
195
- ## More Information [optional]
196
-
197
- [More Information Needed]
198
-
199
- ## Model Card Authors [optional]
200
-
201
- [More Information Needed]
202
-
203
- ## Model Card Contact
204
-
205
- [More Information Needed]
 
15
  ---
16
 
17
  # Model Details
18
+ Political DEBATE (DeBERTa Algorithm for Textual Entailment) is an NLI classifier trained for zero-shot and few-shot classification of political documents.
19
+
20
+ The model was trained using [Moritz Laurer's](https://huggingface.co/MoritzLaurer/deberta-v3-large-zeroshot-v2.0-c) zero shot model as the foundation, and then trained further using the [PolNLI dataset.](https://huggingface.co/datasets/mlburnham/Pol_NLI) The model was trained for four classification categories:
21
+ 1. Stance detection (i.e. opinion mining).
22
+ 2. Hatespeech detection.
23
+ 3. Event extraction.
24
+ 4. Topic classification.
25
+
26
+ The PolNLI dataset contains documents from social media, news outlets, congressional bills, court case summaries, and more. Classification should work well across a broad set of document sources and subjects, but for best performance refer to the recommendations section.
27
+
28
+ # Using NLI Classifiers
29
+ NLI classifiers work by pairing a document (AKA the 'premise') with a 'hypothesis', and determining if the hypothesis is true given the content of the document. The hypothesis is supplied by the user and can be thought of as a simplified version of a prompt for an LLM. It's best to keep hypotheses short and simple with a single classification criteria. If a more complicated hypothesis is necessary, consider few-shot training.
30
+ For more detailed reading on using NLI classifiers see:
31
+ ```
32
+ @article{burnham2024stance,
33
+ title={Stance Detection: A Practical Guide to Classifying Political Beliefs in Text},
34
+ author={Burnham, Michael},
35
+ journal={Political Science Research and Methods},
36
+ year={2024}
37
+ }
38
+ ```
39
+ # Recommendations
40
+ 1. Use the Political DEBATE large model for zero-shot and few-shot applications unless your use case is explicitly in the training data, in which case the base model should perform well. The base model is more appropriate for using the model as a supervised classifier.
41
+ 2. For best results, format hypotheses similar to the PolNLI dataset. Ex:
42
+ - "This text is about {}"
43
+ - "The author of this text believes {}"
44
+ 3. For few-shot training, use a small batch size of 1-2.
45
+ 4. Use a minimum of 10 samples for few-shot training, but we generally recommend 25 because the variance of outcomes at 10 can be quite large. You will see more benefit from more samples the more difficult your classification task and varied your data.
46
+ 5. Train for 3-5 epochs for few-shot learning.
47
+
48
+ # Evaluation
49
+ Evaluation is primarily conducted on the PolNLI test set. No hypotheses in the PolNLI test set are present in the training data in order to estimate zero-shot performance.
50
+
51
+ <div style="display: flex; justify-content: space-between;">
52
+ <div style="flex: 1; margin-right: 10px;">
53
+ <h4>Overall Performance:</h4>
54
+ <img src="https://cdn-uploads.huggingface.co/production/uploads/64d0341901931c60161f2a06/-sQhURg-zeacZAUNEVUpc.png" width="100%" />
55
+ </div>
56
+ <div style="flex: 1; margin-left: 10px;">
57
+ <h4>Performance by Task:</h4>
58
+ <img src="https://cdn-uploads.huggingface.co/production/uploads/64d0341901931c60161f2a06/66BOUiVt7Fdl0UhYxmjQB.png" width="100%" />
59
+ </div>
60
+ </div>
61
+
62
+ <div style="display: flex; justify-content: space-between;">
63
+ <div style="flex: 1; margin-right: 10px;">
64
+ <h4>Few-shot performance vs. Llama 3.1 8B on open-text survey answers:</h4>
65
+ <img src="https://cdn-uploads.huggingface.co/production/uploads/64d0341901931c60161f2a06/kDZXC-OsZtmTCxq0HsJMg.png" width="100%" />
66
+ </div>
67
+ <div style="flex: 1; margin-left: 10px;">
68
+ <h4>Few-shot performance vs. an Electra supervised classifier trained on 2,000 documents:</h4>
69
+ <img src="https://cdn-uploads.huggingface.co/production/uploads/64d0341901931c60161f2a06/WpQ_ZofMJMFPraCK_a3Fb.png" width="100%" />
70
+ </div>
71
+ </div>
72
+
73
+
74
+ # Citation
75
+ If you use this model or the PolNLI data set please cite:
76
+ ```
77
+ @article{burnham2024debate,
78
+ title={Political DEBATE: Efficient Zero-shot and Few-shot Classifiers for Political Text},
79
+ author={Burnham, Michael, Kayla Kahn, Rachel Peng, Ryan Wang},
80
+ journal={working manuscript},
81
+ year={2024}
82
+ }
83
+ ```