Update README.md
Browse files
README.md
CHANGED
|
@@ -1,199 +1,135 @@
|
|
| 1 |
-
|
| 2 |
-
library_name: transformers
|
| 3 |
-
tags: []
|
| 4 |
-
---
|
| 5 |
|
| 6 |
-
|
| 7 |
|
| 8 |
-
|
| 9 |
|
| 10 |
|
|
|
|
| 11 |
|
| 12 |
-
|
| 13 |
|
| 14 |
-
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
|
| 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 |
-
|
| 29 |
|
| 30 |
-
|
| 31 |
|
| 32 |
-
-
|
| 33 |
-
- **Paper [optional]:** [More Information Needed]
|
| 34 |
-
- **Demo [optional]:** [More Information Needed]
|
| 35 |
|
| 36 |
-
|
|
|
|
|
|
|
| 37 |
|
| 38 |
-
|
| 39 |
|
| 40 |
-
###
|
| 41 |
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
-
|
| 45 |
|
| 46 |
-
|
| 47 |
|
| 48 |
-
|
|
|
|
|
|
|
| 49 |
|
| 50 |
-
|
| 51 |
|
| 52 |
-
|
|
|
|
|
|
|
| 53 |
|
| 54 |
-
|
|
|
|
|
|
|
| 55 |
|
| 56 |
-
|
| 57 |
|
| 58 |
-
|
| 59 |
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
-
|
|
|
|
|
|
|
| 63 |
|
| 64 |
-
|
|
|
|
|
|
|
| 65 |
|
| 66 |
-
|
|
|
|
|
|
|
| 67 |
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
-
|
| 73 |
|
| 74 |
-
|
| 75 |
|
| 76 |
-
|
| 77 |
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
-
|
| 83 |
|
| 84 |
-
|
| 85 |
|
| 86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
-
|
|
|
|
| 89 |
|
| 90 |
-
|
| 91 |
|
|
|
|
| 92 |
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
## Evaluation
|
| 104 |
-
|
| 105 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 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 |
-
#### 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]
|
|
|
|
| 1 |
+
# EdNa: Educational Nimble Assistant (MCQA Model)
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
+
This is the official Hugging Face model card for the Multiple-Choice Question Answering (MCQA) version of EdNa (Educational Nimble Assistant), an AI tutor specialized for STEM subjects.
|
| 4 |
|
| 5 |
+
This model was developed by Lysandre Costes, Hassen Aissa, Levin Hertrich, Yassine Turki, and I-am-an-assistant.
|
| 6 |
|
| 7 |
|
| 8 |
+
## Model Description
|
| 9 |
|
| 10 |
+
EdNa is an AI tutor fine-tuned to excel at answering multiple-choice questions in STEM fields. It is designed to provide accurate and consistently formatted answers, making it a reliable tool for educational applications.
|
| 11 |
|
| 12 |
+
This model is the result of a two-stage training pipeline built upon the `Qwen/Qwen2-0.5B-Instruct` base model:
|
| 13 |
|
| 14 |
+
1. **Supervised Fine-Tuning (SFT):** The base model was first fine-tuned on a rich mixture of STEM-focused datasets (mathematics, abstract algebra, coding) and general instruction-following datasets. This SFT stage built a strong foundation in scientific topics and conversational structure, preventing catastrophic forgetting.
|
| 15 |
|
| 16 |
+
2. **Reinforcement Learning with Verifiable Reward (RLVR):** To master the MCQA format, the SFT model was further trained using RLVR. This stage employed a specific reward scheme to shape the model's behavior:
|
| 17 |
+
* `+1.0` reward for generating the correct answer.
|
| 18 |
+
* `-1.0` penalty for generating an incorrect answer.
|
| 19 |
+
* `+0.5` reward for adhering to the required output format (i.e., outputting only the correct letter).
|
| 20 |
|
| 21 |
+
This process pushes the model to not only identify the correct solution but also to present it in a clean, predictable format, making it "nimble" and easy to integrate into downstream applications.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
+
## Intended Uses & Limitations
|
| 24 |
|
| 25 |
+
### Intended Use
|
| 26 |
|
| 27 |
+
EdNa is primarily intended as an educational tool for STEM students. Its main use case is zero-shot Multiple-Choice Question Answering. It can be integrated into applications like:
|
|
|
|
|
|
|
| 28 |
|
| 29 |
+
* AI-powered tutoring platforms
|
| 30 |
+
* Interactive study aids
|
| 31 |
+
* Automated quiz generators and checkers
|
| 32 |
|
| 33 |
+
The model is trained to receive a question and a set of multiple-choice options and output only the letter corresponding to the correct answer.
|
| 34 |
|
| 35 |
+
### Limitations and Bias
|
| 36 |
|
| 37 |
+
* **Language:** EdNa is trained exclusively on English data and will not perform well in other languages.
|
| 38 |
+
* **Domain:** The model is highly specialized for STEM subjects. Using it for non-STEM topics may lead to a higher rate of hallucinations and incorrect answers.
|
| 39 |
+
* **Potential for Misuse:** Like any educational tool, EdNa could be misused for academic dishonesty (e.g., cheating on exams). We recommend its use as a learning aid rather than an answer key.
|
| 40 |
+
* **Knowledge Cutoff:** The model's knowledge is static and based on its training data. It is not aware of information or developments beyond its training date.
|
| 41 |
|
| 42 |
+
## How to Get Started
|
| 43 |
|
| 44 |
+
You can use the `transformers` library to easily run EdNa. Since the model is trained to provide a concise answer, the generation parameters should be set accordingly.
|
| 45 |
|
| 46 |
+
```python
|
| 47 |
+
import torch
|
| 48 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 49 |
|
| 50 |
+
model_id = "HAissa/EdNA"
|
| 51 |
|
| 52 |
+
# Load the model and tokenizer
|
| 53 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
|
| 54 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 55 |
|
| 56 |
+
# --- Example 1: Math Question ---
|
| 57 |
+
question = "What is the derivative of x^2 with respect to x?"
|
| 58 |
+
options = "A) 2x\nB) x\nC) x^2\nD) 2"
|
| 59 |
|
| 60 |
+
prompt = f"Question: {question}\nOptions:\n{options}\nAnswer:"
|
| 61 |
|
| 62 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 63 |
|
| 64 |
+
# Generate the answer
|
| 65 |
+
# EdNa is trained to be concise, so a low max_new_tokens is sufficient.
|
| 66 |
+
outputs = model.generate(**inputs, max_new_tokens=3)
|
| 67 |
+
answer_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 68 |
|
| 69 |
+
# The model is trained to output the correct letter in the first line.
|
| 70 |
+
# We can parse it like this:
|
| 71 |
+
final_answer = answer_text.split("Answer:")[1].strip().split('\n')[0]
|
| 72 |
|
| 73 |
+
print(f"Question: {question}")
|
| 74 |
+
print(f"Final Answer: {final_answer}")
|
| 75 |
+
# Expected Output: A
|
| 76 |
|
| 77 |
+
# --- Example 2: Science Question ---
|
| 78 |
+
question = "Which of the following is a noble gas?"
|
| 79 |
+
options = "A) Oxygen\nB) Nitrogen\nC) Argon\nD) Carbon Dioxide"
|
| 80 |
|
| 81 |
+
prompt = f"Question: {question}\nOptions:\n{options}\nAnswer:"
|
| 82 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 83 |
+
outputs = model.generate(**inputs, max_new_tokens=3)
|
| 84 |
+
answer_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 85 |
+
final_answer = answer_text.split("Answer:")[1].strip().split('\n')[0]
|
| 86 |
|
| 87 |
+
print(f"Question: {question}")
|
| 88 |
+
print(f"Final Answer: {final_answer}")
|
| 89 |
+
# Expected Output: C
|
| 90 |
+
```
|
| 91 |
|
| 92 |
+
## Evaluation Results
|
| 93 |
|
| 94 |
+
EdNa's two-stage training process results in significant performance gains over the base model, particularly in reasoning-intensive tasks. The Output Correctness (OC) metric measures the percentage of questions where the model generates the exact correct option in a zero-shot setting.
|
| 95 |
|
| 96 |
+
The table below shows the clear progression in performance from the base model, through the SFT stage, to the final RLVR-tuned EdNa model.
|
| 97 |
|
| 98 |
+
| Model | SciQ (OC) | MMLU (OC) | AquaRat (OC) | MMLU PRO (Likelihood) |
|
| 99 |
+
|-------------------|-----------|-----------|--------------|-----------------------|
|
| 100 |
+
| Qwen 0.6B Base | 18.9% | 4.4% | 2.5% | 19.0% |
|
| 101 |
+
| Qwen SFT | 77.0% | 34.9% | 19.5% | 20.0% |
|
| 102 |
+
| EdNa (SFT+RLVR) | 84.0% | 42.4% | 34.1% | 22.7% |
|
| 103 |
|
| 104 |
+
The results highlight:
|
| 105 |
+
* **Effectiveness of RLVR:** The reinforcement learning stage dramatically improves performance on all benchmarks, especially on the math reasoning dataset AquaRat (from 19.5% to 34.1%).
|
| 106 |
+
* **Reliable Formatting:** The training method teaches the model to answer MCQs correctly and in the proper format, boosting the Output Correctness metric significantly over the base model.
|
| 107 |
+
* **Strong Generalization:** The model shows improved reasoning capabilities on the challenging MMLU-PRO benchmark.
|
| 108 |
|
| 109 |
+
## Training Data
|
| 110 |
|
| 111 |
+
EdNa was trained on a diverse corpus of data to ensure robust STEM and instruction-following capabilities.
|
| 112 |
|
| 113 |
+
### SFT Stage
|
| 114 |
+
A mixture of datasets including:
|
| 115 |
+
* Math, abstract algebra, and coding subsets from Tulu3 SFT.
|
| 116 |
+
* Math questions from various Stack Exchange sites (stackmathqa2024).
|
| 117 |
+
* General STEM MCQ training splits and instruction-following datasets.
|
| 118 |
+
* A Chain-of-Thought (CoT) dataset to improve reasoning.
|
| 119 |
|
| 120 |
+
### RLVR Stage
|
| 121 |
+
Utilized the MCQ datasets listed above, with rewards based on the correctness of the answer and format.
|
| 122 |
|
| 123 |
+
## Citation
|
| 124 |
|
| 125 |
+
If you use EdNa in your work, please cite the original paper:
|
| 126 |
|
| 127 |
+
```bibtex
|
| 128 |
+
@article{costes2024edna,
|
| 129 |
+
title={EdNA},
|
| 130 |
+
author={Costes, Lysandre and Aissa, Hassen and Hertrich, Levin and Turki, Yassine and I-am-an-assistant},
|
| 131 |
+
year={2024},
|
| 132 |
+
journal={CS-552 Project Report, EPFL},
|
| 133 |
+
note={\href{https://github.com/CS-552/project-m3-2025-i-am-just-an-assistant}{Github repo}}
|
| 134 |
+
}
|
| 135 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|