DevQualityEval: An evaluation benchmark and framework to compare and evolve the quality of code generation of LLMs.
DevQualityEval: An evaluation benchmark and framework to compare and evolve the quality of code generation of LLMs.
An evaluation benchmark and framework to compare and evolve the quality of code generation of LLMs.
This repository gives developers of LLMs (and other code generation tools) a standardized benchmark and framework to improve real-world usage in the software development domain and provides users of LLMs with metrics and comparisons to check if a given LLM is useful for their tasks.
The latest results are discussed in a deep dive: Anthropic's Claude 3.7 Sonnet is the new king of code generation (but only with help), and DeepSeek R1 disappoints (Deep dives from the DevQualityEval v1.0)
With this purchase you are mainly supporting DevQualityEval but you also receive access via your Google account to the detailed results of DevQualityEval v1.0 This includes: Access to the Google Sheet document with the leaderboard summary, as well as graphs, and exported metrics.
Since all deep dives build upon each other, it is worth taking a look at previous dives:
Install Git, install Go, and then execute the following commands:
git clone https://github.com/symflower/eval-dev-quality.git
cd eval-dev-quality
go install -v github.com/symflower/eval-dev-quality/cmd/eval-dev-qualityYou can now use the eval-dev-quality binary to execute the benchmark.
REMARK This project does not execute the LLM generated code in a sandbox by default. Make sure that you are running benchmarks only inside of an isolated environment, e.g. by using
--runtime docker.
The easiest-to-use LLM provider is openrouter.ai. You need to create an access key and save it in an environment variable:
export PROVIDER_TOKEN=openrouter:${your-key}Then you can run all benchmark tasks on all models and repositories:
eval-dev-quality evaluateThe output of the commands is a detailed log of all the requests and responses to the models and of all the commands executed. After the execution, you can find the final result saved to the file evaluation.csv.
See eval-dev-quality --help and especially eval-dev-quality evaluate --help for options.
In the case you only want to evaluate only one or more models you can use the --model option to define a model you want to use. You can use this option with as many models as you want.
Executing the following output:
eval-dev-quality evaluate --model=openrouter/meta-llama/llama-3-70b-instructShould return an evaluation log similar to this:
Log for the above command.
…golang package plain
func plain() {
return // This does not do anything but it gives us a line to cover.
}
```
2024/05/02 10:02:00 Model "openrouter/meta-llama/llama-3-70b-instruct" responded with: ```go package plain
import "testing"
func TestPlain(t *testing.T) {
plain()
}…java package com.eval;
class Plain {
static void plain() {
}
}
```
2024/05/02 10:02:02 Model "openrouter/meta-llama/llama-3-70b-instruct" responded with: ```java package com.eval;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class PlainTest {
@Test
void testPlain() {
Plain.plain();
// Since the method is empty, we can only assert that it doesn't throw an exception
assertTrue(true);
}
}
```
2024/05/02 10:02:02 $ symflower test --language java --workspace /tmp/eval-dev-quality1094965069/plain Total coverage 100.000000% 2024/05/02 10:02:09 Evaluated model "openrouter/meta-llama/llama-3-70b-instruct" using language "java" and repository "java/plain": encountered 0 problems: [] 2024/05/02 10:02:09 Evaluating models and languages 2024/05/02 10:02:09 Evaluation score for "openrouter/meta-llama/llama-3-70b-instruct": coverage=2, files-executed=2, response-no-error=2, response-no-excess=2, response-not-empty=2, response-with-code=2
The execution by default also creates a report file `REPORT.md` that contains additional evaluation results and links to individual result files.
# Containerized use
## Notes
The following parameters do have a special behavior when using a containerized runtime.
- `--configuration`: Passing configuration files to the docker runtime is currently unsupported.
- `--testdata`: The check if the path exists is ignored on the host system but still enforced inside the container because the paths of the host and inside the container might differ.
## Docker
### Setup
Ensure that docker is installed on the system.
### Build or pull the image
```bash
docker build . -t eval-dev-quality:dev
```
```bash
docker pull ghcr.io/symflower/eval-dev-quality:main
```
### Run the evaluation either with the built or pulled image
The following command will run the model `symflower/symbolic-execution` and stores the the results of the run inside the local directory `evaluation`.
```bash
eval-dev-quality evaluate --runtime docker --runtime-image eval-dev-quality:dev --model symflower/symbolic-execution
```
Omitting the `--runtime-image` parameter will default to the image from the `main` branch. `ghcr.io/symflower/eval-dev-quality:main`
```bash
eval-dev-quality evaluate --runtime docker --model symflower/symbolic-execution
```
## Kubernetes
Please check the [Kubernetes](./docs/kubernetes/README.md) documentation.
## Providers
The following providers (for model inference) are currently supported:
- [OpenRouter](https://openrouter.ai/)
- register API key via: `--tokens=openrouter:${key}` or environment `PROVIDER_TOKEN=openrouter:${key}`
- select models via the `openrouter` prefix, i.e. `--model openrouter/meta-llama/llama-3.1-8b-instruct`
- [Ollama](https://ollama.com/)
- the evaluation listens to the default Ollama port (`11434`), or will attempt to start an Ollama server if you have the `ollama` binary on your path
- select models via the `ollama` prefix, i.e. `--model ollama/llama3.1:8b`
- [OpenAI API](https://platform.openai.com/docs/api-reference/chat/create)
- use any inference endpoint that conforms to the OpenAI chat completion API
- register the endpoint using `--urls=custom-${name}:${endpoint-url}` (mind the `custom-` prefix) or using the environment `PROVIDER_URL`
- ensure to register your API key to the same `custom-${name}`
- select models via the `custom-${name}` prefix
- example for [fireworks.ai](https://fireworks.ai/): `eval-dev-quality evaluate --urls=custom-fw:https://api.fireworks.ai/inference/v1 --tokens=custom-fw:${your-api-token} --model custom-fw/accounts/fireworks/models/llama-v3p1-8b-instruct`
# The Evaluation
With `DevQualityEval` we answer answer the following questions:
- Which LLMs can solve software development tasks?
- How good is the quality of their results?
Programming is a non-trivial profession. Even writing tests for an empty function requires substantial knowledge of the used programming language and its conventions. We already investigated this challenge and how many LLMs failed at it in our [first `DevQualityEval` report](https://symflower.com/en/company/blog/2024/can-ai-test-a-go-function-that-does-nothing/#why-evaluate-an-empty-function). This highlights the need for a **benchmarking framework for evaluating AI performance on software development task solving**.
## Setup
The models evaluated in `DevQualityEval` have to solve programming tasks, not only in one, but in multiple programming languages.
Every task is a well-defined, abstract challenge that the model needs to complete (for example: writing a unit test for a given function).
Multiple concrete cases (or candidates) exist for a given task that each represent an actual real-world example that a model has to solve (i.e. for function `abc() {...` write a unit test).
Completing a task-case rewards points depending on the quality of the result. This, of course, depends on which criteria make the solution to a task a "good" solution, but the general rule is that the more points - the better. For example, the unit tests generated by a model might actually be compiling, yielding points that set the model apart from other models that generate only non-compiling code.
### Running specific tasks
### Via repository
Each repository can contain a configuration file `repository.json` in its root directory specifying a list of tasks which are supposed to be run for this repository.
```json
{
"tasks": ["write-tests"]
}
```
For the evaluation of the repository only the specified tasks are executed. If no `repository.json` file exists, all tasks are executed.
Depending on the task, it can be beneficial to exclude parts of the repository from explicit evaluation. To give a concrete example: Spring controller tests can never be executed on their own but need a supporting [`Application` class](https://docs.spring.io/spring-boot/reference/testing/spring-boot-applications.html#testing.spring-boot-applications.using-main). But [such a file](testdata/java/spring-plain/src/main/java/com/example/Application.java) should never be used itself to prompt models for tests. Therefore, it can be excluded through the `repository.json` configuration:
```json
{
"tasks": ["write-tests"],
"ignore": ["src/main/java/com/example/Application.java"]
}
```
This `ignore` setting is currently only applicable for generation task `write-tests`.
It is possible to configure some model prompt parameters through `repository.json`:
```json
{
"tasks": ["write-tests"],
"prompt": {
"test-framework": "JUnit 5 for Spring Boot" // Overwrite the default test framework in the prompt.
}
}
```
This `prompt.test-framework` setting is currently only applicable for the test generation task `write-tests`.
When task results are validated, some repositories might require custom logic. For example: generating tests for a Spring Boot project requires ensuring that the tests used an actual Spring context (i.e. Spring Boot was initialized when the tests were executed). Therefore, the `repository.json` supports adding rudimentary custom validation:
```json
{
"tasks": ["write-tests"],
"validation": {
"execution": {
"stdout": "Initializing Spring" // Ensure the string "Initializing Spring" is contained in the execution output.
}
}
}
```
This `validation.execution.stdout` setting is currently only applicable for the test generation task `write-tests`.
## Tasks
### TaskNo open issues yet, or sync has not completed.