File size: 2,258 Bytes
80b7188
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# DeepCoder Programming Agent Example

This example demonstrates training and running [DeepCoder](https://pretty-radio-b75.notion.site/DeepCoder-A-Fully-Open-Source-14B-Coder-at-O3-mini-Level-1cf81902c14680b3bee5eb349a512a51), a code reasoning LLM fine-tuned from DeepSeek-R1-Distill-Qwen-14B on coding competition problems with RL. The model achieves 60.6% Pass@1 accuracy on LiveCodeBench v5, representing an 8% improvement over the base model.

## Overview

The DeepCoder examples demonstrate:

- How to use rLLM's CompetitionCodingAgent for programming tasks
- How to train agents with iterative context lengthening (16K -> 32K)
- How to evaluate coding performance on LiveCodeBench

## Quick Start

### Setup Coding Data

First, prepare your coding datasets:

```bash

cd examples/deepcoder

python prepare_deepcoder_data.py

```

### Model Hosting

Start a model server (choose one option):

**Option 1: Using vLLM**
```bash

python -m vllm.entrypoints.openai.api_server \

    --model agentica-org/DeepCoder-14B-Preview \

    --host 0.0.0.0 \

    --port 30000 \

    --dtype bfloat16 \

    --max-model-len 32768

```

**Option 2: Using SGLang**
```bash

python -m sglang_router.launch_server \

    --model-path agentica-org/DeepCoder-14B-Preview \ 

    --dp-size 1 \

    --dtype bfloat16

```

### Run DeepCoder Agent

Execute the coding agent for evaluation:

```bash

python evaluate_deepcoder.py

```

### Train DeepCoder Agent

Train your own DeepCoder agent with iterative context lengthening:

```bash

# Train with 16K context

bash train_deepcoder_16k.sh



# Train with 32K context (modify MODEL_PATH to 16k checkpoint)

bash train_deepcoder_32k.sh

```

## Code Reference

### Code Agent Evaluator

Main script for evaluating coding performance:

```python title="examples/deepcoder/run_deepcoder.py"

--8<-- "examples/deepcoder/run_deepcoder.py"

```

### Training Script

DeepCoder training configuration:

```python title="examples/deepcoder/train_deepcoder.py"

--8<-- "examples/deepcoder/train_deepcoder.py"

```

For detailed setup instructions, see the [README](https://github.com/rllm-org/rllm/blob/main/examples/deepcoder/README.md) in the deepcoder example directory.