Skip to content

Instantly share code, notes, and snippets.

@smerrill
Created April 19, 2025 20:11
Show Gist options
  • Save smerrill/2a14634053c751a98f02b10fda62cb68 to your computer and use it in GitHub Desktop.
Save smerrill/2a14634053c751a98f02b10fda62cb68 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"id": "a0b59f6f-4fbc-41e0-9ece-77092d8cd30e",
"metadata": {},
"source": [
"# Comparing Gemma3 Quants"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "0ff4b0db-56db-4f5f-8ac2-8785a0187f95",
"metadata": {},
"outputs": [],
"source": [
"from ollama import Client\n",
"client = Client(\n",
" host='http://localhost:11434',\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "1e39d074-a737-46c3-a4dd-4ea8220e391c",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.09030308962184819\n"
]
}
],
"source": [
"import simsimd\n",
"import numpy as np\n",
"\n",
"embeddings = client.embed(model='snowflake-arctic-embed2', input=['The sky is colored blue', 'The sky is a blue hue'])\n",
"dist = simsimd.cosine(np.array(embeddings.embeddings[0]), np.array(embeddings.embeddings[1]))\n",
"print(dist)"
]
},
{
"cell_type": "code",
"execution_count": 33,
"id": "aec519d8-0c5c-481e-acf3-964106392560",
"metadata": {},
"outputs": [],
"source": [
"import polars as pl\n",
"\n",
"pl.Config.set_fmt_str_lengths(900)\n",
"pl.Config.set_tbl_width_chars(900)\n",
"\n",
"splits = {'train': 'socratic/train-00000-of-00001.parquet', 'test': 'socratic/test-00000-of-00001.parquet'}\n",
"df = pl.read_parquet('hf://datasets/openai/gsm8k/' + splits['train'])"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "e6c82871-58d0-4e75-8bfe-ca15fab9798e",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['72', 'How many clips did Natalia sell in May? ** Natalia sold 48/2 = <<48/2=24>>24 clips in May.\\nHow many clips did Natalia sell altogether in April and May? ** Natalia sold 48+24 = <<48+24=72>>72 clips altogether in April and May.']\n",
"['10', 'How much does Weng earn per minute? ** Weng earns 12/60 = $<<12/60=0.2>>0.2 per minute.\\nHow much did Weng earn? ** Working 50 minutes, she earned 0.2 x 50 = $<<0.2*50=10>>10.']\n"
]
}
],
"source": [
"def split_answer_and_reasoning(combined_answer:str) -> tuple[str, str]:\n",
" [reasoning, answer] = combined_answer.split('####')\n",
" return [answer.strip(), reasoning.strip()]\n",
" \n",
"for [question, answer] in df[:2].iter_rows():\n",
" print(split_answer_and_reasoning(answer))"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "c121e4af-f915-43bd-913c-6aba1c148df0",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['lol', 'N/A', 'N/A']"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import re\n",
"\n",
"def split_on_h1(input: str) -> tuple[str, str]:\n",
" lines = re.split(r'^# (Reasoning|Answer):?', input, flags=re.MULTILINE)\n",
" filtered_lines = list(filter(lambda x: x not in ['', 'Reasoning', 'Answer'], lines))\n",
" if (len(filtered_lines) == 2):\n",
" return [input, filtered_lines[0].strip(), filtered_lines[1].strip()]\n",
" return [input, 'N/A', 'N/A']\n",
"\n",
"split_on_h1(\"\"\"# Reasoning\n",
"Okay, let's break this down.\n",
"\n",
"* **April:** Natalia sold clips to 48 of her friends. So, the number of clips sold in April is 48.\n",
"* **May:** Natalia sold half as many clips in May as she did in April. Half of 48 is 48 / 2 = 24 clips. So, Natalia sold 24 clips in May.\n",
"\n",
"* **Total:** To find the total number of clips sold, we add the number of clips sold in April and the number of clips sold in May: 48 + 24 = 72 clips.\n",
"\n",
"# Answer\n",
"72\"\"\")\n",
"\n",
"split_on_h1(\"\"\"# Reasoning: Yes\n",
"# Answer: 72\"\"\")\n",
"\n",
"split_on_h1(\"lol\")"
]
},
{
"cell_type": "code",
"execution_count": 37,
"id": "aa3fa233-3215-49f2-905c-b15cc7716d05",
"metadata": {},
"outputs": [],
"source": [
"from typing import List\n",
"def get_responses(problem:str) -> List[str]:\n",
" system_prompt = f\"\"\"You will be given a question. Return two lines as follows:\n",
" # Reasoning\n",
" \n",
" <insert a detailed breakdown of how you thought about the problem and came up with the answer>\n",
" \n",
" # Answer\n",
" \n",
" <return the one-word answer>\n",
" \"\"\"\n",
" quant_8_response = client.chat(model='hf.co/unsloth/gemma-3-1b-it-GGUF:Q8_0', options={'temperature': 1}, messages=[\n",
" {\n",
" 'role': 'system',\n",
" 'content': system_prompt,\n",
" },\n",
" {\n",
" 'role': 'user',\n",
" 'content': problem,\n",
" },\n",
" ])\n",
" q8_response = quant_8_response.message.content.strip()\n",
" # print(q8_response)\n",
" quant_1_response = client.chat(model='hf.co/unsloth/gemma-3-1b-it-GGUF:IQ1_S', options={'temperature': 1}, messages=[\n",
" {\n",
" 'role': 'system',\n",
" 'content': system_prompt,\n",
" },\n",
" {\n",
" 'role': 'user',\n",
" 'content': problem,\n",
" },\n",
" ])\n",
" q1_response = quant_1_response.message.content.strip()\n",
" # print(q1_response)\n",
" \n",
" return list(split_on_h1(q8_response)) + list(split_on_h1(q1_response))\n"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "0fcc88a1-c8a5-4ac6-a823-e37ece30c134",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"True\n"
]
}
],
"source": [
"def verify_answer(question: str, ground_truth:str, student_answer: str) -> bool:\n",
" # Borrowed from https://huggingface.co/TIGER-Lab/general-verifier\n",
" verifier_response = client.chat(model='gemma3:12b-it-qat', options={'temperature': 0}, messages=[\n",
" {\n",
" 'role': 'user',\n",
" 'content': (\n",
" f\"### Question: {question}\\n\\n\"\n",
" f\"### Ground Truth Answer: {ground_truth}\\n\\n\"\n",
" f\"### Student Answer: {student_answer}\\n\\n\"\n",
" \"For the above question, please verify if the student's answer is equivalent to the ground truth answer.\\n\"\n",
" \"Do not solve the question by yourself; just check if the student's answer is equivalent to the ground truth answer.\\n\"\n",
" \"If the student's answer is correct, output \\\"Final Decision: Yes\\\". If the student's answer is incorrect, output \\\"Final Decision: No\\\".\"\n",
" )\n",
" },\n",
" ])\n",
" output = verifier_response.message.content.strip()\n",
" return output == 'Final Decision: Yes'\n",
"\n",
"print(verify_answer('What is 1+1', '2', '### Answer: Two'))"
]
},
{
"cell_type": "code",
"execution_count": 43,
"id": "37527063-2f28-4e5d-8537-edbe3cd93b64",
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"testset = df[:5]\n",
"output = []\n",
"for question, combined_answer in testset.iter_rows():\n",
" [q8_raw_output, q8_rationale, q8_answer, q1_raw_output, q1_rationale, q1_answer] = get_responses(question)\n",
" [answer, rationale] = split_answer_and_reasoning(combined_answer)\n",
" q8_is_correct = verify_answer(question, answer, q8_answer if q8_answer != \"N/A\" else q8_raw_output)\n",
" q1_is_correct = verify_answer(question, answer, q1_answer if q1_raw_output != \"N/A\" else q1_raw_output)\n",
" # embeddings = client.embed(model='snowflake-arctic-embed2:latest', input=[q8_rationale, q1_rationale, rationale])\n",
" # np_embeddings = list(map(np.array, embeddings.embeddings))\n",
" # q8_sim = simsimd.cosine(np_embeddings[0], np_embeddings[2])\n",
" # q1_sim = simsimd.cosine(np_embeddings[1], np_embeddings[2])\n",
" output.append({\n",
" 'question': question,\n",
" 'answer': answer,\n",
" 'q8_answer': q8_answer,\n",
" 'q1_answer': q1_answer,\n",
" 'rationale': rationale,\n",
" # 'q8_rationale': q8_rationale,\n",
" # 'q1_rationale': q1_rationale,\n",
" # 'q8_cosine_sim': q8_sim,\n",
" # 'q1_cosine_sim': q1_sim,\n",
" 'q8_raw_output': q8_raw_output,\n",
" 'q1_raw_output': q1_raw_output,\n",
" 'q8_is_correct': q8_is_correct,\n",
" 'q1_is_correct': q1_is_correct,\n",
" })"
]
},
{
"cell_type": "code",
"execution_count": 44,
"id": "a950001f-80ba-4df1-91af-ac67b3fda03a",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div><style>\n",
".dataframe > thead > tr,\n",
".dataframe > tbody > tr {\n",
" text-align: right;\n",
" white-space: pre-wrap;\n",
"}\n",
"</style>\n",
"<small>shape: (5, 9)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>question</th><th>answer</th><th>q8_answer</th><th>q1_answer</th><th>rationale</th><th>q8_raw_output</th><th>q1_raw_output</th><th>q8_is_correct</th><th>q1_is_correct</th></tr><tr><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>bool</td><td>bool</td></tr></thead><tbody><tr><td>&quot;Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May?&quot;</td><td>&quot;72&quot;</td><td>&quot;72&quot;</td><td>&quot;72&quot;</td><td>&quot;How many clips did Natalia sell in May? ** Natalia sold 48/2 = &lt;&lt;48/2=24&gt;&gt;24 clips in May.\n",
"How many clips did Natalia sell altogether in April and May? ** Natalia sold 48+24 = &lt;&lt;48+24=72&gt;&gt;72 clips altogether in April and May.&quot;</td><td>&quot;# Reasoning\n",
"First, we need to find the number of clips Natalia sold in April. She sold clips to 48 of her friends, so she sold 48 clips in April.\n",
"\n",
"Next, we need to find the number of clips she sold in May. She sold half as many clips in May as in April, so she sold 48 / 2 = 24 clips in May.\n",
"\n",
"Finally, we need to find the total number of clips sold in April and May.&nbsp;&nbsp;Total = April&#x27;s clips + May&#x27;s clips = 48 + 24 = 72 clips.\n",
"\n",
"# Answer\n",
"72&quot;</td><td>&quot;# Reasoning\n",
"Okay, let&#x27;s break this down step-by-step.\n",
"\n",
"1. **April&#x27;s sales:** Natalia sold clips to 48 of her friends in April. That&#x27;s 48 individual clips.\n",
"2. **May&#x27;s sales:** She sold half as many clips in May as in April.&nbsp;&nbsp;We need to figure out how many clips she sold in May.&nbsp;&nbsp;We know she sold 48 clips in April, and half that is 48 / 2 = 24 clips.&nbsp;&nbsp;So, Natalia sold 24 clips in May.\n",
"\n",
"3. **Total sales:** To find the total number of clips sold, we add the number of clips sold in April and May: 48 + 24 = 72 clips.\n",
"\n",
"# Answer\n",
"72&quot;</td><td>true</td><td>true</td></tr><tr><td>&quot;Weng earns $12 an hour for babysitting. Yesterday, she just did 50 minutes of babysitting. How much did she earn?&quot;</td><td>&quot;10&quot;</td><td>&quot;10&quot;</td><td>&quot;N/A&quot;</td><td>&quot;How much does Weng earn per minute? ** Weng earns 12/60 = $&lt;&lt;12/60=0.2&gt;&gt;0.2 per minute.\n",
"How much did Weng earn? ** Working 50 minutes, she earned 0.2 x 50 = $&lt;&lt;0.2*50=10&gt;&gt;10.&quot;</td><td>&quot;# Reasoning\n",
"First, we need to convert 50 minutes to hours. Since there are 60 minutes in an hour, we have 50 minutes / 60 minutes/hour = 5/6 hours.\n",
"Then, we multiply the hourly rate by the number of hours worked: $12 * (5/6) = 10.\n",
"# Answer\n",
"10&quot;</td><td>&quot;# Reasoning\n",
"This is a straightforward calculation. We need to find the total earnings.\n",
"\n",
"*&nbsp;&nbsp;&nbsp;**Understanding the Problem:** Weng earns $12 per hour for babysitting. This is her normal rate.\n",
"*&nbsp;&nbsp;&nbsp;**Setting up the Equation:**&nbsp;&nbsp;Total earnings = (Rate per hour) * (Time worked)\n",
"*&nbsp;&nbsp;&nbsp;**Calculation:**&nbsp;&nbsp;$12 per hour * 50 minutes = $600\n",
"\n",
"*&nbsp;&nbsp;&nbsp;**Answer:** $600&quot;</td><td>true</td><td>false</td></tr><tr><td>&quot;Betty is saving money for a new wallet which costs $100. Betty has only half of the money she needs. Her parents decided to give her $15 for that purpose, and her grandparents twice as much as her parents. How much more money does Betty need to buy the wallet?&quot;</td><td>&quot;5&quot;</td><td>&quot;$35&quot;</td><td>&quot;N/A&quot;</td><td>&quot;How much money does Betty have in the beginning? ** In the beginning, Betty has only 100 / 2 = $&lt;&lt;100/2=50&gt;&gt;50.\n",
"How much money did Betty&#x27;s grandparents give her? ** Betty&#x27;s grandparents gave her 15 * 2 = $&lt;&lt;15*2=30&gt;&gt;30.\n",
"How much more money does Betty need to buy the wallet? ** This means, Betty needs 100 - 50 - 30 - 15 = $&lt;&lt;100-50-30-15=5&gt;&gt;5 more.&quot;</td><td>&quot;# Reasoning\n",
"First, we need to find out how much money Betty has. She has half of the wallet cost, which is $100 / 2 = $50. Then, we add the parents’ gift, which is $15. So, Betty has $50 + $15 = $65. Next, we find the grandparents’ contribution, which is twice the parents’ gift, so $15 * 2 = $30. Finally, we subtract the amount Betty has from the wallet cost to find out how much more she needs: $100 - $65 = $35.\n",
"\n",
"# Answer\n",
"$35&quot;</td><td>&quot;**1. Understanding the Problem:**\n",
"\n",
"* **Find the total money Betty has:** Betty needs $100, and her parents gave her $15. So, she has $100 - $15 = $85.\n",
"* **Find the total money her parents gave:** Her parents gave her $15.&nbsp;&nbsp;Grandparents give her twice as much, so they gave her $15 * 2 = $30.\n",
"* **Find the total amount of money Betty has:**&nbsp;&nbsp;We know she has $85, and her parents gave her $15.&nbsp;&nbsp;So, $85 + $30 = $115.\n",
"* **Find the amount of money she needs:**&nbsp;&nbsp;We’re told she has $85, and she needs $100.&nbsp;&nbsp;So, $100 - $115 = -$15.&nbsp;&nbsp;This is impossible, so we must have made a mistake.\n",
"\n",
"**2. Let&#x27;s re-think the problem. Betty has $85, and her parents gave her $15.&nbsp;&nbsp;Her grandparents give her twice as much, so she gets $15 * 2 = $30.&nbsp;&nbsp;We need to find the amount she has *after* the parents&#x27; contribution.&nbsp;&nbsp;We need to find the amount she has *after* her parents gave her $15.&nbsp;&nbsp;The question is asking how muc…</td><td>false</td><td>false</td></tr><tr><td>&quot;Julie is reading a 120-page book. Yesterday, she was able to read 12 pages and today, she read twice as many pages as yesterday. If she wants to read half of the remaining pages tomorrow, how many pages should she read?&quot;</td><td>&quot;42&quot;</td><td>&quot;42&quot;</td><td>&quot;12 pages&quot;</td><td>&quot;How many pages did Maila read today? ** Maila read 12 x 2 = &lt;&lt;12*2=24&gt;&gt;24 pages today.\n",
"How many pages did Maila read since yesterday? ** So she was able to read a total of 12 + 24 = &lt;&lt;12+24=36&gt;&gt;36 pages since yesterday.\n",
"How many pages are left to be read? ** There are 120 - 36 = &lt;&lt;120-36=84&gt;&gt;84 pages left to be read.\n",
"How many pages should she read tomorrow? ** Since she wants to read half of the remaining pages tomorrow, then she should read 84/2 = &lt;&lt;84/2=42&gt;&gt;42 pages.&quot;</td><td>&quot;# Reasoning\n",
"The book has 120 pages.\n",
"Yesterday, Julie read 12 pages.\n",
"Today, she read twice as many pages as yesterday, so she read 2 * 12 = 24 pages.\n",
"The total number of pages read so far is 12 + 24 = 36 pages.\n",
"The remaining pages are 120 - 36 = 84 pages.\n",
"She wants to read half of the remaining pages tomorrow, so she wants to read 84 / 2 = 42 pages.\n",
"\n",
"# Answer\n",
"42&quot;</td><td>&quot;# Reasoning\n",
"Okay, let’s break this down.\n",
"\n",
"1. **Initial Reading:** Julie started with 120 pages and read 12 pages.&nbsp;&nbsp;So, her total reading so far is 12 + 12 = 24 pages.\n",
"\n",
"2. **Today&#x27;s Reading:** Today, she read twice as many pages as yesterday, which means she read 12 + 12 = 24 pages.\n",
"\n",
"3. **Pages Remaining:** Let&#x27;s calculate the number of pages she read *today* which is 24 pages. However, we need to account for the fact that she read 12 pages yesterday. \n",
"&nbsp;&nbsp;&nbsp;We are told that she read twice as many pages as yesterday, which is 24 pages.\n",
"&nbsp;&nbsp;&nbsp;The number of pages read today is 24. \n",
"&nbsp;&nbsp;&nbsp;Let&#x27;s call the number of pages read today *today* as *t*.\n",
"\n",
"4. **Pages Remaining After Reading:** After reading today, she read 12 pages (yesterday). Then, she read 12 + 12 = 24 pages. \n",
"&nbsp;&nbsp;&nbsp;The total number of pages she read is 12 + 12 = 24 pages.\n",
"&nbsp;&nbsp;&nbsp;The number of pages remaining is 24 – 12 = 12 pages. \n",
"\n",
"5. **Pages Re…</td><td>true</td><td>false</td></tr><tr><td>&quot;James writes a 3-page letter to 2 different friends twice a week.&nbsp;&nbsp;How many pages does he write a year?&quot;</td><td>&quot;624&quot;</td><td>&quot;1836&quot;</td><td>&quot;N/A&quot;</td><td>&quot;How many pages does he write each week? ** He writes each friend 3*2=&lt;&lt;3*2=6&gt;&gt;6 pages a week\n",
"How many pages does he write every week? ** So he writes 6*2=&lt;&lt;6*2=12&gt;&gt;12 pages every week\n",
"How many pages does he write a year? ** That means he writes 12*52=&lt;&lt;12*52=624&gt;&gt;624 pages a year&quot;</td><td>&quot;# Reasoning\n",
"The letter is 3 pages long. He writes it twice a week, so in a year (12 months * 52 weeks/year = 612 weeks) he writes 3 pages/week * 612 weeks = 1836 pages.\n",
"\n",
"# Answer\n",
"1836&quot;</td><td>&quot;**12**\n",
"\n",
"**Reasoning:**\n",
"\n",
"The question is a bit of a trick! It’s designed to make you think about the *quantity* of writing rather than the *content*.&nbsp;&nbsp;Let’s break it down:\n",
"\n",
"*&nbsp;&nbsp;&nbsp;**Page 1:** A letter is generally considered to be a single page.\n",
"*&nbsp;&nbsp;&nbsp;**Page 2:** A letter is generally considered to be a single page.\n",
"*&nbsp;&nbsp;&nbsp;**Page 3:** A letter is generally considered to be a single page.\n",
"\n",
"Therefore, the total number of pages is 1 + 1 + 1 = 3 pages.\n",
"\n",
"**Answer:** 3&quot;</td><td>false</td><td>false</td></tr></tbody></table></div>"
],
"text/plain": [
"shape: (5, 9)\n",
"┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────┬───────────┬───────────┬───┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬───────────────┬───────────────┐\n",
"│ question ┆ answer ┆ q8_answer ┆ q1_answer ┆ … ┆ q8_raw_output ┆ q1_raw_output ┆ q8_is_correct ┆ q1_is_correct │\n",
"│ --- ┆ --- ┆ --- ┆ --- ┆ ┆ --- ┆ --- ┆ --- ┆ --- │\n",
"│ str ┆ str ┆ str ┆ str ┆ ┆ str ┆ str ┆ bool ┆ bool │\n",
"╞══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╪════════╪═══════════╪═══════════╪═══╪═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╪══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╪═══════════════╪═══════════════╡\n",
"│ Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May? ┆ 72 ┆ 72 ┆ 72 ┆ … ┆ # Reasoning ┆ # Reasoning ┆ true ┆ true │\n",
"│ ┆ ┆ ┆ ┆ ┆ First, we need to find the number of clips Natalia sold in April. She sold clips to 48 of her friends, so she sold 48 clips in April. ┆ Okay, let's break this down step-by-step. ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ Next, we need to find the number of clips she sold in May. She sold half as many clips in May as in April, so she sold 48 / 2 = 24 clips in May. ┆ 1. **April's sales:** Natalia sold clips to 48 of her friends in April. That's 48 individual clips. ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ 2. **May's sales:** She sold half as many clips in May as in April. We need to figure out how many clips she sold in May. We know she sold 48 clips in April, and half that is 48 / 2 = 24 clips. So, Natalia sold 24 clips in May. ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ Finally, we need to find the total number of clips sold in April and May. Total = April's clips + May's clips = 48 + 24 = 72 clips. ┆ ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ 3. **Total sales:** To find the total number of clips sold, we add the number of clips sold in April and May: 48 + 24 = 72 clips. ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ # Answer ┆ ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ 72 ┆ # Answer ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ 72 ┆ ┆ │\n",
"│ Weng earns $12 an hour for babysitting. Yesterday, she just did 50 minutes of babysitting. How much did she earn? ┆ 10 ┆ 10 ┆ N/A ┆ … ┆ # Reasoning ┆ # Reasoning ┆ true ┆ false │\n",
"│ ┆ ┆ ┆ ┆ ┆ First, we need to convert 50 minutes to hours. Since there are 60 minutes in an hour, we have 50 minutes / 60 minutes/hour = 5/6 hours. ┆ This is a straightforward calculation. We need to find the total earnings. ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ Then, we multiply the hourly rate by the number of hours worked: $12 * (5/6) = 10. ┆ ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ # Answer ┆ * **Understanding the Problem:** Weng earns $12 per hour for babysitting. This is her normal rate. ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ 10 ┆ * **Setting up the Equation:** Total earnings = (Rate per hour) * (Time worked) ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ * **Calculation:** $12 per hour * 50 minutes = $600 ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ * **Answer:** $600 ┆ ┆ │\n",
"│ Betty is saving money for a new wallet which costs $100. Betty has only half of the money she needs. Her parents decided to give her $15 for that purpose, and her grandparents twice as much as her parents. How much more money does Betty need to buy the wallet? ┆ 5 ┆ $35 ┆ N/A ┆ … ┆ # Reasoning ┆ **1. Understanding the Problem:** ┆ false ┆ false │\n",
"│ ┆ ┆ ┆ ┆ ┆ First, we need to find out how much money Betty has. She has half of the wallet cost, which is $100 / 2 = $50. Then, we add the parents’ gift, which is $15. So, Betty has $50 + $15 = $65. Next, we find the grandparents’ contribution, which is twice the parents’ gift, so $15 * 2 = ┆ ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ $30. Finally, we subtract the amount Betty has from the wallet cost to find out how much more she needs: $100 - $65 = $35. ┆ * **Find the total money Betty has:** Betty needs $100, and her parents gave her $15. So, she has $100 - $15 = $85. ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ * **Find the total money her parents gave:** Her parents gave her $15. Grandparents give her twice as much, so they gave her $15 * 2 = $30. ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ # Answer ┆ * **Find the total amount of money Betty has:** We know she has $85, and her parents gave her $15. So, $85 + $30 = $115. ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ $35 ┆ * **Find the amount of money she needs:** We’re told she has $85, and she needs $100. So, $100 - $115 = -$15. This is impossible, so we must have made a mistake. ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ **2. Let's re-think the problem. Betty has $85, and her parents gave her $15. Her grandparents give her twice as much, so she gets $15 * 2 = $30. We need to find the amount she has *after* the parents' contribution. We need to find the amount she has *after* her parents gave ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ her $15. The question is asking how muc… ┆ ┆ │\n",
"│ Julie is reading a 120-page book. Yesterday, she was able to read 12 pages and today, she read twice as many pages as yesterday. If she wants to read half of the remaining pages tomorrow, how many pages should she read? ┆ 42 ┆ 42 ┆ 12 pages ┆ … ┆ # Reasoning ┆ # Reasoning ┆ true ┆ false │\n",
"│ ┆ ┆ ┆ ┆ ┆ The book has 120 pages. ┆ Okay, let’s break this down. ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ Yesterday, Julie read 12 pages. ┆ ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ Today, she read twice as many pages as yesterday, so she read 2 * 12 = 24 pages. ┆ 1. **Initial Reading:** Julie started with 120 pages and read 12 pages. So, her total reading so far is 12 + 12 = 24 pages. ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ The total number of pages read so far is 12 + 24 = 36 pages. ┆ ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ The remaining pages are 120 - 36 = 84 pages. ┆ 2. **Today's Reading:** Today, she read twice as many pages as yesterday, which means she read 12 + 12 = 24 pages. ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ She wants to read half of the remaining pages tomorrow, so she wants to read 84 / 2 = 42 pages. ┆ ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ 3. **Pages Remaining:** Let's calculate the number of pages she read *today* which is 24 pages. However, we need to account for the fact that she read 12 pages yesterday. ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ # Answer ┆ We are told that she read twice as many pages as yesterday, which is 24 pages. ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ 42 ┆ The number of pages read today is 24. ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ Let's call the number of pages read today *today* as *t*. ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ 4. **Pages Remaining After Reading:** After reading today, she read 12 pages (yesterday). Then, she read 12 + 12 = 24 pages. ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ The total number of pages she read is 12 + 12 = 24 pages. ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ The number of pages remaining is 24 – 12 = 12 pages. ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ 5. **Pages Re… ┆ ┆ │\n",
"│ James writes a 3-page letter to 2 different friends twice a week. How many pages does he write a year? ┆ 624 ┆ 1836 ┆ N/A ┆ … ┆ # Reasoning ┆ **12** ┆ false ┆ false │\n",
"│ ┆ ┆ ┆ ┆ ┆ The letter is 3 pages long. He writes it twice a week, so in a year (12 months * 52 weeks/year = 612 weeks) he writes 3 pages/week * 612 weeks = 1836 pages. ┆ ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ **Reasoning:** ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ # Answer ┆ ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ 1836 ┆ The question is a bit of a trick! It’s designed to make you think about the *quantity* of writing rather than the *content*. Let’s break it down: ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ * **Page 1:** A letter is generally considered to be a single page. ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ * **Page 2:** A letter is generally considered to be a single page. ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ * **Page 3:** A letter is generally considered to be a single page. ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ Therefore, the total number of pages is 1 + 1 + 1 = 3 pages. ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n",
"│ ┆ ┆ ┆ ┆ ┆ ┆ **Answer:** 3 ┆ ┆ │\n",
"└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────┴───────────┴───────────┴───┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴───────────────┴───────────────┘"
]
},
"execution_count": 44,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"output_df = pl.DataFrame(output)\n",
"output_df"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment