Web Analytics

s3

⭐ 731 stars Thai by pat-jj

🌐 ภาษา

s3 - การฝึกตัวแทนค้นหาที่มีประสิทธิภาพผ่าน RL

คุณไม่จำเป็นต้องใช้ข้อมูลมากขนาดนั้นเพื่อฝึกตัวแทนค้นหา

arXiv

ภาพรวมประสิทธิภาพ:

performance_overview

s3 คืออะไร?

framework

เฟรมเวิร์ก s3

s3 คือเฟรมเวิร์กที่เรียบง่ายแต่ทรงพลังสำหรับฝึก search agent ใน retrieval-augmented generation (RAG) โดยสอนให้ language model ค้นหาได้อย่างมีประสิทธิภาพมากขึ้น—โดยไม่ต้องเปลี่ยนตัว generator เลย ด้วยการเน้นเฉพาะส่วนของการค้นหา s3 จึงทำผลงานได้ดีในงาน QA ด้วยข้อมูลเพียงเศษเสี้ยวเมื่อเทียบกับวิธีเก่าๆ มีความเป็นโมดูลาร์ มีประสิทธิภาพ และถูกออกแบบให้ทำงานร่วมกับ LLM แบบกล่องดำใดก็ได้อย่างไร้รอยต่อ

สารบัญ

📦 การติดตั้ง

สภาพแวดล้อมของ Searcher & Generator

conda create -n s3 python=3.9

install torch [or you can skip this step and let vllm to install the correct version for you]

pip install torch==2.4.0 --index-url https://download.pytorch.org/whl/cu121

install vllm

pip3 install vllm==0.6.3 # or you can install 0.5.4, 0.4.2 and 0.3.1 pip3 install ray

verl

cd code

pip install -e .

flash attention 2

pip3 install flash-attn --no-build-isolation

we use pyserini for efficient retrieval and evaluation

pip install pyserini # the version we used is 0.22.1

quality of life

pip install wandb IPython matplotlib huggingface_hub
สภาพแวดล้อมของ Retriever

conda create -n ret python=3.10
conda activate ret

conda install pytorch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 pytorch-cuda=12.1 -c pytorch -c nvidia pip install transformers datasets pyserini conda install -c pytorch -c nvidia faiss-gpu=1.8.0 pip install uvicorn fastapi

💡 การเตรียมตัว

ดาวน์โหลดดัชนี & คลังข้อมูล

python scripts/download.py --save_path $save_path
cat $save_path/part_* > $save_path/e5_Flat.index
gzip -d $save_path/wiki-18.jsonl.gz

เตรียมข้อมูลล่วงหน้าสำหรับการเริ่มต้น Naïve RAG (หรือคุณสามารถดาวน์โหลดข้อมูลที่เราประมวลผลแล้วได้ที่นี่: huggingface)

# deploy retriever
bash scripts/deploy_retriever/retrieval_launch.sh # or scripts/deploy_retriever/retrieval_launch_mirage.sh for MedCorp corpus.

deploy generator

bash generator_llms/host.sh # modify tensor-parallel-size to the number of GPUs you use

run precompute

bash scripts/precompute.sh # this step will take a while, as it will precompute the naïve RAG Cache for training

🏋️ เริ่มการฝึกอบรม

ขั้นตอนนี้สำหรับการฝึกอบรม S3

# deploy retriever
bash scripts/deploy_retriever/retrieval_launch.sh 

deploy generator

bash generator_llms/host.sh

run training

bash scripts/train/train_s3.sh

🔍 ดำเนินการค้นหา/ดึงข้อมูล

ขั้นตอนนี้ใช้สำหรับการรวบรวมบริบทของ s3 / baselines

s3

# deploy retriever
bash scripts/deploy_retriever/retrieval_launch.sh 

run s3 inference

bash scripts/s3_inference/evaluate-8-3-3.sh
ค่าพื้นฐาน

RAG

bash scripts/deploy_retriever/retrieval_launch.sh # or retrieval_launch_bm25.sh # deploy retriever
bash scripts/baselines/rag.sh # run RAG 
DeepRetrieval DeepRetrieval
bash retrieval_launch_bm25.sh # deploy BM25 Model
bash generator_llms/deepretrieval.sh # deploy DeepRetrieval Model
bash scripts/baselines/deepretrieval.sh # run DeepRetrieval Query Rewriting + Retrieval
ค้นหา-R1

bash retrieval_launch.sh # deploy e5 retriever
bash scripts/baselines/search_r1.sh # run Search-R1
IRCoT IRCoT
bash retrieval_launch.sh # deploy e5 retriever
python scripts/baselines/ircot.py
ค้นหา-o1

bash retrieval_launch.sh # deploy e5 retriever
bash scripts/baselines/search_o1.sh # run Search-o1

📈 ดำเนินการประเมินผล

ขั้นตอนนี้สำหรับการประเมินผล s3 / baselines

bash scripts/evaluation/run.sh

ถาม-ตอบ

ข้อมูลที่ปรับแต่งเอง?

หากคุณต้องการทดสอบ s3 กับคลังข้อมูล/ชุดข้อมูลของคุณเอง คุณสามารถดูได้จากคอมมิทนี้เพื่อดูว่าต้องทำอะไรบ้างในการสร้าง pipeline ของตัวเอง: commit 8420538

การทำซ้ำผลลัพธ์?

มีนักพัฒนาหลายคนที่สามารถทำซ้ำผลลัพธ์ของเราได้สำเร็จแล้ว หากคุณมีคำถามหรือพบปัญหา สามารถ เปิด issue ได้เลย — เรายินดีให้คำแนะนำแบบลงมือปฏิบัติ (ดู ตัวอย่างนี้).

แม้ว่าการทำซ้ำโมเดลด้วยตัวเองจะง่าย — และเรา แนะนำให้ฝึกจากศูนย์ เพราะการประเมินผลมักใช้เวลามากกว่าการฝึก — เราก็มี checkpoint อ้างอิงให้เช่นกัน: s3-8-3-3-20steps ซึ่งใช้เวลาฝึกประมาณหนึ่งชั่วโมง

ขอขอบคุณ

ขอขอบคุณโปรเจกต์ดังต่อไปนี้: verl, RAGEN, Search-R1, DeepRetrieval, PySerini.

การอ้างอิง

@article{jiang2025s3,
  title={s3: You Don't Need That Much Data to Train a Search Agent via RL},
  author={Jiang, Pengcheng and Xu, Xueqiang and Lin, Jiacheng and Xiao, Jinfeng and Wang, Zifeng and Sun, Jimeng and Han, Jiawei},
  journal={arXiv preprint arXiv:2505.14146},
  year={2025}
}
ขอขอบคุณที่ให้ความสนใจในผลงานของเรา!

--- Tranlated By Open Ai Tx | Last indexed: 2025-10-06 ---