# huggingface/qwen2.5-coder architecture

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

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

## Overview

This repository accompanies the Qwen2.5-Coder model family. Its code supports supervised and preference fine-tuning, plus a collection of code-generation and coding-assistant evaluation tools. The clearest runtime workflow in the sampled sources is LiveCodeBench: select a scenario and benchmark, generate model outputs, extract code, then optionally compute metrics and save results. Other evaluation suites and Aider are separate product branches. Connections for unsampled subsystems are limited to references in the source index; the README mainly documents the released models and capabilities.

Main entry points: [`qwencoder-eval/instruct/aider/aider/main.py`](https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/main.py) (Aider application), [`qwencoder-eval/instruct/livecode_bench/lcb_runner/runner/main.py`](https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/livecode_bench/lcb_runner/runner/main.py) (LiveCodeBench entry), [`finetuning/sft/train.py`](https://github.com/huggingface/qwen2.5-coder/blob/main/finetuning/sft/train.py) (SFT training), [`qwencoder-eval/instruct/eval-dev-quality/evaluate/evaluate.go`](https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/eval-dev-quality/evaluate/evaluate.go) (Dev quality evaluator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_training["Fine-tuning"]
  node_sft["SFT training<br/>[train.py]"]
  node_sftdata["Training datasets"]
  node_sftutils["Training utilities<br/>[utils.py]"]
  node_dpo["DPO training<br/>[train.py]"]
  node_dpoutils["DPO callbacks<br/>[utils.py]"]
end

subgraph group_benchmarks["Benchmark evaluation"]
  node_lcbentry["LiveCodeBench entry<br/>[main.py]"]
  node_lcbrouter["Scenario routing<br/>[scenario_router.py]"]
  node_lcbmodel["Model catalog<br/>[lm_styles.py]"]
  node_lcbrunner["vLLM generation<br/>[vllm_runner.py]"]
  node_lcbmetrics["Benchmark metrics"]
  node_cotentry["CoT benchmark entry<br/>[main.py]"]
  node_bird["BIRD Spider evaluation<br/>[main.py]"]
  node_crux["CRUXEval inference<br/>[main.py]"]
  node_multipl["MultiPL-E evaluation<br/>[evaluate.py]"]
  node_bigcode["BigCodeBench evaluation<br/>[evaluate.py]"]
  node_aggr["Aggregate results<br/>[aggr_results.py]"]
end

subgraph group_assistant["Coding assistant"]
  node_aiderentry["Aider application<br/>[main.py]"]
  node_aiderargs["CLI arguments<br/>[args.py]"]
  node_aidercoder["Code editing<br/>[base_coder.py]"]
  node_aideredit["Edit-block coder<br/>[editblock_coder.py]"]
  node_aidercommands["Chat commands<br/>[commands.py]"]
  node_aiderio["User interaction<br/>[io.py]"]
  node_aiderrepo["Repository context<br/>[repo.py]"]
  node_aidermodel["Model interface<br/>[models.py]"]
end

subgraph group_quality["Code quality evaluation"]
  node_devquality["Dev quality evaluator<br/>[evaluate.go]"]
  node_devtasks["Quality tasks<br/>[task.go]"]
  node_devmodel["Model abstraction<br/>[model.go]"]
  node_devprovider["Model providers<br/>[provider.go]"]
end

node_user(("Engineer"))
node_aideruser(("Developer"))

node_user -.->|"fine-tunes"| node_sft
node_sft -->|"loads datasets"| node_sftdata
node_sft -->|"uses utilities"| node_sftutils
node_user -.->|"fine-tunes"| node_dpo
node_dpo -->|"uses callbacks"| node_dpoutils
node_user -->|"runs benchmark"| node_lcbentry
node_lcbentry -->|"routes scenario"| node_lcbrouter
node_lcbentry -->|"selects model"| node_lcbmodel
node_lcbentry -->|"generates outputs"| node_lcbrunner
node_lcbentry -.->|"evaluates outputs"| node_lcbmetrics
node_lcbrouter -->|"computes metrics"| node_lcbmetrics
node_lcbrunner -.->|"uses model"| node_lcbmodel
node_user -->|"runs benchmark"| node_cotentry
node_cotentry -.->|"shares generation"| node_lcbrunner
node_user -->|"evaluates model"| node_bird
node_user -->|"evaluates model"| node_crux
node_user -.->|"evaluates code"| node_multipl
node_user -.->|"evaluates code"| node_bigcode
node_aideruser -->|"starts assistant"| node_aiderentry
node_aiderentry -->|"parses options"| node_aiderargs
node_aiderentry -->|"creates coder"| node_aidercoder
node_aiderentry -->|"dispatches commands"| node_aidercommands
node_aiderentry -->|"uses interaction"| node_aiderio
node_aiderentry -->|"configures repository"| node_aiderrepo
node_aiderentry -->|"selects model"| node_aidermodel
node_aidercoder -->|"specializes coder"| node_aideredit
node_user -.->|"runs assessment"| node_devquality
node_devquality -.->|"evaluates tasks"| node_devtasks
node_devquality -.->|"uses model"| node_devmodel
node_devmodel -.->|"uses provider"| node_devprovider
node_user -.->|"aggregates results"| node_aggr

click node_sft "https://github.com/huggingface/qwen2.5-coder/blob/main/finetuning/sft/train.py"
click node_sftdata "https://github.com/huggingface/qwen2.5-coder/blob/main/finetuning/sft/utils/training_datasets.py"
click node_sftutils "https://github.com/huggingface/qwen2.5-coder/blob/main/finetuning/sft/utils/utils.py"
click node_dpo "https://github.com/huggingface/qwen2.5-coder/blob/main/finetuning/dpo/train.py"
click node_dpoutils "https://github.com/huggingface/qwen2.5-coder/blob/main/finetuning/dpo/utils.py"
click node_lcbentry "https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/livecode_bench/lcb_runner/runner/main.py"
click node_lcbrouter "https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/livecode_bench/lcb_runner/runner/scenario_router.py"
click node_lcbmodel "https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/livecode_bench/lcb_runner/lm_styles.py"
click node_lcbrunner "https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/livecode_bench/lcb_runner/runner/vllm_runner.py"
click node_lcbmetrics "https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/livecode_bench/lcb_runner/evaluation/compute_code_generation_metrics.py"
click node_cotentry "https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/reasoning/livecode_bench_cot/lcb_runner_cq/runner/main.py"
click node_bird "https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/bird-spider/main.py"
click node_crux "https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/cruxeval/inference/main.py"
click node_multipl "https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/multipl_e/chat/evaluate.py"
click node_bigcode "https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/BigCodeBench/evaluate.py"
click node_aiderentry "https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/main.py"
click node_aiderargs "https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/args.py"
click node_aidercoder "https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/coders/base_coder.py"
click node_aideredit "https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/coders/editblock_coder.py"
click node_aidercommands "https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/commands.py"
click node_aiderio "https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/io.py"
click node_aiderrepo "https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/repo.py"
click node_aidermodel "https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/models.py"
click node_devquality "https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/eval-dev-quality/evaluate/evaluate.go"
click node_devtasks "https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/eval-dev-quality/evaluate/task/task.go"
click node_devmodel "https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/eval-dev-quality/model/model.go"
click node_devprovider "https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/eval-dev-quality/provider/provider.go"
click node_aggr "https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/base/aggr_results.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_sftdata,node_sftutils,node_dpo,node_dpoutils toneBlue
class node_lcbentry,node_lcbrouter,node_lcbmodel,node_lcbrunner,node_lcbmetrics,node_cotentry,node_bird,node_crux,node_multipl,node_bigcode,node_aggr toneAmber
class node_aiderentry,node_aiderargs,node_aidercoder,node_aideredit,node_aidercommands,node_aiderio,node_aiderrepo,node_aidermodel toneMint
class node_devquality,node_devtasks,node_devmodel,node_devprovider toneRose
class node_user,node_aideruser toneIndigo
```

## Components

### Fine-tuning

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

### Benchmark evaluation

- [LiveCodeBench entry](https://github.com/huggingface/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/huggingface/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`
- [Model catalog](https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/livecode_bench/lcb_runner/lm_styles.py): `qwencoder-eval/instruct/livecode_bench/lcb_runner/lm_styles.py`
- [vLLM generation](https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/livecode_bench/lcb_runner/runner/vllm_runner.py): `qwencoder-eval/instruct/livecode_bench/lcb_runner/runner/vllm_runner.py`
- [Benchmark metrics](https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/livecode_bench/lcb_runner/evaluation/compute_code_generation_metrics.py): `qwencoder-eval/instruct/livecode_bench/lcb_runner/evaluation/compute_code_generation_metrics.py`
- [CoT benchmark entry](https://github.com/huggingface/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`
- [BIRD Spider evaluation](https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/bird-spider/main.py): `qwencoder-eval/instruct/bird-spider/main.py`
- [CRUXEval inference](https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/cruxeval/inference/main.py): `qwencoder-eval/instruct/cruxeval/inference/main.py`
- [MultiPL-E evaluation](https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/multipl_e/chat/evaluate.py): `qwencoder-eval/instruct/multipl_e/chat/evaluate.py`
- [BigCodeBench evaluation](https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/BigCodeBench/evaluate.py): `qwencoder-eval/instruct/BigCodeBench/evaluate.py`
- [Aggregate results](https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/base/aggr_results.py): `qwencoder-eval/base/aggr_results.py`

### Coding assistant

- [Aider application](https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/main.py): `qwencoder-eval/instruct/aider/aider/main.py`
- [CLI arguments](https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/args.py): `qwencoder-eval/instruct/aider/aider/args.py`
- [Code editing](https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/coders/base_coder.py): `qwencoder-eval/instruct/aider/aider/coders/base_coder.py`
- [Edit-block coder](https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/coders/editblock_coder.py): `qwencoder-eval/instruct/aider/aider/coders/editblock_coder.py`
- [Chat commands](https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/commands.py): `qwencoder-eval/instruct/aider/aider/commands.py`
- [User interaction](https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/io.py): `qwencoder-eval/instruct/aider/aider/io.py`
- [Repository context](https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/repo.py): `qwencoder-eval/instruct/aider/aider/repo.py`
- [Model interface](https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/aider/aider/models.py): `qwencoder-eval/instruct/aider/aider/models.py`

### Code quality evaluation

- [Dev quality evaluator](https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/eval-dev-quality/evaluate/evaluate.go): `qwencoder-eval/instruct/eval-dev-quality/evaluate/evaluate.go`
- [Quality tasks](https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/eval-dev-quality/evaluate/task/task.go): `qwencoder-eval/instruct/eval-dev-quality/evaluate/task/task.go`
- [Model abstraction](https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/eval-dev-quality/model/model.go): `qwencoder-eval/instruct/eval-dev-quality/model/model.go`
- [Model providers](https://github.com/huggingface/qwen2.5-coder/blob/main/qwencoder-eval/instruct/eval-dev-quality/provider/provider.go): `qwencoder-eval/instruct/eval-dev-quality/provider/provider.go`

### Other components

- **Engineer**
- **Developer**

## Connections

- Engineer → SFT training: fine-tunes
- SFT training → Training datasets: loads datasets (evidence: `finetuning/sft/train.py`)
- SFT training → Training utilities: uses utilities (evidence: `finetuning/sft/train.py`)
- Engineer → DPO training: fine-tunes
- DPO training → DPO callbacks: uses callbacks (evidence: `finetuning/dpo/train.py`)
- Engineer → LiveCodeBench entry: runs benchmark (evidence: `qwencoder-eval/instruct/livecode_bench/lcb_runner/runner/main.py`)
- LiveCodeBench entry → Scenario routing: routes scenario (evidence: `qwencoder-eval/instruct/livecode_bench/lcb_runner/runner/main.py`)
- LiveCodeBench entry → Model catalog: selects model (evidence: `qwencoder-eval/instruct/livecode_bench/lcb_runner/runner/main.py`)
- LiveCodeBench entry → vLLM generation: generates outputs (evidence: `qwencoder-eval/instruct/livecode_bench/lcb_runner/runner/main.py`)
- LiveCodeBench entry → Benchmark metrics: evaluates outputs
- Scenario routing → Benchmark metrics: computes metrics (evidence: `qwencoder-eval/instruct/livecode_bench/lcb_runner/runner/scenario_router.py`)
- vLLM generation → Model catalog: uses model
- Engineer → CoT benchmark entry: runs benchmark (evidence: `qwencoder-eval/reasoning/livecode_bench_cot/lcb_runner_cq/runner/main.py`)
- CoT benchmark entry → vLLM generation: shares generation
- Engineer → BIRD Spider evaluation: evaluates model (evidence: `qwencoder-eval/instruct/bird-spider/main.py`)
- Engineer → CRUXEval inference: evaluates model (evidence: `qwencoder-eval/instruct/cruxeval/inference/main.py`)
- Engineer → MultiPL-E evaluation: evaluates code
- Engineer → BigCodeBench evaluation: evaluates code
- Developer → Aider application: starts assistant (evidence: `qwencoder-eval/instruct/aider/aider/main.py`)
- Aider application → CLI arguments: parses options (evidence: `qwencoder-eval/instruct/aider/aider/main.py`)
- Aider application → Code editing: creates coder (evidence: `qwencoder-eval/instruct/aider/aider/main.py`)
- Aider application → Chat commands: dispatches commands (evidence: `qwencoder-eval/instruct/aider/aider/main.py`)
- Aider application → User interaction: uses interaction (evidence: `qwencoder-eval/instruct/aider/aider/main.py`)
- Aider application → Repository context: configures repository (evidence: `qwencoder-eval/instruct/aider/aider/main.py`)
- Aider application → Model interface: selects model (evidence: `qwencoder-eval/instruct/aider/aider/main.py`)
- Code editing → Edit-block coder: specializes coder (evidence: `qwencoder-eval/instruct/aider/aider/coders/__init__.py`)
- Engineer → Dev quality evaluator: runs assessment
- Dev quality evaluator → Quality tasks: evaluates tasks
- Dev quality evaluator → Model abstraction: uses model
- Model abstraction → Model providers: uses provider
- Engineer → Aggregate results: aggregates results
