初始化项目,由ModelHub XC社区提供模型
Model: tokhey/question-generator-model-qwen2.5-1.5b Source: Original Platform
This commit is contained in:
240
README.md
Normal file
240
README.md
Normal file
@@ -0,0 +1,240 @@
|
||||
---
|
||||
language:
|
||||
- en
|
||||
license: apache-2.0
|
||||
base_model: Qwen/Qwen2.5-1.5B-Instruct
|
||||
pipeline_tag: text-generation
|
||||
library_name: transformers
|
||||
tags:
|
||||
- education
|
||||
- question-generation
|
||||
- qwen2.5
|
||||
- lora
|
||||
- egypt
|
||||
- english
|
||||
- mcq
|
||||
- json
|
||||
---
|
||||
|
||||
# Egyptian Ministry English Exam Question Generator (Qwen2.5-1.5B)
|
||||
|
||||
This model is a fine-tuned version of **Qwen2.5-1.5B-Instruct** designed to generate English multiple-choice questions that closely resemble the official examinations of the **Egyptian Ministry of Education (General Secondary Stage)**.
|
||||
|
||||
Unlike generic question generation models, this model was trained specifically to reproduce the wording, structure, difficulty, distractor quality, and examination style commonly found in Egyptian Ministry exams.
|
||||
|
||||
---
|
||||
|
||||
# Overview
|
||||
|
||||
The model receives curriculum information (Unit, Topic, Grammar Focus, Target Skills, Life Skills, Core Values) together with a user request and generates Ministry-style English MCQs in structured JSON format.
|
||||
|
||||
The objective is to assess **understanding rather than memorization**, while preserving the writing style used in official examinations.
|
||||
|
||||
---
|
||||
|
||||
# Base Model
|
||||
|
||||
- **Model:** Qwen/Qwen2.5-1.5B-Instruct
|
||||
- **Fine-tuning:** LoRA
|
||||
- **Framework:** LLaMA-Factory
|
||||
- **Training Type:** Supervised Fine-Tuning (SFT)
|
||||
- **Deployment Model:** Merged LoRA + Base Model
|
||||
|
||||
---
|
||||
|
||||
# Dataset
|
||||
|
||||
The model was trained using two complementary datasets.
|
||||
|
||||
## 1. Official Egyptian Ministry Dataset
|
||||
|
||||
A manually collected dataset extracted from previous official English examinations.
|
||||
|
||||
Each sample was converted into an instruction-following format including:
|
||||
|
||||
- curriculum metadata
|
||||
- grammar focus
|
||||
- target skills
|
||||
- ministry-style output
|
||||
|
||||
---
|
||||
|
||||
## 2. Synthetic Dataset
|
||||
|
||||
To improve generalization, an additional synthetic dataset was generated using **GLM-5.2**.
|
||||
|
||||
The synthetic data follows the same curriculum structure and examination philosophy while introducing diverse contexts and wording.
|
||||
|
||||
This significantly increased dataset diversity without changing the Ministry examination style.
|
||||
|
||||
---
|
||||
|
||||
# Capabilities
|
||||
|
||||
The model can generate:
|
||||
|
||||
- Grammar Questions
|
||||
- Vocabulary Questions
|
||||
- Reading Questions
|
||||
- Writing Questions
|
||||
- Ministry-style Distractors
|
||||
- JSON Responses
|
||||
- Multiple Questions in a Single Request
|
||||
|
||||
Each generated question contains:
|
||||
|
||||
- statement
|
||||
- correct_answer
|
||||
- plausible_distractors
|
||||
- explanation
|
||||
|
||||
---
|
||||
|
||||
# Recommended Prompt Structure
|
||||
|
||||
Although the model understands simple prompts, it performs significantly better when curriculum information is supplied.
|
||||
|
||||
Recommended prompt:
|
||||
|
||||
- User request
|
||||
- Unit information
|
||||
- Topic
|
||||
- Grammar Focus
|
||||
- Target Skills
|
||||
- Life Skills
|
||||
- Core Values
|
||||
- JSON Output Schema
|
||||
|
||||
---
|
||||
|
||||
# Example Prompt
|
||||
|
||||
Generate 5 Ministry-style grammar MCQs.
|
||||
|
||||
Unit: 11
|
||||
|
||||
Topic:
|
||||
Literature
|
||||
|
||||
Grammar Focus:
|
||||
Comparative and Superlative Adjectives
|
||||
|
||||
Return JSON only.
|
||||
|
||||
---
|
||||
|
||||
# Loading the Model
|
||||
|
||||
```python
|
||||
from transformers import AutoTokenizer, AutoModelForCausalLM
|
||||
|
||||
model_id = "tokhey/question-generator-model-qwen2.5-1.5b"
|
||||
|
||||
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
||||
|
||||
model = AutoModelForCausalLM.from_pretrained(
|
||||
model_id,
|
||||
device_map="auto",
|
||||
torch_dtype="auto"
|
||||
)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# Example Inference
|
||||
|
||||
```python
|
||||
messages = [
|
||||
{
|
||||
"role":"user",
|
||||
"content":"""
|
||||
Generate 3 Ministry-style grammar MCQs.
|
||||
|
||||
Unit: 8
|
||||
|
||||
Topic:
|
||||
A Journey Through Time
|
||||
|
||||
Grammar Focus:
|
||||
Active and Passive Voice
|
||||
|
||||
Return JSON only.
|
||||
"""
|
||||
}
|
||||
]
|
||||
|
||||
text = tokenizer.apply_chat_template(
|
||||
messages,
|
||||
tokenize=False,
|
||||
add_generation_prompt=True
|
||||
)
|
||||
|
||||
inputs = tokenizer(text, return_tensors="pt").to(model.device)
|
||||
|
||||
outputs = model.generate(
|
||||
**inputs,
|
||||
max_new_tokens=1024,
|
||||
do_sample=False
|
||||
)
|
||||
|
||||
print(
|
||||
tokenizer.decode(
|
||||
outputs[0][inputs.input_ids.shape[-1]:],
|
||||
skip_special_tokens=True
|
||||
)
|
||||
)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# Inference Tips
|
||||
|
||||
For deterministic evaluation:
|
||||
|
||||
```python
|
||||
do_sample=False
|
||||
```
|
||||
|
||||
For more diverse generations:
|
||||
|
||||
```python
|
||||
do_sample=True
|
||||
temperature=0.7
|
||||
top_p=0.9
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# Intended Applications
|
||||
|
||||
- Educational Platforms
|
||||
- AI Tutors
|
||||
- Question Generation Systems
|
||||
- Ministry-style Practice Exams
|
||||
- Curriculum Assessment Systems
|
||||
- Intelligent Learning Platforms
|
||||
|
||||
---
|
||||
|
||||
# Limitations
|
||||
|
||||
- The model is optimized for Egyptian Ministry English examinations.
|
||||
- Best performance is achieved when curriculum information is provided.
|
||||
- Output quality depends on prompt specificity.
|
||||
|
||||
---
|
||||
|
||||
# Acknowledgements
|
||||
|
||||
This model was developed as part of an undergraduate graduation project focused on automatic generation of Egyptian Ministry-style English examination questions using Large Language Models.
|
||||
|
||||
Base Model:
|
||||
Qwen Team
|
||||
|
||||
Fine-tuning Framework:
|
||||
LLaMA-Factory
|
||||
|
||||
Synthetic Data Generation:
|
||||
GLM-5.2
|
||||
|
||||
---
|
||||
Reference in New Issue
Block a user