CursorCore: Assist Programming through Aligning Anything

## Abstract

Abstract Large language models have been successfully applied to programming assistance tasks, such as code completion, code insertion, and instructional code editing. However, these applications remain insufficiently automated and struggle to effectively integrate various types of information during the programming process, including coding history, current code, and user instructions. In this work, we propose a new conversational framework that comprehensively integrates these information sources, collect data to train our models and evaluate their performance. Firstly, to thoroughly evaluate how well models align with different types of information and the quality of their outputs, we introduce a new benchmark, APEval (Assist Programming Eval), to comprehensively assess the performance of models in programming assistance tasks. Then, for data collection, we develop a data generation pipeline, Programming-Instruct, which synthesizes training data from diverse sources, such as GitHub and online judge platforms. This pipeline can automatically generate various types of messages throughout the programming process. Finally, using this pipeline, we generate 219K samples, fine-tune multiple models, and develop the CursorCore series. We show that CursorCore outperforms other models of comparable size. This framework unifies applications such as inline chat and automated editing, contributes to the advancement of coding assistants. Code, models and data are freely available at https://github.com/TechxGenus/CursorCore .

## 1 Introduction

Figure: Figure 1: Different forms of programming assistance. The common uses of current LLMs are shown on the left. Our framework is shown on the right.
Refer to caption: x1.png

Since the rise of large language models (LLMs), AI-assisted programming technology has developed rapidly, with many powerful LLMs being applied in this field Zan et al. (); Liang et al. (); Yang et al. (). The technology mainly takes two forms. One form involves completing a specified code snippet at the end or inserting corresponding code at a designated position, typically accomplished by foundation models that support relevant input formats Chen et al. (); Bavarian et al. (). The other form involves generating or editing code snippets based on natural language instructions or reflections through interaction with the environment, usually carried out by instruction models that have been further aligned Shinn et al. (); Cassano et al. (); Muennighoff et al. (); Paul-Gauthier (). Figure 1 shows simple examples of these forms.

However, in practical applications, neither the completion or insertion mode nor the instruction-based mode is perfect. The completion or insertion mode generates based on the current code context, but in actual coding, we are continuously editing the code rather than just completing and inserting. We prefer that the model predicts the upcoming edits, as neither completion nor insertion accurately reflects the coding process, and requires programmers to perform additional operations. The instruction-based mode allows for code editing, but it also has drawbacks, such as writing prompts for specific tasks may be slower or challenging. The process is not automated enough, programmers would prefer a model that can proactively predict future changes without needing extra prompts. In our view, the core issue lies in the limitations of the input and output in both forms of programming assistance. These forms either just align the output with the current code context, limiting completion or insertion instead of editing, or align the output with the user’s natural language instructions. However, to effectively assist with programming, an AI programming assistant needs to utilize anything throughout the programming process. It should be capable of aligning with the history of code changes, the current content of the code, and any instructions provided by the user, predicting the required responses and corresponding changes, reducing any actions required by users.

To solve these issues, in this paper, we introduce a new framework of AI-assisted programming task: Assistant-Conversation to align anything during programming process. To comprehensively evaluate the alignment of models with different information in the programming process and the quality of the corresponding outputs, we propose a new benchmark, APEval (Assist Programming Eval), to comprehensively assess the performance of models in assisting programming. For the Assistant-Conversation framework, we build a data generation pipeline, Programming-Instruct, to synthesize corresponding training data from various data sources. This data generation method can produce any types of messages throughout the programming process, without any additional human annotation and does not rely on specific models. We use this pipeline to generate 219K data points and use them to fine-tune multiple models, resulting in the CursorCore series. These models achieve state-of-the-art results when compared with other models of comparable size.

In conclusion, our main contributions are:

- •
Assistant-Conversation: A new framework to align anything during programming process.
- •
Programming-Instruct: Data synthesis pipeline to produce any types of messages throughout the programming process, and 219K data collected using it.
- •
APEval: A benchmark for assessing the ability to utilize various types of information to assist programming.
- •
CursorCore: One of the best model series with the same number of parameters for AI-assisted programming tasks.

## 2 Assistant-Conversation: New Conversation Framework for Programming Assistants

In this section, we introduce a new conversational framework, Assistant-Conversation, aimed at simplifying the programming process. The framework leverages all available information during programming to streamline work for programmers.

### 2.1 Framework Formulation

We introduce the constituent elements of Assistant-Conversation: System (S), History (H), Current (C), User (U), and Assistant (A). The Assistant (A) represents the output of the model, while the inputs consist of the System (S), History (H), Current (C), and User (U). Figures 1 and 2 shows several examples of them. These definitions will be referenced throughout the rest of this work.

#### System S (Optional)

The system instruction provided to the model at the beginning, which configures the answering style, overall task description and other behaviors. In this work, we fix it to a simple “You are a helpful programming assistant.” and omit it from the subsequent discussion.

#### History H (Optional)

The program’s editing history, consisting of multiple pieces of code. These may include several snippets or may not be present at all. We refer to them as $H_{1},\cdot\cdot\cdot,H_{n}$.

#### Current C

The code currently being processed, along with temporary information like cursor position or selected code area.

#### User U (Optional)

User instructions related to the code, either written by the programmer or generated as feedback based on interactions with external environments (such as a code interpreter).

#### Assistant A

The output of the model, consists of modified code and chat-style interaction with the programmer. In this work, we mainly focus on the prediction of modified code.

Figure: Figure 2: Examples of Assistant-Conversation from our training data.
Refer to caption: x2.png

### 2.2 Comparisons of Assistant-Conversation

#### Completion and insertion modes face challenges when modeling both C and H

Although they can utilize C, they fail to capture H, limiting the modeling of future changes in C, and are incapable of deleting or editing code. Although user instructions and reflection information can be used through comments and assert statements, this capability is weak and unstable.

#### Chat models are not ideal for all programming assistance tasks

These models focus on user input rather than the code content, while the input should primarily be centered on C instead of just user instructions. In traditional conversational frameworks, the sole input source is U, which works for chatbots but not for application assistants. Input sources should include C, H, and U, as both H and U are related to C. Although instruction models can represent the interaction history between users and assistants, they struggle to capture the historical changes in the application’s content. Prompt engineering can integrate some of this information into existing models, but the impact is limited. Constructing prompts with numerous tokens increases cost and reduces efficiency, and models may also lack alignment and proper training for such inputs.

#### Our framework addresses these issues

We use multiple input sources to harness all relevant information from the programming process. For the output, we divide it into two parts: modified code and chat-style communication with the programmer, aligning with the common practices of users. When the user only requires responses based on U, similar to instruction models, we can omit H and C, suppress code modifications, and provide only chat output to ensure compatibility with past chat modes.

### 2.3 Specifications and Implementation

To represent a piece of code like C, we can either use it directly or wrap it in a markdown code block. However, representing code changes, such as H or changes in A, is more complex. We can either use the whole code, patches that alter the code, or records of both the modification locations and the specific changes. Some methods work well but experience issues when handling longer texts, such as outputting the entire modified code, which can be slow. Other methods output minimal content, like providing only the modification locations and changes. These are faster but still not optimal in terms of performance. We represent code changes in the experiments of the main body using the whole code format, and we investigate different ways to represent these modifications, as detailed in Appendix B. Additionally, we explore methods for compressing historical code changes in Appendix F.

In some cases, programmers assign assistants to focus on specific areas of code. They might use the cursor to mark a general location or directly select a range of code, as shown in Figure 2. We handle this by treating them as special tokens (see Appendix D for further details).

We structure conversations in the order of S-H-C-U-A to match the actual workflow. This mirrors the chronological sequence in which information is generated during the programming process. By doing so, we maximize prefix overlap across multiple requests, utilizing prefix caching to reduce redundant kv-cache computations and improve efficiency Zheng et al. (). A is organized in code-chat order, prioritizing code edits due to their importance in real-time applications where speed is crucial.

## 3 APEval: Benchmark for Assisted Programming

### 3.1 Benchmark overview

**Table 1: APEval Statistics.**
| Statistics | Sample Num |
| --- | --- |
| Total | 164 |
| Each type | 41 / 41 / 41 / 41 |
| H Statistics | Mean / Max |
| Num (Snippets) | 2.8 / 10 |
| Num (Lines) | 21.7 / 139 |
| Num (Chars) | 0.6K / 5.1K |
| C Statistics | Mean / Max |
| Num (Lines) | 8.4 / 31 |
| Num (Chars) | 0.3K / 1.4K |
| U Statistics | Mean / Max |
| Num (Lines) | 3.2 / 19 |
| Num (Chars) | 0.2K / 1.2K |

Past benchmarks assessing LLM code capabilities have effectively evaluated tasks like program synthesis Chen et al. (); Austin et al. (), code repair Muennighoff et al. (); Jimenez et al. (), and instructional code editing Cassano et al. (); Paul-Gauthier (); Guo et al. (). However, they fall short in fully assessing how models use various types of information to assist in programming. This gap calls for a new benchmark.

As discussed in Section 2.1, programming assistance can involve different types of information, with H and U being optional. Thus, there are four possible combinations of information: H, C, U; H, C; C, U; and only C. HumanEval Chen et al. () is a well-known benchmark for evaluating code completion. It has been extended to assess other tasks such as code insertion Bavarian et al. (), instruction-based tasks CodeParrot (); Muennighoff et al. (), and multilingual generation Zheng et al. (); Cassano et al. (). We refer to these works and further extend it to comprehensively evaluate the model’s ability to assist programming. We randomly categorize each task into one of the four types, then manually implement the functions and simulate the potential instructions that programmers might give to an LLM during the process, collecting all interactions. We invite programmers with varying levels of experience to annotate the data. After processing, we get the new benchmark, Assist Programming Eval (APEval). Detailed statistics are shown in Table 1.

### 3.2 Evaluation Process and Metrics

In all tasks, we use the classic Pass@1 metric to execute the generated code, which is the simplest version of the Pass@k metric Chen et al. (). Since APEval is an extension of HumanEval, we use the test set created by EvalPlus Liu et al. (). We report the results from both the basic and extra tests. We provide the model with relevant information during the programming process, and the model immediately returns the modified code. Some methods may improve performance by increasing the number of output tokens to model the thinking process; we discuss this further in Appendix E.

## 4 Programming-Instruct: Collect any data during programming

To align models with programming-related data, relevant training data must be collected. While large amounts of unsupervised code
Kocetkov et al. () and instruction data Wei et al. (); Luo et al. () have been gathered, there remains a significant lack of data on the coding process. Manually annotating the coding process is expensive, so we propose Programming-Instruct, a method to automate this data collection.

### 4.1 Data Sources

To ensure both quality and diversity in the coding process data, we collect information from three different sources: AIprogrammer, Git commit, and Online Submit.

#### AIprogrammer

For each code snippet, we use LLMs to generate the corresponding coding history. Since human coding approaches vary widely, we utilize several LLMs, each guided by three distinct prompts, representing novice, intermediate, and expert programmers. The LLMs then return their version of the coding process. Prompts used are shown in Appendix K.

#### Git Commit

Some software can automatically track changes, such as Git. We use Git commit data from Github, which captures users’ code edits and modification histories.

#### Online Submit

Many online coding platforms like Leetcode allow users to submit code for execution and receive feedback. During this process, users continuously modify their code until it is finalized. We also make use of this data.

Through these sources, we obtain a large number of samples, each consisting of multiple code snippets. The last snippet in each sample is referred to as the final snippet (F). Examples of data sources are shown in Figure 3.

Figure: Figure 3: Samples from AIprogrammer, Git Commit and Online Submit.
Refer to caption: x3.png

### 4.2 Data Processing

After collecting a large number of coding processes, we process them to meet the requirements of Assistant-Conversation. Figure 4 shows the steps of data processing. First, we randomly select a time point in the coding process, referred to as C. As mentioned in Section 2.1, H and U are optional, we need to collect four types of data distinguished according to input data types: H, C, U; H, C; C, U; and only C. For each sample, we randomly designate one type. If the selected type includes H, We use the preceding edits of C as the historical records H.

We then handle each type of data based on whether U is available. For cases without U, we segment the changes from C to F based on continuity, referring to them as M, and let LLMs judge whether each segment of M aligns with user’s purpose through principle-driven approaches Bai et al. (); Sun et al. (); Lin et al. (). This approach accounts for ambiguity in user intent when inferring from H or C. For example, if a programmer actively adds some private information at the beginning of the code without it being mentioned in the previous records, LLMs should not predict this change. We discard segments deemed irrelevant, and merge the remaining ones as outputs that models need to learn to predict. For cases with U, we follow the instruction generation series methods Wang et al. (); Wei et al. (); Luo et al. () by inputting both the historical edits and current code into the LLM, prompting it to generate corresponding instructions.

In addition to the above, we model selected code regions, cursor positions, and make LLMs create chat-style interactions with users. Further details are provided in Appendix C.

Figure: Figure 4: Data processing pipeline. The randomly selected time point is the third, and the randomly selected data type is H and C.
Refer to caption: x4.png

## 5 CursorCore: Fine-tune LLMs to align anything

### 5.1 Base models

We fine-tune existing base LLMs to assist with programming tasks. Over the past few years, many open-source foundation models have been trained on large code corpora sourced from GitHub and other platforms, demonstrating strong performance in coding. We choose Deepseek-Coder Guo et al. (), Yi-Coder AI et al. () and Qwen2.5-Coder Hui et al. () series, which we refer to as CursorCore-DS, CursorCore-Yi and CursorCore-QW2.5 series after training. Deepseek-Coder has achieved state-of-the-art performance on numerous coding-related benchmarks over the past year, gaining wide recognition. Yi-Coder and Qwen2.5-Coder are the most recently released models at the start of our experiments and show the best performance on many benchmarks for code now. These models are widely supported by the community, offering a good balance between size and performance, making them suitable for efficient experimentation. For ablation experiments, we use the smallest version, Deepseek-Coder-1.3B, to accelerate the process. We use a chat template adapted from ChatML OpenAI () to model Assistant-Conversation during training, as detailed in Appendix I.

### 5.2 Training data

**Table 2: Statistics of our training data.**
|  | Sample | Language | History Snippets | Input Length | Output Length |
| --- | --- | --- | --- | --- | --- |
|  | Num | Num | Mean / Max | Mean / Max | Mean / Max |
| AIprogrammer | 70.9K | - | 2.0 / 17 | 0.6K / 25K | 1.0K / 5.2K |
| Git Commit | 88.0K | 14 | 1.5 / 15 | 1.5K / 19.9K | 1.4K / 5.2K |
| Online Submit | 60.5K | 44 | 3.8 / 96 | 4.8K / 357.2K | 1.9K / 35.1K |

We use Programming-Instruct to collect data. For AIprogrammer, we gather code snippets from datasets such as the stack Kocetkov et al. () and oss-instruct Wei et al. (), then prompt LLMs to generate the programming process. For Git commit data, we collect relevant information from editpackft Cassano et al. () (a filtered version of commitpackft Muennighoff et al. ()) and further refine it through post-processing and filtering. Regarding online submission data, we source the programming process from the Codenet dataset Puri et al. (). First, we group all submissions by user for each problem, then exclude invalid groups without correct submissions to obtain complete programming processes. These are then fed into the processing pipeline to generate the final training data. In total, we accumulate 219K samples, with detailed statistics and distributions shown in Tables 2, 3, 6, 6, 8 and 8. To ensure compatibility with previous chatbot-style interactions and further improve model performance, we also incorporate the evol-instruct dataset ISE-UIUC () collected using the GPT series Ouyang et al. (), which has been widely recognized for its high quality during training. Following StarCoder’s data processing approach Li et al. (), we decontaminate our training data.

**Table 3: The proportion of four combinations of information during programming in our training data.**
|  | C | H, C | C, U | H, C, U |
| --- | --- | --- | --- | --- |
| AIprogrammer | 24.1 | 22.2 | 25.4 | 28.3 |
| Git Commit | 25.9 | 20.0 | 28.0 | 26.1 |
| Online Submit | 27.5 | 19.7 | 29.4 | 23.4 |

During data collection, we randomly utilize two powerful open-source LLMs: Mistral-Large-Instruct Mistral-AI () and Deepseek-Coder-V2-Instruct DeepSeek-AI et al. (). These models have demonstrated performance comparable to strong closed-source models like GPT-4o across many tasks, and are currently the only two open-source models scoring over 90% on the classic HumanEval benchmark at the start of our experiment. Additionally, they are more cost-effective and offer easier reproducibility than GPT-4o. For Mistral-Large-Instruct, we quantize the model using the GPTQ Frantar et al. () algorithm and deploy it locally with sglang Zheng et al. () and marlin kernel Frantar et al. () on 4 Nvidia RTX 4090 GPUs. For Deepseek-Coder-V2-Instruct, we use the official API for integration.

Figure: Figure 5: The distribution of programming language in the training data.
Refer to caption: x5.png

Figure: Figure 7: The distribution of input lengths in the training data.
Refer to caption: x7.png

### 5.3 Training details

Our models are trained for 2 epochs using the Transformers library Wolf et al. (). We enhance memory efficiency and speed with techniques such as Deepspeed ZeRO3 Rajbhandari et al. (), ZeRO Offload Ren et al. (), FlashAttention2 Dao (), and triton kernels Hsu et al. (). We calculate the maximum sequence length that can be processed per batch based on the available VRAM. Using the First-Fit Decreasing algorithm Kundu et al. (), we pack training samples to ensure that each batch reaches its maximum sequence length, thereby optimizing training speed. The training process employs the Adafactor optimizer Shazeer & Stern () with a learning rate of 5e-5, coupled with a cosine scheduler featuring 15 warm-up steps.

## 6 Evaluation and Results

In this section, we evaluate the CursorCore models. We begin by describing the experimental setup and then present and analyze the results.

### 6.1 Experimental setup

We conduct the data selection ablation and primary evaluation on our APEval benchmark, and provide results on well-known benchmarks such as Python program synthesis, automated program repair, and instructional code editing, which are detailed in Appendix G. We choose prominent open-source and closed-source LLMs as our baselines. For all benchmarks, we use greedy decoding to generate evaluation results. CursorCore natively supports various inputs in APEval, whereas base and instruction LLMs require additional prompts for effective evaluation. We design few-shot prompts separately for base and instruction models, as detailed in Appendix J.

### 6.2 Data Selection Ablation

Figure: Figure 9: Data Selection Ablation on APEval.
Refer to caption: x9.png

We train the smallest model Deepseek-Coder-1.3B on different combinations of datasets to determine the optimal data mix. The results of the ablation study are shown in Figure 9.

#### AIprogrammer has the highest data quality

Among the various data sources, the model trained on the AIprogrammer dataset achieve the best performance on APEval. We believe this is primarily because the data aligns well with the required format of APEval. Moreover, unlike other data sources such as Git Commit, the AIprogrammer data is almost entirely synthesized by LLMs, except for the initial code. As LLMs have advanced, the quality of their generated data has generally surpassed that of data collected and filtered from human-created sources.

#### Importance of mixing data with different information types

We find that using high-quality chat-style data alone, such as the Evol-Instruct dataset, does not achieve the desired performance; it underperforms compared to the AIprogrammer dataset. However, when combining both datasets, the model shows a notable improvement. This indicates that to better align the model with a variety of data and information, it is necessary to use datasets containing diverse types of information.

#### Our final selection

We combine data from all sources for training. Since our focus is on Python, and training on multilingual data leads to a decrease in APEval scores, we use only the Python part of the Git Commit and Online Submit datasets. As a result, we get CursorCore series models.

**Table 4: Evaluation results of LLMs on APEval.**
| Model | C | H, C | C, U | H, C, U | Avg. |
| --- | --- | --- | --- | --- | --- |
| Closed Models |  |  |  |  |  |
| GPT-4o-Mini | 17.1 (17.1) | 36.6 (31.7) | 78.0 (70.7) | 53.7 (43.9) | 46.3 (40.9) |
| GPT-4o | 68.3 (63.4) | 61.0 (56.1) | 75.6 (75.6) | 56.1 (53.7) | 65.2 (62.2) |
| 10B+ Models |  |  |  |  |  |
| Codestral-V0.1-22B | 68.3 (56.1) | 41.5 (41.5) | 75.6 (73.2) | 48.8 (46.3) | 58.5 (54.3) |
| DS-Coder-33B-Base | 31.7 (31.7) | 26.8 (22.0) | 43.9 (36.6) | 24.4 (24.4) | 31.7 (28.7) |
| DS-Coder-33B-Inst | 63.4 (56.1) | 56.1 (48.8) | 70.7 (63.4) | 51.2 (48.8) | 60.4 (54.3) |
| Qwen2.5-72B | 63.4 (61.0) | 36.6 (34.1) | 75.6 (63.4) | 39.0 (34.1) | 53.7 (48.2) |
| Qwen2.5-72B-Inst | 73.2 (68.3) | 53.7 (51.2) | 78.0 (70.7) | 56.1 (56.1) | 65.2 (61.6) |
| Mistral-Large-123B-Inst | 65.9 (58.5) | 56.1 (46.3) | 73.2 (68.3) | 48.8 (48.8) | 61.0 (55.5) |
| DS-Coder-V2-236B-Base | 41.5 (39.0) | 36.6 (31.7) | 58.5 (56.1) | 36.6 (34.1) | 43.3 (40.2) |
| DS-Coder-V2-236B-Inst | 78.0 (65.9) | 48.8 (43.9) | 68.3 (61.0) | 53.7 (48.8) | 62.2 (54.9) |
| 6B+ Models |  |  |  |  |  |
| Llama-3.1-8B | 12.2 (12.2) | 17.1 (14.6) | 19.5 (19.5) | 22.0 (17.1) | 17.7 (15.9) |
| Llama-3.1-8B-Inst | 24.4 (24.4) | 31.7 (29.3) | 53.7 (51.2) | 39.0 (34.1) | 37.2 (34.8) |
| Gemma-2-9B | 22.0 (22.0) | 19.5 (17.1) | 17.1 (19.5) | 22.0 (17.1) | 20.1 (18.9) |
| Gemma-2-9B-It | 56.1 (53.7) | 41.5 (36.6) | 51.2 (46.3) | 36.6 (29.3) | 46.3 (41.5) |
| Codegeex4-All-9B | 43.9 (41.5) | 34.1 (31.7) | 73.2 (61.0) | 34.1 (34.1) | 46.3 (42.1) |
| DS-Coder-6.7B-Base | 29.3 (24.4) | 26.8 (22.0) | 41.5 (31.7) | 22.0 (19.5) | 29.9 (24.4) |
| DS-Coder-6.7B-Inst | 56.1 (53.7) | 41.5 (36.6) | 70.7 (61.0) | 34.1 (29.3) | 50.6 (45.1) |
| Yi-Coder-9B | 29.3 (26.8) | 26.8 (22.0) | 17.1 (17.1) | 29.3 (26.8) | 25.6 (23.2) |
| Yi-Coder-9B-Chat | 56.1 (51.2) | 39.0 (36.6) | 73.2 (70.7) | 36.6 (36.6) | 51.2 (48.8) |
| Qwen2.5-Coder-7B | 56.1 (53.7) | 41.5 (36.6) | 65.9 (56.1) | 31.7 (29.3) | 48.8 (43.9) |
| Qwen2.5-Coder-7B-Inst | 22.0 (19.5) | 46.3 (39.0) | 75.6 (65.9) | 41.5 (39.0) | 46.3 (40.9) |
| CursorCore-DS-6.7B | 68.3 (63.4) | 41.5 (39.0) | 68.3 (63.4) | 36.6 (31.7) | 53.7 (49.4) |
| CursorCore-Yi-9B | 53.7 (53.7) | 46.3 (43.9) | 75.6 (68.3) | 43.9 (36.6) | 54.9 (50.6) |
| CursorCore-QW2.5-7B | 65.9 (61.0) | 41.5 (39.0) | 65.9 (63.4) | 48.8 (43.9) | 55.5 (51.8) |
| 1B+ Models |  |  |  |  |  |
| Llama-3.2-1B | 0.0 (0.0) | 14.6 (12.2) | 2.4 (4.9) | 14.6 (12.2) | 7.9 (7.3) |
| Llama-3.2-1B-Instruct | 7.3 (7.3) | 14.6 (14.6) | 19.5 (19.5) | 22.0 (19.5) | 15.9 (15.2) |
| Llama-3.2-3B | 14.6 (14.6) | 12.2 (9.8) | 26.8 (19.5) | 22.0 (17.1) | 18.9 (15.2) |
| Llama-3.2-3B-Instruct | 14.6 (14.6) | 22.0 (19.5) | 29.3 (26.8) | 34.1 (31.7) | 25.0 (23.2) |
| Gemma-2-2B | 7.3 (7.3) | 4.9 (2.4) | 12.2 (12.2) | 14.6 (9.8) | 9.8 (7.9) |
| Gemma-2-2B-It | 14.6 (14.6) | 22.0 (19.5) | 29.3 (26.8) | 34.1 (31.7) | 25.0 (23.2) |
| Phi-3.5-3.8B-Inst | 24.4 (22.0) | 19.5 (14.6) | 34.1 (34.1) | 39.0 (34.1) | 29.3 (26.2) |
| DS-Coder-1.3B-Base | 0.0 (0.0) | 12.2 (12.2) | 17.1 (12.2) | 19.5 (14.6) | 12.2 (9.8) |
| DS-Coder-1.3B-Inst | 39.9 (36.6) | 39.0 (36.6) | 39.0 (29.3) | 34.1 (34.1) | 37.8 (34.1) |
| Yi-Coder-1.5B | 2.4 (0.0) | 2.4 (2.4) | 14.6 (14.6) | 12.2 (7.3) | 7.9 (6.1) |
| Yi-Coder-1.5B-Chat | 31.7 (31.7) | 4.9 (4.9) | 51.2 (41.5) | 26.8 (22.0) | 28.7 (25.0) |
| Qwen2.5-Coder-1.5B | 43.9 (36.6) | 26.8 (26.8) | 51.2 (41.5) | 36.6 (34.1) | 39.6 (34.8) |
| Qwen2.5-Coder-1.5B-Inst | 14.6 (14.6) | 17.1 (14.6) | 43.9 (34.1) | 31.7 (29.3) | 26.8 (23.2) |
| CursorCore-DS-1.3B | 36.6 (31.7) | 39.0 (31.7) | 53.7 (46.3) | 26.8 (22.0) | 39.0 (32.9) |
| CursorCore-Yi-1.5B | 46.3 (39.0) | 34.1 (29.3) | 68.3 (58.5) | 36.6 (34.1) | 46.3 (40.2) |
| CursorCore-QW2.5-1.5B | 46.3 (43.9) | 48.8 (43.9) | 65.9 (61.0) | 39.0 (36.6) | 50.0 (46.3) |

### 6.3 Evaluation results on APEval

In Table 4, we present the results of evaluating CursorCore series models and other LLMs on APEval. It includes both the average results and the results across four different types of information within the benchmark, each item in the table is the score resulting from running the base tests and extra tests. We also report the evaluation results of other well-known models on APEval, which can be found in Appendix H.

#### CursorCore outperforms other models of comparable size

CursorCore consistently outperforms other models in both the 1B+ and 6B+ parameter sizes. It achieves the highest average score, with the best 1B+ model surpassing the top scores of other models by 10.4%, and even by 11.5% when running extra tests. Similarly, the best 6B+ model exceeds by 4.3%, and by 3.0% in the case of extra tests. Additionally, across various information types, CursorCore consistently demonstrates optimal performance among all similarly sized models.

#### Instruction models mostly outperform base models

For most model series, instruction-tuned models outperform their corresponding base models, as instruction fine-tuning generally enhances model capabilities Ouyang et al. (); Longpre et al. (). The only exception observed in our experiments is the latest model, Qwen2.5-Coder. Its base model achieves a very high score, while the instruction-tuned model performes worse. We attribute the base model’s high performance to its extensive pre-training, which involved significantly more tokens than previous models Hui et al. (). This training on a wide range of high-quality data grants it strong generalization abilities, enabling it to effectively handle the newly defined APEval task format. In contrast, the instruction-tuned model is not specifically aligned with this task, leading to a decrease in its APEval score. This highlights the challenges of aligning models with numerous diverse tasks, especially small models.

#### Performance difference between general and code LLMs is strongly related to model size

In 1B+ parameter models, general LLMs significantly underperform code LLMs. Even the best-performing general model scores over 10% lower on APEval compared to the best-performing code model, despite having more parameters. For models with 6B+ parameters, while general LLMs still lag behind code LLMs, the performance gap narrows considerably, with general LLMs even surpassing in certain cases involving specific information types. When it comes to 10B+ models, the performance difference between general and code LLMs becomes negligible. We think that smaller models, due to their limited parameter capacity, tend to focus on a single domain, such as programming assistance, while larger models can encompass multiple domains without compromising generalizability.

#### Gap between closed models and the best open models is smaller

Historically, open-source models significantly lag behind closed-source models, like those in the GPT series, leading to a preference for closed-source models in synthetic data generation and other applications Taori et al. (); Xu et al. (). However, with the continuous advancement of open-source LLMs, increasingly powerful models have emerged. On APEval, the best open-source models—such as Qwen2.5-72B-Instruct, Mistral-Large-Instruct, and Deepseek-Coder-V2-Instruct—demonstrate performance that closely approaches that of the leading GPT series model, GPT-4o. This indicates that the performance gap between open-source and closed-source LLMs has considerably narrowed, encouraging the development of more interesting applications based on open-source LLMs. Despite this progress, GPT-4o remains more comprehensive than open-source LLMs. It utilizes H far more effectively than any other model, demonstrating its strong capability to process and align with various types of information. This is an area where open-source LLMs still need to improve.

## 7 Conclusion

This work explores how LLMs can maximize the use of any available information during programming process to assist coding. We introduce Assistant-Conversation to model the diverse types of information involved in programming. We present APEval, a new benchmark that includes various historical edits and instructions, providing a comprehensive evaluation of the model’s programming assistance capabilities. Additionally, we propose Programming-Instruct, which is designed to collect data for training LLMs to assist programming, along with their corresponding data sources. Furthermore, we train CursorCore, which demonstrate outstanding performance in assisting programming tasks while achieving a good balance between efficiency and cost. We also conduct extensive ablation experiments and analyzes. Beyond enhancing traditional approaches of programming assistance, we plan to extend this approach to support models capable of assisting with repository-level development as well as other applications.

## Appendix A Related Work

### A.1 AI-Assisted Programming

AI-assisted programming has a long history, encompassing various tasks such as clone detection Lu et al. (), code summarization Sun et al. (), program synthesis Chen et al. (); Austin et al. (), automatic program repair Gulwani et al. (), code editing Wei et al. (), and code optimization Shypula et al. (). In the past, these tasks were typically addressed by custom-built models, which were difficult to scale across different tasks. With the rise of LLMs, AI-assisted programming increasingly leverages LLMs to handle multiple types of tasks simultaneously. Numerous high-quality open-source and closed-source products, such as Continue Continue-Dev (), Aider Paul-Gauthier (), Copilot Github-Copilot () and Cursor Cursor-AI (), are based on this approach.

### A.2 Code Models

Recently, LLMs have attracted significant attention in the research community for their impact on enhancing various aspects of code intelligence. Open-source code LLMs like CodeLlama Rozière et al. (); Touvron et al. (), Deepseek-Coder Guo et al. (); DeepSeek-AI et al. (), StarCoder Li et al. (); Lozhkov et al. (), Codegemma Team et al. (), Codestral Mistral-AI (), Codegeex Zheng et al. (), Yi-Coder AI et al. (), and Qwen-Coder Hui et al. () have made substantial contributions by utilizing large code corpora during training. Some models, such as WizardCoder Luo et al. (), OctoCoder Muennighoff et al. (), CodeLlama-Instruct, Deepseek-Coder-Instruct, MagiCoder Wei et al. (), Yi-Coder-Chat, and Qwen-Coder-Instruct, have been fine-tuned using instruction data collected through methods like Self-Instruct Wang et al. (); Taori et al. (), Evol-Instruct, and OSS-Instruct. These models are specifically trained on code-related instructions, improving their ability to follow coding instructions. They have made significant breakthroughs in tasks like code completion and editing.

### A.3 Code Benchmarks

HumanEval Chen et al. () is one of the most well-known benchmarks in the code domain, featuring several variants that extend it to different programming languages, extra tests, and broader application scenarios. Other notable benchmarks include MBPP Austin et al. () for program synthesis, DS1000 Lai et al. () for data science tasks, SWE-Bench Jimenez et al. () for real-world software engineering problems, and CanItEdit / CodeEditorBench Cassano et al. (); Guo et al. () for code editing. Additionally, LiveCodeBench Jain et al. () focuses on contamination-free evaluations, while Bigcodebench Zhuo et al. () and Naturecodebench Zhang et al. () provide comprehensive program synthesis assessments. CRUXEval Gu et al. () targets reasoning, CrossCodeEval Ding et al. () focuses on repository-level code completion, and Needle in the code Hui et al. () is designed for long-context evaluations.

## Appendix B Code modification representation

As discussed in Section 2.3, there are various ways to represent code modifications. Many previous works have explored techniques for instruction-based code editing Wei et al. (); Muennighoff et al. (); Paul-Gauthier (); Sweep-AI (). We build upon these works with the following formats, as shown in Figure 12:

#### Whole file format (WF)

We use the entire code, allows for a straightforward representation of the modifications. However, when only small parts of the code are changed, this method leads to redundancy, especially for long code files. Certain mitigation can be achieved through technologies such as retrieval-based speculative decoding Yang et al. (); He et al. ().

#### Unified diff format (UD)

The diff format is a common way to represent code changes, widely adopted for its efficiency and readability. Among various diff formats, unified diff is one of the most popular, as it efficiently shows code changes while reducing redundancy. It is commonly used in software tools such as git and patch.

#### Location-and-change format (LC)

To further reduce redundancy, we consider further simplify the diff formats by showing only the location and content of the changes. The location is based on line numbers. Some reports indicate that LLMs often struggle with localization, so we insert line numbers into the code to assist them.

#### Search-and-replace format (SR)

Another option is to eliminate the need for localization altogether by simply displaying the part to be modified alongside the updated version. This format eliminates the need for line numbers.

We conduct experiments using Deepseek-Coder-1.3B with these formats. For quick experiments, we train the model on data generated by AIprogrammer. We then evaluate their performance on APEval, with results shown in Figure 12. In programming assistance tasks, where real-time performance is critical, such as in tasks like auto completion or editing, the generation speed becomes particularly important. The number of tokens in both input and output directly affects the model’s speed, and the editing format greatly impacts the token count. Therefore, we also report the average input-output token count for each format in Figure 12.

Figure: Figure 10: Different formats for representing code modifications.
Refer to caption: x10.png

The results show that using WF yields the best performance, followed by SR and LC, with UD performing the worst. In terms of token usage, LC uses the fewest tokens, followed by SR and UD, while WF uses the most. The average token count for SR and UD is only slightly lower than that of WF, as they are more concise for small code changes, when a large portion needs modification, they must include both versions, making them less efficient than using WF instead.

Recent research has pointed out correlations and scaling laws between model input and output length, as well as performance OpenAI (); Snell et al. (). Our results align with these findings. As the length increases, performance improves consistently across LC, SR, and WF. UD performs poorly in both token usage and performance, likely because it contains redundant information, such as both line numbers and content for the modified sections, where only one would suffice. This redundancy reduces the format’s efficiency compared to the other three formats.

## Appendix C Additional details about Programming-Instruct

In our code editing records, we place no limits on the granularity or number of edits. Changes between two code versions may involve anything from a single character to multiple extensive modifications. However, data collected from various sources may be compressed, resulting in incomplete records. This compression can lead to a higher proportion of large-scale edits, particularly in Git Commit data. To address this issue, we propose a decomposition strategy: when there are multiple changes between versions, we break them down into single-step modifications, with the steps ordered randomly. For Git Commit data, we apply this decomposition strategy with a 90% probability, while for AIprogrammer and Online Submit data, we apply it with a 50% probability.

We randomly select a time point from the records to represent C. In practice, we prefer the model to provide assistance at earlier stages. Thus, we implement a simple rule where the random selection follows an exponential distribution, with the probability of selecting each time point decreasing by 10% with each subsequent step. This biases the model toward choosing earlier time points.

In addition to generating H and U, as discussed in Section 4.2, we also simulate the programmer’s specification of the target area and model interactions in a chat-style format. The target modification area is created using a random algorithm, as described in Appendix D, while the chat-style interaction is generated using LLMs which is similar to the generation of instructions. Prompts used for it are provided in Appendix K.

## Appendix D Target area representation

Figure: Figure 13: With and without the use of location information on APEval.
Refer to caption: x13.png

To modify code, programmers often specify the parts requiring changes, typically in one of two ways: either by clicking with the cursor to indicate a general area or by selecting a specific text range with defined start and end points. We model both cases using special tokens: “
” for cursor positions, and “
” and “
” to mark the selected region’s boundaries. While collecting training data, we determine modification locations based on the code differences before and after changes. In real-world applications, the decision to provide explicit locations—and their granularity—varies among programmers. To account for this variability, we introduce randomized choices for determining the form and location, integrating this approach into the Programming-Instruct pipeline.

We evaluate CursorCore-DS-1.3B on APEval both with and without location information to assess its impact on performance. The results in Figure 13 show that including location information has minimal effect, likely because most APEval examples are relatively short, enabling LLMs to easily infer modification locations, much like humans do without a cursor. Previous works, such as those on automated program repair Zhang et al. (), have emphasized the importance of identifying the modification location. We believe this emphasis stems from traditional code completion and insertion paradigms, as well as the natural alignment of specifying modification points with human thought processes. However, with the advancement of LLMs, the benefit of providing location information diminishes when generating code at the function or file level. This may need further exploration in longer contexts, such as repository-level editing tasks.

## Appendix E Discussion about thought process

Figure: Figure 14: Performance of models using thought process or not on APEval.
Refer to caption: x14.png

Incorporating reasoning processes in prompts has been shown to improve model performance, as demonstrated in various works like CoT Wei et al. () and ReACT Yao et al. (). Some studies have even integrated these processes into the training phase to further enhance effectiveness Zelikman et al. (). In this work, we also explore a self-taught approach, where we prompt LLMs to reverse-generate the reasoning process from outputs and incorporate them into the model’s output during training. Our model and data setup follow the same configuration as described in Appendix B to enable quick experiments. The evaluation results are shown in Figure 14.

After incorporating reasoning into training, the model shows slight performance improvements, but the output length increases significantly. The tokens used for reasoning often exceed those in the modified code. Since many programming-assist applications require real-time responses, longer reasoning times may be impractical, so we do not integrate this process into CursorCore. We believe that the decision to use reasoning processes should be based on a combination of factors, such as performance, latency, model size, and specific application requirements.

## Appendix F Conversation retrieval for Assistant-Conversation

Figure: Figure 15: Performance of models using different sliding window sizes on APEval.
Refer to caption: x16.png

Not all code editing records are necessary for inferring user intent and predicting output. Some past modifications, such as simple typos corrected shortly after, offer little value to future predictions, and thus can be safely removed. Additionally, if a programmer continuously interacts with the model without deleting these records, the editing history will accumulate and grow until it exceeds the model’s maximum context length. This could negatively affect performance and speed.

To address this, it is essential to compress the editing history or retrieve only the relevant portions. Similar to how many conversation retrieval techniques, such as memory modules Packer et al. (), prompt compression Jiang et al. () and query rewriting Ye et al. (), are used to manage dialogues for chatbots, these methods can be adapted for handling code editing records. In this work, we explore a basic approach, sliding window, to investigate possible solutions. When the number of historical editing records surpasses a predefined threshold, the model automatically discards the oldest entries.

We evaluate this method on APEval, as shown in Figure 15. The impact of setting a sliding window of a certain size on the results is minimal, indicating that compressing the historical records effectively balances performance and efficiency.

## Appendix G Evaluation results of other benchmarks

We also evaluate CursorCore on other well-known benchmarks. We use HumanEval+ and MBPP+ Liu et al. () to evaluate Python program synthesis, CanItEdit Cassano et al. () for instructional code editing, and the Python subset of HumanEvalFix from OctoPack Muennighoff et al. () for automated program repair. All benchmarks are based on their latest versions, and HumanEvalFix uses the test-based repair version as described in the original paper. To generate results, we consistently use vLLM Kwon et al. () due to its versatility and support for customized conversation formats. Evaluations are conducted within each benchmark’s execution environment.

Unlike previous LLMs, CursorCore supports multiple input formats, and different formats may produce different results. To comprehensively showcase this, we categorize input formats based on specific assisted programming scenarios into three cases:

- •
Chat: Similar to the chat format of ChatGPT Ouyang et al. (), we wrap the query before passing it to the model, which returns a response in a chat style. The final result is obtained after post-processing.
- •
Inline: Similar to Copilot Inline Chat Github-Copilot () and Cursor Command K Cursor-AI () scenarios, corresponding to the combination of C and U in Assistant-Conversation. Compared to the Chat mode, it is more tightly integrated with the IDE and returns less additional content.
- •
Tab: Similar to the use case of Copilot++ Cursor-AI (), it is the most automated of all scenarios. We provide only the C to the model. For instructional code editing and automated code repair, no explicit instructions are passed.

Evaluation results are shown in Table 5. Our model outperforms the corresponding instruction-tuned and base models across several benchmarks. However, the performance of the 6B+ model, when compared to its corresponding models, is not as strong as that of the 1B+ model. Notably, with the recent release of Qwen2.5-Coder-7B at the start of our experiments, we outperform it on only one benchmark, while other models achieve better performance across more benchmarks. We attribute it to the quantity of high-quality data: larger models require more high-quality data for training. While the current dataset is sufficient to train a highly effective 1B+ model, additional data is needed to train a more competitive 6B+ model.

We analyze the evaluation results of various input types defined in real-world assisted programming scenarios. The results of the Chat and Inline modes are comparable, with Chat mode showing a slight advantage. We attribute this to the flexibility of the Chat format, which allows the model to output its thought process and thus enhances output accuracy. The Tab mode shows comparable results on EvalPlus but underperforms on HumanEvalFix and struggles with CanItEdit, likely due to variations in the informational content of task instructions. For program synthesis based on docstrings, instructions like “complete this function” provide minimal additional context. In contrast, program repair tasks provide crucial information by indicating the presence of errors. When only code is available, the model must first determine correctness independently. Instructional code editing tasks clearly state objectives, such as implementing a new feature, requiring the model to fully understand the given information, as accurate predictions based solely on code are nearly impossible.

**Table 5: Evaluation results on EvalPlus, CanItEdit and OctoPack.**
| Model | EvalPlus |  | CanItEdit |  | OctoPack |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- |
| HE (+) | MBPP (+) |  | Desc. | Lazy |  | HE Fix |  |
| DS-Coder-6.7B-Base | 47.6 (39.6) | 70.2 (56.6) |  | 34.3 | 27.6 |  | 23.8 |
| DS-Coder-6.7B-Inst | 74.4 (71.3) | 75.1 (66.1) |  | 41.9 | 31.4 |  | 42.1 |
| CursorCore-DS-6.7B (Chat) | 78.0 (73.2) | 74.1 (63.8) |  | 45.7 | 31.4 |  | 43.3 |
| CursorCore-DS-6.7B (Inline) | 73.8 (67.1) | 71.2 (59.8) |  | 38.1 | 32.4 |  | 32.3 |
| CursorCore-DS-6.7B (Tab) | 72.0 (65.9) | 74.3 (63.0) |  | 6.7 | 6.7 |  | 25.6 |
| Yi-Coder-9B | 55.5 (47.0) | 69.6 (56.9) |  | 47.6 | 34.3 |  | 32.3 |
| Yi-Coder-9B-Chat | 83.5 (76.8) | 84.4 (71.4) |  | 58.1 | 45.7 |  | 54.3 |
| CursorCore-Yi-9B (Chat) | 84.1 (79.3) | 84.4 (73.5) |  | 56.2 | 41.0 |  | 56.1 |
| CursorCore-Yi-9B (Inline) | 79.9 (72.0) | 83.6 (69.6) |  | 48.6 | 35.2 |  | 33.5 |
| CursorCore-Yi-9B (Tab) | 79.3 (71.3) | 83.9 (72.5) |  | 10.5 | 10.5 |  | 25.6 |
| Qwen2.5-Coder-7B | 61.6 (53.0) | 76.7 (63.0) |  | 49.5 | 40.0 |  | 17.1 |
| Qwen2.5-Coder-7B-Inst | 87.2 (83.5) | 83.5 (71.7) |  | 53.3 | 44.8 |  | 54.3 |
| CursorCore-QW2.5-7B (Chat) | 80.5 (75.6) | 77.0 (64.3) |  | 51.4 | 44.8 |  | 50.6 |
| CursorCore-QW2.5-7B (Inline) | 79.9 (73.2) | 77.0 (64.0) |  | 57.1 | 39.0 |  | 41.5 |
| CursorCore-QW2.5-7B (Tab) | 79.9 (74.4) | 75.1 (64.3) |  | 5.7 | 5.7 |  | 27.4 |
| DS-Coder-1.3B-Base | 34.8 (26.8) | 55.6 (46.9) |  | 13.3 | 8.6 |  | 1.2 |
| DS-Coder-1.3B-Inst | 65.2 (59.8) | 61.6 (52.6) |  | 26.7 | 17.1 |  | 29.3 |
| CursorCore-DS-1.3B (Chat) | 68.9 (63.4) | 61.9 (49.7) |  | 21.9 | 14.3 |  | 30.4 |
| CursorCore-DS-1.3B (Inline) | 57.9 (53.7) | 60.1 (51.1) |  | 25.7 | 17.1 |  | 17.1 |
| CursorCore-DS-1.3B (Tab) | 63.4 (57.3) | 65.6 (54.8) |  | 2.9 | 2.9 |  | 8.5 |
| Yi-Coder-1.5B | 40.6 (34.8) | 59.0 (50.0) |  | 21.0 | 12.4 |  | 3.7 |
| Yi-Coder-1.5B-Chat | 67.7 (64.0) | 66.9 (56.6) |  | 21.0 | 23.8 |  | 37.2 |
| CursorCore-Yi-1.5B (Chat) | 68.9 (65.2) | 65.6 (54.8) |  | 27.6 | 24.8 |  | 38.4 |
| CursorCore-Yi-1.5B (Inline) | 60.4 (54.3) | 65.6 (55.0) |  | 28.6 | 24.8 |  | 22.6 |
| CursorCore-Yi-1.5B (Tab) | 67.1 (59.1) | 66.1 (56.6) |  | 4.8 | 4.8 |  | 20.1 |
| Qwen2.5-Coder-1.5B | 43.9 (36.6) | 69.3 (58.5) |  | 31.4 | 22.9 |  | 4.9 |
| Qwen2.5-Coder-1.5B-Inst | 70.7 (66.5) | 69.3 (59.4) |  | 28.6 | 21.0 |  | 32.9 |
| CursorCore-QW2.5-1.5B (Chat) | 71.3 (65.9) | 69.3 (58.5) |  | 31.4 | 22.9 |  | 36.6 |
| CursorCore-QW2.5-1.5B (Inline) | 66.5 (60.4) | 68.5 (58.2) |  | 23.8 | 20.0 |  | 36.6 |
| CursorCore-QW2.5-1.5B (Tab) | 64.0 (58.5) | 67.2 (56.6) |  | 1.0 | 1.0 |  | 13.4 |

## Appendix H Additional evaluation results on APEval

We also report the evaluation results of various versions of other well-known models on APEval, as shown in Table 6.

**Table 6: Additional evaluation results of LLMs on APEval.**
| Model | C | H, C | C, U | H, C, U | Total |
| --- | --- | --- | --- | --- | --- |
| StarCoder2-3B | 19.5 (19.5) | 19.5 (17.1) | 22.0 (19.5) | 22.0 (17.1) | 20.7 (18.3) |
| StarCoder2-7B | 7.3 (7.3) | 14.6 (12.2) | 19.5 (14.6) | 22.0 (17.1) | 15.9 (12.8) |
| StarCoder2-15B | 26.8 (24.4) | 24.4 (22.0) | 43.9 (36.6) | 29.3 (24.4) | 31.1 (26.8) |
| DS-Coder-V2-16B-Base | 24.4 (24.4) | 22.0 (19.5) | 31.7 (26.8) | 22.0 (17.1) | 25.0 (22.0) |
| DS-Coder-V2-16B-Inst | 43.9 (41.5) | 41.5 (31.7) | 68.3 (63.4) | 36.6 (31.7) | 47.6 (42.1) |
| Gemma-2-27B | 36.6 (36.6) | 24.4 (22.0) | 56.1 (46.3) | 26.8 (24.4) | 36.0 (32.3) |
| Gemma-2-27B-It | 63.4 (56.1) | 48.8 (41.5) | 68.3 (63.4) | 41.5 (39.0) | 55.5 (50.0) |
| Llama-3.1-70B | 24.4 (24.4) | 24.4 (22.0) | 46.3 (39.0) | 29.3 (24.4) | 31.1 (27.4) |
| Llama-3.1-70B-Inst | 61.0 (56.1) | 46.3 (46.3) | 65.9 (58.5) | 56.1 (51.2) | 57.3 (53.0) |

## Appendix I Chat template

Our model’s chat template OpenAI () is adapted from the ChatML template, where each message in the conversation is restricted to one of the following roles: system, history, current, user, or assistant. The assistant’s output includes both code modifications and chat interaction with the user. To indicate code changes, we use two special tokens “
” and “
” to wrap the code modification parts. This approach models Assistant-Conversation effectively and is compatible with standard ChatML templates and chatbot applications.
Figure 16 illustrates an example of our chat template, while Figure 17 presents examples of the chat template when using the LC and SR modes described in Appendix B.

Figure: Figure 16: Example of chat template and its corresponding demonstration in the IDE scenario.
Refer to caption: x17.png

Figure: Figure 17: Example of chat templates in LC and SR modes.
Refer to caption: x18.png

## Appendix J Prompts for evaluation

We report the prompts used to evaluate base LLMs on APEval in Table 13, while the prompts used for evaluating instruct LLMs are presented in Table 14.

## Appendix K Prompts for data collection

We design specific system prompts and few-shot examples to collect high-quality training data, as we find that many examples are very difficult to complete with current LLMs, and only a few of them can be successfully completed using rough prompts. For AIprogrammer, we utilize LLMs to simulate programmers at three different skill levels, with each level using a distinct set of prompts as shown in Tables 7, 8 and 9. Additionally, prompts used for evaluating whether the outputs align with user intent, generating user instructions, and facilitating chat interactions between models and users are outlined in Tables 12, 10 and 11. Partial few-shot examples are shown in Figures 18, 19, 20, 21, 22 and 23.

## Appendix L Limitations and future work

#### Repo-level development assistance

In this work, we focus on supporting the development of single files or function-level code. However, real-world development operates at the repository level, involving multiple files and greater interaction with IDEs. Previous research has made notable advances in repository-level tasks such as code completion Zhang et al. (), issue fixing Jimenez et al. (), and documentation generation Luo et al. (). Repository-level code assistance deals with larger datasets, and achieving optimal performance and speed will require more effort. We leave the exploration of multi-file repository-level programming assistance and leveraging additional IDE interactions for future work.

#### More scenarios and criteria for evaluation

We have only tested our models’ code assistance capabilities on Python-specific benchmarks. While multi-language program synthesis benchmarks like Multipl-E Cassano et al. () can evaluate coding abilities across languages, dedicated benchmarks are still needed to assess programming assistance for each language. Additionally, our benchmark is relatively small and based on an extension of HumanEval, making it insufficient to cover all development scenarios. Beyond using the classic Pass@k metric to evaluate accuracy, other criteria should also be considered, such as evaluating the model’s efficiency, security, and redundancy Huang et al. (); Pearce et al. (); Li et al. ().

#### Preference-based optimization

Methods like PPO Schulman et al. () and DPO Rafailov et al. (), which optimize models based on human preferences, have been widely used in LLMs. In programming assistance, programmers can provide feedback on predicted outputs for identical or similar coding processes, further optimizing the model Shinn et al. (). To enable this, a significant amount of feedback data from programmers using AI-assisted tools should be collected or synthesized.

#### Enhance performance with API calls

We aim to integrate function calls Patil et al. () into the model to further enhance its capabilities. One potential application is incorporating function calls into the thinking process, such as retrieving information or executing partial code for feedback. Although our final models excludes this thinking step due to performance and speed considerations, we are exploring hybrid approaches to introduce this process while maintaining speed and combine it with other strategies for searching how to edit. Another application is leveraging function calls in output, where calling a Python script for tasks like variable replacement might be more efficient than manually generating code blocks or search-and-replace strategies. For repository-level changes, using terminal commands or IDE APIs could sometimes be a more convenient solution.

#### Expand to other applications

Our framework is designed for programming assistance applications, but the alignment approach can also be applied to other types of AI assistants. For example, in designing an art assistant, it should be able to predict the next drawing step based on the artist’s previous drawing patterns, the current state of the canvas, and the artist’s instructions. Extending this approach to design assistants for other applications is an interesting research direction.

**Table 7: Prompt designed to leverage LLMs for simulating the behavior of a novice programmer.**
| Please play the role of a novice programmer. You are required to write a piece of code. Simulate the real process of repeatedly adding, deleting, and modifying the code. Please return the code block after each step of editing. While writing the code, make some mistakes, such as incorrect logic or syntax errors, etc. |
| --- |

**Table 8: Prompt designed to leverage LLMs for simulating the behavior of an ordinary programmer.**
| Please act as an ordinary programmer. Now, you need to write a piece of code. Please simulate the process of repeatedly adding, deleting, and modifying the code during the actual coding process. Please return the code block after each editing step. Try to simulate the coding process of an ordinary programmer as much as possible. |
| --- |

**Table 9: Prompt designed to leverage LLMs for simulating the behavior of an expert programmer.**
| Please play the role of an expert programmer. You are now required to write a piece of code. Please simulate the process of repeatedly adding, deleting, and modifying code during the real coding process. Please return the code block after each step of editing. During the coding process, you should be as professional as possible. |
| --- |

**Table 10: Prompt designed to generate user instructions.**
| You are a programming assistant. The following content includes information related to your programming assistance, which may contain the record of the programming process, the current code, the git commit after all changes, relevant details about the problem, and your predicted modifications. Please generate an instruction for you to make the corresponding modifications, ensuring it resembles instructions typically given by a human programmer. The instruction may be detailed or concise and may or may not specify the location of the modification. Return the generated instruction in the following format: |
| --- |
| ‘‘‘ |
| *instruction:** |
| {instruction} |
| ‘‘‘ |

**Table 11: Prompt designed to generate chat-style interactions between models and users.**
| You are a programming assistant. The following content includes information related to your programming assistance, which may contain the record of the programming process, the current code, the user instruction, and your predicted modifications. Please provide the chat conversation for making the prediction. This may include analyzing the past programming process, speculating on the user’s intent, and explaining the planning and ideas for modifying the code. Return your chat conversation in the following format: |
| --- |
| ‘‘‘ |
| *chat:** |
| {chat} |
| ‘‘‘ |

**Table 12: Prompt designed to evaluate whether the outputs align with user intent.**
| You are tasked with assisting a programmer by maintaining a record of the programming process, including potential future changes. Your role is to discern which changes the programmer desires you to propose proactively. These should align with their actual intentions and be helpful. To determine which changes align with a programmer’s intentions, consider the following principles: |
| --- |
| 1. **Understand the Context**: Assess the overall goal of the programming project. Ensure that any proposed change aligns with the project’s objectives and the programmer’s current focus. |
| 2. **Maintain Clear Communication**: Before proposing changes, ensure that your suggestions are clear and concise. This helps the programmer quickly understand the potential impact of each change. |
| 3. **Prioritize Stability**: Avoid proposing changes that could introduce instability or significant complexity unless there is a clear benefit. Stability is often more valued than optimization in the early stages of development. |
| 4. **Respect the Programmer’s Preferences**: Pay attention to the programmer’s coding style and preferences. Propose changes that enhance their style rather than contradict it. |
| 5. **Incremental Improvements**: Suggest changes that offer incremental improvements rather than drastic overhauls, unless specifically requested. This approach is less disruptive and easier for the programmer to integrate. |
| 6. **Consider Long-Term Maintenance**: Propose changes that improve code maintainability and readability. This includes refactoring for clarity, reducing redundancy, and enhancing documentation. |
| 7. **Balance Proactivity and Reactivity**: Be proactive in suggesting improvements that are likely to be universally beneficial (e.g., bug fixes, performance enhancements). However, be reactive, not proactive, in areas where the programmer’s specific intentions are unclear or where personal preference plays a significant role. |
| For each potential change, return ‘True‘ if suggesting this change would be beneficial to the programmer, return ‘False‘ if the change does not align with the programmer’s intentions or if they do not want you to predict this change. Give your decision after analyzing each change. Provide your response in the following format: |
| ‘‘‘ |
| *Analysis of change 1:** |
| Your analysis here. |
| *Decision:** ‘True‘ or ‘False‘ |
| *Analysis of change 2:** |
| Your analysis here. |
| *Decision:** ‘True‘ or ‘False‘ |
| … |
| ‘‘‘ |

**Table 13: Prompt used to evaluate base LLMs.**
| Read the following messages during programming and return the modified code in this format: |
| --- |
| 
{modified code}
 |
| 
Programming process 1: |
| ‘‘‘python |
| a = 1 |
| b = 2 |
| c = a + b |
| ‘‘‘ |
| Current code: |
| ‘‘‘python |
| i = 1 |
| b = 2 |
| c = a + b |
| ‘‘‘ |
| User instruction: |
| Please change variable names.
 |
| 
‘‘‘python |
| i = 1 |
| j = 2 |
| k = i + j |
| ‘‘‘
 |
| Read the following messages during programming and return the modified code in this format: |
| 
{modified code}
 |
| 
Programming process 1: |
| {Programming process 1} |
| … |
| Programming process n: |
| {Programming process n} |
| Current code: |
| {Current code} |
| User instruction: |
| {User instruction}
 |

**Table 14: Prompt used to evaluate instruct LLMs.**
| user |
| --- |
| Read the following messages during programming and return the modified code in this format: |
| 
{modified code}
 |
| Programming process 1: |
| ‘‘‘python |
| a = 1 |
| b = 2 |
| c = a + b |
| ‘‘‘ |
| Current code: |
| ‘‘‘python |
| i = 1 |
| b = 2 |
| c = a + b |
| ‘‘‘ |
| User instruction: |
| Please change variable names. |
| assistant |
| 
‘‘‘python |
| i = 1 |
| j = 2 |
| k = i + j |
| ‘‘‘
 |
| user |
| Read the following messages during programming and return the modified code in this format: |
| 
{modified code}
 |
| Programming process 1: |
| {Programming process 1} |
| … |
| Programming process n: |
| {Programming process n} |
| Current code: |
| {Current code} |
| User instruction: |
| {User instruction} |
| assistant |

Figure: Figure 18: Few-shot prompts designed to leverage LLMs for simulating the behavior of a novice programmer.
Refer to caption: x19.png

Figure: Figure 19: Few-shot prompts designed to leverage LLMs for simulating the behavior of an ordinary programmer.
Refer to caption: x20.png

Figure: Figure 20: Few-shot prompts designed to leverage LLMs for simulating the behavior of an expert programmer.
Refer to caption: x21.png

Figure: Figure 21: Few-shot prompts designed to evaluate whether the outputs align with user intent.
Refer to caption: x22.png

Figure: Figure 22: Few-shot prompts designed to generate user instructions
Refer to caption: x23.png

Figure: Figure 23: Few-shot prompts designed to generate chat-style interactions between models and users.
Refer to caption: x24.png

## Peer Reviews

confidence: 4
contribution: 4
initial_rating: 8
presentation: 3
questions: Formatting:
- Caption for figure 2 can be improved.
- Table 1 caption should explain the data.
- Figure 7 and 8 are hard to parse.

Writing:
Related works should talk about other tasks in AI for code that look at the history of changes like OverWatch.
soundness: 4
strengths: - Current agents lack history information and are very specific to the current context which is the key challenge this paper tries to solve.
- Real user scenarios are a more complex framework of interactions similar to the one proposed.
- The benchmark created evaluates information use from different context sources.
summary: The paper proposes:
(1) the Assistant-Conversation Framework. This combines multiple components like System (priming to the tasks), History (past edits and changes made in code), Current (The current code being processed), User (instructions for the task) and Assistant (the responses from the model).
(2) APEval: A benchmark for holistic programming assistant evaluation.
(3) CursorCore: A model for assisted programming tasks.
weaknesses: - The improvements with using CursorCode is not clear from the performance differential.
- The conversational framework needs to be motivated better as its hard to understand why this system was chosen. Also, the paper tries to cover a lot of things which makes it hard to focus on the core problem.

---

confidence: 3
contribution: 3
initial_rating: 5
presentation: 3
questions: - How do you determine the appropriate timing for recording code changes? In real-world scenarios, code changes are often continuous; for example, a modification to a single code block may consist of multiple edits across different lines, and each line may undergo multiple token-level edits. How are boundaries between different history records (H1, H2, etc.) defined?
- How does the framework address the issue of long inputs? With a large number of code changes, the input text can become very lengthy. What strategies are used to manage or reduce input length while preserving relevant information?
- How is the code change history constructed for APEval during manual annotation? Given that HumanEval’s inputs are only function declarations, how do annotators simulate the evolution of a function declaration through code changes to build realistic histories?
soundness: 3
strengths: - The paper addresses a critical limitation of current code benchmarks by focusing on continuous code editing, aligning its benchmarks more closely with real-world development scenarios.
- The paper introduces Programming-Instruct, a data synthesis pipeline that generates a substantial dataset of 219K samples from sources like GitHub. Experimental results demonstrate that this dataset effectively supports supervised fine-tuning, making it a valuable resource for training code assistance models.
- The description of the Assistant-Conversation framework is clear and comprehensive.
summary: The paper presents CursorCore, an AI-powered programming assistant that improves programming support by utilizing multiple sources of information, including code change history, current code and user intention, throughout the coding process. CursorCore introduces a new framework, Assistant-Conversation, and establishes a benchmark, APEval, to assess its effectiveness. The work also develops the Programming-Instruct pipeline for training data synthesis. Evaluation results in HumanEval benchmark shows the effectiveness of CursorCore.
weaknesses: - The paper divides the HumanEval benchmark into four settings, each with 41 examples, which limits direct comparison across these settings. This approach uses different data for each setting, making it difficult to assess their relative effectiveness. For instance, settings with code history (H) might not be particularly relevant for a task like HumanEval’s code generation, raising questions about its utility in this context.
- The evaluation relies heavily on code generation tasks, which may not fully capture the utility of incorporating code change history information (H) as input. In Table 4, the setting with H seems perform worse than without H. Expanding to additional tasks beyond code generation could better assess the contribution of code history information and more accurately reflect the value of the proposed framework across a broader range of code assistant applications.
- The experimental results analysis is insufficient. In Table 4’s 6B+ model comparison, CursorCore underperforms relative to its base models in specific settings, such as DS-Coder’s C+U, Yi-Coder’s C, and Qwen-Coder’s H+C and C+U settings. This raises questions about the factors driving these inconsistencies, suggesting that the paper’s analysis of model performance across settings could be more thorough to address the causes of these variances.

---

confidence: 4
contribution: 3
initial_rating: 5
presentation: 3
questions: As mentioned above, the authors should:
(1) elaborate why eval dataset is convincing, and should be used by future model developers for the general coding assistant benchmark.
(2) compare in detail about data from three sources.
soundness: 3
strengths: This paper's main contribution is the dataset synthesis approach, that leverages AIprogrammer to generate code edit histories from seed code snippets. Then, together with the mixture strategy, APEval includes a diverse set of insertion, editing, generation tasks. Given that fine-grained coding history data can be difficult to obtain, this synthetic approach is great for this task.

The dataset selection process also highlights the benefit of mixing datasets with both chat data and synthetic data. It seems like the gain from github and online coding platform is minimal, which potentially requires additional analysis.
summary: This paper presents a dataset synthesis pipeline to generate mixed style programming data to support in-context code generation task. The paper considers a mixture of history steps, current context, user instruction for generation code completion together with rationale as the task. To collect training and evaluation dataset, the authors consider (1) use LLM to generate intermediate steps from an initial program, (2) collect from github commits, and (3) collect coding platform submits. A random mixture approach is taken to generate tasks, with LLM as a judge to compare consistency. 

The authors present three models trained on this dataset (with mixture from all sources), and CursorCore models show impressive improvement over baseline models of similar size.
weaknesses: There are two weakness of the paper:

1. As a benchmark paper, this paper doesn't provide a very convincing evaluation dataset. The authors should provide analysis of the evaluation dataset, justifying (1) why the evaluation set reflects practical editing needs (since AIprogrammer generated data may not completely align with typical programming styles), (2) how does the evaluation set ensures high accuracy, especially with respect to the contextual information (as the authors filtered with the AI judge).

2. The paper doesn't make clear comparison with dataset curated from github/coding submits and synthetic data, despite dataset selection section clearly show that git-commit and online submit made minimal contribution on top of AIProgrammer + Evol-instruct. I suggest the authors provide some insights about their difference qualitatively (e.g., how does the editing styles different among them). If possible, maybe perform cross-evaluation between models trained on these subsets (e.g., train on AIProgrammer, but eval on git data / then train on git data and eval on AIProgrammer data). This might highlight and justify how these datasets should be mixed together.

---

confidence: 3
contribution: 2
initial_rating: 5
presentation: 2
questions: 1. what is the conversational bit in the Assistant-Conversation framework?

2. Lines 288-293 discuss the process of discarding some segments that are not aligned with "user's purpose" -- is there any check in place to ensure that this step does not throws away some important segments? How do you decide if something is aligned with user's purpose when you may not even have the user query (U)?

3. Line 340-343 mention "randomly utilize two powerful open-source LLMs" -- utilize for what?

4. Line 295-296 mention things that are mentioned only there in the main part of the paper. What are the learnings from that part of the paper? Is there a conclusion to be drawn, and if so, then it should be in the main paper, and if not, then adding 2 sentences with a pointer to the Appendix is not very helpful.
soundness: 3
strengths: + The paper describes a fairly extensive effort that includes benchmark generation using human annotations,
automated data generation, and fine tuning. 

+ Evaluation across several models, including several open-source models, across sizes
summary: This paper presents (1) a new conversational framework called Assistant-Conversation aimed at simplifying the programming process.  The paper also presents (2) a benchmark set for assisted programming, namely APEval, which has 164 benchmarks that are hand-curated starting with HumanEval and adding some or all of the "history", "code", and "user" components.  Since generating APEval like benchmarks is time consuming manual process, the paper also presents (3) a method, Programming-Instruct, to automate data collection.  Finally, the dataset is used (4) to fine-tune LLMs and get CursorCore models.

Assistant-Conversation framework: The framework consists of the elements system (S), history (H), current snapshot of code (C), user query (U) and assistant response (A).  The paper observes that current models have limitations in dealing with these 5 pieces.  This point about history (H) not being incorporated in prediction has been made previously in many papers in software engineering conferences; see, for example, see the FSE 2023 paper titled "Grace: Language models meet code edits."

APEval: APEval is an extension of HumanEval generated by asking programmers with varying levels of experience to annotate HumanEval by interacting with an LLM. The paper identifies four categories of benchmarks, where we either have H,C,U or just H,C, or just C, U or just C. Benchmarks for each category are generated by humans starting from HumanEval benchmarks.  There are a total of 164 benchmarks in APEval, 41 of each category, where history (H) ranges from 21-139 lines, code (C) ranges from 8-31 lines, and user query (U) ranges from 3-19 lines (Table 1).  The benchmark set could be useful contribution, but there is no mention of releasing the benchmark set in the paper.

Programming-Instruct: The idea here is to get a history of code snapshots generated in the process of solving a programming task. This history could come from an LLM, or Git commits, or online submissions of (partial or incorrect) solutions of programming tasks. The data is processed and categorized into HCU, HC, CU or C buckets. The user query U is LLM generated.

Cursor-Core: The data generated in (3) above is used to fine-tune Deepseek-Coder, Yi-Coder AI and Qwen2.5-Coder of different sizes. The benchmarks in (2) are used to evaluate.

The evaluation results show that the fine-tuned model perform better than the base models, and other models in that (size) category. The fine-tuned CursorCore models all perform worse than GPT-4o.
weaknesses: - While the effort is impressive, the take-home message remains unclear. The paper starts by emphasizing the need for history (H) -- but inclusion of H almost always leads to worse performance (going from C to HC or going from CU to HCU) -- in fact, that is also true for GPT-4o, which is evidence contrary to the thesis of the paper. The code (C) and user interaction (U) part is already part of most LLM-based programming assistants. 

- The abstract also emphasizes conversational framework, but I did not find any conversational interactions here, just the history of the code.

- The presentation is poor because the paper tries to pack too much information in the limited space.

Meta-review: This paper formulates the task of LLM-assisted in-IDE programming, where a model generates code given a system instruction (S), history code changes (H), current programmatic context (C), as well as a user prompt (U). The authors also built an execution-based evaluation benchmark APEval by repurposing coding tasks in the HumanEval dataset, consisting of 164 programming assistance problems with varying types of contextual information (e.g., with or without history code changes H). To adapt LLMs to this new task, the authors also proposed several approaches to generate synthetic instruction tuning data following the same format, using resources like Github commits, submissions to online judges like LeetCode, or LLM-curated coding tasks. Finally, the authors fine-tuned several LLMs using the synthetic data and showed improved performance on APEval compared to prompting existing models.

**Strengths:**

* Compared to other formulations of code generation or editing tasks, the proposed setup of generating code given historical code changes along with current code context and user instructions is more aligned with real-world in-IDE coding assist scenarios (jgRp, 13qq). 
The proposed benchmark, APEval and the synthetic data generation pipeline consider different types of contextual information (jgRp, fkg9). The proposed method to generate code edit history is particularly valuable given that “coding history data can be difficult to obtain” (fkg9). Overall, this is “a fairly extensive effort” (zutF).

* The resulting instruction tuning dataset is “substantial” in size (13qq), and the positive experimental results suggested “it a valuable resource for training code assistance models” (13qq). Evaluation also seems comprehensive, with results “across several models, including several open-source models, across sizes” (zutF)

**Weaknesses:**

While this paper presents positive results and involves a fairly extensive amount of effort, there are still several opening issues yet to be addressed:

1. **Limitation of the Benchmark** (R-13qq) There are only 41 evaluation examples covering each context setting (H+C+U **;** H+C **;** C+U **;** C only), and different underlying HumanEval problems are used in these four settings. This makes it difficult to compare scores across different settings and assess their relative effectiveness. While the authors provided convincing reasons of creating problems with different contextual settings from different HumanEval problems, I found the size of each split still very small (41 tasks), making it difficult to interpret the statistical significance of the mainline results in Table 4, where each pass@1 metrics are estimated only using a small group of 41 tasks.

2. **Limited study on the value of training data from different sources** (R-fkg9) The dataset selection section “clearly showed that git-commit and online judge submissions made minimal contribution on top of AIProgrammer + Evol-instruct”, and “there is not much insight about how these datasets help with each other in practical tasks”. Additionally, there is a potential mismatch between the distribution of problems in the APEval benchmark and those in the training data. In particular, HumanEval problems only consider simple algorithmic tasks using built-in Python functions, and may not reflect the benefit of training data that feature a broader spectrum of more realistic use cases and domains, such as data derived from arbitrary github commits.

3. **Overall Significance of the Contribution** (R-zutF) “Observations about the role of code edit history, current code, and user interactions in predicting code transformations have been made before, and so have the observations about gains from fine-tuning and how fine-tuned models require smaller prompts.” 

4. **Potential Misuse of Terms** (zutF) The usage of “conversational framework” in the paper is potentially misleading, as this term has specific meanings in NLP, in particular dialogue research. There is nothing that is "conversational" in the APEval dataset and the instruction following data (e.g., there is only one turn of user interaction, i.e., there is at most one user prompt in each problem).

5. **Issues with Writing** There is a lot of room for improvement in the overall writing and presentation. To name a few:

* “Online submit”: consider renaming to "submissions to online coding platforms”

* Sec 3.1: “Table 1: APEval Statistics. Present …” -> “Table 1: APEval Statistics and breakdown of tasks by context type”.

* L139: Consider using a more precise noun to refer to $C$, for example, “code context”, instead of using “current”. Similarly, consider using “User Prompt” to refer to $U$ and "Assistant Output” for $A$.

Given these remaining issues, this paper could benefit from another round of revision. Hence the recommendation is Rejection.

Decision: Reject