Notebooks
T
Together
Thinking Augmented Generation

Thinking Augmented Generation

Author: Zain Hasan

Open In Colab

Introduction

In this notebook we will explore how you can improve the quality of smaller specialized models by using reasoning models.

Specifically we will get DeepSeek-R1 to reason about a prompt and then provide the thinking tokens to a smaller model like Qwen3.5-9B to generate a better response.

[1]

Small model alone:

[27]
To determine the number of "r's" in the words "strawberry" and "burberry" combined, we need to count the "r's" in each word and then add them together.

- The word "strawberry" has 3 "r's".
- The word "burberry" has 2 "r's".

Adding these together:

3 (from strawberry) + 2 (from burberry) = 5

So, there are 5 "r's" in the words "strawberry" and "burberry" combined.

Let's get R1 to think about the question and then provide the thinking tokens to a smaller model like Qwen3.5-9B to generate a better response.

[ ]
<think>
Okay, let's see. The question is asking how many times the letter "r" appears in the words "strawberry" and "burberry" combined. Hmm, I need to make sure I count each "r" in both words correctly. Let me start by writing down each word separately and then check each letter one by one.

First, let's take "strawberry". Let me spell it out: S-T-R-A-W-B-E-R-R-Y. Wait, let me count the letters. S (1), T (2), R (3), A (4), W (5), B (6), E (7), R (8), R (9), Y (10). So "strawberry" has 10 letters. Now, looking for the letter "r". Let's go through each letter again:

1. S - no
2. T - no
3. R - yes, that's the first "r"
4. A - no
5. W - no
6. B - no
7. E - no
8. R - second "r"
9. R - third "r"
10. Y - no

Wait, hold on. So in "strawberry", there are three "r"s? Let me confirm. The spelling is S-T-R-A-W-B-E-R-R-Y. So after the B, it's E, then R, R, Y. So positions 8 and 9 are both R's. So that's two R's after the E. But the third letter is also R. So that's three R's total in "strawberry"? Wait, no. Let me check again. The word is "strawberry". Let me break it down: "straw" + "berry". "Straw" is S-T-R-A-W, which has one R. Then "berry" is B-E-R-R-Y, which has two R's. So combined, that's 1 + 2 = 3 R's in "strawberry". Okay, that makes sense.

Now, moving on to "burberry". Let's spell that out: B-U-R-B-E-R-R-Y. Let me count the letters. B (1), U (2), R (3), B (4), E (5), R (6), R (7), Y (8). So "burberry" has 8 letters. Now, let's check for "r"s:

1. B - no
2. U - no
3. R - first "r"
4. B - no
5. E - no
6. R - second "r"
7. R - third "r"
8. Y - no

So in "burberry", there are three "r"s as well. Let me confirm by breaking it down. The brand name "Burberry" is often spelled B-U-R-B-E-R-R-Y. So after the B-U-R, then another B-E-R-R-Y. So the R's are at positions 3, 6, and 7. That's three R's. So "burberry" has three R's.

Now, adding both words together: "strawberry" has 3 R's and "burberry" has 3 R's. So 3 + 3 = 6. Therefore, the total number of R's in both words combined is 6.

Wait a second, let me double-check to make sure I didn't miscount. For "strawberry": S-T-R-A-W-B-E-R-R-Y. The R's are at positions 3, 8, and 9. That's three. For "burberry": B-U-R-B-E-R-R-Y. R's at positions 3, 6, 7. That's three. So 3 + 3 = 6. Yeah, that seems right. I don't think I missed any. Sometimes when letters are close together, it's easy to miscount, but breaking it down step by step helps. So the answer should be 6.

Prompt template to pass in the thinking tokens to the smaller model:

[29]
[30]
The total number of 'r's in the words "strawberry" and "burberry" combined is 6.