# qwenlm/qwen2.5-coder architecture

> Architecture diagram of the GitHub repository qwenlm/qwen2.5-coder, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/qwenlm/qwen2.5-coder
- Repository: https://github.com/qwenlm/qwen2.5-coder

## Overview

This repository combines Qwen3-Coder fine-tuning workflows with a collection of coding, reasoning, and tool-use evaluation suites; it is not a single end-user application. The training branch prepares data and runs supervised or preference optimization. Evaluation branches generate model outputs, execute or grade them, and produce benchmark results. The README describes the model’s coding-agent, long-context, and tool-calling capabilities, while the tree shows dedicated evaluation suites for those areas. Connections below follow the README or shown source references; most unsampled benchmark internals are represented at their existing directory paths.

Main entry points: [`qwencoder-eval/instruct/aider/aider/main.py`](https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/main.py) (Aider entry point), [`finetuning/sft/train.py`](https://github.com/qwenlm/qwen2.5-coder/blob/main/finetuning/sft/train.py) (SFT training), [`finetuning/dpo/train.py`](https://github.com/qwenlm/qwen2.5-coder/blob/main/finetuning/dpo/train.py) (DPO training), [`qwencoder-eval/instruct/bird-spider/main.py`](https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/instruct/bird-spider/main.py) (Bird-Spider runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_training["Model training"]
  node_sft["SFT training<br/>[train.py]"]
  node_sft_data["SFT data prep"]
  node_dpo["DPO training<br/>[train.py]"]
  node_dpo_utils["DPO utilities<br/>[utils.py]"]
end

subgraph group_coding_eval["Coding evaluation"]
  node_aider_main["Aider entry point<br/>[main.py]"]
  node_aider_coder["Coder engine<br/>[base_coder.py]"]
  node_aider_models["Model registry<br/>[models.py]"]
  node_aider_repo["Repository context<br/>[repo.py]"]
  node_aider_dump["Conversation dump<br/>[dump.py]"]
  node_aider_report["Issue reporting<br/>[report.py]"]
  node_bird_main["Bird-Spider runner<br/>[main.py]"]
  node_bird_eval["SQL evaluation<br/>[evaluator.py]"]
  node_livecode_main["LiveCodeBench runner<br/>[main.py]"]
  node_livecode_router["Scenario routing<br/>[scenario_router.py]"]
  node_multi_eval["Multilingual execution<br/>[evaluation.py]"]
end

subgraph group_reasoning_eval["Reasoning evaluation"]
  node_cruxeval_main["CRUXEval inference<br/>[main.py]"]
  node_cot_main["CoT benchmark runner<br/>[main.py]"]
  node_cot_router["CoT scenario routing<br/>[scenario_router.py]"]
end

subgraph group_agent_eval["Agent evaluation"]
  node_bfcl_generation["BFCL inference"]
  node_bfcl_handler["BFCL model handler<br/>[base_handler.py]"]
  node_oss_handler["Local model serving"]
  node_tau_tasks["Retail task scenarios<br/>[tasks.py]"]
  node_tau_router["Tau API router<br/>[router.py]"]
end

node_engineer(("Model engineer"))

node_engineer -->|"trains"| node_sft
node_engineer -->|"trains"| node_dpo
node_sft -->|"loads data"| node_sft_data
node_dpo -->|"uses utilities"| node_dpo_utils
node_engineer -.->|"uses coding agent"| node_aider_main
node_aider_main -->|"registers models"| node_aider_models
node_aider_main -->|"creates coder"| node_aider_coder
node_aider_main -->|"configures repository"| node_aider_repo
node_aider_main -->|"imports dump"| node_aider_dump
node_aider_main -->|"imports reporting"| node_aider_report
node_engineer -->|"runs benchmark"| node_bird_main
node_bird_main -->|"uses evaluator"| node_bird_eval
node_engineer -->|"runs benchmark"| node_livecode_main
node_livecode_main -->|"routes scenarios"| node_livecode_router
node_engineer -.->|"runs execution metrics"| node_multi_eval
node_engineer -->|"runs reasoning tests"| node_cruxeval_main
node_engineer -->|"runs reasoning benchmark"| node_cot_main
node_cot_main -->|"routes scenarios"| node_cot_router
node_engineer -.->|"runs tool tests"| node_bfcl_generation
node_bfcl_handler -->|"extended by"| node_oss_handler
node_engineer -.->|"runs agent tasks"| node_tau_tasks
node_engineer -.->|"uses API evaluation"| node_tau_router

click node_sft "https://github.com/qwenlm/qwen2.5-coder/blob/main/finetuning/sft/train.py"
click node_sft_data "https://github.com/qwenlm/qwen2.5-coder/blob/main/finetuning/sft/utils/training_datasets.py"
click node_dpo "https://github.com/qwenlm/qwen2.5-coder/blob/main/finetuning/dpo/train.py"
click node_dpo_utils "https://github.com/qwenlm/qwen2.5-coder/blob/main/finetuning/dpo/utils.py"
click node_aider_main "https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/main.py"
click node_aider_coder "https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/coders/base_coder.py"
click node_aider_models "https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/models.py"
click node_aider_repo "https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/repo.py"
click node_aider_dump "https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/dump.py"
click node_aider_report "https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/report.py"
click node_bird_main "https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/instruct/bird-spider/main.py"
click node_bird_eval "https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/instruct/bird-spider/code_eval/evaluator.py"
click node_livecode_main "https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/instruct/livecode_bench/lcb_runner/runner/main.py"
click node_livecode_router "https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/instruct/livecode_bench/lcb_runner/runner/scenario_router.py"
click node_multi_eval "https://github.com/qwenlm/qwen2.5-coder/blob/main/finetuning/sft/utils/multiple_metrics/evaluation.py"
click node_cruxeval_main "https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/instruct/cruxeval/inference/main.py"
click node_cot_main "https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/reasoning/livecode_bench_cot/lcb_runner_cq/runner/main.py"
click node_cot_router "https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/reasoning/livecode_bench_cot/lcb_runner_cq/runner/scenario_router.py"
click node_bfcl_generation "https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/tool_calling_eval/berkeley-function-call-leaderboard/bfcl_eval/_llm_response_generation.py"
click node_bfcl_handler "https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/tool_calling_eval/berkeley-function-call-leaderboard/bfcl_eval/model_handler/base_handler.py"
click node_oss_handler "https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/tool_calling_eval/berkeley-function-call-leaderboard/bfcl_eval/model_handler/local_inference/base_oss_handler.py"
click node_tau_tasks "https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/tool_calling_eval/tau-bench/tau_bench/envs/retail/tasks.py"
click node_tau_router "https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/tool_calling_eval/tau-bench/tau_bench/model_utils/api/router.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_sft,node_sft_data,node_dpo,node_dpo_utils toneBlue
class node_aider_main,node_aider_coder,node_aider_models,node_aider_repo,node_aider_dump,node_aider_report,node_bird_main,node_bird_eval,node_livecode_main,node_livecode_router,node_multi_eval toneAmber
class node_cruxeval_main,node_cot_main,node_cot_router toneMint
class node_bfcl_generation,node_bfcl_handler,node_oss_handler,node_tau_tasks,node_tau_router toneRose
class node_engineer toneIndigo
```

## Components

### Model training

- [SFT training](https://github.com/qwenlm/qwen2.5-coder/blob/main/finetuning/sft/train.py): `finetuning/sft/train.py`
- [SFT data prep](https://github.com/qwenlm/qwen2.5-coder/blob/main/finetuning/sft/utils/training_datasets.py): `finetuning/sft/utils/training_datasets.py`
- [DPO training](https://github.com/qwenlm/qwen2.5-coder/blob/main/finetuning/dpo/train.py): `finetuning/dpo/train.py`
- [DPO utilities](https://github.com/qwenlm/qwen2.5-coder/blob/main/finetuning/dpo/utils.py): `finetuning/dpo/utils.py`

### Coding evaluation

- [Aider entry point](https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/main.py): `qwencoder-eval/instruct/aider/aider/main.py`
- [Coder engine](https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/coders/base_coder.py): `qwencoder-eval/instruct/aider/aider/coders/base_coder.py`
- [Model registry](https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/models.py): `qwencoder-eval/instruct/aider/aider/models.py`
- [Repository context](https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/repo.py): `qwencoder-eval/instruct/aider/aider/repo.py`
- [Conversation dump](https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/dump.py): `qwencoder-eval/instruct/aider/aider/dump.py`
- [Issue reporting](https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/report.py): `qwencoder-eval/instruct/aider/aider/report.py`
- [Bird-Spider runner](https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/instruct/bird-spider/main.py): `qwencoder-eval/instruct/bird-spider/main.py`
- [SQL evaluation](https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/instruct/bird-spider/code_eval/evaluator.py): `qwencoder-eval/instruct/bird-spider/code_eval/evaluator.py`
- [LiveCodeBench runner](https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/instruct/livecode_bench/lcb_runner/runner/main.py): `qwencoder-eval/instruct/livecode_bench/lcb_runner/runner/main.py`
- [Scenario routing](https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/instruct/livecode_bench/lcb_runner/runner/scenario_router.py): `qwencoder-eval/instruct/livecode_bench/lcb_runner/runner/scenario_router.py`
- [Multilingual execution](https://github.com/qwenlm/qwen2.5-coder/blob/main/finetuning/sft/utils/multiple_metrics/evaluation.py): `finetuning/sft/utils/multiple_metrics/evaluation.py`

### Reasoning evaluation

- [CRUXEval inference](https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/instruct/cruxeval/inference/main.py): `qwencoder-eval/instruct/cruxeval/inference/main.py`
- [CoT benchmark runner](https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/reasoning/livecode_bench_cot/lcb_runner_cq/runner/main.py): `qwencoder-eval/reasoning/livecode_bench_cot/lcb_runner_cq/runner/main.py`
- [CoT scenario routing](https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/reasoning/livecode_bench_cot/lcb_runner_cq/runner/scenario_router.py): `qwencoder-eval/reasoning/livecode_bench_cot/lcb_runner_cq/runner/scenario_router.py`

### Agent evaluation

- [BFCL inference](https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/tool_calling_eval/berkeley-function-call-leaderboard/bfcl_eval/_llm_response_generation.py): `qwencoder-eval/tool_calling_eval/berkeley-function-call-leaderboard/bfcl_eval/_llm_response_generation.py`
- [BFCL model handler](https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/tool_calling_eval/berkeley-function-call-leaderboard/bfcl_eval/model_handler/base_handler.py): `qwencoder-eval/tool_calling_eval/berkeley-function-call-leaderboard/bfcl_eval/model_handler/base_handler.py`
- [Local model serving](https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/tool_calling_eval/berkeley-function-call-leaderboard/bfcl_eval/model_handler/local_inference/base_oss_handler.py): `qwencoder-eval/tool_calling_eval/berkeley-function-call-leaderboard/bfcl_eval/model_handler/local_inference/base_oss_handler.py`
- [Retail task scenarios](https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/tool_calling_eval/tau-bench/tau_bench/envs/retail/tasks.py): `qwencoder-eval/tool_calling_eval/tau-bench/tau_bench/envs/retail/tasks.py`
- [Tau API router](https://github.com/qwenlm/qwen2.5-coder/blob/main/qwencoder-eval/tool_calling_eval/tau-bench/tau_bench/model_utils/api/router.py): `qwencoder-eval/tool_calling_eval/tau-bench/tau_bench/model_utils/api/router.py`

### Other components

- **Model engineer**

## Connections

- Model engineer → SFT training: trains (evidence: `finetuning/sft/train.py`)
- Model engineer → DPO training: trains (evidence: `finetuning/dpo/train.py`)
- SFT training → SFT data prep: loads data (evidence: `finetuning/sft/train.py`)
- DPO training → DPO utilities: uses utilities (evidence: `finetuning/dpo/train.py`)
- Model engineer → Aider entry point: uses coding agent
- Aider entry point → Model registry: registers models (evidence: `qwencoder-eval/instruct/aider/aider/main.py`)
- Aider entry point → Coder engine: creates coder (evidence: `qwencoder-eval/instruct/aider/aider/main.py`)
- Aider entry point → Repository context: configures repository (evidence: `qwencoder-eval/instruct/aider/aider/main.py`)
- Aider entry point → Conversation dump: imports dump (evidence: `qwencoder-eval/instruct/aider/aider/main.py`)
- Aider entry point → Issue reporting: imports reporting (evidence: `qwencoder-eval/instruct/aider/aider/main.py`)
- Model engineer → Bird-Spider runner: runs benchmark (evidence: `qwencoder-eval/instruct/bird-spider/main.py`)
- Bird-Spider runner → SQL evaluation: uses evaluator (evidence: `qwencoder-eval/instruct/bird-spider/main.py`)
- Model engineer → LiveCodeBench runner: runs benchmark (evidence: `qwencoder-eval/instruct/livecode_bench/lcb_runner/runner/main.py`)
- LiveCodeBench runner → Scenario routing: routes scenarios (evidence: `qwencoder-eval/instruct/livecode_bench/lcb_runner/runner/main.py`)
- Model engineer → Multilingual execution: runs execution metrics
- Model engineer → CRUXEval inference: runs reasoning tests (evidence: `qwencoder-eval/instruct/cruxeval/inference/main.py`)
- Model engineer → CoT benchmark runner: runs reasoning benchmark (evidence: `qwencoder-eval/reasoning/livecode_bench_cot/lcb_runner_cq/runner/main.py`)
- CoT benchmark runner → CoT scenario routing: routes scenarios (evidence: `qwencoder-eval/reasoning/livecode_bench_cot/lcb_runner_cq/runner/main.py`)
- Model engineer → BFCL inference: runs tool tests
- BFCL model handler → Local model serving: extended by (evidence: `qwencoder-eval/tool_calling_eval/berkeley-function-call-leaderboard/bfcl_eval/model_handler/local_inference/base_oss_handler.py`)
- Model engineer → Retail task scenarios: runs agent tasks
- Model engineer → Tau API router: uses API evaluation
