aiXapply-4B-RL is the reinforcement-learning / GRPO post-trained aiXapply model for Full-File Apply. Given an original file and a localized update snippet, it generates the complete updated file while preserving everything outside the requested edit.
This RL model is optimized for task-level correctness, locality, and robustness under alternative edit representations. Use it when you want the RL-aligned variant reported in the latency/accuracy frontier and cross-format experiments. For the highest in-distribution full-file Apply accuracy and long-context fidelity, also see aiXcoder/aiXapply-4B-SFT.
This model is part of the official artifact release for paper:
AiXapply: Fast and Reliable Full-File Code Integration with Specialized Small Models for IDE Workflows
Overview
Modern coding assistants often produce a local edit snippet first. The hard downstream step is applying that snippet to the original file without changing unrelated code. Unified diffs are compact but brittle, and search-and-replace is easy to generate but depends on exact string matching. aiXapply treats this downstream step as a standalone code-integration task.
In an IDE workflow, an upstream coding assistant proposes an update snippet, aiXapply expands it into a complete updated file, and the IDE presents the resulting diff for review. See the code repository for figures, scripts, and full experiment details.
The repository includes:
Component
Path
OpenAI-compatible inference scripts
experiments/aiXapply/
Experiment entrypoints for full-file Apply, unified diff, and search-and-replace
experiments/
Shared evaluation and six-class error taxonomy
experiments/evaluation/
Multi-language data construction pipeline
data_generation/
SFT and RL training scripts
training/sft/, training/rl/
Continue IDE integration adapter
continue_config/
Highlights
High accuracy: aiXapply-SFT reaches 94.4% average equivalence accuracy on the 1,637-sample main benchmark, close to Qwen3.5-397B-A17B (94.8%) and above DeepSeek-V3.2 (91.6%).
Fast full-file generation: with n-gram speculative decoding, aiXapply reaches 1.06s average latency and 2692 tokens/s on a single A100 40GB GPU.
Deployment-ready apply backend: the model can be served behind an OpenAI-compatible endpoint and used as a dedicated apply model in Continue.
Reproducible pipeline: data generation, training, inference, scoring, and error classification scripts are included.
Resources
This release is split into one GitHub repository and three Hugging Face artifacts:
Open-source project repository containing inference scripts, data construction code, training recipes, evaluation tools, Continue integration, and documentation.
Public evaluation set for Full-File Apply, covering 20 programming languages and file formats. Use this artifact to reproduce benchmark scores without rebuilding the training data pipeline.
4B Apply model post-trained with reinforcement learning / GRPO. It is optimized for task-level correctness, locality, and robustness under alternative edit representations.
4B Apply model trained with supervised fine-tuning. It provides strong in-distribution accuracy and better long-context structural preservation in our experiments.
Task Definition
Full-File Apply takes:
text
1<language>{language}</language>
2<source_file>{original full file}</source_file>
3<update_snippet>{localized update snippet}</update_snippet>
Complete output: the model must return the full updated file, not a patch or partial fragment.
No side effects: content outside the requested edit region should remain identical to the source file.
Placeholder expansion: markers such as // ... existing code ... mean "copy the corresponding original content exactly"; placeholders must not appear in the final output.
If anchors in the update snippet are ambiguous or cannot be located safely, the model should fail conservatively rather than hallucinate an unrelated edit.
Use --max-model-len 262144 only if your serving setup has enough memory for the full long-context configuration.
Call the Endpoint
python
1from openai import OpenAI
23client = OpenAI(base_url="http://127.0.0.1:12003/v1", api_key="local")45system_prompt ="""You are a deterministic Code Patching Engine. Your task is to synthesize a "Updated File" by applying a partial "Update Snippet" to the provided "Source File".
67### Algorithm
81. **Context Matching**: Analyze the `Update Snippet` to identify the context anchors (the lines of code surrounding the changes). Locate the exact corresponding block in the `Source File`. The match must be unique.
92. **Code Merging**: Replace the matched block in the `Source File` with the logic from the `Update Snippet`.
103. **Expansion**: The `Update Snippet` contains omission markers (e.g., `// ... existing code ...`). You MUST replace these markers with the original, unchanged lines from the `Source File`.
114. **Output Generation**: Output the FULL content of the resulting file.
1213### Constraints
14- **NO Laziness**: Never output comments like `// ... rest of code ...` in the final output. You must write out every single line of the final code.
15- **Strict Fidelity**: Preserve the original indentation style (spaces/tabs) and comments of the Source File for all unchanged parts.
16- **Safety**: If the context in the snippet is ambiguous or cannot be found, output nothing inside the tags.
1718### Output Format
19<update_file>[Your final code here]</update_file>"""2021user_prompt ="""<language>{language}</language>
2223<source_file>{source_file}</source_file>
2425<update_snippet>{update_snippet}</update_snippet>
2627Please generate the full updated code strictly following the instructions."""282930LANGUAGE ="python"31SOURCE_FILE ="""def add(a, b):
32 return a + b
3334def main():
35 print(add(1, 2))
36"""37UPDATE_SNIPPET ="""# ... existing code ...
38def main():
39 print(add(7, 8))
40"""414243response = client.chat.completions.create(44 model="aiXapply-4B-RL",45 messages=[46{"role":"system","content": system_prompt},47{"role":"user","content": user_prompt.format(language=LANGUAGE, source_file=SOURCE_FILE, update_snippet=UPDATE_SNIPPET)},48],49 temperature=0,50)5152print(response.choices[0].message.content)
Continue Integration
continue_config/ contains an adapter for using aiXapply as Continue's dedicated Apply backend.
Then merge the apply model block from continue_config/continue.config.yaml.example into your Continue config. The proxy strips <update_file>...</update_file> tags before returning the result to Continue and supports streaming responses.
The public test dataset is released separately on Hugging Face. It contains the benchmark examples used to evaluate aiXapply and comparable models. Each example follows the Apply format:
<source_file, update_snippet, update_file>
The broader training-data construction pipeline is included in this repository. It synthesizes Apply examples from real-world commits, including CommitPack-style records with (old_file, new_file, commit_message).
aiXapply dataset construction pipeline
Figure 2: Dataset construction pipeline. Raw CommitPack records are sampled, consistency-verified, solvability-filtered, and split into train/test sets.
High-level pipeline:
Sampling and filtering: keep localized same-file edits and balance languages/formats.
Change description generation: make the intent of each commit explicit.
Snippet synthesis: produce a localized update_snippet and full-file ground truth.
Consistency verification: ensure every diff is explained by the snippet and no extra change is introduced.
Solvability filtering: remove ambiguous or non-reproducible samples, then convert to training format.
Dataset scale:
Split
Samples
Notes
Train
19,347
Multi-language Apply training examples
Test
1,637
Public Hugging Face test dataset
The test set covers C, C++, Dockerfile, Go, HTML, INI, Java, JavaScript, JSON, Makefile, Markdown, Python, reStructuredText, Rust, Shell, SQL, Text, TypeScript, XML, and YAML.
aiXapply is trained from a Qwen3-4B backbone with two complementary strategies:
SFT: direct supervised learning from (source_file, update_snippet) to update_file.
RL / GRPO: task-level optimization with rewards based on equivalence, patch correctness, and side-effect penalties.
The released model artifacts are aiXapply-4B-SFT and aiXapply-4B-RL. Use the SFT model as the default choice for high full-file Apply accuracy and long-context fidelity; use the RL model when you want the RL-aligned variant used in the latency/accuracy frontier and cross-format experiments.
The local provider in experiments/aiXapply/infer_openai.py expects an OpenAI-compatible endpoint at http://127.0.0.1:12003/v1. If you serve the model on a different port or with a different served model name, update the local provider config in that script before running evaluation.
aiXapply-RL keeps full-file Apply accuracy while reducing latency to an interactive range in the latency/accuracy frontier experiments.
Main Benchmark
Average equivalence accuracy on the 1,637-example aiXapply test set:
Model
Avg Accuracy
Qwen3-4B baseline
0.626
Fast-Apply-7B
0.620
DeepSeek-V3.2
0.916
GLM-5
0.921
aiXapply-RL
0.938
aiXapply-SFT
0.944
Qwen3.5-397B-A17B
0.948
Editing Paradigms
Under the same DeepSeek-V3.2 model, full-file Apply improves one-shot accuracy over common edit representations:
Representation
Accuracy
Avg Latency
Unified diff
0.560
14.22s
Search-and-replace
0.749
28.48s
Full-file Apply
0.916
108.96s
aiXapply-RL full-file Apply
0.938
1.44s
Speculative Decoding
Method
Avg Latency
P95 Latency
Throughput
No speculation
28.83s
90.23s
102.04 tokens/s
Suffix default
5.75s
20.74s
509.54 tokens/s
N-gram default
2.17s
6.94s
1343.99 tokens/s
N-gram best (n=7, k=128)
1.06s
3.38s
2692.01 tokens/s
Generalization
Setting
DeepSeek-V3.2
aiXapply-RL
aiXapply-SFT
Long context
0.588
0.647
0.843
Untrained languages avg.
0.932
0.938
0.941
Random placeholders avg.
0.932
0.948
0.951
Chunk file avg.
0.850
0.881
0.900
Industrial Deployment
In the aiXcoder IDE plugin, aiXapply is deployed as a dedicated Apply service after the upstream model generates an update snippet. In production traces, the Apply stage drops from 50s average latency to 1.89s, with P95 latency reduced from 89s to 3.78s. The setup also offloads full-file generation from the upstream large model, improving serving capacity and reducing cost.
Repository Notes
The current release focuses on single-file Apply. Multi-file edits and interactive multi-step editing are future work.
aiXapply optimizes deterministic integration, not semantic validation. You should still run tests and review generated diffs before accepting edits.
Do not commit secrets, checkpoints, datasets, or generated prediction artifacts unless they are intentionally part of a release.
Contributing
Contributions are welcome. Please read CONTRIBUTING.md before opening issues or pull requests.
For useful bug reports, include the script or endpoint you ran, the command/configuration, the observed output or traceback, and enough model/provider context to reproduce the problem.
License
This model is licensed under the Apache License 2.0. See the code repository LICENSE for details.
Citation
If you find aiXapply useful, please cite:
bibtex
1@misc{jiang2026aixapply,
2 title = {AiXapply: Fast and Reliable Full-File Code Integration with Specialized Small Models for IDE Workflows},
3 author = {Jiang, Siyuan and Cai, Xiang and Wang, Peixu and Han, Yu and Dong, Yihong and Ning, Wei and Guo, Xuyuan and Wen, Jincheng and Zhao, Wei and Li, Ge},
4 year = {2026},
5 url = {https://github.com/aixcoder-plugin/aiXapply-4B}
6}