File size: 8,008 Bytes
94ade6b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
Quantization made by Richard Erkhov.

[Github](https://github.com/RichardErkhov)

[Discord](https://discord.gg/pvy7H8DZMG)

[Request more models](https://github.com/RichardErkhov/quant_request)


ReflectionCoder-CL-34B - GGUF
- Model creator: https://huggingface.co/SenseLLM/
- Original model: https://huggingface.co/SenseLLM/ReflectionCoder-CL-34B/


| Name | Quant method | Size |
| ---- | ---- | ---- |
| [ReflectionCoder-CL-34B.Q2_K.gguf](https://huggingface.co/RichardErkhov/SenseLLM_-_ReflectionCoder-CL-34B-gguf/blob/main/ReflectionCoder-CL-34B.Q2_K.gguf) | Q2_K | 11.65GB |
| [ReflectionCoder-CL-34B.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/SenseLLM_-_ReflectionCoder-CL-34B-gguf/blob/main/ReflectionCoder-CL-34B.Q3_K_S.gguf) | Q3_K_S | 13.6GB |
| [ReflectionCoder-CL-34B.Q3_K.gguf](https://huggingface.co/RichardErkhov/SenseLLM_-_ReflectionCoder-CL-34B-gguf/blob/main/ReflectionCoder-CL-34B.Q3_K.gguf) | Q3_K | 15.19GB |
| [ReflectionCoder-CL-34B.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/SenseLLM_-_ReflectionCoder-CL-34B-gguf/blob/main/ReflectionCoder-CL-34B.Q3_K_M.gguf) | Q3_K_M | 15.19GB |
| [ReflectionCoder-CL-34B.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/SenseLLM_-_ReflectionCoder-CL-34B-gguf/blob/main/ReflectionCoder-CL-34B.Q3_K_L.gguf) | Q3_K_L | 16.55GB |
| [ReflectionCoder-CL-34B.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/SenseLLM_-_ReflectionCoder-CL-34B-gguf/blob/main/ReflectionCoder-CL-34B.IQ4_XS.gguf) | IQ4_XS | 16.99GB |
| [ReflectionCoder-CL-34B.Q4_0.gguf](https://huggingface.co/RichardErkhov/SenseLLM_-_ReflectionCoder-CL-34B-gguf/blob/main/ReflectionCoder-CL-34B.Q4_0.gguf) | Q4_0 | 17.74GB |
| [ReflectionCoder-CL-34B.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/SenseLLM_-_ReflectionCoder-CL-34B-gguf/blob/main/ReflectionCoder-CL-34B.IQ4_NL.gguf) | IQ4_NL | 17.92GB |
| [ReflectionCoder-CL-34B.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/SenseLLM_-_ReflectionCoder-CL-34B-gguf/blob/main/ReflectionCoder-CL-34B.Q4_K_S.gguf) | Q4_K_S | 17.87GB |
| [ReflectionCoder-CL-34B.Q4_K.gguf](https://huggingface.co/RichardErkhov/SenseLLM_-_ReflectionCoder-CL-34B-gguf/blob/main/ReflectionCoder-CL-34B.Q4_K.gguf) | Q4_K | 18.83GB |
| [ReflectionCoder-CL-34B.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/SenseLLM_-_ReflectionCoder-CL-34B-gguf/blob/main/ReflectionCoder-CL-34B.Q4_K_M.gguf) | Q4_K_M | 18.83GB |
| [ReflectionCoder-CL-34B.Q4_1.gguf](https://huggingface.co/RichardErkhov/SenseLLM_-_ReflectionCoder-CL-34B-gguf/blob/main/ReflectionCoder-CL-34B.Q4_1.gguf) | Q4_1 | 19.69GB |
| [ReflectionCoder-CL-34B.Q5_0.gguf](https://huggingface.co/RichardErkhov/SenseLLM_-_ReflectionCoder-CL-34B-gguf/blob/main/ReflectionCoder-CL-34B.Q5_0.gguf) | Q5_0 | 21.64GB |
| [ReflectionCoder-CL-34B.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/SenseLLM_-_ReflectionCoder-CL-34B-gguf/blob/main/ReflectionCoder-CL-34B.Q5_K_S.gguf) | Q5_K_S | 21.64GB |
| [ReflectionCoder-CL-34B.Q5_K.gguf](https://huggingface.co/RichardErkhov/SenseLLM_-_ReflectionCoder-CL-34B-gguf/blob/main/ReflectionCoder-CL-34B.Q5_K.gguf) | Q5_K | 22.2GB |
| [ReflectionCoder-CL-34B.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/SenseLLM_-_ReflectionCoder-CL-34B-gguf/blob/main/ReflectionCoder-CL-34B.Q5_K_M.gguf) | Q5_K_M | 22.2GB |
| [ReflectionCoder-CL-34B.Q5_1.gguf](https://huggingface.co/RichardErkhov/SenseLLM_-_ReflectionCoder-CL-34B-gguf/blob/main/ReflectionCoder-CL-34B.Q5_1.gguf) | Q5_1 | 23.59GB |
| [ReflectionCoder-CL-34B.Q6_K.gguf](https://huggingface.co/RichardErkhov/SenseLLM_-_ReflectionCoder-CL-34B-gguf/blob/main/ReflectionCoder-CL-34B.Q6_K.gguf) | Q6_K | 25.78GB |
| [ReflectionCoder-CL-34B.Q8_0.gguf](https://huggingface.co/RichardErkhov/SenseLLM_-_ReflectionCoder-CL-34B-gguf/blob/main/ReflectionCoder-CL-34B.Q8_0.gguf) | Q8_0 | 33.39GB |




Original model description:
---
license: apache-2.0
datasets:
- SenseLLM/ReflectionSeq-GPT
- SenseLLM/ReflectionSeq-DS
language:
- en
---
## ReflectionCoder: Learning from Reflection Sequence for Enhanced One-off Code Generation

<p align="center">
    <a href="https://arxiv.org/abs/2405.17057">πŸ“„ Paper</a> β€’
    <a href="https://github.com/SenseLLM/ReflectionCoder">🏠 Repo</a> β€’
    <a href="https://huggingface.co/SenseLLM/ReflectionCoder-DS-33B">πŸ€– Models</a> β€’
    <a href="https://huggingface.co/datasets/SenseLLM/ReflectionSeq-GPT">πŸ“š Datasets </a>
</p>

## Introduction
ReflectionCoder is a novel approach that effectively leverages reflection sequences constructed by integrating compiler feedback to improve one-off code generation performance. Please refer to our paper and repo for more details!

![](method.png)

<hr>

## Models

| Model | Checkpoint | Size | HumanEval (+) | MBPP (+) | License|
|:-------|:------------|:------|:---------------|:----------|:--------|
| ReflectionCoder-CL-7B   | πŸ€— [HF Link](https://huggingface.co/SenseLLM/ReflectionCoder-CL-7B) | 7B   | 75.0 (68.9)     | 72.2 (61.4)     | [Llama2](https://ai.meta.com/llama/license/) |
| ReflectionCoder-CL-34B  | πŸ€— [HF Link](https://huggingface.co/SenseLLM/ReflectionCoder-CL-34B) | 34B  | 70.7 (66.5)     | 68.4 (56.6)     | [Llama2](https://ai.meta.com/llama/license/) |
| ReflectionCoder-DS-6.7B | πŸ€— [HF Link](https://huggingface.co/SenseLLM/ReflectionCoder-DS-6.7B) | 6.7B | 80.5 (74.4)     | 81.5 (69.6)     | [DeepSeek](https://github.com/deepseek-ai/DeepSeek-Coder/blob/main/LICENSE-MODEL) |
| ReflectionCoder-DS-33B  | πŸ€— [HF Link](https://huggingface.co/SenseLLM/ReflectionCoder-DS-33B) | 33B  | 82.9 (76.8) | 84.1 (72.0) | [DeepSeek](https://github.com/deepseek-ai/DeepSeek-Coder/blob/main/LICENSE-MODEL) |

## Datasets

| Dataset           | Link           | License                                      |
|:-------------------|:----------------|:----------------------------------------------|
| ReflectionSeq-GPT | πŸ€— [HF Link](https://huggingface.co/datasets/SenseLLM/ReflectionSeq-GPT) | [License](LICENSE) |
| ReflectionSeq-DS  | πŸ€— [HF Link](https://huggingface.co/datasets/SenseLLM/ReflectionSeq-DS) | [License](LICENSE) |


## How to Use

#### Chat Format
Following chat templates of most models, we use two special tokens to wrap the message of user and assistant, *i.e.*, ``<|user|>``, ``<|assistant|>``, and ``<|endofmessage|>``. Furthermore, we use two special tokens to wrap the content of different blocks, *i.e.*,  ``<|text|>`` and ``<|endofblock|>``. You can use the following template to prompt our ReflectionCoder.

```python
import torch
from transformers import pipeline

chat = [
    {"role": "user", "content": "<Your code instruction here>"}
]

generator = pipeline(
    model="SenseLLM/ReflectionCoder-CL-34B",
    task="text-generation",
    torch_dtype=torch.bfloat16,
    device_map="auto",
)

result = generator(chat, max_length=128, num_return_sequences=1)

print(result)
```

Please refer to our [GitHub Repo](https://github.com/SenseLLM/ReflectionCoder) for more technical details.

## Citation

If you find this repo useful for your research, please kindly cite our paper:
```
@misc{ren2024reflectioncoder,
    title={ReflectionCoder: Learning from Reflection Sequence for Enhanced One-off Code Generation}, 
    author={Houxing Ren and Mingjie Zhan and Zhongyuan Wu and Aojun Zhou and Junting Pan and Hongsheng Li},
    year={2024},
    eprint={2405.17057},
    archivePrefix={arXiv},
    primaryClass={cs.CL}
}
```

## Acknowledgments

We thank the following amazing projects that truly inspired us:

- [CodeLlama](https://ai.meta.com/research/publications/code-llama-open-foundation-models-for-code/)
- [DeepSeek-Coder](https://github.com/deepseek-ai/DeepSeek-Coder)
- [WizardCoder](https://github.com/nlpxucan/WizardLM/tree/main/WizardCoder)
- [Evol-CodeAlpaca-v1](https://huggingface.co/datasets/theblackcat102/evol-codealpaca-v1)
- [MagiCoder](https://github.com/ise-uiuc/magicoder/tree/main)
- [EvalPlus](https://github.com/evalplus/evalplus)
- [OpenCoderInterpreter](https://github.com/OpenCodeInterpreter/OpenCodeInterpreter/tree/main)