pybeebee commited on
Commit
6e0d8e2
β€’
1 Parent(s): 7cf6343

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +95 -3
README.md CHANGED
@@ -1,3 +1,95 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ datasets:
4
+ - yale-nlp/MDCure-72k
5
+ language:
6
+ - en
7
+ base_model:
8
+ - Qwen/Qwen2-1.5B-Instruct
9
+ tags:
10
+ - multi-document
11
+ - long-context
12
+ - Long Context
13
+ ---
14
+
15
+ # MDCure-Qwen2-1.5B-Instruct
16
+
17
+
18
+ [πŸ“„ Paper](https://arxiv.org/pdf/2410.23463) | [πŸ€— HF Collection](https://huggingface.co/collections/yale-nlp/mdcure-6724914875e87f41e5445395) | [βš™οΈ GitHub Repo](https://github.com/yale-nlp/MDCure)
19
+
20
+
21
+ ## Introduction
22
+
23
+ **MDCure** is an effective and scalable procedure for generating high-quality multi-document (MD) instruction tuning data to improve MD capabilities of LLMs. Using MDCure, we construct a suite of MD instruction datasets complementary to collections such as [FLAN](https://github.com/google-research/FLAN) and fine-tune a variety of already instruction-tuned LLMs from the FlanT5, Qwen2, and LLAMA3.1 model families, up to 70B parameters in size. We additionally introduce **MDCureRM**, an evaluator model specifically designed for the MD setting to filter and select high-quality MD instruction data in a cost-effective, RM-as-a-judge fashion. Extensive evaluations on a wide range of MD and long-context benchmarks spanning various tasks show MDCure consistently improves performance over pre-trained baselines and over corresponding base models by up to 75.5%.
24
+
25
+ We release MDCure datasets of size 12k, 36k, and 72k. We also release MDCureRM and the best MDCure'd model for each architecture/size combination. To access all our models and datasets, please visit our [HF Collection](https://huggingface.co/collections/yale-nlp/mdcure-6724914875e87f41e5445395). For further details regarding dataset construction, please see our [paper](https://arxiv.org/pdf/2410.23463) and [Github repo](https://github.com/yale-nlp/MDCure). For additional details regarding how to use **yale-nlp/MDCure-Qwen2-1.5B-Instruct**, please see below.
26
+
27
+ <p align="center">
28
+ <img src="fig1.png" width="90%">
29
+ </p>
30
+ <p align="center" style="margin-top: 0; padding-top: 0;">
31
+ <em>The MDCure pipeline generates diverse multi-document instructions, filters them via fine-grained scoring by MDCureRM, and tunes a base LLM to enhance its multi-document capabilities.</em>
32
+ </p>
33
+
34
+ ## Model Details
35
+
36
+ **yale-nlp/MDCure-Qwen2-1.5B-Instruct** is initialized from [Qwen/Qwen2-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2-1.5B-Instruct) and fine-tuned on the [MDCure-72k](https://huggingface.co/datasets/yale-nlp/MDCure-72k) dataset.
37
+
38
+ ## Requirements
39
+
40
+ We recommend using the latest version of HF Transformers, or any `transformers>=4.45.0`, to avoid any potential errors when using this model.
41
+
42
+ ## Quickstart
43
+
44
+ Below we provide a code snippet demonstrating how to load the tokenizer and model and generate content in response to an input context concerning multiple source documents and a related question or instruction. We strongly recommend to separate the texts and/or instruction using `\n\n` or `<doc-sep>` to maintain consistency with the format of the data used during training.
45
+
46
+ ```python
47
+ model = AutoModelForCausalLM.from_pretrained("yale-nlp/MDCure-Qwen2-1.5B-Instruct", device_map='auto',torch_dtype="auto")
48
+ tokenizer = AutoTokenizer.from_pretrained("yale-nlp/MDCure-Qwen2-1.5B-Instruct")
49
+
50
+ source_text_1 = ...
51
+ source_text_2 = ...
52
+ source_text_3 = ...
53
+ prompt = f"{source_text_1}\n\n{source_text_2}\n\n{source_text_3}\n\nWhat happened in CHAMPAIGN regarding Lovie Smith and the 2019 defense improvements? Respond with 1-2 sentences."
54
+
55
+ messages = [
56
+ {"role": "system", "content": "You are an assistant with strong multi-document processing skills."},
57
+ {"role": "user", "content": prompt},
58
+ ]
59
+
60
+ text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
61
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
62
+
63
+ generated_ids = model.generate(**model_inputs, max_new_tokens=512)
64
+ generated_ids = [output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)]
65
+
66
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
67
+ print(response)
68
+ ```
69
+
70
+ ## All MDCure Models
71
+ We open-source our custom multi-document instruction scoring model, MDCureRM, as well as our best MDCure'd models at the following links:
72
+
73
+ | Model | Huggingface Repo | Description |
74
+ |---------------------------|---------------------|------------------------------|
75
+ | **MDCureRM** | [πŸ€— HF Repo](https://huggingface.co/yale-nlp/MDCureRM) | Multi-objective reward model to score and filter MD instruction data more cheaply and effectively than GPT-3.5-Turbo |
76
+ | **MDCure-FlanT5-Base** | [πŸ€— HF Repo](https://huggingface.co/yale-nlp/MDCure-FlanT5-Base) | **FlanT5-Base** fine-tuned with MDCure-72k |
77
+ | **MDCure-FlanT5-Large** | [πŸ€— HF Repo](https://huggingface.co/yale-nlp/MDCure-FlanT5-Large) | **FlanT5-Large** fine-tuned with MDCure-72k |
78
+ | **MDCure-Qwen2-1.5B-Instruct** | [πŸ€— HF Repo](https://huggingface.co/yale-nlp/MDCure-Qwen2-1.5B-Instruct) | **Qwen2-1.5B-Instruct** fine-tuned with MDCure-72k |
79
+ | **MDCure-Qwen2-7B-Instruct** | [πŸ€— HF Repo](https://huggingface.co/yale-nlp/MDCure-Qwen2-7B-Instruct) | **Qwen2-7B-Instruct** fine-tuned with MDCure-72k |
80
+ | **MDCure-LLAMA3.1-8B-Instruct** | [πŸ€— HF Repo](https://huggingface.co/yale-nlp/MDCure-LLAMA3.1-8B-Instruct) | **LLAMA3.1-8B-Instruct** fine-tuned with MDCure-72k |
81
+ | **MDCure-LLAMA3.1-70B-Instruct** | [πŸ€— HF Repo](https://huggingface.co/yale-nlp/MDCure-LLAMA3.1-70B-Instruct) | **LLAMA3.1-70B-Instruct** fine-tuned with MDCure-72 |
82
+
83
+ ## Citation
84
+
85
+ If you find our work useful, please cite our paper as:
86
+
87
+ ```bibtex
88
+ @article{liu2023mdcure,
89
+ title={MDCure: A Scalable Pipeline for Multi-Document Instruction-Following},
90
+ author={Gabrielle Kaili-May Liu and Bowen Shi and Avi Caciularu and Idan Szpektor and Arman Cohan},
91
+ journal={arXiv preprint arXiv:2410.23463},
92
+ year={2024},
93
+ url={https://arxiv.org/abs/2410.23463}
94
+ }
95
+ ```