CONCUR: Benchmarking LLMs for Concurrent Code Generation
Organizations: The University of Queensland · Texas A&M University - Kingsville · Carnegie Mellon University
Abstract
Leveraging Large Language Models (LLMs) for code generation has increasingly emerged as a common practice in the domain of software engineering. Relevant benchmarks have been established to evaluate the code generation capabilities of LLMs. However, existing benchmarks focus primarily on sequential code, lacking the ability to effectively evaluate LLMs on concurrent code generation. Compared to sequential code, concurrent code exhibits greater complexity and possesses unique types of bugs, such as deadlocks and race conditions, that do not occur in sequential code. Therefore, a benchmark for evaluating sequential code generation cannot be useful for evaluating concurrent code generation with LLMs. To address this gap, we designed a benchmark CONCUR specifically aimed at evaluating the capability of LLMs to generate concurrent code. CONCUR consists of a base set of 43 concurrency problems derived from a standard concurrency textbook, together with 72 validated mutant variants, resulting in 115 total problems. The base problems serve as the semantic core of the benchmark, while the mutants expand linguistic and structural diversity. We conducted an evaluation of a range of LLMs on CONCUR, highlighting limitations of current models. Overall, our work provides a novel direction for evaluating the capability of LLMs to generate code with focus on concurrency.
Figures & tables
| Error Type | Description |
|---|---|
| Deadlock (DL) | A deadlock occurs when multiple threads are running and each thread waits indefinitely for others to release their locks. |
| Race Condition (RC) | A race condition occurs when concurrent read and write operations access the same shared variable without proper synchronization. |
| Starvation (SV) | Starvation occurs when one or more threads are perpetually denied access to shared resources because higher-priority threads monopolize execution. |
| Uncaught Exception (UE) | Exceptions that arise during concurrent program execution, including both concurrency-related errors and all exceptions defined in the Java 8 standard libraries. |
| No Entry Method (NEM) | The generated code lacks a public class with a main method, resulting in no valid entry point for execution. |
| Single Thread (ST) | The generated code executes with only a single thread, which violates the prompt requirement for multi-threaded concurrent code. |
| Model | Passing Rate | CodeBLEU | ||
|---|---|---|---|---|
| k=1 | k=3 | k=1 | k=3 | |
| gpt-5 | 89/115 (77.39%) | 105/115 (91.30%) | 0.576122 | 0.576229 |
| claude-opus-4-1 | 78/115 (67.83%) | 91/115 (79.13%) | 0.579037 | 0.580484 |
| gemini-3-pro | 76/115 (66.09%) | 85/115 (73.91%) | 0.574317 | 0.575100 |
| gpt-4o | 69/115 (60.00%) | 95/115 (82.61%) | 0.547317 | 0.541937 |
| llama3.3:70b | 57/115 (49.57%) | 71/115 (61.74%) | 0.514043 | 0.514464 |
| Model | Compilation Errors | JPF Errors | ||||||
|---|---|---|---|---|---|---|---|---|
| DL | RC | SV | UE | NEM | ST | TE | ||
| claude-opus-4-1 | 1 | 5 | 7 | 0 | 9 | 0 | 0 | 15 |
| codellama:34b | 88 | 2 | 2 | 0 | 8 | 3 | 2 | 9 |
| codeqwen:7b | 64 | 1 | 3 | 0 | 1 | 6 | 3 | 4 |
| codestral:22b | 42 | 6 | 3 | 0 | 5 | 2 | 1 | 10 |
| deepseek-r1:32b | 43 | 1 | 3 | 0 | 4 | 0 | 1 | 17 |
Code Generation Evaluation
Code generation evaluation measures whether AI-produced programs are correct, reliable, secure, efficient, and faithful to their specifications.
See all 215 papers