File size: 3,841 Bytes
a29adcf
 
 
 
 
 
 
 
 
 
 
 
 
3a7e30a
 
 
22507c4
 
3a7e30a
809466f
 
3a7e30a
68aa3f5
22507c4
68aa3f5
55d6387
22507c4
 
3a7e30a
55d6387
 
22507c4
7d93d02
 
 
 
22507c4
 
 
6b79ba6
22507c4
 
6b79ba6
22507c4
 
6b79ba6
 
 
 
 
 
 
 
 
 
22507c4
6b79ba6
22507c4
 
3a7e30a
 
809466f
 
 
 
 
 
 
 
 
3a7e30a
 
55d6387
 
 
 
 
 
 
 
 
 
 
 
3a7e30a
 
55d6387
 
 
 
 
 
 
 
 
 
 
3a7e30a
 
 
 
 
 
 
 
 
 
 
55d6387
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
---
title: Open O1
emoji: 🦀
colorFrom: gray
colorTo: indigo
sdk: streamlit
sdk_version: 1.38.0
app_file: app.py
pinned: false
license: apache-2.0
short_description: mimics openai-o1
---

# Open-o1

It thinks like o1

## TODO

Todo

[ ] Add fallback llms 
[ ] Better error handling 
[ ] Add Tools (web, math, code)
[ ] Make cli
[ ] better prompts for mathematical reasoning/reviewing

## What it does

- It taks the prompt, decides whether to use chain of thought or direct answer, if cot then generates answer and does self review, if direct answer then directly generates answer.
- Mathematical reasoning, symbolic reasoning and semi-symbolic reasoning kind of tasks generally improves with chain of thought, but direct answer is good for factual recall, simple inferences, commonsense reasoning, language understanding tasks.

## Live Demo
Open-o1 
* [Streamlit](https://open-o1.streamlit.app/)
* [Huggingface](https://huggingface.co/spaces/tikendraw/open-o1)
## Installation

```bash
#clone the repo
git clone https://github.com/tikendraw/open-o1.git

# goto folder
cd open-o1

# make a virtual env
python -m venv .venv

# activate the virtual env
source .venv/bin/activate

# install requirements
pip install -e .

#finally run the server
streamlit run app.py

```

HAVE FUN.

## FIndings

Although this project tries to mimic openai's o1,  many times it falls short in generating and better reflections on previous answers, and that i thinks comes from the lack of such kind of training data that used to train the models (other models before o1), these models are probably not trained for fixing mistakes with better reasoning.  

for example: here a `cerebras/llama3.1-70b` models jumps back and forth between count of "r" s in Straberry as 2 and 3. Even when having second thoughts, It doesn't sticks to its reasoning and because of the model bias it generates wrong answers. may be prompting can solve, but training with such data would be better.
![wrong answer formation due to model bias](src/error-image.png)



## Helpful Papers

1. To Cot or not to Cot? CHAIN-OF-THOUGHT HELPS MAINLY ON MATH AND SYMBOLIC REASONING
```bibtex
@misc{sprague2024cotcotchainofthoughthelps,
      title={To CoT or not to CoT? Chain-of-thought helps mainly on math and symbolic reasoning}, 
      author={Zayne Sprague and Fangcong Yin and Juan Diego Rodriguez and Dongwei Jiang and Manya Wadhwa and Prasann Singhal and Xinyu Zhao and Xi Ye and Kyle Mahowald and Greg Durrett},
      year={2024},
      eprint={2409.12183},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2409.12183}, 
}
```

2. The Impact of Reasoning Step Length on Large Language Models
```bibtex
@misc{jin2024impactreasoningsteplength,
      title={The Impact of Reasoning Step Length on Large Language Models}, 
      author={Mingyu Jin and Qinkai Yu and Dong Shu and Haiyan Zhao and Wenyue Hua and Yanda Meng and Yongfeng Zhang and Mengnan Du},
      year={2024},
      eprint={2401.04925},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2401.04925}, 
}
```
3. Towards Understanding Chain-of-Thought Prompting: An Empirical Study of What Matters [2212.10001](https://arxiv.org/abs/2212.10001)
```bibtex
@misc{wang2023understandingchainofthoughtpromptingempirical,
      title={Towards Understanding Chain-of-Thought Prompting: An Empirical Study of What Matters}, 
      author={Boshi Wang and Sewon Min and Xiang Deng and Jiaming Shen and You Wu and Luke Zettlemoyer and Huan Sun},
      year={2023},
      eprint={2212.10001},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2212.10001}, 
}
```

# But me a Coffee

[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://buymeacoffee.com/tikendraw)