Update README.md
Browse files
README.md
CHANGED
|
@@ -1,199 +1,172 @@
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
---
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
<!-- Provide a quick summary of what the model is/does. -->
|
| 9 |
-
|
| 10 |
-
|
| 11 |
|
| 12 |
## Model Details
|
| 13 |
|
| 14 |
### Model Description
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
| 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 |
-
|
| 38 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 39 |
-
|
| 40 |
-
### Direct Use
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
-
|
| 57 |
|
| 58 |
-
|
|
|
|
| 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 |
-
|
| 73 |
-
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
## Training Details
|
| 77 |
|
| 78 |
### Training Data
|
| 79 |
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
|
|
|
| 83 |
|
| 84 |
### Training Procedure
|
| 85 |
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
[More Information Needed]
|
| 91 |
-
|
| 92 |
|
| 93 |
#### Training Hyperparameters
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 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 |
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
### Testing Data, Factors & Metrics
|
| 108 |
-
|
| 109 |
-
#### Testing Data
|
| 110 |
-
|
| 111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
| 112 |
-
|
| 113 |
-
[More Information Needed]
|
| 114 |
|
| 115 |
-
|
| 116 |
|
| 117 |
-
|
| 118 |
|
| 119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
|
| 121 |
-
####
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
|
| 123 |
-
|
| 124 |
|
| 125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
|
| 127 |
-
|
| 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 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 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]
|
|
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
+
datasets:
|
| 4 |
+
- s-nlp/EverGreen-Multilingual
|
| 5 |
+
language:
|
| 6 |
+
- ru
|
| 7 |
+
- en
|
| 8 |
+
- fr
|
| 9 |
+
- de
|
| 10 |
+
- he
|
| 11 |
+
- ar
|
| 12 |
+
- zh
|
| 13 |
+
base_model:
|
| 14 |
+
- intfloat/multilingual-e5-small
|
| 15 |
+
pipeline_tag: text-classification
|
| 16 |
---
|
| 17 |
+
# E5-EG-small
|
| 18 |
|
| 19 |
+
A lightweight multilingual model for temporal classification of questions, fine-tuned from [intfloat/multilingual-e5-small](https://huggingface.co/intfloat/multilingual-e5-small).
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
## Model Details
|
| 22 |
|
| 23 |
### Model Description
|
| 24 |
|
| 25 |
+
E5-EG-small (E5 EverGreen - Small) is an efficient multilingual text classification model that determines whether questions have temporally mutable or immutable answers. This model offers a balanced trade-off between performance and computational efficiency.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
+
- **Model type:** Text Classification
|
| 28 |
+
- **Base model:** [intfloat/multilingual-e5-small](https://huggingface.co/intfloat/multilingual-e5-small)
|
| 29 |
+
- **Language(s):** Russian, English, French, German, Hebrew, Arabic, Chinese
|
| 30 |
+
- **License:** MIT
|
| 31 |
|
| 32 |
+
### Model Sources
|
| 33 |
|
| 34 |
+
- **Repository:** [GitHub](https://github.com/s-nlp/Evergreen-classification)
|
| 35 |
+
- **Paper:** [Will It Still Be True Tomorrow? Multilingual Evergreen Question Classification to Improve Trustworthy QA](https://arxiv.org/abs/2505.21115)
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
## How to Get Started with the Model
|
| 39 |
|
| 40 |
+
```python
|
| 41 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 42 |
+
import torch
|
| 43 |
+
import time
|
| 44 |
+
|
| 45 |
+
# Load model and tokenizer
|
| 46 |
+
model_name = "s-nlp/E5-EG-small"
|
| 47 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 48 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 49 |
+
|
| 50 |
+
# For optimal performance, use GPU if available
|
| 51 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 52 |
+
model = model.to(device)
|
| 53 |
+
model.eval()
|
| 54 |
+
|
| 55 |
+
# Batch classification example
|
| 56 |
+
questions = [
|
| 57 |
+
"What is the capital of France?",
|
| 58 |
+
"Who won the latest World Cup?",
|
| 59 |
+
"What is the speed of light?",
|
| 60 |
+
"What is the current Bitcoin price?"
|
| 61 |
+
]
|
| 62 |
+
|
| 63 |
+
# Tokenize all questions
|
| 64 |
+
inputs = tokenizer(
|
| 65 |
+
questions,
|
| 66 |
+
return_tensors="pt",
|
| 67 |
+
padding=True,
|
| 68 |
+
truncation=True,
|
| 69 |
+
max_length=64
|
| 70 |
+
).to(device)
|
| 71 |
+
|
| 72 |
+
# Classify
|
| 73 |
+
start_time = time.time()
|
| 74 |
+
with torch.no_grad():
|
| 75 |
+
outputs = model(**inputs)
|
| 76 |
+
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
|
| 77 |
+
predicted_classes = torch.argmax(predictions, dim=-1)
|
| 78 |
+
|
| 79 |
+
inference_time = (time.time() - start_time) * 1000 # ms
|
| 80 |
+
|
| 81 |
+
# Display results
|
| 82 |
+
class_names = ["Immutable", "Mutable"]
|
| 83 |
+
for i, question in enumerate(questions):
|
| 84 |
+
print(f"Q: {question}")
|
| 85 |
+
print(f" Classification: {class_names[predicted_classes[i].item()]}")
|
| 86 |
+
print(f" Confidence: {predictions[i][predicted_classes[i]].item():.2f}")
|
| 87 |
+
|
| 88 |
+
print(f"\nTotal inference time: {inference_time:.2f}ms")
|
| 89 |
+
print(f"Average per question: {inference_time/len(questions):.2f}ms")
|
| 90 |
+
```
|
| 91 |
|
| 92 |
## Training Details
|
| 93 |
|
| 94 |
### Training Data
|
| 95 |
|
| 96 |
+
Same multilingual dataset as E5-EG-large:
|
| 97 |
+
- ~4,000 questions per language
|
| 98 |
+
- Balanced class distribution
|
| 99 |
+
- Augmented with synthetic and translated data
|
| 100 |
|
| 101 |
### Training Procedure
|
| 102 |
|
| 103 |
+
#### Preprocessing
|
| 104 |
+
- Identical to E5-EG-large
|
| 105 |
+
- Maximum sequence length: 64 tokens
|
| 106 |
+
- Multilingual tokenization
|
|
|
|
|
|
|
| 107 |
|
| 108 |
#### Training Hyperparameters
|
| 109 |
+
- **Training regime:** fp16 mixed precision
|
| 110 |
+
- **Epochs:** 10
|
| 111 |
+
- **Batch size:** 32
|
| 112 |
+
- **Learning rate:** 5e-05
|
| 113 |
+
- **Warmup steps:** 300
|
| 114 |
+
- **Weight decay:** 0.01
|
| 115 |
+
- **Optimizer:** AdamW
|
| 116 |
+
- **Loss function:** Focal Loss (γ=2.0, α=0.25) with class weighting
|
| 117 |
+
- **Gradient accumulation steps:** 1
|
| 118 |
|
| 119 |
+
#### Hardware
|
| 120 |
+
- **GPUs:** Single NVIDIA V100
|
| 121 |
+
- **Training time:** ~2 hours
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
|
| 123 |
## Evaluation
|
| 124 |
|
| 125 |
+
### Testing Data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
|
| 127 |
+
Same test sets as E5-EG-large (2100 samples per language).
|
| 128 |
|
| 129 |
+
### Metrics
|
| 130 |
|
| 131 |
+
#### Per-Language F1 Scores
|
| 132 |
+
| Language | F1 Score | Δ vs Large |
|
| 133 |
+
|----------|----------|------------|
|
| 134 |
+
| English | 0.88 | -0.04 |
|
| 135 |
+
| Chinese | 0.87 | -0.04 |
|
| 136 |
+
| French | 0.86 | -0.04 |
|
| 137 |
+
| German | 0.85 | -0.04 |
|
| 138 |
+
| Russian | 0.84 | -0.04 |
|
| 139 |
+
| Hebrew | 0.83 | -0.04 |
|
| 140 |
+
| Arabic | 0.82 | -0.04 |
|
| 141 |
|
| 142 |
+
#### Class-wise Performance
|
| 143 |
+
| Class | Precision | Recall | F1 |
|
| 144 |
+
|-------|-----------|--------|-----|
|
| 145 |
+
| Immutable | 0.83 | 0.86 | 0.84 |
|
| 146 |
+
| Mutable | 0.86 | 0.83 | 0.84 |
|
| 147 |
|
| 148 |
+
### Efficiency Metrics
|
| 149 |
|
| 150 |
+
| Metric | E5-EG-small | E5-EG-large | Improvement |
|
| 151 |
+
|--------|-------------|-------------|-------------|
|
| 152 |
+
| Parameters | 118M | 560M | 4.7x smaller |
|
| 153 |
+
| Model Size (MB) | 471 | 2,240 | 4.8x smaller |
|
| 154 |
+
| Inference Time (ms) | 12 | 45 | 3.8x faster |
|
| 155 |
+
| Memory Usage (GB) | 0.8 | 3.2 | 4x less |
|
| 156 |
+
| Throughput (samples/sec) | 83 | 22 | 3.8x higher |
|
| 157 |
|
| 158 |
+
## Citation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
|
| 160 |
**BibTeX:**
|
| 161 |
|
| 162 |
+
```bibtex
|
| 163 |
+
@misc{pletenev2025truetomorrowmultilingualevergreen,
|
| 164 |
+
title={Will It Still Be True Tomorrow? Multilingual Evergreen Question Classification to Improve Trustworthy QA},
|
| 165 |
+
author={Sergey Pletenev and Maria Marina and Nikolay Ivanov and Daria Galimzianova and Nikita Krayko and Mikhail Salnikov and Vasily Konovalov and Alexander Panchenko and Viktor Moskvoretskii},
|
| 166 |
+
year={2025},
|
| 167 |
+
eprint={2505.21115},
|
| 168 |
+
archivePrefix={arXiv},
|
| 169 |
+
primaryClass={cs.CL},
|
| 170 |
+
url={https://arxiv.org/abs/2505.21115},
|
| 171 |
+
}
|
| 172 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|