|
--- |
|
library_name: transformers |
|
tags: [] |
|
license: apache-2.0 |
|
--- |
|
 |
|
|
|
# II-Search-CIR 4B |
|
|
|
|
|
Inspired by the success of our [II-Researcher](https://ii.inc/web/blog/post/ii-researcher) approach, which applies tools with augmented reasoning on top of the [Deep-seek-R1](https://huggingface.co/deepseek-ai/DeepSeek-R1-0528) model, II-Search-4B-CIR introduces Code-Integrated Reasoning (CIR), a more powerful and flexible method for tool interaction with the reasoning process. |
|
|
|
|
|
 |
|
|
|
 |
|
|
|
# Model Description |
|
|
|
## Code Integrated Reasoning |
|
|
|
We instruct the model to generate code blocks enclosed between `<start_code>\n```python` and |
|
`\n```<end_code>` , within which it can invoke a set of predefined functions. |
|
|
|
These functions act as interfaces to external resources, similar to the tool call paradigm but offering greater flexibility and control. This approach enables the model to not only retrieve external information but also process, filter, and reason over it programmatically within the code itself. |
|
|
|
In our setup, we provide two predefined functions: |
|
|
|
- `web_search(query: str, num_result: int)` |
|
- `web_visit(url: str)` |
|
|
|
## Training Methodology |
|
|
|
In our early experiments, we found that even large models such as [Qwen/Qwen3-235B-A22B](https://huggingface.co/Qwen/Qwen3-235B-A22B) or [Deep-seek-R1](https://huggingface.co/deepseek-ai/DeepSeek-R1-0528) could not produce the code format efficiently. Sometimes, models would not use any code blocks at all, instead relying on their internal knowledge base to answer the query. |
|
To address this issue, we first curated a dataset and performed SFT fine-tuning on the [Qwen/Qwen3-4B](https://huggingface.co/Qwen/Qwen3-4B) model. Following this, we further optimized the SFT model by training DAPO on a hard-reasoning dataset to boost performance. |
|
|
|
For SFT stage we using the hyperparameters: |
|
|
|
- Max Length: 26000. |
|
- Batch Size: 128. |
|
- Learning-Rate: 1e-5. |
|
- Number Of Epoch: 4. |
|
|
|
For RL stage we setup training with: |
|
|
|
- Max prompt length: 3000 tokens. |
|
- Max response length: 16384 tokens. |
|
- Max Total length: 32768 tokens. |
|
- Max Observation Length: 3000 tokens per observation. |
|
- Masking Observation Tokens: True |
|
- Max n.o code blocks: 32. |
|
- Clip ratios: Low 0.2, High 0.3. |
|
- Batch sizes: Train prompt 128, Generation prompt 128, Mini-batch 16. |
|
- Responses per prompt: 16. |
|
- Temperature: 1.0, Top-p: 1.0, Top-k: -1 (vLLM rollout). |
|
- Learning rate: 1e-6, Warmup steps: 20. |
|
- Loss aggregation: Token-mean. |
|
- Gradient clipping: 1.0. |
|
|
|
We describe more detail of our training methodology in our [II-Search-4B](https://ii.inc/web/blog/post/ii-search) blog post |
|
|
|
## Datasets |
|
|
|
We also release our dataset to reproduce the results: |
|
|
|
- [II-Search-CIR-SFT](https://huggingface.co/datasets/Intelligent-Internet/II-Search-CIR-SFT) |
|
- [II-Search-RL](https://huggingface.co/datasets/Intelligent-Internet/II-Search-RL) |
|
|
|
# Evaluation Results |
|
|
|
We compare our model with other small-sized open-source models, including Qwen3-4B (the model on which we are based) and other models that also specialize in information-seeking tasks. [Qwen3-4B](https://huggingface.co/Qwen/Qwen3-4B), [Jan-4B](https://huggingface.co/Menlo/Jan-nano-128k), [WebSailor-3B](https://huggingface.co/Alibaba-NLP/WebSailor-3B). We also reported the benchmarking results on Google Frames dataset from 2 latest MoE models [Qwen3-30B-A3B-Instruct-2507](https://huggingface.co/Qwen/Qwen3-30B-A3B-Instruct-2507) and [Qwen3-30B-A3B-Thinking-2507](https://huggingface.co/Qwen/Qwen3-30B-A3B-Thinking-2507) on this task. |
|
The search API was SerpDev, Google Gemini Pro 2.5 was used to extract and judge the answers (Using the proper judge prompt from the each benchmarking dataset’s author). |
|
|
|
| **Benchmark** | **Qwen3-4B** | **Jan-4B** | **WebSailor-3B** | **II-Search-4B** | **II-Search-CIR-4B** | |
|
| --- | --- | --- | --- | --- | --- | |
|
| OpenAI/SimpleQA | 76.8 | 80.1 | 81.8 | 91.8 | 91.8 | |
|
| Google/Frames | 30.7 | 24.8 | 34.0 | 67.5 | 72.2 | |
|
| Seal_0 | 6.31 | 2.7 | 1.8 | 22.5 | 26.4 | |
|
|
|
**Note**: Our MCP ensure that we didn't go to any url come from the huggingface when we evaluate the II-Search-CIR-4B model. |
|
|
|
All benchmark traces from models can be found at:[Inspect-Search-Models-Benchmarking-Result ](https://huggingface.co/datasets/II-Vietnam/Inspect-Search-Models-Benchmarking-Result). |
|
|
|
# How To Use |
|
|
|
|
|
Our model can be utilized in the same manner as Qwen or Deepseek-R1-Distill models. |
|
|
|
For instance, you can easily start a service using [vLLM](https://github.com/vllm-project/vllm): |
|
|
|
```bash |
|
vllm serve Intelligent-Internet/II-Search-CIR-4B --rope-scaling '{"rope_type":"yarn","factor":4.0,"original_max_position_embeddings":32768}' |
|
``` |
|
|
|
You can also easily start a service using [SGLang](https://github.com/sgl-project/sglang): |
|
|
|
```bash |
|
python -m sglang.launch_server --model Intelligent-Internet/II-Search-CIR-4B --json-model-override-args '{"rope_scaling":{"rope_type":"yarn","factor":4.0,"original_max_position_embeddings":32768}}' --context-length 128000 |
|
``` |
|
|
|
To try out the II-SEARCH-CIR model, refer to the example provided in the GitHub repo here which includes the **System prompt, Hint prompt, and Code executor**: |
|
|
|
👉 [II-Researcher CIR-4B Example](https://github.com/Intelligent-Internet/ii-researcher/tree/main/examples/ii_search_4b) |
|
|
|
|
|
## Citation |
|
|
|
```bib |
|
@misc{2025II-Search-4B, |
|
title={II-Search-4B: Search Reasoning Model}, |
|
author={Intelligent Internet}, |
|
year={2025} |
|
} |
|
``` |