namesarnav commited on
Commit
d107e40
·
1 Parent(s): 9c564eb

Update README.md (#3)

Browse files

- Update README.md (6602198dcbb24d8bba04b4a60f058ba6f7600e9d)

Files changed (1) hide show
  1. README.md +124 -73
README.md CHANGED
@@ -3,131 +3,182 @@ license: apache-2.0
3
  base_model: openai-community/gpt2
4
  pipeline_tag: token-classification
5
  tags:
6
- - nlp
7
  - token-classification
8
- - named-entity-recognition
9
  - event-extraction
 
 
 
 
10
  metrics:
11
  - f1
12
  ---
13
 
14
- # gpt-2-eventx-sentence-recognition
 
 
15
 
16
- ## 🧠 Overview
17
 
18
- This model is a **fully fine-tuned version** of `openai-community/gpt2` for **Event Expression Extraction**.
19
 
20
- It identifies event expressions in natural language text using BIO sequence labeling.
 
 
21
 
22
- ### Labels:
23
- - **B-E**
24
- - **I-E**
25
- - **O**
 
26
 
27
  ---
28
- ## 📊 Task
29
 
30
- **Event Expression Extraction**
31
 
32
- Given an input sequence, the model identifies event expression spans using BIO token labels.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
  ---
35
- ## 📚 Dataset
36
 
37
- - **Name:**
38
- - **Format:** CoNLL (token + label)
39
- - **Labels:** B-E, I-E, O
40
- - **Distribution:**
41
 
42
- ### Label Map
43
 
44
- - **0**: B-E
45
- - **1**: I-E
46
- - **2**: O
47
 
48
  ---
49
- ## ⚙️ Training Details
50
-
51
- - **Model:** openai-community/gpt2
52
- - **Fine-tuning:** Full fine-tuning (all parameters updated)
53
- - **Epochs:** 3
54
- - **Learning Rate:** 2e-5
55
- - **Train Batch Size:** 16
56
- - **Evaluation Batch Size:** 32
57
- - **Optimizer:** AdamW
58
- - **Weight Decay:** 0.01
59
- - **Warmup Steps:** 500
60
- - **Max Sequence Length:** 128
61
- - **Evaluation:** Every 250 steps
62
- - **Early Stopping:** Patience of 3 evaluations
63
- - **Model Selection:** Entity-level F1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
 
65
  ---
66
- ## 📈 Evaluation
67
 
68
- Scores are reported using **F1**.
 
 
69
 
70
- | Evaluation Setting | F1 |
71
  |---|---:|
72
- | Base | 0.84 |
73
  | T2C | 0.18 |
74
- | Adv | 0.78 |
75
  | Length | 0.85 |
76
- | Voc | 0.84 |
77
- | Adv_P | 0.50 |
78
-
79
- ---
80
- ## 🔬 Analysis
81
 
82
- The model achieves an F1 score of **0.84** on the base evaluation setting.
83
- Performance across T2C, adversarial, length, vocabulary, and adversarial perturbation settings provides a broader view of model generalization.
84
 
85
  ---
86
- ## 🚀 Usage
87
 
88
- ```python
89
- from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
 
 
90
 
91
  model_id = "mdg-nlp/gpt-2-eventx-sentence-recognition"
92
 
93
  tokenizer = AutoTokenizer.from_pretrained(model_id)
94
  model = AutoModelForTokenClassification.from_pretrained(model_id)
95
 
96
- classifier = pipeline("token-classification", model=model, tokenizer=tokenizer)
97
- text = "The patient arrived on Monday and underwent surgery the next day."
 
 
 
 
 
 
 
 
 
 
98
 
99
- print(classifier(text))
 
 
 
100
  ```
101
 
102
  ---
103
- ## 📊 Training Logs
104
 
105
- **Weights & Biases run:**
106
 
 
 
 
 
 
 
 
107
 
108
  ---
109
- ## 🧩 Limitations
110
 
111
- - Performance depends on dataset distribution
112
- - May not generalize well to unseen domains
113
- - Sequence truncation may affect long inputs
114
- - Performance can vary across different generalization settings
115
 
116
- ---
117
- ## 🔬 Research Context
118
 
119
- This model was developed as part of research on:
120
- - Temporal reasoning in NLP
121
- - Temporal and event expression extraction
122
- - Generalization of language models
123
 
124
  ---
125
- ## 📬 Contact
126
 
127
- **Author:** Arnav Verma
128
- **Affiliation:** New York University
 
 
129
 
130
  ---
131
- ## ⭐ Citation
132
 
133
- If you use this model in your research, please cite appropriately.
 
 
 
3
  base_model: openai-community/gpt2
4
  pipeline_tag: token-classification
5
  tags:
6
+ - gpt2
7
  - token-classification
8
+ - nlp
9
  - event-extraction
10
+ - eventx
11
+ - sequence-labeling
12
+ datasets:
13
+ - mdg-nlp/eventx-recognition-original
14
  metrics:
15
  - f1
16
  ---
17
 
18
+ # GPT-2 Fine-Tuned for Event Expression Extraction (EVENTX)
19
+
20
+ ## Overview
21
 
22
+ This model is a fully fine-tuned version of `openai-community/gpt2` for **Event Expression Extraction (EVENTX)**.
23
 
24
+ The model identifies spans in natural language text that correspond to events, including actions, occurrences, processes, and states expressed in a sentence.
25
 
26
+ The task is formulated as token-level sequence labeling using BIO tags.
27
+
28
+ ### Label Map
29
 
30
+ | ID | Label | Description |
31
+ |---|---|---|
32
+ | 0 | O | Token is outside an event expression |
33
+ | 1 | B-E | Beginning of an event expression |
34
+ | 2 | I-E | Inside an event expression |
35
 
36
  ---
 
37
 
38
+ ## Task
39
 
40
+ **Event Expression Extraction (EVENTX)**
41
+
42
+ Given an input sentence, the model identifies spans corresponding to event expressions.
43
+
44
+ For example:
45
+
46
+ ```text id="2nxbq8"
47
+ Input:
48
+ The company announced the acquisition on Monday.
49
+
50
+ Event expressions:
51
+ announced
52
+ acquisition
53
+ ```
54
+
55
+ Each token is assigned one of three BIO labels:
56
+
57
+ - **O**: outside an event expression
58
+ - **B-E**: beginning of an event expression
59
+ - **I-E**: inside an event expression
60
+
61
+ Event expression extraction provides structured information about events mentioned in text and can support downstream temporal reasoning, event ordering, relation extraction, and timeline construction.
62
 
63
  ---
 
64
 
65
+ ## Model
 
 
 
66
 
67
+ GPT-2 is a decoder-only transformer architecture. This model uses GPT-2 with a token-classification head and is fully fine-tuned for sentence-level event expression extraction.
68
 
69
+ The model is one of the fine-tuned pretrained language model baselines used to study multi-dimensional generalization in temporal extraction tasks.
 
 
70
 
71
  ---
72
+
73
+ ## Dataset
74
+
75
+ **Dataset:** `mdg-nlp/eventx-recognition-original`
76
+
77
+ ### Labels
78
+
79
+ ```text id="i9llpo"
80
+ 0 -> O
81
+ 1 -> B-E
82
+ 2 -> I-E
83
+ ```
84
+
85
+ ---
86
+
87
+ ## Training Details
88
+
89
+ | Configuration | Value |
90
+ |---|---|
91
+ | Base Model | `openai-community/gpt2` |
92
+ | Task | Event Expression Extraction |
93
+ | Formulation | Token Classification |
94
+ | Label Scheme | BIO |
95
+ | Fine-tuning | Full fine-tuning |
96
+ | Epochs | 3 |
97
+ | Learning Rate | 2e-5 |
98
+ | Optimizer | AdamW |
99
+ | Weight Decay | 0.01 |
100
+ | Warmup Steps | 500 |
101
+ | Train Batch Size | 16 |
102
+ | Evaluation Batch Size | 32 |
103
+ | Max Sequence Length | 128 |
104
 
105
  ---
 
106
 
107
+ ## Evaluation
108
+
109
+ All reported scores use **micro-F1**.
110
 
111
+ | Evaluation Setting | Micro-F1 |
112
  |---|---:|
113
+ | Base | **0.84** |
114
  | T2C | 0.18 |
115
+ | Adversarial (Adv) | 0.78 |
116
  | Length | 0.85 |
117
+ | Vocabulary (Voc) | 0.84 |
118
+ | Adversarial Perturbation (Adv_P) | 0.50 |
 
 
 
119
 
120
+ The evaluation settings measure generalization across the original task, cross-domain data, adversarial examples, structural changes, vocabulary variation, and adversarial perturbations.
 
121
 
122
  ---
 
123
 
124
+ ## Usage
125
+
126
+ ```python id="fjbd21"
127
+ from transformers import AutoTokenizer, AutoModelForTokenClassification
128
 
129
  model_id = "mdg-nlp/gpt-2-eventx-sentence-recognition"
130
 
131
  tokenizer = AutoTokenizer.from_pretrained(model_id)
132
  model = AutoModelForTokenClassification.from_pretrained(model_id)
133
 
134
+ text = "The company announced the acquisition on Monday."
135
+
136
+ inputs = tokenizer(text, return_tensors="pt", truncation=True)
137
+ outputs = model(**inputs)
138
+
139
+ predictions = outputs.logits.argmax(dim=-1)[0].tolist()
140
+
141
+ id2label = {
142
+ 0: "O",
143
+ 1: "B-E",
144
+ 2: "I-E"
145
+ }
146
 
147
+ tokens = tokenizer.convert_ids_to_tokens(inputs["input_ids"][0])
148
+
149
+ for token, prediction in zip(tokens, predictions):
150
+ print(token, id2label[prediction])
151
  ```
152
 
153
  ---
 
154
 
155
+ ## Limitations
156
 
157
+ - Performance may decrease under distribution shifts.
158
+ - Cross-domain event expressions may be more difficult to identify.
159
+ - Adversarial perturbations can affect extraction performance.
160
+ - Tokenization can affect predicted event boundaries.
161
+ - Longer or structurally different inputs may produce different behavior.
162
+ - Ambiguous or implicit events may not be identified correctly.
163
+ - The model extracts event expressions and does not directly perform event relation or temporal relation classification.
164
 
165
  ---
 
166
 
167
+ ## Research Context
 
 
 
168
 
169
+ This model was developed as part of research on **multi-dimensional generalization in temporal extraction tasks**.
 
170
 
171
+ The broader work studies temporal and event expression extraction under different forms of distribution shift, including domain shift, adversarial perturbations, vocabulary variation, compositional changes, and structural changes.
 
 
 
172
 
173
  ---
 
174
 
175
+ ## Contact
176
+
177
+ **Author:** Arnav Verma <br>
178
+ **Affiliation:** New York University <br>
179
 
180
  ---
 
181
 
182
+ ## Citation
183
+
184
+ If you use this model in your research, please cite the associated work when available.