File size: 2,200 Bytes
eb0f39d
 
 
e9beef1
 
 
13711d7
e9beef1
 
 
 
 
 
 
 
 
13711d7
 
 
 
e9beef1
 
 
 
 
 
 
 
 
13711d7
 
d24c768
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e9beef1
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
# DeepRetrieval-SQL-7B 

## Prompt Template

```
<|im_start|>system
You are a helpful assistant. You first think about the reasoning process in the mind and then provides the user with the answer.<|im_end|>
<|im_start|>user

You are a SQL query writing expert. Your task is to write the SQL query for the user query to retrieve data from a database.
Database Schema:
{database_schema}

External Knowledge: {knowledge}
Note: Using valid SQLite and understanding External Knowledge, answer the following questions for the tables provided above.

Show your work in <think> </think> tags. Your final response must be in JSON format within <answer> </answer>. For example,
<think>
[thinking process]
</think>
<answer>
{
    "sql": "SELECT ... (in one line)"
} 
</answer>. 

Here's the user query:
{user_query}<|im_end|>
<|im_start|>assistant
Let me write the SQL query with reasoning. 
<think>
```

# DeepRetrieval
## Overview

DeepRetrieval is a novel approach that uses reinforcement learning (RL) to train Large Language Models (LLMs) for query generation without requiring supervised data. Instead of relying on expensive human-annotated or distilled reference queries, DeepRetrieval enables LLMs to learn through direct trial and error, using retrieval metrics as rewards.
## Key Features

- **No Supervision Required**: Eliminates the need for expensive human-annotated or distilled reference queries
- **RL-Based Framework**: Uses reinforcement learning to optimize query generation directly for retrieval performance
- **State-of-the-Art Performance**: Achieves remarkable results across diverse retrieval tasks

Please view our [GitHub page](https://github.com/pat-jj/DeepRetrieval) for instructions.

[DeepRetrieval Paper](arxiv.org/abs/2503.00223)
```
@article{jiang2025deepretrievalhackingrealsearch,
      title={DeepRetrieval: Hacking Real Search Engines and Retrievers with Large Language Models via Reinforcement Learning}, 
      author={Pengcheng Jiang and Jiacheng Lin and Lang Cao and Runchu Tian and SeongKu Kang and Zifeng Wang and Jimeng Sun and Jiawei Han},
      year={2025},
      journal = {arXiv preprint arXiv: 2503.00223},
      url={https://arxiv.org/abs/2503.00223}
  }
```