Text Generation
Transformers
Safetensors
English
qwen3
code-search
code-localization
reinforcement-learning
agent
software-engineering
GSPO
OpenHands
SWE-Bench
conversational
text-generation-inference
Instructions to use OpenHands/CodeScout-1.7B-RFT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenHands/CodeScout-1.7B-RFT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="OpenHands/CodeScout-1.7B-RFT") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("OpenHands/CodeScout-1.7B-RFT") model = AutoModelForCausalLM.from_pretrained("OpenHands/CodeScout-1.7B-RFT") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use OpenHands/CodeScout-1.7B-RFT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenHands/CodeScout-1.7B-RFT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenHands/CodeScout-1.7B-RFT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/OpenHands/CodeScout-1.7B-RFT
- SGLang
How to use OpenHands/CodeScout-1.7B-RFT with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "OpenHands/CodeScout-1.7B-RFT" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenHands/CodeScout-1.7B-RFT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "OpenHands/CodeScout-1.7B-RFT" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenHands/CodeScout-1.7B-RFT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use OpenHands/CodeScout-1.7B-RFT with Docker Model Runner:
docker model run hf.co/OpenHands/CodeScout-1.7B-RFT
| library_name: transformers | |
| license: apache-2.0 | |
| language: | |
| - en | |
| base_model: Qwen/Qwen3-1.7B | |
| pipeline_tag: text-generation | |
| tags: | |
| - code-search | |
| - code-localization | |
| - reinforcement-learning | |
| - agent | |
| - software-engineering | |
| - GSPO | |
| - OpenHands | |
| - SWE-Bench | |
| datasets: | |
| - OpenHands/SWE-smith-py-code-search | |
| - OpenHands/SWE-Gym-code-search | |
| - OpenHands/CodeScout_Training_Rollouts | |
| # CodeScout-1.7B-RFT | |
| [π Paper](https://arxiv.org/abs/2603.17829) β’ [π» Code](https://github.com/OpenHands/codescout) β’ [π€ Collection](https://huggingface.co/collections/OpenHands/codescout-69b9a6adcf21f348f4db937f) | |
| **Pre-RL checkpoint β rejection fine-tuned on expert trajectories from CodeScout-14B.** | |
| <p align="center"> | |
| <img src="codescout_overview.png" alt="CodeScout Overview" width="100%"> | |
| </p> | |
| CodeScout-1.7B-RFT is part of the **CodeScout** family of open-source RL-trained code search agents. | |
| CodeScout models achieve state-of-the-art repository-level code localization using *nothing more than a standard Unix terminal* β no static analysis, no repository graphs, no language-specific tooling. | |
| ## Key Highlights | |
| - Warm-start checkpoint for [CodeScout-1.7B](https://huggingface.co/OpenHands/CodeScout-1.7B) RL training | |
| - Distilled from CodeScout-14B expert trajectories with rejection sampling | |
| - Useful for researchers studying the effect of RFT vs. RL in agent training pipelines | |
| - Can be used as a base for custom RL experiments on code search | |
| ## Results | |
| Performance on SWE-Bench code localization (instance-averaged F1 scores): | |
| | Benchmark | CodeScout-1.7B | CodeScout-4B | CodeScout-14B | | |
| |---|---|---|---| | |
| | **SWE-Bench Verified** β File F1 | 55.46 | 68.52 | **68.57** | | |
| | **SWE-Bench Verified** β Func F1 | 28.22 | 36.78 | **40.32** | | |
| | **SWE-Bench Pro** β File F1 | 40.96 | 51.77 | **53.63** | | |
| | **SWE-Bench Pro** β Func F1 | 18.24 | **29.03** | 28.74 | | |
| | **SWE-Bench Lite** β File F1 | 56.57 | 67.03 | **71.84** | | |
| | **SWE-Bench Lite** β Func F1 | 27.07 | 39.87 | **44.43** | | |
| <p align="center"> | |
| <img src="f1_vs_params_file.png" alt="File-level F1 vs Model Size" width="48%"> | |
| <img src="f1_vs_params_function.png" alt="Function-level F1 vs Model Size" width="48%"> | |
| </p> | |
| <p align="center"><em>Code localization performance on SWE-Bench Verified. CodeScout (β) achieves superior or competitive results over larger open-source LLMs and narrows the gap with closed-source frontier models.</em></p> | |
| ## Training | |
| CodeScout-1.7B-RFT is the intermediate checkpoint produced by rejection fine-tuning (RFT) `Qwen3-1.7B` on expert trajectories from CodeScout-14B, before the final RL stage. | |
| - **Teacher model:** [CodeScout-14B](https://huggingface.co/OpenHands/CodeScout-14B) | |
| - **Source trajectories:** Rollouts from CodeScout-14B on 7,700 training instances | |
| - **Filtered data:** 4K trajectories with perfect scores (F1 = 1.0 at file, module, and function level) | |
| - **SFT epochs:** 1 | |
| - **Learning rate:** 5e-5 with cosine scheduler (warmup ratio 0.1) | |
| - **Batch size:** 8 | |
| - **Optimizer:** AdamW | |
| - **Framework:** [veRL](https://github.com/volcengine/verl) | |
| This checkpoint serves as the starting point for RL training of [CodeScout-1.7B](https://huggingface.co/OpenHands/CodeScout-1.7B). | |
| ## How It Works | |
| CodeScout uses the **OpenHands-Bash** scaffold β an agent equipped with only a `Terminal` tool (supporting standard Unix commands like `rg`, `find`, `grep`, `ls`) and a `LocalizationFinish` tool for structured output submission. The agent iteratively navigates the repository to identify relevant files, classes, and functions related to a given issue. | |
| The model is trained with **GSPO** (Group Sequence Policy Optimization) using multi-level F1 rewards at the file, module, and function level. | |
| ## Intended Use | |
| CodeScout-1.7B-RFT is designed for **repository-level code localization**: given a GitHub issue description and a code repository, it identifies the relevant files, classes, and functions that need to be modified. It is intended to be used as a localization subagent within larger coding agent pipelines. | |
| ## Limitations | |
| - Trained and evaluated exclusively on **Python** repositories | |
| - Designed for code *localization*, not code *editing* or issue resolution | |
| - Performance may vary on repositories significantly different from the training distribution | |
| - Requires the OpenHands-Bash scaffold for optimal performance | |
| ## Citation | |
| ```bibtex | |
| @misc{sutawika2026codescouteffectiverecipereinforcement, | |
| title={CodeScout: An Effective Recipe for Reinforcement Learning of Code Search Agents}, | |
| author={Lintang Sutawika and Aditya Bharat Soni and Bharath Sriraam R R and Apurva Gandhi and Taha Yassine and Sanidhya Vijayvargiya and Yuchen Li and Xuhui Zhou and Yilin Zhang and Leander Melroy Maben and Graham Neubig}, | |
| year={2026}, | |
| eprint={2603.17829}, | |
| archivePrefix={arXiv}, | |
| primaryClass={cs.SE}, | |
| url={https://arxiv.org/abs/2603.17829}, | |
| } | |
| ``` | |