cguna yannisk2 commited on
Commit
f2e3c77
·
verified ·
1 Parent(s): b0f2359

Upload README.md for citations (#27)

Browse files

- Upload README.md for citations (2c0ff0068ca30464bcaf0ae7e088c58de24b6311)
- Update README.md for citations (55473a2fd912d8d60e18babcfc2cd4768110652a)


Co-authored-by: Yannis Katsis <[email protected]>

Files changed (1) hide show
  1. citations/README.md +369 -0
citations/README.md ADDED
@@ -0,0 +1,369 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ pipeline_tag: text-generation
6
+ library_name: peft
7
+ library_name: transformers
8
+ ---
9
+
10
+ # Intrinsics for Citation Generation
11
+
12
+ ## Model Summary
13
+
14
+ This is a RAG-specific family of intrinsics fine-tuned for the citation generation task. Given a multi-turn conversation between a user and an AI assistant ending with an assistant response and a set of documents/passages on which the last assistant response is supposed to be based, each intrinsic in the family generates citations for the last assistant response from the provided documents/passages. The intrinsic has the following features:
15
+ 1. **Fine-grained citations:** The intrinsic generates citations for each sentence in the assistant response (when available). Moreover, each citation consists of a set of sentences from the documents/passages that support the corresponding sentence in the assistant response.
16
+ 2. **Post-hoc citation generation:** Since the intrinsic takes the assistant response as input, it can generate citations for responses generated by any LLM. Pick your favorite LLM and use the intrinsic to generate post-hoc citations!
17
+
18
+ We provide two intrinsics implemented as LoRA adapters trained over Granite-3.3-2b-instruct and Granite-3.3-8b-instruct, respectively.
19
+
20
+ </br>
21
+
22
+ - **Developer:** IBM Research
23
+ - **Model type:** LoRA adapter for [ibm-granite/granite-3.3-2b-instruct](https://huggingface.co/ibm-granite/granite-3.3-2b-instruct) and [ibm-granite/granite-3.3-8b-instruct](https://huggingface.co/ibm-granite/granite-3.3-8b-instruct)
24
+ - **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
25
+
26
+ ## Intended use
27
+ This is a family of citation generation intrinsics that give the ability to generate citations for the last assistant response in a multi-turn RAG conversation based on a set of provided documents/passages. They can be used to generate post-hoc citations for assistant responses generated by any LLM in a RAG setting.
28
+
29
+ > [!TIP]
30
+ > Note: While you can invoke a citation generation intrinsic directly, it is strongly recommended to call it through [granite-common](https://github.com/ibm-granite/granite-common), which wraps the model with a tailored I/O processor, enabling a friendlier development interface. The I/O processor takes care of several data transformation/validation tasks that would be otherwise required (incl. splitting the input documents and assistant response into sentences before calling the intrinsic as well as validating the intrinsic's output and transforming the returned sentence IDs into spans over the documents and the response). We next describe the input/output of the citation generation intrinsics when invoked through granite-common.
31
+
32
+ **Intrinsic input**: The input to the citation generation intrinsic is an OpenAI-compatible chat completion request, containing a list of conversation turns ending with the assistant response for which the citations should be generated as well as the list of documents from which the citations should be drawn. Please see the code snippets in the Quickstart Example section below for examples on how to specify the chat completion request as a JSON object.
33
+
34
+ **Intrinsic output**: The output of the citation generation intrinsic is formatted as the result of the original chat completion request containing the citations for the last assistant response. The citations are provided in the form of a JSON array, whose items include the text and begin/end of a response span together with the text, document id and begin/end of a document span that serves as a citation for the response span. When there are more than one document spans that serve as citations for a single response span, they are represented as separate objects in the JSON array.
35
+
36
+ **Going from input to output**: When calling the intrinsic through granite-common one should follow the steps below to transform the intrinsic input to the corresponding output. These steps are also exemplified in the code snippets included in the Quickstart Example section below. Given an input chat completion request, the request should be passed to the corresponding input processor (also referred to as IntrinsicsRewriter) provided by granite-common. The input processor converts the request to the appropriate format expected by the underlying citation generation model. This includes, among others, splitting the last assistant response and the documents into sentences and prepending them with sentence IDs as well as introducing an appropriate task-specific instruction. The input processor's result should then be passed to the underlying citation generation model for inference. The model generates citations using a compact representation consisting of sentence IDs in the last assistant response and documents. This output should finally be passed to the appropriate output processor (also referred to as IntrinsicsResultProcessor) provided by granite-common. The output processor converts the low-level raw model output to the final output by, among others, mapping the sentence IDs back to response and document spans. The result is an application-friendly format ready for consumption by downstream applications.
37
+
38
+ ## Quickstart Example
39
+
40
+ To run the citation generation intrinsics through granite-common, you can either (a) use an OpenAI-compatible inference backend, such as vLLM or (b) use the Hugging Face Transformers library. We provide below instructions for each of the two approaches. Note that running inference using vLLM or another scalable OpenAI-compatible inference backend should be significantly faster than using the Hugging Face Transformers library directly.
41
+
42
+ ### Using an OpenAI-Compatible Inference Backend
43
+
44
+ To run the intrinsic using an OpenAI-compatible inference backend, such as vLLM, follow the steps below. We recommend using Python 3.11 or higher.
45
+
46
+ 1. Install the granite-common library:
47
+ ```
48
+ pip install granite-common[nltk]
49
+ ```
50
+
51
+ 2. Install the Hugging Face CLI:
52
+ ```
53
+ pip install -U "huggingface_hub[cli]"
54
+ ```
55
+
56
+ 3. Install vLLM:
57
+ ```
58
+ pip install vllm
59
+ ```
60
+
61
+ 4. Download the intrinsics library:
62
+ ```
63
+ hf download ibm-granite/rag-intrinsics-lib --local-dir ./rag-intrinsics-lib
64
+ ```
65
+
66
+ 5. Edit the vLLM startup script found in `./rag-intrisics-lib/run_vllm.sh` using your favorite editor:
67
+
68
+ Edit the constants `BASE_MODEL_NAME` and `BASE_MODEL_ORG` depending on the base model on which the desired LoRA adapter has been trained. Optionally, edit the constant `PORT` to change the port on which vLLM will run. Save the modified file and exit the editor.
69
+
70
+ 6. Start vLLM through the startup script. The first time you run the script, you may have to change the permissions to allow execution:
71
+ ```
72
+ cd rag-intrinsics-lib
73
+ chmod u+x ./run_vllm.sh
74
+ ./run_vllm.sh &
75
+ ```
76
+
77
+ 7. Run the following code snippet:
78
+
79
+ ```
80
+ import json
81
+ import openai
82
+ import granite_common
83
+
84
+ intrinsic_name = "citations"
85
+
86
+ # Change the following constant to select a different base model
87
+ base_model_name = "granite-3.3-8b-instruct"
88
+
89
+ # Change the following constants as needed to reflect the location of the vLLM server
90
+ # The selected port should be identical to the one you specified in the vLLM startup script
91
+ openai_base_url = "http://localhost:55555/v1"
92
+ openai_api_key = "rag_intrinsics_1234"
93
+
94
+ # Fetch IO configuration file from Hugging Face Hub
95
+ io_yaml_file = granite_common.intrinsics.util.obtain_io_yaml(
96
+ intrinsic_name, base_model_name
97
+ )
98
+
99
+ # Instantiate input/output processors
100
+ rewriter = granite_common.IntrinsicsRewriter(config_file=io_yaml_file)
101
+ result_processor = granite_common.IntrinsicsResultProcessor(config_file=io_yaml_file)
102
+
103
+ # Sample request
104
+ request_json = {
105
+ "messages": [
106
+ {
107
+ "role": "user",
108
+ "content": "What is the visibility level of Git Repos and Issue Tracking projects?"
109
+ },
110
+ {
111
+ "role": "assistant",
112
+ "content": "Git Repos and Issue Tracking projects can have one of the following visibility levels: private, internal, or public. Private projects are visible only to project members, internal projects are visible to all users that are logged in to IBM Cloud, and public projects are visible to anyone. By default, new projects are set to private visibility level, which is the most secure for your data."
113
+ }
114
+ ],
115
+ "extra_body": {
116
+ "documents": [
117
+ {
118
+ "doc_id": "0",
119
+ "text": "Git Repos and Issue Tracking is an IBM-hosted component of the Continuous Delivery service. All of the data that you provide to Git Repos and Issue Tracking, including but not limited to source files, issues, pull requests, and project configuration properties, is managed securely within Continuous Delivery. However, Git Repos and Issue Tracking supports various mechanisms for exporting, sending, or otherwise sharing data to users and third parties. The ability of Git Repos and Issue Tracking to share information is typical of many social coding platforms. However, such sharing might conflict with regulatory controls that apply to your business. After you create a project in Git Repos and Issue Tracking, but before you entrust any files, issues, records, or other data with the project, review the project settings and change any settings that you deem necessary to protect your data. Settings to review include visibility levels, email notifications, integrations, web hooks, access tokens, deploy tokens, and deploy keys. Project visibility levels \n\nGit Repos and Issue Tracking projects can have one of the following visibility levels: private, internal, or public. * Private projects are visible only to project members. This setting is the default visibility level for new projects, and is the most secure visibility level for your data. * Internal projects are visible to all users that are logged in to IBM Cloud. * Public projects are visible to anyone. To limit project access to only project members, complete the following steps:\n\n\n\n1. From the project sidebar, click Settings > General. 2. On the General Settings page, click Visibility > project features > permissions. 3. Locate the Project visibility setting. 4. Select Private, if it is not already selected. 5. Click Save changes. Project membership \n\nGit Repos and Issue Tracking is a cloud hosted social coding environment that is available to all Continuous Delivery users. If you are a Git Repos and Issue Tracking project Maintainer or Owner, you can invite any user and group members to the project. IBM Cloud places no restrictions on who you can invite to a project."
120
+ },
121
+ {
122
+ "doc_id": "1",
123
+ "text": "After you create a project in Git Repos and Issue Tracking, but before you entrust any files, issues, records, or other data with the project, review the project settings and change any settings that are necessary to protect your data. Settings to review include visibility levels, email notifications, integrations, web hooks, access tokens, deploy tokens, and deploy keys. Project visibility levels \n\nGit Repos and Issue Tracking projects can have one of the following visibility levels: private, internal, or public. * Private projects are visible only to project members. This setting is the default visibility level for new projects, and is the most secure visibility level for your data. * Internal projects are visible to all users that are logged in to IBM Cloud. * Public projects are visible to anyone. To limit project access to only project members, complete the following steps:\n\n\n\n1. From the project sidebar, click Settings > General. 2. On the General Settings page, click Visibility > project features > permissions. 3. Locate the Project visibility setting. 4. Select Private, if it is not already selected. 5. Click Save changes. Project email settings \n\nBy default, Git Repos and Issue Tracking notifies project members by way of email about project activities. These emails typically include customer-owned data that was provided to Git Repos and Issue Tracking by users. For example, if a user posts a comment to an issue, Git Repos and Issue Tracking sends an email to all subscribers. The email includes information such as a copy of the comment, the user who posted it, and when the comment was posted. To turn off all email notifications for your project, complete the following steps:\n\n\n\n1. From the project sidebar, click Settings > General. 2. On the **General Settings **page, click Visibility > project features > permissions. 3. Select the Disable email notifications checkbox. 4. Click Save changes. Project integrations and webhooks"
124
+ }
125
+ ]
126
+ }
127
+ }
128
+
129
+ # Add other parameters
130
+ request_json["model"] = intrinsic_name
131
+ request_json["temperature"] = 0.0
132
+
133
+ # Apply input processor
134
+ rewritten_request = rewriter.transform(request_json)
135
+
136
+ # Run inference
137
+ client = openai.OpenAI(base_url=openai_base_url, api_key=openai_api_key)
138
+ chat_completion = client.chat.completions.create(**rewritten_request.model_dump())
139
+
140
+ # Apply output processor
141
+ processed_chat_completion = result_processor.transform(
142
+ chat_completion, rewritten_request
143
+ )
144
+
145
+ # Verify that the contents of the completion is valid JSON and pretty-print the JSON.
146
+ parsed_contents = json.loads(processed_chat_completion.choices[0].message.content)
147
+ print("JSON output:")
148
+ print(json.dumps(parsed_contents, indent=2))
149
+ ```
150
+
151
+ ### Using the Hugging Face Transformers Library
152
+
153
+ To run the intrinsic using the Hugging Face Transformers library directly, follow the steps below. We recommend using Python 3.11 or higher.
154
+
155
+ 1. Install the granite-common library:
156
+ ```
157
+ pip install granite-common[nltk]
158
+ ```
159
+
160
+ 2. Install the Hugging Face CLI:
161
+ ```
162
+ pip install -U "huggingface_hub[cli]"
163
+ ```
164
+
165
+ 3. Install PEFT:
166
+ ```
167
+ pip install peft
168
+ ```
169
+
170
+ 4. Install xgrammar:
171
+ ```
172
+ pip install xgrammar
173
+ ```
174
+
175
+ 5. Run the following code snippet:
176
+
177
+ ```
178
+ import json
179
+ import granite_common.util
180
+ import peft
181
+
182
+ intrinsic_name = "citations"
183
+
184
+ # Change the following constant to select a different base model
185
+ base_model_name = "granite-3.3-8b-instruct"
186
+
187
+ use_cuda = True # Set to False to use default PyTorch device for this machine + model
188
+
189
+ # Fetch IO configuration file from Hugging Face Hub
190
+ io_yaml_file = granite_common.intrinsics.util.obtain_io_yaml(
191
+ intrinsic_name, base_model_name
192
+ )
193
+
194
+ # Fetch LoRA directory from Hugging Face Hub
195
+ lora_dir = granite_common.intrinsics.util.obtain_lora(
196
+ intrinsic_name, base_model_name
197
+ )
198
+
199
+ # Instantiate input/output processors
200
+ rewriter = granite_common.IntrinsicsRewriter(config_file=io_yaml_file)
201
+ result_processor = granite_common.IntrinsicsResultProcessor(config_file=io_yaml_file)
202
+
203
+ # Sample request
204
+ request_json = {
205
+ "messages": [
206
+ {
207
+ "role": "user",
208
+ "content": "What is the visibility level of Git Repos and Issue Tracking projects?"
209
+ },
210
+ {
211
+ "role": "assistant",
212
+ "content": "Git Repos and Issue Tracking projects can have one of the following visibility levels: private, internal, or public. Private projects are visible only to project members, internal projects are visible to all users that are logged in to IBM Cloud, and public projects are visible to anyone. By default, new projects are set to private visibility level, which is the most secure for your data."
213
+ }
214
+ ],
215
+ "extra_body": {
216
+ "documents": [
217
+ {
218
+ "doc_id": "0",
219
+ "text": "Git Repos and Issue Tracking is an IBM-hosted component of the Continuous Delivery service. All of the data that you provide to Git Repos and Issue Tracking, including but not limited to source files, issues, pull requests, and project configuration properties, is managed securely within Continuous Delivery. However, Git Repos and Issue Tracking supports various mechanisms for exporting, sending, or otherwise sharing data to users and third parties. The ability of Git Repos and Issue Tracking to share information is typical of many social coding platforms. However, such sharing might conflict with regulatory controls that apply to your business. After you create a project in Git Repos and Issue Tracking, but before you entrust any files, issues, records, or other data with the project, review the project settings and change any settings that you deem necessary to protect your data. Settings to review include visibility levels, email notifications, integrations, web hooks, access tokens, deploy tokens, and deploy keys. Project visibility levels \n\nGit Repos and Issue Tracking projects can have one of the following visibility levels: private, internal, or public. * Private projects are visible only to project members. This setting is the default visibility level for new projects, and is the most secure visibility level for your data. * Internal projects are visible to all users that are logged in to IBM Cloud. * Public projects are visible to anyone. To limit project access to only project members, complete the following steps:\n\n\n\n1. From the project sidebar, click Settings > General. 2. On the General Settings page, click Visibility > project features > permissions. 3. Locate the Project visibility setting. 4. Select Private, if it is not already selected. 5. Click Save changes. Project membership \n\nGit Repos and Issue Tracking is a cloud hosted social coding environment that is available to all Continuous Delivery users. If you are a Git Repos and Issue Tracking project Maintainer or Owner, you can invite any user and group members to the project. IBM Cloud places no restrictions on who you can invite to a project."
220
+ },
221
+ {
222
+ "doc_id": "1",
223
+ "text": "After you create a project in Git Repos and Issue Tracking, but before you entrust any files, issues, records, or other data with the project, review the project settings and change any settings that are necessary to protect your data. Settings to review include visibility levels, email notifications, integrations, web hooks, access tokens, deploy tokens, and deploy keys. Project visibility levels \n\nGit Repos and Issue Tracking projects can have one of the following visibility levels: private, internal, or public. * Private projects are visible only to project members. This setting is the default visibility level for new projects, and is the most secure visibility level for your data. * Internal projects are visible to all users that are logged in to IBM Cloud. * Public projects are visible to anyone. To limit project access to only project members, complete the following steps:\n\n\n\n1. From the project sidebar, click Settings > General. 2. On the General Settings page, click Visibility > project features > permissions. 3. Locate the Project visibility setting. 4. Select Private, if it is not already selected. 5. Click Save changes. Project email settings \n\nBy default, Git Repos and Issue Tracking notifies project members by way of email about project activities. These emails typically include customer-owned data that was provided to Git Repos and Issue Tracking by users. For example, if a user posts a comment to an issue, Git Repos and Issue Tracking sends an email to all subscribers. The email includes information such as a copy of the comment, the user who posted it, and when the comment was posted. To turn off all email notifications for your project, complete the following steps:\n\n\n\n1. From the project sidebar, click Settings > General. 2. On the **General Settings **page, click Visibility > project features > permissions. 3. Select the Disable email notifications checkbox. 4. Click Save changes. Project integrations and webhooks"
224
+ }
225
+ ]
226
+ }
227
+ }
228
+
229
+ # Add additional parameters
230
+ request_json["model"] = intrinsic_name
231
+ request_json["temperature"] = 0.0
232
+
233
+ # Apply input processor
234
+ rewritten_request = rewriter.transform(request_json)
235
+
236
+ # Load the base model and merge LoRA weights
237
+ model, tokenizer = granite_common.util.load_transformers_lora(lora_dir)
238
+ if use_cuda:
239
+ model = model.cuda()
240
+
241
+ # Convert the chat completion request into a the Transformers library's proprietary
242
+ # format.
243
+ generate_input, other_input = (
244
+ granite_common.util.chat_completion_request_to_transformers_inputs(
245
+ rewritten_request,
246
+ tokenizer,
247
+ model,
248
+ )
249
+ )
250
+
251
+ # Use the Transformers library's APIs to generate one or more completions,
252
+ # then convert those completions into OpenAI-compatible chat completion
253
+ responses = granite_common.util.generate_with_transformers(
254
+ tokenizer, model, generate_input, other_input
255
+ )
256
+
257
+ # Apply output processor
258
+ transformed_responses = result_processor.transform(responses, rewritten_request)
259
+
260
+ # Verify that the contents of the completion is valid JSON and pretty-print the JSON.
261
+ parsed_contents = json.loads(transformed_responses.choices[0].message.content)
262
+ print("JSON output:")
263
+ print(json.dumps(parsed_contents, indent=2))
264
+ ```
265
+
266
+ ## Training Details
267
+
268
+ The citation generation intrinsics were trained on synthetically-generated citation datasets. The process of generating the training data consisted of two main steps:
269
+ - **Multi-turn RAG conversation generation:** Starting from publicly available document corpora, we generated a set of multi-turn RAG data, consisting of multi-turn conversations grounded on passages retrieved from the corpora. For details on the RAG conversation generation process please refer to the [Granite Technical Report](https://github.com/ibm-granite/granite-3.0-language-models/blob/main/paper.pdf) and [Lee, Young-Suk, et al.](https://arxiv.org/pdf/2409.11500).
270
+ - **Citation generation:** For each turn of the multi-turn RAG conversations from the previous step, we used a multi-step synthetic citation generation pipeline to generate citations for the assistant response.
271
+
272
+ The resulting data instances were used to train the citation generation intrinsics.
273
+
274
+ ### Training Data
275
+
276
+ The following public datasets were used as seed datasets for the multi-turn RAG conversation generation process:
277
+ - [CoQA](https://stanfordnlp.github.io/coqa/) - Wikipedia passages
278
+ - [MultiDoc2Dial](https://huggingface.co/datasets/IBM/multidoc2dial)
279
+ - [QuAC](https://huggingface.co/datasets/allenai/quac)
280
+
281
+
282
+ ## Evaluation
283
+
284
+ We evaluate the citation generation intrinsics on two citation benchmarks:
285
+ - [ALCE](https://aclanthology.org/2023.emnlp-main.398/): Evaluates the ability of models to produce document/passage-level citations (i.e., identify the documents/passages that support a statement in the response).
286
+ - [LongBench-Cite](https://arxiv.org/abs/2409.02897): Evaluates the ability of models to produce fine-grained span-level citations (i.e., identify the spans within the input documents/passages that support a statement in the response) with a focus on long contexts.
287
+
288
+ Since the intrinsics correspond to a post-hoc citation generation approach, their performance on the two benchmarks depends on the assistant responses for which they are asked to generate citations. To facilitate an apples-to-apples comparison, for each experiment, we keep the assistant responses the same and change the model that is used to generate the citations. In particular, we prompt an LLM to create an assistant response together with citations and evaluate the generated citations on the corresponding benchmark. Then, we compute and evaluate the citations generated for the same LLM response by each of the citation generation intrinsics. We provide results for the two intrinsics, implemented as LoRA adapters over Granite-3.3-2b-instruct and Granite-3.3-8b-instruct, respectively.
289
+
290
+ ### Evaluation on ALCE
291
+
292
+ For the ALCE evaluation, we prompt Llama-3.1-70B-Instruct and Mixtral-8x22B-Instruct to generate both the assistant response and corresponding passage-level citations. We first calculate the performance of the citations generated by these models on ALCE. Subsequently, we feed the responses of these models (leaving out the citations) to the citation generation intrinsics and evaluate their generated citations. The results are shown in the table below:
293
+
294
+ Model used to generate response | Model used to generate citations | Recall | Precision | F1 |
295
+ |--------------| ----------------------------- | --------------- | ----------------- | --------- |
296
+ | Llama-3.1-70B-Instruct | Llama-3.1-70B-Instruct | 61.4 | 58.1 | 59.7 |
297
+ | Llama-3.1-70B-Instruct | Granite-3.3-2B LoRA citations | 51.5 | 64.2 | 57.2 |
298
+ | Llama-3.1-70B-Instruct | Granite-3.3-8B LoRA citations | 55.4 | 64.2 | 59.5 |
299
+ | Mixtral-8x22B-Instruct | Mixtral-8x22B-Instruct | 62.2 | 62.5 | 62.3 |
300
+ | Mixtral-8x22B-Instruct | Granite-3.3-2B LoRA citations | 51.4 | 67.3 | 58.3 |
301
+ | Mixtral-8x22B-Instruct | Granite-3.3-8B LoRA citations | 55.8 | 68.5 | 61.5 |
302
+
303
+ We observe that the LoRA adapter over Granite-3.3-8b-instruct performs on par with much bigger models when those are prompted to create passage-level citations (with the LoRA adapter over over Granite-3.3-2b-instruct being slightly worse). It is interesting to note that while the adapter's F1 performance is similar to the baselines, it exhibits a different precision-recall trade-off, trading lower recall for higher precision.
304
+
305
+ Notes:
306
+ - All results are reported on the ELI5 dataset using the ORACLE (5-psg) setting.
307
+ - To prompt Llama and Mixtral, we employ a setting similar to the one proposed in the ALCE paper; in particular we use a two-shot prompt comprised of two of the ICL examples from ALCE as well as a slightly modified version of the instruction from the paper.
308
+ - Sentence splitting of context/response is performed using NLTK.
309
+ - Finally, since ALCE expects passage-level citations, we elevate the finer-grained citations produced by the LoRA adapter to the passage level before running the ALCE evaluation.
310
+
311
+
312
+ ### Evaluation on LongBench-Cite
313
+
314
+ For the LonBench-Cite evaluation, we prompt Llama-3.1-70B-Instruct to generate both the assistant response and corresponding citations. Then we evaluate the citations generated by Llama as well as the post-hoc citations generated by the citation generation intrinsics when invoked on the Llama responses. The results are shown in the table below:
315
+
316
+ <table>
317
+ <tr>
318
+ <th>Model used to generate response</th>
319
+ <th>Model used to generate citations</th>
320
+ <th colspan="3">Longbench-Chat (en)</th>
321
+ <th colspan="3">MultifieldQA (en)</th>
322
+ <th colspan="3">HotpotQA</th>
323
+ <th colspan="3">GovReport</th>
324
+ </tr>
325
+ <tr>
326
+ <th></th>
327
+ <th></th>
328
+ <th>R</th><th>P</th><th>F1</th>
329
+ <th>R</th><th>P</th><th>F1</th>
330
+ <th>R</th><th>P</th><th>F1</th>
331
+ <th>R</th><th>P</th><th>F1</th>
332
+ </tr>
333
+ <tr>
334
+ <td>Llama-3.1-70B-Instruct</td>
335
+ <td>Llama-3.1-70B-Instruct</td>
336
+ <td>27.0</td><td>34.4</td><td>26.1</td>
337
+ <td>46.1</td><td>63.3</td><td>49.7</td>
338
+ <td>34.0</td><td>39.4</td><td>30.2</td>
339
+ <td>55.0</td><td>77.5</td><td>62.0</td>
340
+ </tr>
341
+ <tr>
342
+ <td>Llama-3.1-70B-Instruct</td>
343
+ <td>Granite-3.3-2B LoRA citations</td>
344
+ <td>38.7</td><td>47.4</td><td>39.3</td>
345
+ <td>66.4</td><td>81.8</td><td>70.4</td>
346
+ <td>60.7</td><td>68.5</td><td>59.7</td>
347
+ <td>60.1</td><td>72.4</td><td>64.7</td>
348
+ </tr>
349
+ <tr>
350
+ <td>Llama-3.1-70B-Instruct</td>
351
+ <td>Granite-3.3-8B LoRA citations</td>
352
+ <td>54.5</td><td>59.9</td><td>55.6</td>
353
+ <td>73.0</td><td>82.9</td><td>75.7</td>
354
+ <td>68.5</td><td>73.8</td><td>66.4</td>
355
+ <td>73.5</td><td>84.6</td><td>78.2</td>
356
+ </tr>
357
+ </table>
358
+
359
+ We observe that both variants of the LoRA adapter (even the one trained over Granite-3.3-2b-instruct) perform across the board significantly better than Llama-3.1-70B-Instruct when prompted to create span-level citations. This demonstrates the value of the adapter to create post-hoc citations even for assistant responses generated by much bigger LLMs.
360
+
361
+ Notes:
362
+ - The evaluation results are reported on the English subset of LongBench-Cite (i.e., restricted to instances whose `language` field equals to `en`).
363
+ - To prompt Llama to generate a response with citations, we use the one-shot prompt described in the paper.
364
+ - For the LoRA adapter, sentence splitting of the context is performed using NLTK. For the response, we reuse the splitting in Llama's output (since the LongBench-Cite prompt instructs the model to output a response split into sentences/statements).
365
+
366
+ ## Model Card Authors
367
+
368
+ [Yannis Katsis](mailto:[email protected])</br>
369
+ [Chulaka Gunasekara](mailto:[email protected])