kamesh.work

Teaching a Small Model to Count the R's in Strawberry

· Kamesh Sethupathi

I'm currently experimenting with a reasoning-capable AI agent built on the Llama 3.2 3B model. So far the results have been promising.

To test its reasoning, I used the classic "strawberry" problem. When asked how many R's are in the word strawberry, the model without my changes consistently answered 2. With my implementation, it answered 3. That is the kind of reasoning I would expect from much bigger models like GPT-4o.

My approach:

  • Receive a query from the user.
  • Feed the query to the LLM and ask it to generate a set of reasoning sub-questions. This runs as a loop, and the model signals a stop when it is done.
  • Once the reasoning is complete, ask the LLM for the final answer.

Key insight:

The quality of an LLM's output doesn't depend only on model size. It depends on the quality of the context it processes.

Caveats:

  • The output isn't always consistent. Sometimes it gets the right answer, and sometimes it hallucinates.
  • Even so, the correct answers in many cases give me hope that there is room to improve.

Reach me

Happy to talk about frontend and backend technologies, or about building something together.