Create readme.md
Browse files
readme.md
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Introduction
|
| 2 |
+
Here is the checkpoint used in the paper `AceSearcher: Bootstrapping Reasoning and Search for LLMs via Reinforced Self-Play`. It uses `Qwen-2.5-Instruct-32B` as the backbone.
|
| 3 |
+
|
| 4 |
+
## Model Usage
|
| 5 |
+
For question decomposition on QA tasks:
|
| 6 |
+
```
|
| 7 |
+
prompt_plan_qa = """Please break down the question "{question}" into multiple specific sub-questions that address individual components of the original question.
|
| 8 |
+
Mark each sub-question with ### at the beginning. If you need to refer to answers from earlier sub-questions, use #1, #2, etc., to indicate the corresponding answers.
|
| 9 |
+
Decomposed Question:"""
|
| 10 |
+
|
| 11 |
+
prompt_qa = prompt_plan_qa.replace("{question}", question)
|
| 12 |
+
|
| 13 |
+
prompt = [
|
| 14 |
+
{"role": "user", "content": prompt_qa.strip()}
|
| 15 |
+
]
|
| 16 |
+
|
| 17 |
+
text = tokenizer.apply_chat_template(
|
| 18 |
+
prompt,
|
| 19 |
+
tokenize=False,
|
| 20 |
+
add_generation_prompt=True,
|
| 21 |
+
enable_thinking=False
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
outputs = llm.generate([text], sampling_params)
|
| 25 |
+
generated_text = outputs[0].outputs[0].text
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
For question decomposition on fact verification tasks:
|
| 29 |
+
```
|
| 30 |
+
prompt_plan_claim = """Please break down the claim "{claim}" into multiple smaller sub-claims that each focus on a specific component of the original statement, making it easier for a model to verify.
|
| 31 |
+
Begin each sub-claim with ###. If needed, refer to answers from earlier sub-claims using #1, #2, etc.
|
| 32 |
+
Decomposed claim:"""
|
| 33 |
+
|
| 34 |
+
prompt_plan_claim = prompt_plan_claim.replace("{question}", question)
|
| 35 |
+
|
| 36 |
+
prompt = [
|
| 37 |
+
{"role": "user", "content": prompt_plan_claim.strip()}
|
| 38 |
+
]
|
| 39 |
+
|
| 40 |
+
text = tokenizer.apply_chat_template(
|
| 41 |
+
prompt,
|
| 42 |
+
tokenize=False,
|
| 43 |
+
add_generation_prompt=True,
|
| 44 |
+
enable_thinking=False
|
| 45 |
+
)
|
| 46 |
+
|
| 47 |
+
outputs = llm.generate([text], sampling_params)
|
| 48 |
+
generated_text = outputs[0].outputs[0].text
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
For question answering for subquestions:
|
| 52 |
+
```
|
| 53 |
+
prompt = f"""You have the following context passages:
|
| 54 |
+
{context_text}
|
| 55 |
+
|
| 56 |
+
Please answer the question '{sub_q}' with a short span using the context as reference.
|
| 57 |
+
If no answer is found in the context, use your own knowledge. Your answer needs to be as short as possible."""
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
For fact verification tasks for subquestions:
|
| 61 |
+
```
|
| 62 |
+
prompt = f"""You have the following context passages:
|
| 63 |
+
{context_text}
|
| 64 |
+
|
| 65 |
+
Please verify whether the claim '{sub_q}' is correct using the context as reference.
|
| 66 |
+
If no answer is found in the context, use your own knowledge.
|
| 67 |
+
Please only output Yes or No and do not give any explanation."""
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
For question answering to generate the final answer:
|
| 71 |
+
```
|
| 72 |
+
prompt = f"""You have the following passages:
|
| 73 |
+
{passages}
|
| 74 |
+
|
| 75 |
+
You are also given some subquestions and their answers:
|
| 76 |
+
{sub_answer_text}
|
| 77 |
+
|
| 78 |
+
Please answer the question '{original_question}' with {final_prompt} using the documents and subquestions as reference.
|
| 79 |
+
Make sure your response is grounded in documents and provides clear reasoning followed by a concise conclusion. If no relevant information is found, use your own knowledge.
|
| 80 |
+
Wrap your answer with <answer> and </answer> tags."""
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
For fact verification tasks to generate the final answer:
|
| 84 |
+
```
|
| 85 |
+
prompt = f"""You have the following passages:
|
| 86 |
+
{passages}
|
| 87 |
+
|
| 88 |
+
You are given some subquestions and their answers:
|
| 89 |
+
{sub_answer_text}
|
| 90 |
+
|
| 91 |
+
Please verify the correctness of the claim: '{original_question}' using the subquestions as reference. Please provide a concise and clear reasoning followed by a concise conclusion. Your answer should be Yes or No only.
|
| 92 |
+
Wrap your answer with <answer> and </answer> tags."""
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
For Decomposition for document-level financial reasoning tasks:
|
| 96 |
+
```
|
| 97 |
+
decompose_prompt = """You have the following passages and table:\nPassages:\n{passage}\nPlease break down the question '{question}' into multiple specific sub-questions that address individual components of the original question, with the table and passages as the reference. Use ### to mark the start of each sub-question."""
|
| 98 |
+
|
| 99 |
+
qa_prompt = """You have the following passages and table:\nPassages:\n{passage}\nFor the question '{question}', here is a referenced breakdown:\n{decompose}.\n\nWrite a Python program to solve the question. Store the final result in the variable ans."""
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
question = "What would the change in furniture and fixtures between 2018 and 2019 be if furniture and fixtures were $5,000 thousand in 2018 instead? (in thousand)"
|
| 103 |
+
|
| 104 |
+
context_text = "\n|||December 31,||\n||Useful Life|2019|2018|\n|Computer equipment and software|3 \u2013 5 years|$57,474|$52,055|\n|Furniture and fixtures|7 years|6,096|4,367|\n|Leasehold improvements|2 \u2013 6 years|22,800|9,987|\n|Renovation in progress|n/a|8|1,984|\n|Build-to-suit property|25 years|\u2014|51,058|\n|Total property and equipment, gross||86,378|119,451|\n|Less: accumulated depreciation and amortization||(49,852)|(42,197)|\n|Total property and equipment, net||$36,526|$77,254|\n 7. OTHER BALANCE SHEET AMOUNTS The components of property and equipment, net is as follows (in thousands): Depreciation expense for the years ended December 31, 2019, 2018, and 2017 was $11.8 million, $10.2 million, and $10.3 million, respectively.\n"
|
| 105 |
+
|
| 106 |
+
decompose_prompt = decompose_prompt.replace("{passage}" , context_text)
|
| 107 |
+
decompose_prompt = decompose_prompt.replace("{question}", question)
|
| 108 |
+
message = [{"role": "user", "content": decompose_prompt.strip()}]
|
| 109 |
+
prompt = tokenizer.apply_chat_template(message, tokenize=False, add_generation_prompt=True)
|
| 110 |
+
generated_text = llm.generate(prompt, sampling_params)[0].outputs[0].text
|
| 111 |
+
|
| 112 |
+
qa_prompt = qa_prompt.replace("{passage}", context_text)
|
| 113 |
+
qa_prompt = qa_prompt.replace("{question}", question)
|
| 114 |
+
qa_prompt = qa_prompt.replace("{decompose}", generated_text)
|
| 115 |
+
message = [{"role": "user", "content": qa_prompt.strip()}]
|
| 116 |
+
prompt = tokenizer.apply_chat_template(message, tokenize=False, add_generation_prompt=True)
|
| 117 |
+
output = llm.generate(prompt, sampling_params)[0].outputs[0].text
|
| 118 |
+
```
|
| 119 |
+
|
| 120 |
+
## Citation
|
| 121 |
+
If you find our paper or models helpful, please consider cite as follows. Thank you!
|
| 122 |
+
|
| 123 |
+
```
|
| 124 |
+
@inproceedings{
|
| 125 |
+
xu2025acesearcher,
|
| 126 |
+
title={AceSearcher: Bootstrapping Reasoning and Search for LLMs via Reinforced Self-Play},
|
| 127 |
+
author={Ran Xu and Yuchen Zhuang and Zihan Dong and Ruiyu Wang and Yue Yu and Joyce C. Ho and Linjun Zhang and Haoyu Wang and Wenqi Shi and Carl Yang },
|
| 128 |
+
booktitle={the 39th Annual Conference on Neural Information Processing Systems},
|
| 129 |
+
year={2025},
|
| 130 |
+
url={https://openreview.net/forum?id=jSgCM0uZn3}
|
| 131 |
+
}
|
| 132 |
+
```
|