Text Generation
Safetensors
English
lwl-uestc commited on
Commit
34e6544
·
verified ·
1 Parent(s): dbaf663

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +30 -3
README.md CHANGED
@@ -12,7 +12,7 @@ pipeline_tag: text-generation
12
  ---
13
  ## ⚡ Introduction
14
 
15
- [RAG-Instruct](https://arxiv.org/abs/2501.00353) is a method for generating diverse and high-quality RAG instruction data. It synthesizes instruction datasets based on any source corpus, leveraging the following approaches:
16
 
17
  - **Five RAG paradigms**, which represent diverse query-document relationships to enhance model generalization across tasks.
18
  - **Instruction simulation**, which enriches instruction diversity and quality by utilizing the strengths of existing instruction datasets.
@@ -22,12 +22,39 @@ Our RAG-Instruct significantly enhances the RAG ability of LLMs, demonstrating r
22
 
23
  | Model | WQA (acc) | PQA (acc) | TQA (acc) | OBQA (EM) | Pub (EM) | ARC (EM) | 2WIKI (acc) | HotP (acc) | MSQ (acc) | CFQA (EM) | PubMed (EM) |
24
  |--------------------------------|-----------|-----------|-----------|-----------|----------|----------|-------------|------------|-----------|-----------|-------------|
25
- | Llama3.2-3B | 58.7 | 61.8 | 69.7 | 77.0 | 55.0 | 66.8 | 55.6 | 40.2 | 13.2 | 46.8 | 70.3 |
26
  | Llama3.1-8B | 59.5 | 60.8 | 73.4 | 82.0 | 56.7 | 77.1 | 65.6 | 45.6 | 18.7 | 56.5 | 73.9 |
27
- | Llama3.2-3B + **RAG-Instruct** | 65.3 | 64.0 | 77.0 | 81.2 | 66.4 | 73.0 | 72.9 | 52.7 | 25.0 | 50.3 | 72.6 |
28
  | Llama3.1-8B + **RAG-Instruct** | 69.7 | 68.4 | 79.3 | 84.8 | 77.2 | 79.9 | 79.3 | 56.4 | 30.3 | 57.8 | 77.0 |
29
 
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  ## 📖 Citation
32
  ```
33
  @misc{liu2024raginstructboostingllmsdiverse,
 
12
  ---
13
  ## ⚡ Introduction
14
 
15
+ RAG-Instruct is a method for generating diverse and high-quality RAG instruction data. It synthesizes instruction datasets based on any source corpus, leveraging the following approaches:
16
 
17
  - **Five RAG paradigms**, which represent diverse query-document relationships to enhance model generalization across tasks.
18
  - **Instruction simulation**, which enriches instruction diversity and quality by utilizing the strengths of existing instruction datasets.
 
22
 
23
  | Model | WQA (acc) | PQA (acc) | TQA (acc) | OBQA (EM) | Pub (EM) | ARC (EM) | 2WIKI (acc) | HotP (acc) | MSQ (acc) | CFQA (EM) | PubMed (EM) |
24
  |--------------------------------|-----------|-----------|-----------|-----------|----------|----------|-------------|------------|-----------|-----------|-------------|
 
25
  | Llama3.1-8B | 59.5 | 60.8 | 73.4 | 82.0 | 56.7 | 77.1 | 65.6 | 45.6 | 18.7 | 56.5 | 73.9 |
 
26
  | Llama3.1-8B + **RAG-Instruct** | 69.7 | 68.4 | 79.3 | 84.8 | 77.2 | 79.9 | 79.3 | 56.4 | 30.3 | 57.8 | 77.0 |
27
 
28
 
29
+ # <span>Usage</span>
30
+ RAG-Instruct models can be used just like `Llama-3.1-8B-Instruct`. You can deploy it with tools like [vllm](https://github.com/vllm-project/vllm) or [Sglang](https://github.com/sgl-project/sglang), or perform direct inference:
31
+ ```python
32
+ from transformers import AutoModelForCausalLM, AutoTokenizer
33
+
34
+ # Load the model and tokenizer
35
+ model = AutoModelForCausalLM.from_pretrained("FreedomIntelligence/RAG-Instruct-Llama3-8B",torch_dtype="auto",device_map="auto")
36
+ tokenizer = AutoTokenizer.from_pretrained("FreedomIntelligence/RAG-Instruct-Llama3-8B")
37
+
38
+ # Example input
39
+ input_text = """### Paragraph:
40
+ [1] structure is at risk from new development...
41
+ [2] as Customs and Excise stores...
42
+ [3] Powis Street is partly underway...
43
+ ...
44
+
45
+ ### Instruction:
46
+ Which organization is currently using a building in Woolwich that holds historical importance?
47
+ """
48
+
49
+ # Tokenize and prepare input
50
+ messages = [{"role": "user", "content": input_text}]
51
+ inputs = tokenizer(tokenizer.apply_chat_template(messages, tokenize=False,add_generation_prompt=True), return_tensors="pt").to(model.device)
52
+
53
+ # Generate output
54
+ outputs = model.generate(**inputs, max_new_tokens=2048)
55
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
56
+ ```
57
+
58
  ## 📖 Citation
59
  ```
60
  @misc{liu2024raginstructboostingllmsdiverse,