File size: 7,168 Bytes
2d26bd7
 
 
f91e47d
2d26bd7
 
51f9b2c
2d26bd7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
---
base_model: TinyLlama/TinyLlama-1.1B-Chat-v1.0
library_name: peft
pipeline_tag: text-generation
---

# woym

This model is a fine-tuned version of TinyLlama-1.1B-Chat-v1.0 specialized for educational interactions with young children. It aims to provide helpful, age-appropriate responses to questions and prompts from primary school students.

## Model Details

### Model Description

This model was created by fine-tuning the TinyLlama-1.1B-Chat-v1.0 base model using the PEFT (Parameter-Efficient Fine-Tuning) library with QLoRA techniques. The fine-tuning focused on optimizing the model for educational content specifically tailored for young children, enhancing its ability to provide clear, simple, and instructional responses suitable for primary education.

- **Developed by:** Mohammad Ali
- **Funded by:** Self-funded research project
- **Model type:** Instruction-tuned causal language model with QLoRA fine-tuning
- **Language(s):** English
- **License:** Same as base model (TinyLlama-1.1B-Chat-v1.0)
- **Finetuned from model:** TinyLlama/TinyLlama-1.1B-Chat-v1.0

### Model Sources

- **Repository:** https://github.com/mohammad17ali/woym.ai



### Direct Use

This model is designed for direct interaction with primary school children or for educational applications targeting young learners. It can be used to:

- Answer basic educational questions
- Explain simple concepts
- Assist with homework in age-appropriate ways
- Generate educational content for young children
- Support teachers in creating learning materials

### Downstream Use

The model can be integrated into:
- Educational applications and platforms
- Classroom assistant tools
- Interactive learning environments
- Child-friendly chatbots
- Educational content creation systems

### Out-of-Scope Use

This model is not designed for:
- Providing medical, legal, or professional advice
- Generating content for adult audiences
- Addressing complex academic topics beyond primary education level
- Sensitive topics requiring nuanced understanding
- Decision-making in high-stakes scenarios

## Bias, Risks, and Limitations

- **Limited knowledge base**: As a fine-tuned version of a 1.1B parameter model, it has significantly less knowledge than larger models.
- **Simplified responses**: May oversimplify complex topics in ways that could create misconceptions.
- **Language limitations**: Primarily trained on English data and educational contexts.
- **Potential biases**: May reflect biases present in the educational dataset used for fine-tuning.
- **Hallucination risk**: Like all language models, it may generate plausible-sounding but incorrect information.
- **Limited context window**: The model has a maximum context length of 512 tokens, limiting its ability to process lengthy conversations.

### Recommendations

- Always review the model's outputs before sharing them with children
- Provide clear instructions when prompting the model
- Use the model as a supplementary tool rather than a primary educational resource
- Be aware of the model's tendency to occasionally generate incorrect information
- Consider deploying with human-in-the-loop oversight when used in educational settings

## How to Get Started with the Model

Use the code below to get started with the model:

```python
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

# Load the tokenizer
tokenizer = AutoTokenizer.from_pretrained("path/to/your/model")

# Load the model
model = AutoModelForCausalLM.from_pretrained("path/to/your/model")

# Generate text
def generate_text(prompt):
    formatted_prompt = f"<|im_start|>user\n{prompt}<|im_end|>\n<|im_start|>assistant\n"
    inputs = tokenizer(formatted_prompt, return_tensors="pt").to("cuda" if torch.cuda.is_available() else "cpu")
    
    output = model.generate(
        **inputs, 
        max_length=512, 
        temperature=0.7, 
        top_p=0.9, 
        do_sample=True,
        repetition_penalty=1.2
    )
    
    generated_text = tokenizer.decode(output[0], skip_special_tokens=False)
    assistant_response = generated_text.split("<|im_start|>assistant\n")[-1].split("<|im_end|>")[0]
    return assistant_response

# Example usage
prompt = "Can you explain what photosynthesis is in simple terms?"
response = generate_text(prompt)
print(response)
```


### Training Data

This model was fine-tuned on the "ajibawa-2023/Education-Young-Children" dataset, which contains educational interactions between teachers and primary school students. The dataset includes a variety of educational topics appropriate for young learners.

### Training Procedure

The model was fine-tuned using Parameter-Efficient Fine-Tuning (PEFT) with QLoRA technique to reduce memory usage while maintaining quality.

#### Preprocessing

- Input data was formatted with special tokens to denote user and assistant turns
- Prompts and responses were concatenated with appropriate markers
- Tokenization was performed with a maximum sequence length of 512 tokens

#### Training Hyperparameters

- **Training regime:** FP16 mixed precision
- **Number of epochs:** 2
- **Learning rate:** 2e-5
- **Batch size:** 1 (with gradient accumulation)
- **LoRA rank (r):** 8
- **LoRA alpha:** 32
- **LoRA dropout:** 0.05
- **Target modules:** q_proj, v_proj
- **Warmup steps:** 100
- **Optimizer:** AdamW

#### Speeds, Sizes, Times

- **Training time:** Approximately [X] hours on a P100 GPU
- **Model size:** Base model (1.1B parameters) + 2-3MB for LoRA adapters
- **Hardware used:** NVIDIA P100 GPU on Kaggle

## Evaluation

### Testing Data, Factors & Metrics

#### Testing Data

The model was evaluated on a held-out subset of the "ajibawa-2023/Education-Young-Children" dataset.

#### Factors

Evaluation considered:
- Response relevance to educational queries
- Age-appropriateness of language and content
- Accuracy of educational information
- Safety and appropriateness of content

#### Metrics

- Perplexity
- Manual evaluation of response quality
- Response coherence and helpfulness

### Results

[You can add specific evaluation results here when available]

## Environmental Impact

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).

- **Hardware Type:** NVIDIA P100 GPU
- **Hours used:** Approximately [X] hours
- **Cloud Provider:** Kaggle
- **Compute Region:** [Your region]
- **Carbon Emitted:** [Add estimation if available]

## Technical Specifications

### Model Architecture and Objective

The model uses the TinyLlama architecture (1.1B parameters) with additional LoRA adapters applied to the attention layers. The objective was next-token prediction using a causal language modeling approach, specialized for educational content.

### Compute Infrastructure

#### Hardware

- NVIDIA P100 GPU on Kaggle
- 16GB GPU memory
- 4 vCPUs

#### Software

- Python 3.10
- PyTorch 2.0+
- Transformers 4.30+
- PEFT 0.14.0
- Accelerate 0.20+

## Model Card Authors

Mohammad Ali

## Model Card Contact
GitHub: https://github.com/mohammad17ali
mailto:mohammad.ali.goba@gmail.com