--- language: - en license: apache-2.0 datasets: - SenseLLM/ReflectionSeq-GPT - SenseLLM/ReflectionSeq-DS model-index: - name: ReflectionCoder-DS-33B results: - task: type: text-generation name: Text Generation dataset: name: IFEval (0-Shot) type: HuggingFaceH4/ifeval args: num_few_shot: 0 metrics: - type: inst_level_strict_acc and prompt_level_strict_acc value: 37.87 name: strict accuracy source: url: https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard?query=SenseLLM/ReflectionCoder-DS-33B name: Open LLM Leaderboard - task: type: text-generation name: Text Generation dataset: name: BBH (3-Shot) type: BBH args: num_few_shot: 3 metrics: - type: acc_norm value: 8.34 name: normalized accuracy source: url: https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard?query=SenseLLM/ReflectionCoder-DS-33B name: Open LLM Leaderboard - task: type: text-generation name: Text Generation dataset: name: MATH Lvl 5 (4-Shot) type: hendrycks/competition_math args: num_few_shot: 4 metrics: - type: exact_match value: 2.04 name: exact match source: url: https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard?query=SenseLLM/ReflectionCoder-DS-33B name: Open LLM Leaderboard - task: type: text-generation name: Text Generation dataset: name: GPQA (0-shot) type: Idavidrein/gpqa args: num_few_shot: 0 metrics: - type: acc_norm value: 3.24 name: acc_norm source: url: https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard?query=SenseLLM/ReflectionCoder-DS-33B name: Open LLM Leaderboard - task: type: text-generation name: Text Generation dataset: name: MuSR (0-shot) type: TAUR-Lab/MuSR args: num_few_shot: 0 metrics: - type: acc_norm value: 0.46 name: acc_norm source: url: https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard?query=SenseLLM/ReflectionCoder-DS-33B name: Open LLM Leaderboard - task: type: text-generation name: Text Generation dataset: name: MMLU-PRO (5-shot) type: TIGER-Lab/MMLU-Pro config: main split: test args: num_few_shot: 5 metrics: - type: acc value: 2.24 name: accuracy source: url: https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard?query=SenseLLM/ReflectionCoder-DS-33B name: Open LLM Leaderboard --- ## ReflectionCoder: Learning from Reflection Sequence for Enhanced One-off Code Generation

📄 Paper🏠 Repo🤖 Models📚 Datasets

## 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)
## 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": ""} ] generator = pipeline( model="SenseLLM/ReflectionCoder-DS-33B", 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) # [Open LLM Leaderboard Evaluation Results](https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard) Detailed results can be found [here](https://huggingface.co/datasets/open-llm-leaderboard/details_SenseLLM__ReflectionCoder-DS-33B) | Metric |Value| |-------------------|----:| |Avg. | 9.03| |IFEval (0-Shot) |37.87| |BBH (3-Shot) | 8.34| |MATH Lvl 5 (4-Shot)| 2.04| |GPQA (0-shot) | 3.24| |MuSR (0-shot) | 0.46| |MMLU-PRO (5-shot) | 2.24|