SenseLLM/ReflectionCoder-CL-7B
133
1---2license: apache-2.03datasets:4- SenseLLM/ReflectionSeq-GPT5- SenseLLM/ReflectionSeq-DS6language:7- en8---9## ReflectionCoder: Learning from Reflection Sequence for Enhanced One-off Code Generation10 11<p align="center">12 <a href="https://arxiv.org/abs/2405.17057">๐ Paper</a> โข13 <a href="https://github.com/SenseLLM/ReflectionCoder">๐ Repo</a> โข14 <a href="https://huggingface.co/SenseLLM/ReflectionCoder-DS-33B">๐ค Models</a> โข15 <a href="https://huggingface.co/datasets/SenseLLM/ReflectionSeq-GPT">๐ Datasets </a>16</p>17 18## Introduction19ReflectionCoder 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!20 2122 23<hr>24 25## Models26 27| Model | Checkpoint | Size | HumanEval (+) | MBPP (+) | License|28|:-------|:------------|:------|:---------------|:----------|:--------|29| 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/) |30| 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/) |31| 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) |32| 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) |33 34## Datasets35 36| Dataset | Link | License |37|:-------------------|:----------------|:----------------------------------------------|38| ReflectionSeq-GPT | ๐ค [HF Link](https://huggingface.co/datasets/SenseLLM/ReflectionSeq-GPT) | [License](LICENSE) |39| ReflectionSeq-DS | ๐ค [HF Link](https://huggingface.co/datasets/SenseLLM/ReflectionSeq-DS) | [License](LICENSE) |40 41 42## How to Use43 44#### Chat Format45Following 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 code to prompt our ReflectionCoder.46 47```python48import torch49from transformers import pipeline50 51chat = [52 {"role": "user", "content": "<Your code instruction here>"}53]54 55generator = pipeline(56 model="SenseLLM/ReflectionCoder-CL-7B",57 task="text-generation",58 torch_dtype=torch.bfloat16,59 device_map="auto",60)61 62result = generator(chat, max_length=128, num_return_sequences=1)63 64print(result)65```66 67Please refer to our [GitHub Repo](https://github.com/SenseLLM/ReflectionCoder) for more technical details.68 69## Citation70 71If you find this repo useful for your research, please kindly cite our paper:72```73@misc{ren2024reflectioncoder,74 title={ReflectionCoder: Learning from Reflection Sequence for Enhanced One-off Code Generation}, 75 author={Houxing Ren and Mingjie Zhan and Zhongyuan Wu and Aojun Zhou and Junting Pan and Hongsheng Li},76 year={2024},77 eprint={2405.17057},78 archivePrefix={arXiv},79 primaryClass={cs.CL}80}81```82 83## Acknowledgments84 85We thank the following amazing projects that truly inspired us:86 87- [CodeLlama](https://ai.meta.com/research/publications/code-llama-open-foundation-models-for-code/)88- [DeepSeek-Coder](https://github.com/deepseek-ai/DeepSeek-Coder)89- [WizardCoder](https://github.com/nlpxucan/WizardLM/tree/main/WizardCoder)90- [Evol-CodeAlpaca-v1](https://huggingface.co/datasets/theblackcat102/evol-codealpaca-v1)91- [MagiCoder](https://github.com/ise-uiuc/magicoder/tree/main)92- [EvalPlus](https://github.com/evalplus/evalplus)93- [OpenCoderInterpreter](https://github.com/OpenCodeInterpreter/OpenCodeInterpreter/tree/main)