Guidelines for High Quality Code Generation
To generate high-quality code using DeepCoder-14B-Preview, follow these best practices:
1. Developing clear question prompts
- Specify programming language requirements
- Detailed description of functional requirements
- Example inputs and expected outputs can be added
- Example:
"写一个 Python 函数,找出数组中的最大值"
2. Setting appropriate generation parameters
- Temperature is set to 0.6 for creativity and certainty of equilibrium.
- top_p is set to 0.95 to ensure some diversity.
- max_new_tokens Depends on the complexity of the code, usually 512-1024.
3. Long code generation techniques
- For very long code, set max_tokens=64000
- It can be generated in sections and then filled in with details after it has been framed.
- Use explicit continuation instructions, such as "Please continue to complete the implementation of the following function."
4. Code optimization and validation
- Test and validate the generated code
- The model can be asked to optimize specific aspects: "Optimize the time complexity of this code"
- Use an iterative approach: first build a basic version, then refine it incrementally
Remember, the more explicit and specific the prompt, the higher the quality of the generated code usually is. Try fine-tuning the hints several times to get the best results.
This answer comes from the articleDeepCoder-14B-Preview: an open source model that specializes in code generationThe































