---
license: other
tags:
- math
- alpaca
- synthetic data
- instruct
- axolotl
- finetune
- gpt4
datasets:
- TIGER-Lab/MathInstruct
- microsoft/orca-math-word-problems-200k
language:
- en
base_model: meta-math/MetaMath-Mistral-7B
---
![image/png](https://cdn-uploads.huggingface.co/production/uploads/6468ce47e134d050a58aa89c/jsw9mC64I69A_KwX0c6oi.png)
# š¢ EulerMath-Mistral-7B
This model is a full fine-tuned version of [meta-math/MetaMath-Mistral-7B](https://huggingface.co/meta-math/MetaMath-Mistral-7B) on the following datasets:
- š§® [TIGER-Lab/MathInstruct](https://huggingface.co/datasets/TIGER-Lab/MathInstruct)
- š [microsoft/orca-math-word-problems-200k](https://huggingface.co/datasets/microsoft/orca-math-word-problems-200k)
This model is finetuned using `8xRTX3090` + `1xRTXA6000` using [axolotl](https://github.com/OpenAccess-AI-Collective/axolotl).
This model's training was sponsored by [sablo.ai](https://sablo.ai).
See axolotl config
axolotl version: `0.4.0`
```yaml
base_model: meta-math/MetaMath-Mistral-7B
model_type: MistralForCausalLM
tokenizer_type: LlamaTokenizer
is_mistral_derived_model: true
load_in_8bit: false
load_in_4bit: false
strict: false
chat_template: alpaca
datasets:
- path: microsoft/orca-math-word-problems-200k
type: alpaca_chat.load_qa
conversation: alpaca
- path: TIGER-Lab/MathInstruct
type: alpaca
conversation: alpaca
dataset_prepared_path: last_run_prepared
val_set_size: 0.005
#val_set_size: 0.0
output_dir: ./EulerMath-Mistral-7B-model
sequence_len: 8192
sample_packing: true
pad_to_sequence_len: true
eval_sample_packing: false
wandb_project: Euler
wandb_entity:
wandb_watch:
wandb_name:
wandb_log_model:
hub_model_id: Weyaxi/EulerMath-Mistral-7B
save_safetensors: true
gradient_accumulation_steps: 4
micro_batch_size: 2 # changed
num_epochs: 2
optimizer: adamw_bnb_8bit
lr_scheduler: cosine
learning_rate: 0.000005
train_on_inputs: false
group_by_length: false
bf16: true
fp16: false
tf32: false
gradient_checkpointing: true
early_stopping_patience:
resume_from_checkpoint:
local_rank:
logging_steps: 1
xformers_attention:
flash_attention: true
warmup_steps: 10
evals_per_epoch: 4 # changed
eval_table_size:
eval_table_max_new_tokens: 128
saves_per_epoch: 1 # changed
debug:
deepspeed: zero3_bf16.json
weight_decay: 0.0
fsdp:
fsdp_config:
special_tokens:
bos_token: ""
eos_token: ""
unk_token: ""
```
# š¬ Prompt Template
You can use this prompt template while using the model:
### Alpaca
```
Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction:
{instruction}
### Response:
```
This prompt template is available as a [chat template](https://huggingface.co/docs/transformers/main/chat_templating), which means you can format messages using the
`tokenizer.apply_chat_template()` method:
```python
messages = [
{"role": "system", "content": "You are helpful AI asistant."},
{"role": "user", "content": "Hello!"}
]
gen_input = tokenizer.apply_chat_template(message, return_tensors="pt")
model.generate(**gen_input)
```
# š Quantizationed versions
## GGUF [@bartowski](https://huggingface.co/bartowski)
- https://huggingface.co/bartowski/EulerMath-Mistral-7B-GGUF
## ExLlamaV2 [@bartowski](https://huggingface.co/bartowski)
- https://huggingface.co/bartowski/EulerMath-Mistral-7B-exl2
## AWQ [@solidrust](https://huggingface.co/solidrust)
- https://huggingface.co/solidrust/EulerMath-Mistral-7B-AWQ
# šÆ Evaluation Results
Evaluation Results of this model are low due to the strict requirements for the eval GSM8K eval harness. I evaluated this model using [tinyGSM8k](https://huggingface.co/datasets/tinyBenchmarks/tinyGSM8k) which is a streamlined subset of 100 data points from the GSM8K dataset, enabling efficient evaluation of large language models with reduced computational resources.
The results are as follows:
```json
{
"exact_match,strict-match": 0.02,
"exact_match_stderr,strict-match": 0.014070529413628952,
"exact_match,flexible-extract": 0.73,
"exact_match_stderr,flexible-extract": 0.04461960433384741,
"alias": "gsm8k"
}
```
As you can see from the results, this model does not meet the required format for `strict-match` results but the given answers is actually correct. However, as indicated by the `flexible-extract` part, this model is actually quite proficient at math.
More details with examples
```json
{
"doc_id": 0,
"doc": {
"question": "Rory orders 2 subs for $7.50 each, 2 bags of chips for $1.50 each and 2 cookies for $1.00 each for delivery. Thereās a 20% delivery fee added at check out and she wants to add a $5.00 tip. What will her delivery order cost?",
"answer": "2 subs are $7.50 each so thatās 2*7.50 = $<<2*7.5=15.00>>15.00\n2 bags of chips are $1.50 each so thatās 2*1.50 = $<<2*1.50=3.00>>3.00\n2 cookies are $1.00 each so thatās 2*1 = $<<2*1=2.00>>2.00\nHer delivery order will be 15+3+2= $<<15+3+2=20.00>>20.00\nThereās a 20% delivery fee on the $20.00 which adds .20*20 = $4.00 to her bill\nThe delivery order is $20.00, thereās a $4.00 delivery fee and she adds a $5.00 tip for a total of 20+4+5 = $<<20+4+5=29.00>>29.00\n#### 29",
"input_formatted": "Question: Bridgette has 2 dogs, 3 cats, and 4 birds. She gives the dogs a bath twice a month. She gives the cats a bath once a month. She gives the birds a bath once every 4 months. In a year, how many baths does she give?\nAnswer: Each dog gets 24 baths a year because 2 x 12 = <<2*12=24>>24\nEach cat gets 12 baths a year because 1 x 12 = <<1*12=12>>12\nEach bird averages .25 baths per month because 1 / 4 = <<1/4=.25>>.25\nEach bird gets 3 baths a year because .25 x 12 = <<.25*12=3>>3\nShe gives 48 dog baths because 2 x 24 = <<2*24=48>>48\nShe gives 72 cat baths because 3 x 12 = 36\nShe gives 12 bird baths a year because 4 x 3 = <<4*3=12>>12\nShe gives 132 baths a year because 48 + 36+ 12 = <<48+36+12=96>>96\n#### 96\n\nQuestion: There are 3 numbers that are consecutive integers. Together they have a sum of 18. What is the largest of the 3 numbers?\nAnswer: Let N = smallest number\nN + 1 = next number\nN + 2 = largest number\nN + (N + 1) + (N + 2) = 18\n3N + 3 = 18\n3N = <<3*5=15>>15\nN = <<5=5>>5\nThe largest number is <<7=7>>7.\n#### 7\n\nQuestion: Betsy won 5 games of Monopoly. Helen won twice as many as Betsy and Susan won three times as many as Betsy. Between them, how many games have they won?\nAnswer: Helen won twice as many games as Betsy's 5 so Helen won 2*5 = <<10=10>>10 games\nSusan won three times as many games as Betsy's 5 so Susan won 3*5 = <<3*5=15>>15 games\nWhen you combine their wins, together they won 5+10+15 = <<5+10+15=30>>30 games total\n#### 30\n\nQuestion: Two friends, Hubert and Ian, are planning to have a pizza party. One box of pizza is worth $14, and a can of soda is worth $1.80. Hubert orders eight boxes of pizza and ten cans of soda. Ian buys ten boxes of pizza and fifteen cans of soda. How much do they spend in all?\nAnswer: The number of boxes of pizza is 8 + 10 = <<8+10=18>>18 boxes.\nThe number of cans of soda is 10 + 15 = <<10+15=25>>25 cans.\nThe eighteen boxes of pizza cost 18 x $14= $<<18*14=252>>252.\nThe cost of 25 cans of soda is 25 x $1.80= $<<25*1.8=45>>45.\nTherefore, the total amount they spend is $252 + $45 = $<<252+45=297>>297\n#### 297\n\nQuestion: Greg drives 30 miles from his workplace to the farmer's market. After buying his groceries at the farmers market, he drives home. To get home, he travels for 30 minutes at 20 miles per hour. How many miles in total does Greg travel?\nAnswer: We must first convert minutes to hours, so 30 minutes * (1 hour/60 minutes) = <<30*(1/60)=0.5>>0.5 hours\nThe number of miles Greg travels on his trip home is 0.5 hours * 20 mph = <<0.5*20=10>>10 miles\nThe total miles Greg travels is 10 + 30 = <<10+30=40>>40 miles\n#### 40\n\nQuestion: Rory orders 2 subs for $7.50 each, 2 bags of chips for $1.50 each and 2 cookies for $1.00 each for delivery. Thereās a 20% delivery fee added at check out and she wants to add a $5.00 tip. What will her delivery order cost?\nAnswer:"
},
"target": "2 subs are $7.50 each so thatās 2*7.50 = $<<2*7.5=15.00>>15.00\n2 bags of chips are $1.50 each so thatās 2*1.50 = $<<2*1.50=3.00>>3.00\n2 cookies are $1.00 each so thatās 2*1 = $<<2*1=2.00>>2.00\nHer delivery order will be 15+3+2= $<<15+3+2=20.00>>20.00\nThereās a 20% delivery fee on the $20.00 which adds .20*20 = $4.00 to her bill\nThe delivery order is $20.00, thereās a $4.00 delivery fee and she adds a $5.00 tip for a total of 20+4+5 = $<<20+4+5=29.00>>29.00\n#### 29",
"arguments": [
[
"Question: Jen and Tyler are gymnasts practicing flips. Jen is practicing the triple-flip while Tyler is practicing the double-flip. Jen did sixteen triple-flips during practice. Tyler flipped in the air half the number of times Jen did. How many double-flips did Tyler do?\nAnswer: Jen did 16 triple-flips, so she did 16 * 3 = <<16*3=48>>48 flips.\nTyler did half the number of flips, so he did 48 / 2 = <<48/2=24>>24 flips.\nA double flip has two flips, so Tyler did 24 / 2 = <<24/2=12>>12 double-flips.\n#### 12\n\nQuestion: Four people in a law firm are planning a party. Mary will buy a platter of pasta for $20 and a loaf of bread for $2. Elle and Andrea will split the cost for buying 4 cans of soda which cost $1.50 each, and chicken wings for $10. Joe will buy a cake that costs $5. How much more will Mary spend than the rest of the firm put together?\nAnswer: Mary will spend $20 + $2 = $<<20+2=22>>22.\nElle and Andrea will spend $1.5 x 4 = $<<1.5*4=6>>6 for the soda.\nElle and Andrea will spend $6 + $10 = $<<6+10=16>>16 for the soda and chicken wings.\nElle, Andrea, and Joe together will spend $16 + $5 = $<<16+5=21>>21.\nSo, Mary will spend $22 - $21 = $<<22-21=1>>1 more than all of them combined.\n#### 1\n\nQuestion: A charcoal grill burns fifteen coals to ash every twenty minutes of grilling. The grill ran for long enough to burn three bags of coals. Each bag of coal contains 60 coals. How long did the grill run?\nAnswer: The grill burned 3 * 60 = <<3*60=180>>180 coals.\nIt takes 20 minutes to burn 15 coals, so the grill ran for 180 / 15 * 20 = <<180/15*20=240>>240 minutes.\n#### 240\n\nQuestion: A bear is preparing to hibernate for the winter and needs to gain 1000 pounds. At the end of summer, the bear feasts on berries and small woodland animals. During autumn, it devours acorns and salmon. It gained a fifth of the weight it needed from berries during summer, and during autumn, it gained twice that amount from acorns. Salmon made up half of the remaining weight it had needed to gain. How many pounds did it gain eating small animals?\nAnswer: The bear gained 1 / 5 * 1000 = <<1/5*1000=200>>200 pounds from berries.\nIt gained 2 * 200 = <<2*200=400>>400 pounds from acorns.\nIt still needed 1000 - 200 - 400 = <<1000-200-400=400>>400 pounds.\nThus, it gained 400 / 2 = <<400/2=200>>200 pounds from salmon.\nTherefore, the bear gained 400 - 200 = <<400-200=200>>200 pounds from small animals.\n#### 200\n\nQuestion: Brendan can cut 8 yards of grass per day, he bought a lawnmower and it helped him to cut more yards by Fifty percent per day. How many yards will Brendan be able to cut after a week?\nAnswer: The additional yard Brendan can cut after buying the lawnmower is 8 x 0.50 = <<8*0.50=4>>4 yards.\nSo, the total yards he can cut with the lawnmower is 8 + 4 = <<8+4=12>>12.\nTherefore, the total number of yards he can cut in a week is 12 x 7 = <<12*7=84>>84 yards.\n#### 84\n\nQuestion: Rory orders 2 subs for $7.50 each, 2 bags of chips for $1.50 each and 2 cookies for $1.00 each for delivery. Thereās a 20% delivery fee added at check out and she wants to add a $5.00 tip. What will her delivery order cost?\nAnswer:",
{
"until": [
"Question:",
"",
"<|im_end|>"
],
"do_sample": false,
"temperature": 0.0
}
]
],
"resps": [
[
"The subs will cost 2 * $7.50 = $<<2*7.5=15>>15.\nThe chips will cost 2 * $1.50 = $<<2*1.5=3>>3.\nThe cookies will cost 2 * $1.00 = $<<2*1=2>>2.\nThe total cost of the food is $15 + $3 + $2 = $<<15+3+2=20>>20.\nThe delivery fee is $20 * 0.20 = $<<20*0.20=4>>4.\nThe total cost of the order is $20 + $4 + $5 = $<<20+4+5=29>>29.\nThe answer is 29"
]
],
"filtered_resps": [
"[invalid]"
],
"exact_match": 0.0
}
```
# š¤ Additional information about training
This model is full fine-tuned for 2 epoch.
Total number of steps was 544.
Loss graph
![image/png](https://cdn-uploads.huggingface.co/production/uploads/6468ce47e134d050a58aa89c/j0JhlZy3t3znB0DrWBFAT.png)
# š¤ Acknowledgments
Thanks to [sablo.ai](https://sablo.ai) for sponsoring this model.
Thanks to all the dataset authors mentioned in the datasets section.
Thanks to [axolotl](https://github.com/OpenAccess-AI-Collective/axolotl) for making the repository I used to make this model.
Thanks to all open source AI community.
[](https://github.com/OpenAccess-AI-Collective/axolotl)
If you would like to support me:
[ā Buy Me a Coffee](https://www.buymeacoffee.com/weyaxi)