Add pipeline tag and link to paper page
#1
by
nielsr
HF staff
- opened
README.md
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
---
|
2 |
-
|
3 |
language:
|
4 |
- en
|
|
|
|
|
5 |
metrics:
|
6 |
- accuracy
|
7 |
-
|
8 |
-
library_name: transformers
|
9 |
tags:
|
10 |
-
- llama
|
11 |
-
- gguf-my-repo
|
12 |
---
|
13 |
|
14 |
# Triangle104/SuperCorrect-7B-Q5_K_S-GGUF
|
@@ -28,6 +28,8 @@ Introduction
|
|
28 |
-
|
29 |
This repo provides the official implementation of SuperCorrect a novel two-stage fine-tuning method for improving both reasoning accuracy and self-correction ability for LLMs.
|
30 |
|
|
|
|
|
31 |
Notably, our SupperCorrect-7B model significantly surpasses powerful DeepSeekMath-7B by 7.8%/5.3% and Qwen2.5-Math-7B by 15.1%/6.3% on MATH/GSM8K benchmarks, achieving new SOTA performance among all 7B models.
|
32 |
🚨 Unlike other LLMs, we incorporate LLMs with our pre-defined hierarchical thought template ([Buffer of Thought (BoT)](https://github.com/YangLing0818/buffer-of-thought-llm)) to conduct more deliberate reasoning than conventional CoT. It should be noted that our evaluation methods relies on pure mathematical reasoning abilities of LLMs, instead of leverage other programming methods such as PoT and ToRA.
|
33 |
|
@@ -50,6 +52,7 @@ Inference
|
|
50 |
-
|
51 |
🤗 Hugging Face Transformers
|
52 |
|
|
|
53 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
54 |
|
55 |
model_name = "BitStarWalkin/SuperCorrect-7B"
|
@@ -62,7 +65,7 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
62 |
)
|
63 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
64 |
|
65 |
-
prompt = "Find the distance between the foci of the ellipse
|
66 |
hierarchical_prompt = "Solve the following math problem in a step-by-step XML format, each step should be enclosed within tags like <Step1></Step1>. For each step enclosed within the tags, determine if this step is challenging and tricky, if so, add detailed explanation and analysis enclosed within <Key> </Key> in this step, as helpful annotations to help you thinking and remind yourself how to conduct reasoning correctly. After all the reasoning steps, summarize the common solution and reasoning steps to help you and your classmates who are not good at math generalize to similar problems within <Generalized></Generalized>. Finally present the final answer within <Answer> </Answer>."
|
67 |
# HT
|
68 |
messages = [
|
@@ -87,6 +90,34 @@ generated_ids = [
|
|
87 |
|
88 |
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
89 |
print(response)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
Performance
|
92 |
-
|
@@ -96,7 +127,7 @@ Citation
|
|
96 |
-
|
97 |
@article{yang2024supercorrect,
|
98 |
title={SuperCorrect: Supervising and Correcting Language Models with Error-Driven Insights}
|
99 |
-
author={Yang, Ling and Yu, Zhaochen and Zhang, Tianjun and Xu, Minkai
|
100 |
journal={arXiv preprint arXiv:2410.09008},
|
101 |
year={2024}
|
102 |
}
|
@@ -150,4 +181,4 @@ Step 3: Run inference through the main binary.
|
|
150 |
or
|
151 |
```
|
152 |
./llama-server --hf-repo Triangle104/SuperCorrect-7B-Q5_K_S-GGUF --hf-file supercorrect-7b-q5_k_s.gguf -c 2048
|
153 |
-
```
|
|
|
1 |
---
|
2 |
+
base_model: BitStarWalkin/SuperCorrect-7B
|
3 |
language:
|
4 |
- en
|
5 |
+
library_name: transformers
|
6 |
+
license: apache-2.0
|
7 |
metrics:
|
8 |
- accuracy
|
9 |
+
pipeline_tag: question-answering
|
|
|
10 |
tags:
|
11 |
+
- llama
|
|
|
12 |
---
|
13 |
|
14 |
# Triangle104/SuperCorrect-7B-Q5_K_S-GGUF
|
|
|
28 |
-
|
29 |
This repo provides the official implementation of SuperCorrect a novel two-stage fine-tuning method for improving both reasoning accuracy and self-correction ability for LLMs.
|
30 |
|
31 |
+
[Paper](https://huggingface.co/papers/2410.09008)
|
32 |
+
|
33 |
Notably, our SupperCorrect-7B model significantly surpasses powerful DeepSeekMath-7B by 7.8%/5.3% and Qwen2.5-Math-7B by 15.1%/6.3% on MATH/GSM8K benchmarks, achieving new SOTA performance among all 7B models.
|
34 |
🚨 Unlike other LLMs, we incorporate LLMs with our pre-defined hierarchical thought template ([Buffer of Thought (BoT)](https://github.com/YangLing0818/buffer-of-thought-llm)) to conduct more deliberate reasoning than conventional CoT. It should be noted that our evaluation methods relies on pure mathematical reasoning abilities of LLMs, instead of leverage other programming methods such as PoT and ToRA.
|
35 |
|
|
|
52 |
-
|
53 |
🤗 Hugging Face Transformers
|
54 |
|
55 |
+
```python
|
56 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
57 |
|
58 |
model_name = "BitStarWalkin/SuperCorrect-7B"
|
|
|
65 |
)
|
66 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
67 |
|
68 |
+
prompt = "Find the distance between the foci of the ellipse \\[9x^2 + \\frac{y^2}{9} = 99.\\]"
|
69 |
hierarchical_prompt = "Solve the following math problem in a step-by-step XML format, each step should be enclosed within tags like <Step1></Step1>. For each step enclosed within the tags, determine if this step is challenging and tricky, if so, add detailed explanation and analysis enclosed within <Key> </Key> in this step, as helpful annotations to help you thinking and remind yourself how to conduct reasoning correctly. After all the reasoning steps, summarize the common solution and reasoning steps to help you and your classmates who are not good at math generalize to similar problems within <Generalized></Generalized>. Finally present the final answer within <Answer> </Answer>."
|
70 |
# HT
|
71 |
messages = [
|
|
|
90 |
|
91 |
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
92 |
print(response)
|
93 |
+
```
|
94 |
+
|
95 |
+
#### 🔥 vLLM
|
96 |
+
|
97 |
+
```python
|
98 |
+
import os
|
99 |
+
from vllm import LLM, SamplingParams
|
100 |
+
model_name = 'BitStarWalkin/SuperCorrect-7B'
|
101 |
+
hierarchical_prompt = "Solve the following math problem in a step-by-step XML format, each step should be enclosed within tags like <Step1></Step1>. For each step enclosed within the tags, determine if this step is challenging and tricky, if so, add detailed explanation and analysis enclosed within <Key> </Key> in this step, as helpful annotations to help you thinking and remind yourself how to conduct reasoning correctly. After all the reasoning steps, summarize the common solution and reasoning steps to help you and your classmates who are not good at math generalize to similar problems within <Generalized></Generalized>. Finally present the final answer within <Answer> </Answer>."
|
102 |
+
prompts = [
|
103 |
+
"For what positive value of $t$ is $|{-4+ti}| = 6$?",
|
104 |
+
"Find the distance between the foci of the ellipse \\[9x^2 + \\frac{y^2}{9} = 99.\\]",
|
105 |
+
"The fourth term of a geometric series is $24$ and the eleventh term is $3072$. What is the common ratio?"
|
106 |
+
]
|
107 |
+
combined_prompts = [hierarchical_prompt + '\n' + prompt for prompt in prompts]
|
108 |
+
sampling_params = SamplingParams(temperature=0, top_p=1,max_tokens=1024)
|
109 |
+
llm = LLM(model=model_name, trust_remote_code=True)
|
110 |
+
outputs = llm.generate(combined_prompts, sampling_params)
|
111 |
+
|
112 |
+
#Print the outputs.
|
113 |
+
for output in outputs:
|
114 |
+
prompt = output.prompt
|
115 |
+
generated_text = output.outputs[0].text
|
116 |
+
print(f"Prompt: {prompt}")
|
117 |
+
print(f"Generated text: {generated_text}")
|
118 |
+
```
|
119 |
+
|
120 |
+
Here we also provide inference code with [vLLM](https://github.com/vllm-project/vllm) . vLLM is a fast and easy-to-use library for LLM inference and serving.
|
121 |
|
122 |
Performance
|
123 |
-
|
|
|
127 |
-
|
128 |
@article{yang2024supercorrect,
|
129 |
title={SuperCorrect: Supervising and Correcting Language Models with Error-Driven Insights}
|
130 |
+
author={Yang, Ling and Yu, Zhaochen and Zhang, Tianjun and Xu, Minkai, Joseph E and Gonzalez, Bin Cui and Yan, Shuicheng},
|
131 |
journal={arXiv preprint arXiv:2410.09008},
|
132 |
year={2024}
|
133 |
}
|
|
|
181 |
or
|
182 |
```
|
183 |
./llama-server --hf-repo Triangle104/SuperCorrect-7B-Q5_K_S-GGUF --hf-file supercorrect-7b-q5_k_s.gguf -c 2048
|
184 |
+
```
|