Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,118 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
base_model:
|
4 |
+
- meta-llama/Llama-3.2-3B-Instruct
|
5 |
+
library_name: transformers
|
6 |
+
---
|
7 |
+
# Thought-Ranked Llama 3.2 3B v2
|
8 |
+
|
9 |
+
## What's New in v2?
|
10 |
+
|
11 |
+
The biggest improvement in v2 is how the model thinks through problems. Instead of just one level of thoughts, it can now explore up to 6 levels deep, building on its best ideas at each step. Think of it like having a conversation with yourself, where each new thought builds on your previous best insight.
|
12 |
+
|
13 |
+
## How It Works
|
14 |
+
|
15 |
+
Let's look at an example. When asked "What would happen if the moon disappeared?", the model might think:
|
16 |
+
|
17 |
+
```
|
18 |
+
<thoughts>
|
19 |
+
<thought>First, I should consider the moon's main effects on Earth</thought>
|
20 |
+
<thought>The moon controls our tides, so ocean patterns would change dramatically</thought>
|
21 |
+
<thought>Without the moon's gravitational pull, Earth's rotation would become unstable</thought>
|
22 |
+
<thought>This would lead to extreme climate changes and disrupted ecosystems</thought>
|
23 |
+
<thought>The loss of moonlight would affect nocturnal animals and human culture</thought>
|
24 |
+
<thought>Combining all these effects, we'd see a cascade of environmental changes</thought>
|
25 |
+
</thoughts>
|
26 |
+
|
27 |
+
The disappearance of the moon would have far-reaching consequences for Earth...
|
28 |
+
[detailed answer follows]
|
29 |
+
```
|
30 |
+
|
31 |
+
### System Messages
|
32 |
+
|
33 |
+
The model responds to different types of system prompts. Here are some examples:
|
34 |
+
|
35 |
+
1. Basic prompt:
|
36 |
+
```
|
37 |
+
{"role": "system", "content": "You are a helpful assistant. Think before responding."}
|
38 |
+
```
|
39 |
+
|
40 |
+
2. Specific thought count:
|
41 |
+
```
|
42 |
+
{"role": "system", "content": "You are a helpful assistant. Think 3 thoughts before responding."}
|
43 |
+
```
|
44 |
+
|
45 |
+
3. Standard helper:
|
46 |
+
```
|
47 |
+
{"role": "system", "content": "You are a helpful assistant."}
|
48 |
+
```
|
49 |
+
|
50 |
+
About 40% of training examples include system messages, and 75% of those specifically mention thinking. This helps the model learn when and how much to think through problems.
|
51 |
+
|
52 |
+
## Technical Details
|
53 |
+
|
54 |
+
- **Base Model**: Llama 3.2 3B
|
55 |
+
- **Training Data**: 2,500 carefully selected examples, each with up to 6 levels of thought chains
|
56 |
+
- **Thought Selection**: At each level, the model generates multiple possible thoughts and picks the best one using an external ranking system
|
57 |
+
|
58 |
+
## What's It Good For?
|
59 |
+
|
60 |
+
This model excels at tasks that benefit from careful thinking:
|
61 |
+
|
62 |
+
✅ Breaking down complex problems
|
63 |
+
✅ Step-by-step math solutions
|
64 |
+
✅ Detailed analysis of situations
|
65 |
+
✅ Explaining complicated concepts
|
66 |
+
✅ Making well-reasoned decisions
|
67 |
+
|
68 |
+
## Limitations
|
69 |
+
|
70 |
+
- Can sometimes overthink simple problems
|
71 |
+
- Limited by the capabilities of the base Llama 3.2 3B model
|
72 |
+
- Not suitable for critical decisions without human oversight
|
73 |
+
- May occasionally generate irrelevant thought chains
|
74 |
+
|
75 |
+
## Example Usage
|
76 |
+
|
77 |
+
```python
|
78 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
79 |
+
|
80 |
+
model = AutoModelForCausalLM.from_pretrained("ericflo/Llama-3.2-3B-COT-v2")
|
81 |
+
tokenizer = AutoTokenizer.from_pretrained("ericflo/Llama-3.2-3B-COT-v2")
|
82 |
+
|
83 |
+
messages = [
|
84 |
+
{"role": "system", "content": "You are a helpful assistant. Think 3 thoughts before responding."},
|
85 |
+
{"role": "user", "content": "How would you teach a child to ride a bike?"}
|
86 |
+
]
|
87 |
+
|
88 |
+
input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt")
|
89 |
+
output = model.generate(input_ids, temperature=1.0)
|
90 |
+
response = tokenizer.decode(output[0])
|
91 |
+
```
|
92 |
+
|
93 |
+
Example output:
|
94 |
+
```
|
95 |
+
<thoughts>
|
96 |
+
<thought>Safety should be the first priority - helmet and protective gear</thought>
|
97 |
+
<thought>Starting with balance using training wheels can build confidence</thought>
|
98 |
+
<thought>Breaking the process into small, manageable steps will help avoid overwhelm</thought>
|
99 |
+
</thoughts>
|
100 |
+
|
101 |
+
Here's how I would teach a child to ride a bike...
|
102 |
+
[detailed answer follows]
|
103 |
+
```
|
104 |
+
|
105 |
+
## Citation
|
106 |
+
|
107 |
+
```bibtex
|
108 |
+
@misc{thought-ranked-llama-v2,
|
109 |
+
title={Thought-Ranked Llama 3.2 v2: Hierarchical Chain-of-Thought Generation},
|
110 |
+
author={[Eric Florenzano]},
|
111 |
+
year={2024},
|
112 |
+
howpublished={\url{https://huggingface.co/ericflo/Llama-3.2-3B-COT-v2}}
|
113 |
+
}
|
114 |
+
```
|
115 |
+
|
116 |
+
## Acknowledgments
|
117 |
+
|
118 |
+
This model builds on the Llama 3.2 3B base model from Meta. Special thanks to the open-source AI community for their contributions to chain-of-thought prompting techniques.
|