XaiverZ commited on
Commit
0dcfe36
·
1 Parent(s): f1d1db0
Files changed (37) hide show
  1. abs_9K/validation_abstract_short_2404.15845v1.json +16 -0
  2. abs_9K/validation_abstract_short_2404.15846v1.json +16 -0
  3. abs_9K/validation_abstract_short_2404.15848v2.json +17 -0
  4. abs_9K/validation_abstract_short_2404.15899v3.json +19 -0
  5. abs_9K/validation_abstract_short_2404.15923v1.json +17 -0
  6. abs_9K/validation_abstract_short_2404.15949v1.json +18 -0
  7. abs_9K/validation_abstract_short_2404.15974v1.json +16 -0
  8. abs_9K/validation_abstract_short_2404.15993v1.json +18 -0
  9. abs_9K/validation_abstract_short_2404.16019v1.json +0 -0
  10. abs_9K/validation_abstract_short_2404.16022v1.json +16 -0
  11. abs_9K/validation_abstract_short_2404.16030v1.json +19 -0
  12. abs_9K/validation_abstract_short_2404.16032v1.json +16 -0
  13. abs_9K/validation_abstract_short_2404.16069v1.json +17 -0
  14. abs_9K/validation_abstract_short_2404.16076v1.json +19 -0
  15. abs_9K/validation_abstract_short_2404.16113v1.json +17 -0
  16. abs_9K/validation_abstract_short_2404.16115v1.json +18 -0
  17. abs_9K/validation_abstract_short_2404.16118v1.json +16 -0
  18. abs_9K/validation_abstract_short_2404.16123v1.json +19 -0
  19. abs_9K/validation_abstract_short_2404.16130v1.json +19 -0
  20. abs_9K/validation_abstract_short_2404.16131v1.json +18 -0
  21. abs_9K/validation_abstract_short_2404.16160v1.json +17 -0
  22. abs_9K/validation_abstract_short_2404.16164v1.json +18 -0
  23. abs_9K/validation_abstract_short_2404.16189v1.json +17 -0
  24. abs_9K/validation_abstract_short_2404.16248v1.json +17 -0
  25. abs_9K/validation_abstract_short_2404.16251v2.json +18 -0
  26. abs_9K/validation_abstract_short_2404.16891v1.json +19 -0
  27. abs_9K/validation_abstract_short_2404.17584v1.json +17 -0
  28. abs_9K/validation_abstract_short_2404.17590v1.json +17 -0
  29. abs_9K/validation_abstract_short_2404.17591v1.json +18 -0
  30. abs_9K/validation_abstract_short_2404.17593v1.json +17 -0
  31. abs_9K/validation_abstract_short_2404.17605v1.json +17 -0
  32. abs_9K/validation_abstract_short_2405.00705v1.json +17 -0
  33. abs_9K/validation_abstract_short_2405.00709v1.json +18 -0
  34. abs_9K/validation_abstract_short_2405.00710v1.json +17 -0
  35. abs_9K/validation_abstract_short_2405.01573v1.json +17 -0
  36. abs_9K/validation_abstract_short_2405.05141v1.json +17 -0
  37. abs_9K/validation_abstract_short_2405.05145v1.json +17 -0
abs_9K/validation_abstract_short_2404.15845v1.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.15845v1",
3
+ "title": "Exploring LLM Prompting Strategies for Joint Essay Scoring and Feedback Generation",
4
+ "abstract": "Individual feedback can help students improve their essay writing skills.\nHowever, the manual effort required to provide such feedback limits\nindividualization in practice. Automatically-generated essay feedback may serve\nas an alternative to guide students at their own pace, convenience, and desired\nfrequency. Large language models (LLMs) have demonstrated strong performance in\ngenerating coherent and contextually relevant text. Yet, their ability to\nprovide helpful essay feedback is unclear. This work explores several prompting\nstrategies for LLM-based zero-shot and few-shot generation of essay feedback.\nInspired by Chain-of-Thought prompting, we study how and to what extent\nautomated essay scoring (AES) can benefit the quality of generated feedback. We\nevaluate both the AES performance that LLMs can achieve with prompting only and\nthe helpfulness of the generated essay feedback. Our results suggest that\ntackling AES and feedback generation jointly improves AES performance. However,\nwhile our manual evaluation emphasizes the quality of the generated essay\nfeedback, the impact of essay scoring on the generated feedback remains low\nultimately.",
5
+ "authors": "Maja Stahl, Leon Biermann, Andreas Nehring, Henning Wachsmuth",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-04-24",
8
+ "primary_cat": "cs.CL",
9
+ "cats": [
10
+ "cs.CL"
11
+ ],
12
+ "label": "Original Paper",
13
+ "paper_cat": "LLM Fairness",
14
+ "gt": "Individual feedback can help students improve their essay writing skills.\nHowever, the manual effort required to provide such feedback limits\nindividualization in practice. Automatically-generated essay feedback may serve\nas an alternative to guide students at their own pace, convenience, and desired\nfrequency. Large language models (LLMs) have demonstrated strong performance in\ngenerating coherent and contextually relevant text. Yet, their ability to\nprovide helpful essay feedback is unclear. This work explores several prompting\nstrategies for LLM-based zero-shot and few-shot generation of essay feedback.\nInspired by Chain-of-Thought prompting, we study how and to what extent\nautomated essay scoring (AES) can benefit the quality of generated feedback. We\nevaluate both the AES performance that LLMs can achieve with prompting only and\nthe helpfulness of the generated essay feedback. Our results suggest that\ntackling AES and feedback generation jointly improves AES performance. However,\nwhile our manual evaluation emphasizes the quality of the generated essay\nfeedback, the impact of essay scoring on the generated feedback remains low\nultimately.",
15
+ "main_content": "Introduction Essay writing is a valuable skill that empowers students to communicate effectively, to think critically, and to express their opinions clearly (BangertDrowns et al., 2004; Liu et al., 2014; Schendel and Tolmie, 2016). However, learning to write essays of high quality can be challenging (Peloghitis, 2017; Febriani, 2022). Individual feedback to essays is thus critical, so students may recognize and overcome their weaknesses (Riddell, 2015). However, manually writing essay feedback is timeand laborintensive. Given educators\u2019 limited time, this often renders real individual feedback infeasible in practice. As an alternative, automated essay writing support could benefit students by offering guidance at their own pace and convenience. Student Essay Everyone has their favorite book. But if it offended someone, should he be allowed to remove it? Offensive materials should not be removed from shelves. If we removed books that offended even one person, then no books would remain. Essay Feedback Your essay presents a clear and well-articulated opinion on the issue of library censorship. However, there are some areas where your essay could be improved. Essay Prompt As americans, we have the right to freedom of speech. Authors use their freedom in their writing, just like musicians use their freedom to make music. But if we denied them their right to put out their creations, we would be denying them their basic rights as an american citizen. Personally, I hate rap. I don't even consider it to be music, due to the fact that no one actually sings. But I do understand that a large percent of our population does enjoy listening to it. ... First, try to stay focused on the topic of library censorship and avoid bringing in unrelated examples, such as your personal dislike of rap music. While it's important to acknowledge different perspectives, it's crucial to keep the focus on the main topic. Second, provide more specific examples and evidence to support your argument. For instance, you could discuss specific instances of censorship in libraries and the negative ... Write a persuasive essay to a newspaper reflecting your vies on censorship in libraries. Do you believe that certain materials [...] should be removed from the shelves if they are found offensive? 3 Figure 1: Exemplary student essay on library censorship from the ASAP dataset (Hamner et al., 2012) along with feedback and essay score generated by one of the methods evaluated in this paper. Explicit connections of the feedback to essay parts are color-coded. Towards supporting essay writing automatically, much research has focused on quality assessment, mostly in the form of automated essay scoring (AES; Ke and Ng, 2019; Ramesh and Sanampudi, 2022). Most existing AES approaches perform a holistic scoring, summarizing the quality of an essay with a single score (Alikaniotis et al., 2016; Vajjala, 2018; Uto et al., 2020; Wang et al., 2023). Alternatively, specific essay quality aspects may be assessed, such as coherence (Li et al., 2018; Farag et al., 2018), grammar (Ajit Tambe and Kulkarni, 2022), and organization (Persing et al., 2010; arXiv:2404.15845v1 [cs.CL] 24 Apr 2024 \fRahimi et al., 2015). While AES helps assess essay quality and monitor writing skill progress, most approaches cannot explain why a score was predicted, nor guide the student in improving the essay. Another prominent line of research towards writing support focuses on identifying and correcting grammatical errors (Imamura et al., 2012; Bryant et al., 2017; Rozovskaya and Roth, 2019; Grundkiewicz et al., 2019). However, studies in educational research show that computer-based learning systems lead to higher learning outcomes if elaborated feedback is provided that provides explanations instead of only pointing to errors or providing the solution (Van der Kleij et al., 2015). Therefore, Nagata (2019) introduced the task of feedback comment generation in NLP: Given a learner text with a grammatical error, automatically generate a comment with hints and explanations to guide their correction process. Song et al. (2023) extended this task by generating explanations for a broader range of grammatical error types using large language models (LLMs). However, these tasks operate only on the sentence level and are limited to grammatical errors. Generating feedback on the essay level by addressing not only grammatical errors but the essay as a whole remains relatively unexplored. To foster research in this direction, we tackle the task of essay feedback generation: Given a student essay, automatically generate textual feedback that helps students improve their essays. An example is shown in Figure 1. Building on the strong abilities of LLMs in many text-generation tasks, this work examines how well LLMs can generate essay feedback by exploring various prompting strategies in zeroand few-shot settings. Inspired by Chainof-Thought prompting (Wei et al., 2022), we study whether AES can benefit the performance of essay feedback generation and vice versa. Our experiments suggest that generating essay feedback by explaining the predicted essay score improves the scoring performance on the widelyused ASAP dataset (Hamner et al., 2012). For essay feedback generation, we deem helpfulness to be the most important quality criterion. Helpful essay feedback should point out and explain mistakes made in an essay in a precise and easy way for students to understand (Shute, 2008; Hattie and Timperley, 2007). We evaluate the helpfulness automatically and manually. Due to the lack of ground-truth essay feedback, we propose using LLMs to automatically judge the essay feedback\u2019s helpfulness, which turns out to correlate well with human helpfulness judgments. Our manual evaluation also reveals that the generated essay feedback is deemed helpful for students to improve their essay writing skills. However, the impact of scoring the essay remains low ultimately. Altogether, this paper\u2019s main contributions are: \u2022 A comparison of several LLM prompting strategies for automated essay scoring \u2022 An approach and task-specific automatic evaluation strategy for essay feedback generation using LLM prompting \u2022 Empirical insights into the influence of automated essay scoring on generating essay feedback and vice versa1 2 Related Work Essay writing is a central task in education to evaluate various skills of students, including logical thinking, critical reasoning, and creativity (Liu et al., 2014; Schendel and Tolmie, 2016). However, manual essay grading is time-consuming and not always consistent within and across raters (Kassim, 2011; Eckes, 2015). Automated essay scoring (AES) aims to alleviate these issues, reducing the effort of graders and, ideally, making grading more consistent and reliable (Ke and Ng, 2019; Uto, 2021; Ramesh and Sanampudi, 2022). While extensive research exists on AES (Ke and Ng, 2019; Ramesh and Sanampudi, 2022), assessing all important quality aspects (known as traits), including the relevance of an essay\u2019s content to the prompt, the development of ideas, cohesion, coherence, and more remains challenging (Ramesh and Sanampudi, 2022). Only few works focus on scoring multiple traits at once (Mathias and Bhattacharyya, 2020; Hussein et al., 2020). Instead, the majority of AES research targets holistic essay scoring, that is, summarizing the essay quality in a single score (Alikaniotis et al., 2016; Cozma et al., 2018; Vajjala, 2018; Wang et al., 2023). State-of-the-art approaches to AES can be divided by their use of the available data into full-data and fewor zero-shot settings (Tao et al., 2022). In the full-data setting, where all labeled data is used for training, most approaches fine-tune pretrained language models, such as BERT (Devlin et al., 2019). Yang et al. (2020) proposed solving the task 1The code used for our experiments can be found under https://github.com/webis-de/BEA-24. \fby combining essay scoring and essay ranking, finetuning BERT using multiple losses simultaneously. Extending this idea, Xie et al. (2022) combined regression and ranking into a single loss. Rather than fine-tuning a language model, Tao et al. (2022) designed two self-supervised constraints for learning a multi-layer embedding, which prepends the input to a frozen BERT model. They evaluate their approach in the full-data and one-shot setting, outperforming a fine-tuned BERT in the latter. To explore the potential of large language models (LLMs), Mizumoto and Eguchi (2023) prompted GPT-3.5 to score the student essays from the TOEFL11 dataset (Blanchard et al., 2013) in a zero-shot setting, indicating promising scoring performance. The most straightforward way to provide more detailed feedback for an essay than a holistic score is trait scoring (Jong et al., 2023), that is, to evaluate an essay for different quality aspects. However, the reasoning behind an assigned trait score usually remains unknown to the student. Therefore, Kumar and Boulanger (2020) adopted explainability methods to explain how input features to an AES system influence the trait scores for an essay. While this provides more insights, the pedagogical quality and impact on writing performance remain questionable if no feedback is given together with the scores (Kumar and Boulanger, 2020). Specific feedback generation tasks have been addressed in educational NLP. Nagata (2019) introduced feedback comment generation to explain grammatical errors to a learner on the sentence level. This task has been tackled by combining retrieval and text generation (Hanawa et al., 2021; Ihori et al., 2023), by identifying different feedback types (Stahl and Wachsmuth, 2023), by augmenting the dataset (Babakov et al., 2023; Behzad et al., 2023), and by correcting the error (Jimichi et al., 2023; Koyama et al., 2023), all using fine-tuned language models. For a wider range of grammatical error types, Song et al. (2023) used the LLM GPT-4 to first identify the necessary corrective edit before generating a grammar error explanation using one-shot prompting. In the educational domain, Meyer et al. (2024) showed that LLM-based writing feedback, generated using a single handcrafted prompt, positively impacts students\u2019 text revisions, motivation, and positive emotions. So far, however, the generation of textual feedback on complete student essays has, to our knowledge, received very little attention. All generation approaches mentioned above operate on the sentence level and explain grammatical errors only, while our work aims to address all aspects of student essays that may need improvement. The only other work on essay feedback generation tackled the task using Chain-of-Thought prompting using zero-shot learning (Han et al., 2023). The resulting feedback was deemed to be more helpful than the feedback generated using standard prompting, as evaluated by humans. Motivated by these promising results and the positive effects of LLM-based writing feedback on students, we go beyond previous work by comparing the effectiveness of different prompting strategies for essay feedback generation. We also study how and to what extent AES can benefit essay feedback generation (and vice versa) by addressing the tasks jointly. Following the educational literature on feedback, we aim to generate essay feedback that is specific and elaborate (Shute, 2008) while assessing the current state and instructing on how to improve to achieve the goals (Hattie and Timperley, 2007). 3 Approach This section describes our approach to essay feedback generation. We propose to tackle essay scoring and feedback generation jointly in order to study how and to what extent AES can benefit essay feedback generation and vice versa. By comparing different prompting strategies for large language models (LLMs), we explore how well the tasks can be solved using in-context learning. In particular, we test different prompting strategies by systematically varying three main aspects of the prompts, as visualized in Figure 2: (a) the prompt pattern, which defines the context and layout; (b) the task instruction type, which sets the ordering and phrasing of the tasks to be tackled; and (c) the in-context learning approach, which specifies the number of examples provided. 3.1 Prompt Patterns We compare two different kinds of prompt patterns, which define the context and format of the prompt: (i) a base pattern and (ii) different persona patterns. All prompt patterns are displayed in Table 1. Base Pattern The base pattern simply gives the general context and defines the layout and order in which the essay prompt (i.e., the task given to the learner writing the essay), the task instruction, as \fPrompt Task Essay (a) Prompt Pattern (b) Task Instruction Type (c) In-Context Learning Feedback Score Base Persona: Teacher\u2019s assistant Persona: Educational researcher Persona: Creative writing mentor Feedback \u2013> Score Score \u2013> Feedback Score \u2013> Feedback_CoT Zero-shot learning One-shot learning Few-shot learning \u2026 Student Essay Score&Feedback Prompt Task Essay vs vs Score Feedback 4 vs 4 3 + Figure 2: Overview of the main points of variation in our approach to predict a score and to generate feedback for a student essay: (a) Prompt pattern: Use of the base pattern or persona-specific pattern; (b) Task instruction type: Tasks to be tackled and their ordering; (c) In-context learning approach: Number of examples to learn from. Base: You are given an essay written by a student and the corresponding prompt for the 7th to 10th grade student. #### Prompt: \u201c{essay_prompt}\u201d ### Task: {task_instruction} #### Student essay: \u201c{essay}\u201d Teacher\u2019s Assistant: Imagine you are a teacher\u2019s assistant in a middle school tasked with reviewing a 7th to 10th grade student\u2019s essay. You have the essay and the prompt that was given to the student. #### Original Prompt Provided to Student: \u201c{essay_prom.}\u201d ### Review Task: {task_instruction} #### Student\u2019s Essay for Review: \u201c{essay}\u201d Educational Researcher: You are part of an educational research team analyzing the writing skills of students in grades 7 to 10. You have been given a student\u2019s essay and the prompt they responded to. #### Essay Prompt: \u201c{essay_prompt}\u201d ### Analysis Task: {task_instruction} #### Analyzed Student Essay: \u201c{essay}\u201d Creative Writing Mentor: You are a creative writing mentor evaluating a piece written by a student in grades 7 to 10. The student\u2019s work is based on a specific prompt. #### Creative Prompt Given: \u201c{essay_prompt}\u201d ### Critique Instructions: {task_instruction} #### Student\u2019s Creative Piece: \u201c{essay}\u201d Table 1: Prompt patterns: Base pattern and all persona patterns. Brackets indicate placeholders that are filled respectively during the experiments. We removed modelspecific pre-/suffixes and line breaks for illustration. defined by the used task instruction type, and the current learner essay will be presented to the model. All inputs are indicated by markdown headings. Persona Patterns These prompt patterns are inspired by persona prompting (White et al., 2023), giving the LLM a persona or role to play when generating output. This aims to implicitly define the expected type of output. For our task, we compare the three personas, namely, teacher\u2019s assistant, educational researcher, and creative writing mentor, by altering the context given in the prompt pattern. 3.2 Task Instruction Types The task instruction type defines the tasks to be tackled along with their ordering. We differentiate between tackling (i) only essay scoring, (ii) essay scoring and feedback generation, and (iii) only essay feedback generation. This way, we can measure the influence that essay scoring has on feedback generation, and vice versa. We explore the following task instruction types for our tasks: \u2022 Scoring. Instruct to score the student essay on a given score range. This serves as a baseline for assessing the essay scoring performance. \u2022 Feedback. Instruct to generate essay feedback for the student writer. This serves as a baseline for assessing the feedback performance. \u2022 Scoring\u2192Feedback. Instruct to score the essay and then generate feedback for the student writer. This measures the influence of essay scoring on the feedback performance. \u2022 Feedback\u2192Scoring. Instructs to first generate feedback before scoring the essay. This evaluates whether feedback generation helps to predict the correct essay score. \u2022 Scoring\u2192Feedback_CoT. Instruct to score the essay and to then generate feedback using zero-shot Chain-of-Thought (CoT) prompting, that is, to add the phrase \u201cLet\u2019s think step by step.\u201d, which has been shown to increase LLM\u2019s reasoning performance (Kojima et al., 2022). This might benefit the reasoning needed in feedback generation. \u2022 Feedback_dCoT\u2192Scoring. Instruct to first analyze the essay quality using the rubric, to then generate feedback, and to finally score the essay. This is a more detailed variation of CoT that provides task-specific steps to follow before arriving at the final essay score. \fScore Description 3 The response demonstrates an understanding of the complexities of the text. \u2013 Addresses the demands of the question \u2013 Uses expressed and implied information from the text \u2013 Clarifies and extends understanding beyond the literal 2 The response demonstrates a partial or literal understanding of the text. \u2013 Addresses the demands of the question, although may not develop all parts equally \u2013 Uses some expressed or implied information from the text to demonstrate understanding \u2013 May not fully connect the support to a conclusion or assertion made about the text(s) 1 The response shows evidence of a minimal understanding of the text. \u2013 May show evidence that some meaning has been derived from the text \u2013 May indicate a misreading of the text or the question \u2013 May lack information or explanation to support an understanding of the text in relation to the question 0 The response is completely irrelevant or incorrect, or there is no response. Table 2: Exemplary rubric from essay set 3 of the ASAP dataset (Hamner et al., 2012). The rubrics are provided as additional information within the task instructions. \u2022 Scoring\u2192Explanation. Instruct to score the essay and to then generate an explanation for the predicted score. This explores whether score explanations as a form of feedback relate to asking for essay feedback specifically. \u2022 Explanation\u2192Scoring. Instruct to analyze the essay, to then first generate an explanation for an essay score that, in turn, should be generated at the end. This avoids that the LLM predicts an incorrect score and then generates an explanation justifying the incorrect score, as observed by Ye and Durrett (2022). Task instructions for essay scoring provide the scoring range that should be used, while those for feedback generation provide the rubric, that is, guidelines including a short description for essays of each quality level and typical elements of such. An exemplary rubric can be seen in Table 2. Since the performance of LLMs is sensitive to the exact wording of a prompt (Leidinger et al., 2023), we create a total of four task instructions for each task instruction type by instructing ChatGPT (OpenAI, 2023) to generate three paraphrases of each initial, manually written task instruction. Examples of the latter can be seen in Table 3. We provide all task instructions in Appendix A. Scoring: Given this essay that was written for the given prompt, grade the essay using those ranges: {scoring_range}. Feedback: Analyze the given essay using the following rubric: {rubric}. Provide comprehensive feedback for the student that helps them to achieve better grades in the future. Scoring\u2192Feedback: Grade the given essay using the following rubric: {rubric}. Use those score ranges: {scoring_range}. Provide comprehensive feedback for the student that helps them to achieve better grades in the future. Feedback_dCoT\u2192Scoring: Analyze the given essay using the following rubric and give helpful feedback to the student: {rubric}. Use those score ranges: {scoring_range}. Let\u2019s think step by step. First, analyze the quality of the essay in terms of the given rubric. Then, give feedback to the student that explains their mistakes and errors and additionally gives them tips to avoid them in the future. As a final step, output the score at the end. Scoring\u2192Explanation: Grade the given essay using the following rubric: {rubric}. Use those score ranges: {scoring_range}. Provide an explanation for your score as well. Table 3: Task instruction types: Examples of the initial, manually written task instructions for five types. Brackets indicate placeholders that are filled with the respective information during the experiments. One-shot Example: Essay: \u201c{essay}\u201d Reasoning: This is a minimally-developed response with inadequate support and detail. The writer takes the position that computers can be harmful to the eyes and then addresses eye damage to three groups of people (kids, teens, adults). A few specific details are included (sensitive eyes, MySpace), but elaboration is minimal. Some organization is demonstrated but few transitions are used. Overall, the response is sufficiently developed to move into the score point \u20183\u2019 range. Scores: {Overall: 3} Table 4: One-shot example consisting of a student essay, a manually written score justification, and the assigned score. The data is taken from the scoring guidelines for essay set 1 of the ASAP dataset (Hamner et al., 2012). 3.3 In-Context Learning As final point of variation of our approach, we explore how providing one or multiple exemplary essays, together with their score and a reasoning for the score, helps with essay scoring and feedback generation. The data comes from additional material given to human raters. We argue that the reasoning of the score may help with essay scoring, but could also be seen as a form of feedback and may benefit that task as well. We compare (i) zero-shot, (ii) one-shot, and (iii) few-shot learning. For one-shot, we randomly select an essay with a medium score, as the one in Table 4. For few-shot, we first randomly select examples among the essays with the best and worst scores before covering the \fPattern Essay Set 1 2 3 4 5 6 7 8 Mean Base .495 .532 .405 .495 .497 .601 .436 .377 .480 TA .536 .603 .408 .499 .512 .625 .443 .439 .508 ER .436 .554 .460 .560 .553 .620 .418 .467 .509 CWM .484 .588 .382 .434 .507 .596 .471 .352 .477 Table 5: Essay scoring results: Average QWK over all task instructions using zero-shot learning for each prompt pattern: base, teacher\u2019s assistant (TA), educational researcher (ER), and creative writing mentor (CWM). We report the performance for each of the eight essay sets as well as the mean QWK over all sets. other scores. Due to the limited context length, we restrict the prompt to 5,120 characters and select as many examples that fit this limitation as possible.2 4 Data Multiple AES datasets are available, with the Automated Student Assessment Prize\u2019s (ASAP) dataset (Hamner et al., 2012) being the most widely used. It comprises 12,980 essays written by school students in grades 7 to 10. All essays were scored manually by two raters. The essays are divided into eight essay sets. The essay sets differ by the essay prompt, i.e., the task description they were written for, the scoring range, and the rubric used by the raters as annotation guidelines. The rubrics provide a short description for essays of each quality level and typical elements of such essays. Since for the introduced task of essay feedback generation, no parallel dataset is available yet, we use the ASAP dataset as input data and evaluate the generated feedback without supervision. 5 Evaluation We evaluate the performance of a large language model (LLM) by comparing the proposed prompting strategies on the two tasks: essay scoring and feedback generation. First, we assess the scoring performance and, then, we both automatically and manually evaluate the generated feedback in terms of the helpfulness for the student writer. We aim to study the effects of tackling essay scoring and feedback generation jointly, as well as explore how well LLMs can solve both tasks using prompting. 2For the few-shot variation, the described example selection process led to 3, 2, 4, 5, 8, 6, 4 and 2 examples for the essay sets 1 to 8 respectively. The differences are due to the variation in essay and reasoning length per essay set. 5.1 Essay Scoring We compare the proposed prompt patterns, task instruction types, and in-context learning approaches, to evaluate the performance of an LLM on the essay scoring task. Also, we measure the influence of feedback generation on the scoring performance. Approach We use the instruction-following recent LLM Mistral with 7B parameters (Mistral-7BInstruct-v0.2, Jiang et al., 2023) in our experiments, generating each output with greedy decoding.3 We found that instructing the model to generate the essay score in JSON format helps to extract the score from the generated text automatically.4 Below, we report the number of essays that still did not receive a score (Unscored) and omit them from the performance calculation. Baselines As a baseline, we report the performance AES-Prompt (Tao et al., 2022), which is, to our knowledge, the best-performing AES approach that is not fully fine-tuned on the ASAP dataset. As an upper bound, we also report the performance of R2BERT (Yang et al., 2020), the state-of-the-art approach fully fine-tuned on the same dataset. Experimental Setup We automatically assess the essay scoring performance using quadratic weighted kappa (QWK), the most widely adopted metric for automatic essay scoring (Ke and Ng, 2019). Since the test set of the ASAP dataset is not publicly available, we follow Taghipour and Ng (2016) and apply their 5-fold cross-validation split. Since we perform no training, we only use the validation splits to create reasonable initial prompts and report the performance on the test splits. Results Table 5 presents the scoring performance for each prompt pattern. We report the average QWK of all task instructions using zero-shot learning to measure the influence of the prompt pattern on the scoring performance. Using the personas \u201ceducational researcher\u201d (ER) and \u201cteacher\u2019s assistant\u201d (TA) seems beneficial for essay scoring, either of which performs best on all but one essay set, and ER best on average (mean QWK of .509). To evaluate the influence of the task instruction type, Table 6 shows the performance of the best3Initial experiments on essay scoring with Llama-2 (7bchat-hf and 13b-chat-hf, Touvron et al., 2023) led to lower performance, which halted further testing with Llama-2. 4If the score was not generated as instructed, we reprompted the model to extract the score from its prior response. This was effective when a score was in the initial answer. \fTask Instruction Type Essay Set Unscored 1 2 3 4 5 6 7 8 Mean Scoring .448 .585 .479 .596 .557 .649 .438 .481 .529 1 Scoring\u2192Feedback .510 .615 .439 .530 .489 .621 .449 .481 .517 1 Feedback\u2192Scoring .388 .561 .484 .600 .622 .630 .385 .545 .527 16 Scoring\u2192Feedback_CoT .538 .595 .422 .494 .530 .635 .458 .477 .519 19 Feedback_dCoT\u2192Scoring .546 .564 .424 .558 .581 .628 .477 .489 .533 37 Scoring\u2192Explanation .466 .580 .472 .565 .541 .639 .420 .417 .513 0 Explanation\u2192Scoring .470 .553 .488 .636 .571 .675 .384 .484 .533 2 Table 6: Essay scoring results: QWK for the best approach variation per task instruction type in the zero-shot setting. We report the performance per essay set and the average over essay sets. The best results per column are bold. performing approach variations per task instruction type. We report the combination of prompt pattern and task instruction that performed best on the validation set using zero-shot learning. The results suggest that instructing the LLM to first follow task-specific steps to analyze and give feedback (Feedback_dCoT\u2192Scoring) as well as to first generate an explanation for the essay score (Explanation\u2192Scoring) particularly help with essay scoring. These two achieve the highest mean QWK (.553). In general, the variations that generate some form of feedback first perform better than their counterparts that perform scoring first. Finally, we study the influence of in-context learning on the instruction type Scoring\u2192Feedback using the prompt pattern and task instruction that performs best on the validation split for a fair comparison to the baselines (Table 7). The results indicate that giving examples of scored essays aid essay scoring. One-shot learning outperforms few-shot learning, but the effect is rather small. Our prompting approaches perform rather competitively to the strong baseline AES-Prompt (Tao et al., 2022). 5.2 Essay Feedback Generation As with essay scoring, we evaluate the generated feedback by comparing the prompt patterns, task instruction types, and in-context learning approaches. Our goal is to explore how well LLMs perform at generating helpful essay feedback and whether essay scoring can benefit the feedback generation. Approach We continue using the large language model Mistral (Mistral-7B-Instruct-v0.2, Jiang et al., 2023) for the essay feedback generation task since it performed well at the essay scoring task. Automatic Evaluation Using LLMs to assess the quality of generated texts has been shown to be consistent with human expert annotations for some free-text generation tasks (Chiang and Lee, 2023). Context Essay Set 1 2 3 4 5 6 7 8 Mean Zero-shot .510 .615 .439 .530 .489 .621 .449 .481 .517 One-shot .565 .619 .523 .600 .606 .665 .509 .233 .540 Few-shot .558 .586 .515 .586 .618 .671 .472 .297 .538 AES-Pro. .682 .544 .590 .672 .701 .622 .683 .620 .639 R2BERT .817 .719 .698 .845 .841 .847 .839 .744 .794 Table 7: Essay scoring results: QWK per in-context learning approach for Scoring\u2192Feedback using the best-performing prompt pattern and task instruction. The baseline AES-Prompt (Tao et al., 2022) also has one shot. R2BERT (Yang et al., 2020) is fully fine-tuned. Since there are no existing automatic metrics for assessing the quality of generated essay feedback, we follow previous work and use Mistral itself as well as Llama-2 (Llama-2-13b-chat-hf, Touvron et al., 2023) for the automatic part of our feedback evaluation. We instruct them to assign an overall helpfulness scores between 1 (not helpful) and 10 (very helpful) for each generated essay feedback. The used prompt can be found in Appendix B.5 Our evaluation focuses on helpfulness, which we deem to be the most important quality dimension for essay feedback. We anticipate that other quality aspects, such as faithfulness, are implicitly covered since irrelevant or incorrect feedback would not be helpful for the student author. Automatic Results Table 8 presents the assigned helpfulness scores for each prompt pattern, averaged over task instructions using zero-shot learning. Both LLMs deemed the feedback generated by a persona pattern to be most helpful, on average: the top helpfulness score is achieved by ER for Mistral (8.26) and CWM for Llama-2 (7.48). To evaluate the influence of the task instruction 5We also experimented with relative comparisons of feedback for automatic helpfulness assessment. However, the correlation to our manual helpfulness annotations was low. \fPrompt Pattern Mistral Llama-2 Base 7.78 \u00b10.53 6.88 \u00b10.18 Teacher\u2019s assistant (TA) 7.90 \u00b10.39 6.84 \u00b10.19 Educational researcher (ER) 8.26 \u00b10.23 6.87 \u00b10.18 Creative writing mentor (CWM) 7.83 \u00b10.47 7.48 \u00b10.85 Table 8: Automatic feedback generation results: Average helpfulness scores predicted by Mistral and Llama-2 for each prompt pattern over all task instructions using zero-shot learning. The best result per column is bold. Task Instruction Type Mistral Llama-2 Feedback 8.96 \u00b1.25 7.31 \u00b1.19 Scoring\u2192Feedback 8.04 \u00b1.44 7.15 \u00b1.45 Feedback\u2192Scoring 8.27 \u00b1.38 7.27 \u00b1.50 Scoring\u2192Feedback_CoT 7.30 \u00b1.63 6.72 \u00b1.41 Feedback_dCoT\u2192Scoring 8.53 \u00b1.66 7.28 \u00b1.55 Scoring\u2192Explanation 7.22 \u00b1.45 6.68 \u00b1.40 Explanation\u2192Scoring 7.27 \u00b1.63 6.75 \u00b1.36 Table 9: Automatic feedback generation results: Average helpfulness scores predicted by Mistral or Llama-2 for each task instruction type over all task instructions and prompt patterns using zero-shot learning. type, Table 9 shows the results per type, averaged over prompt patterns and task instructions using zero-shot learning. Both evaluation models gave the highest average scores to performing feedback generation only (Feedback). For the other task instruction types, the variations that generate some form of feedback first seem more helpful than their counterparts that perform scoring first. Finally, we study the influence of each in-context learning approach on the task instruction type Scoring\u2192Feedback on average over the prompt patterns and task instructions (Table 10). The results suggest that the reasoning presented in the provided in-context examples positively impacts the feedback helpfulness. Although the effect is small, more examples help more. Manual Evaluation The proposed automatic evaluation only approximates the quality of the generated essay feedback. Therefore, we conducted a manual annotation study during which 12 annotators manually judged the feedback quality. All annotators have advanced English skills and are not authors of this paper. The annotators were divided into four groups that annotated the same feedback. In particular, we randomly selected 24 essay feedback texts generated by the three task instruction types that performed best in the automatic evaluation: Feedback, Feedback\u2192Scoring, and Feedback_dCoT\u2192Scoring. Here, we used the bestIn-Context Learning Mistral Llama-2 Zero-shot learning 8.04 \u00b1.44 7.15 \u00b1.45 One-shot learning 8.39 \u00b1.54 7.28 \u00b1.47 Few-shot learning 8.42 \u00b1.56 7.30 \u00b1.46 Table 10: Automatic feedback generation results: Average helpfulness scores predicted by Mistral or Llama-2 per in-context learning approach for Scoring\u2192Feedback over all prompt patterns and task instructions. Task Instruction Type S1 S2 S3 S4 S5 Feedback 5.88 5.71 6.04 5.75 6.08 Feedback\u2192Scoring 5.17 5.04 5.46 5.21 5.08 Feedback_dCoT\u2192Scoring 5.50 4.92 5.29 4.83 5.00 Table 11: Manual feedback generation results: Average scores assigned by the annotators for each approach for statements S1\u2013S5 on a 7-point Likert scale (7 is best). performing combination of prompt pattern and task instruction. All sampled feedback texts were written for essays from one essay set only to reduce the time the annotators need to read the essay prompt. We chose essay set 4, which covers the most common ASAP task, reading comprehension. To judge the feedback helpfulness, the annotators received the essay prompt, the student essay, and the generated feedback. Based on this, they were asked to assess to what extent the following statements apply on a 7-point Likert scale (score 1: \u201cI strongly disagree\u201d, score 7: \u201cI fully agree\u201d): S1: The feedback clearly points out mistakes that were made in the essay. S2: The feedback explains exactly why the errors are errors. S3: The feedback is very clear and precise so that the student can understand it. S4: The feedback is absolutely suitable for students from 7th to 10th grade. S5: Overall, the feedback is very helpful. Manual Results Table 11 presents the results of the manual annotation study. For all five statements covering different helpfulness aspects, Feedback achieved the highest scores on average. Especially the clarity and precision (S3) as well as the overall helpfulness (S5) of Feedback were rated with the second-best score of 6 (\u201cI mostly agree\u201d). All compared task instruction types reach an average score above the neutral score of 4, indicating that all feedback is perceived as rather helpful in general. Overall, the generated essay feedback seems \fAutom. Evaluation S1 S2 S3 S4 S5 Mistral 0.29 0.27 0.45 0.25 0.61 Llama-2 \u20130.11 \u20130.11 \u20130.02 0.07 \u20130.10 Table 12: Pearson correlation of the manual annotations per statement (S1\u2013S5) and the automatic helpfulness scores using Mistral or Llama-2. The top value is bold. to have the most potential for improvement by better explaining why an error is erroneous (S2) and being more suitable for students (S4). The interannotator agreement in terms of Krippendorff\u2019s \u03b1 on average over the four groups is 0.44. To evaluate the reliability of our automatic helpfulness evaluation, we show the correlation between manual and automatic helpfulness scores in Table 12. The highest correlation value (0.61) was measured between the manually annotated overall helpfulness (S5) and the automatic helpfulness scores predicted by Mistral. This indicates that using Mistral can be useful for automatically evaluating feedback helpfulness. The helpfulness scores generated by Llama-2 do not correlate with the manual annotation for any statement. 6"
16
+ }
abs_9K/validation_abstract_short_2404.15846v1.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.15846v1",
3
+ "title": "From Complex to Simple: Enhancing Multi-Constraint Complex Instruction Following Ability of Large Language Models",
4
+ "abstract": "It is imperative for Large language models (LLMs) to follow instructions with\nelaborate requirements (i.e. Complex Instructions Following). Yet, it remains\nunder-explored how to enhance the ability of LLMs to follow complex\ninstructions with multiple constraints. To bridge the gap, we initially study\nwhat training data is effective in enhancing complex constraints following\nabilities. We found that training LLMs with instructions containing multiple\nconstraints enhances their understanding of complex instructions, especially\nthose with lower complexity levels. The improvement can even generalize to\ncompositions of out-of-domain constraints. Additionally, we further propose\nmethods addressing how to obtain and utilize the effective training data.\nFinally, we conduct extensive experiments to prove the effectiveness of our\nmethods in terms of overall performance, training efficiency, and\ngeneralization abilities under four settings.",
5
+ "authors": "Qianyu He, Jie Zeng, Qianxi He, Jiaqing Liang, Yanghua Xiao",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-04-24",
8
+ "primary_cat": "cs.CL",
9
+ "cats": [
10
+ "cs.CL"
11
+ ],
12
+ "label": "Original Paper",
13
+ "paper_cat": "LLM Fairness",
14
+ "gt": "It is imperative for Large language models (LLMs) to follow instructions with\nelaborate requirements (i.e. Complex Instructions Following). Yet, it remains\nunder-explored how to enhance the ability of LLMs to follow complex\ninstructions with multiple constraints. To bridge the gap, we initially study\nwhat training data is effective in enhancing complex constraints following\nabilities. We found that training LLMs with instructions containing multiple\nconstraints enhances their understanding of complex instructions, especially\nthose with lower complexity levels. The improvement can even generalize to\ncompositions of out-of-domain constraints. Additionally, we further propose\nmethods addressing how to obtain and utilize the effective training data.\nFinally, we conduct extensive experiments to prove the effectiveness of our\nmethods in terms of overall performance, training efficiency, and\ngeneralization abilities under four settings.",
15
+ "main_content": "Introduction Large language models (LLMs) have become the backbone for real-world applications (Anil et al., 2023; Touvron et al., 2023; Achiam et al., 2023). Given natural language instructions, LLMs can solve unseen tasks with few or no examples (Brown et al., 2020). The capability of LLMs to accurately understand instructions and convey the desired output, known as Instruction Following (Lou et al., 2024), is crucial for the safety (Mu et al., 2023) and reliability (Zhou et al., 2023a) of LLMs. It is imperative for LLMs to follow instructions with elaborate requirements (Yin et al., 2023; Xu et al., 2023) (i.e. Complex Instructions), such as formatting specifications outlined in Fig. 1. On one * Equal contribution. \u2020 Corresponding author. GOALS: 1. write a weather report for SF today Requirements: 1. ~4000 word limit for short term memory. 2. Exclusively use the commands listed in double quotes e.g. \"command name\u201d Commands: 1. search: useful for when you need to answer questions about current events. You should ask targeted questions, args json schema: {\"query\": {\"title\": \"Query\", \"type\": \"string\"}} 2. write_file: \u2026 You should only respond in JSON format as described below Response Format: { \"thoughts\": { \"text\": \"thought\", \"reasoning\": \"reasoning\", \u2026 } \u2026 } Make a short introduction and list a few popular songs from the album: Back To Black. There should be exactly two paragraphs in your response, separated by the markdown divider: ***. Do not say the word \"popular\" in the response and answer in lowercase letters only. The response should end with the phrase \"really love their song!\". Instructions with Detailed Requirements Instructions with Multiple Constraints Numerical Constraints Format Constraints Format Constraints Format Constraints 1 2 4 5 6 Semantic Constraints 1 2 3 4 To study Complex Instructions Following ability Complex Instruction Model Outputs : \u2026 album by the iconic British singer-songwriter Amy Winehouse \u2026 vocalists of her generation.\\n Some standout tracks \u2026 love their song! 3 1 : \"back to black\" is \u2026 of the 21st century.***some standout tracks from \u2026 21st century.***some standout tracks from \u2026 love their song! 1 3 Semantic Constraints GPT3.5 GPT4 Figure 1: Real-world applications generally involve instructions with multiple constraints (i.e. Complex Instructions), posing challenges for models. hand, the ability to follow detailed instructions alleviates the need for annotating samples, which can be costly and challenging for intricate tasks (Zeng et al., 2023a). On the other hand, complex instructions hardly appear in the training data (Zhou et al., 2024). Hence, the ability to follow complex instructions demonstrates models to have better generalization ability to unseen tasks (Yin et al., 2023). Specifically, satisfying the multiple constraints in the instructions simultaneously (i.e. Constraints Following) poses a significant challenge in complex instruction following (Jiang et al., 2023; He et al., 2024). As shown in Fig. 1, whether models can satisfy the multiple constraints in the instructions determines their ability to follow complex arXiv:2404.15846v1 [cs.CL] 24 Apr 2024 \fMake a short introduction and list a few popular songs from the album: Back To Black. There should be exactly two paragraphs in your response, separated by the markdown divider: ***. Do not say the word \"popular\" in the response and answer in lowercase letters only. The response should end with the phrase \"love their song!\". \u2026 Released in 2006, ... \\n\\nSome tracks include \u2026These songs leave an impact on listeners who love their song! Generation Back to Black is a \u2026 by Amy Winehouse, ... *** Here are some popular tracks \u2026 I love their song! back to black is a \u2026 by amy winehouse, ... *** here are some standout tracks \u2026 i love their song! back to black is a \u2026 by amy winehouse, ... *** here are some popular tracks \u2026 i love their song! Discrimination Student Model Why can I see the moon during the day? Do not say the word \u201cmoon\u201d Recommend 5 films to me. End with the phrase \u2018That\u2019s all.\u2019 How can I increase my productivity? Don\u2019t mention the word \u201ctalent\u201d and end with \u201cwork harder!\u201d Teacher Model Composition(C) A Complex Instruction Fix Fix 1 Output 2 3 4 3 2 A C A A C 3 1 \ud835\udc90\ud835\udc97 \ud835\udc90\ud835\udfcf \ud835\udc90\ud835\udfd0 SFT: Positive Samples \ud835\udc90\ud835\udfd0 \ud835\udcdb\ud835\udc7a\ud835\udc6d\ud835\udc7b Training Objective \ud835\udc90\ud835\udfd0 \ud835\udc90\ud835\udfcf Generate \ud835\udc90\ud835\udc97 \ud835\udc90\ud835\udfd0> \ud835\udc90\ud835\udc97 \ud835\udc90\ud835\udfd0> \ud835\udc90\ud835\udfcf\ud835\udcdb\ud835\udc6b\ud835\udc77\ud835\udc76 \ud835\udc90\ud835\udfd0\ud835\udcdb\ud835\udc7a\ud835\udc6d\ud835\udc7b Training Objective Train Fix 3 Fix 2 Train What training data is effective for Complex Instruction Following ? How to use the data? How to obtain the data (the effective training data)? Atom(A) 3 2 2 RLFT: Positive and Negative Samples Atom(A) Figure 2: The framework of our study. We first study what training data is effective in enhancing complex instruction following abilities via an empirical study. Then, we design a discrimination-based method to address how to obtain the data. Finally, we propose a method for effectively utilizing positive and negative samples obtained through the discrimination-based method. instructions. Hence, in our work, we explore complex instruction following by examining LLMs\u2019 ability to follow instructions with multiple constraints (Yin et al., 2023; Lou et al., 2024). On one hand, human instructions are subjective and ambiguous, while constraints within these instructions facilitate the automatic evaluation of instruction following ability (Zhou et al., 2023a; Wang et al., 2024). On the other hand, the compositional nature of constraints enables the automatic creation of instructions with unseen compositions of constraints (Zhou et al., 2023b; Yao et al., 2023). These instructions hardly appear in the training data, thus effectively assessing the model\u2019s ability to generalize to unseen tasks (Aksu et al., 2023). Complex constraints following is a challenging task for LLMs (Jiang et al., 2023; He et al., 2024; Qin et al., 2024). As shown in Fig. 1, even advanced LLMs struggle to meet the four specified constraints in complex instructions. However, it remains under-explored how to enhance LLMs to follow multi-constraint complex instructions. First, the existing works on constraints following mainly focus on evaluation without proposing methods for enhancement (Jiang et al., 2023; Chen et al., 2024; Xia et al., 2024). Additionally, even when the improvement methods are proposed, they mainly consider instructions with few constraints, thereby failing to showcase the complexity of human instructions in practical applications (Chen et al., 2022; Zhang et al., 2023; Wang et al., 2024). Moreover, although some studies construct complex instructions with multiple constraints and fine-tune LLMs on them (Aksu et al., 2023; Sun et al., 2024), one key research question remains under-explored: What training data is effective in enhancing complex constraint-following abilities? This leads to two follow-up questions: (1) How to obtain the effective training data? and (2) How to utilize the data effectively? In this work, we systematically study how to enhance the ability of LLMs to follow complex instructions, with the framework shown in Fig. 2. We initially explore the effective training data for this purpose through an empirical study. We found that training LLMs on instructions containing multiple constraints (compositional data) enhances their understanding of complex instructions more effectively than training on atomic constraints (atomic data). Moreover, the improvement in performance is related to the number of constraints, the model size (\u00a73), and can even generalize to the compositions of out-of-domain constraints found in \u00a75.3.1. To obtain high-quality compositional data, we generate initial output via a student model (vanilla model) and then correct via a teacher model (advanced model), termed the Discrimination method. This approach yields higher-quality output than using the teacher model to generate directly. To leverage the positive and negative samples collected during the Discrimination method, we introduce a contrastive method with reinforcement learning finetuning (RLFT) (Rafailov et al., 2023). Our method surpasses the SFT training paradigm on the instruction following benchmark (Zhou et al., 2023a) with fewer training steps. It also demonstrates superior generalization across out-of-domain, in-domain, and adversarial settings while preserving overall capabilities. Overall, our contributions are mainly three-fold: (1) We systematically improve LLMs\u2019 instructionfollowing ability by exploring effective training \fdata. (2) We design a discrimination-based method to obtain effective training data. We also propose a method for utilizing positive and negative samples obtained through this approach. (3) We conduct extensive experiments to prove the effectiveness and efficiency of our method. We also validate its generalization ability under four settings. 2 Related Work 2.1 Instruction Following There are various perspectives for assessing the ability of LLMs to follow instructions. A line of work perturbs the answer space to assess whether the model truly understands instructions or recites the answer (Zeng et al., 2023b; Li et al., 2023a; Wu et al., 2023). Another line of work exemplifies models\u2019 ability to follow instructions by incorporating verifiable constraints within them, such as lexical, numerical, format, and semantic constraints (Sun et al., 2023; Jiang et al., 2023). These constraints can be compositional, allowing one instruction to contain multiple constraints simultaneously (Aksu et al., 2023; Zhou et al., 2023b; Yao et al., 2023). Such complex instructions containing multiple user-specified constraints present greater challenges for LLMs to follow (He et al., 2024; Qin et al., 2024). Our work falls into this latter category. The existing works on constraints following solely either focus on evaluation (Chen et al., 2024; Xia et al., 2024) or only consider instructions with few constraints (Chen et al., 2022; Zhang et al., 2023; Chen and Wan, 2023; Wang et al., 2024). Different from existing works, we systematically investigate how to enhance complex instructions with multiple constraints. 2.2 Complex Instruction Tuning Complex Instructions can refer to instructions that involve more reasoning steps (Mukherjee et al., 2023), intricate input (Zhou et al., 2024), or multiple constraints (Luo et al., 2023a). Many studies have demonstrated that fine-tuning with complex instructions can boost performance in tasks such as instruction following (Xu et al., 2023), reasoning (Mitra et al., 2023), or code generation (Luo et al., 2023b). However, our work differs from these studies in two main aspects. First, we focus on improving LLMs\u2019 ability to follow complex instructions containing multiple constraints, which is crucial for the practicality and safety of LLMs (Zhou et al., 2023a; Mu et al., 2023). Furthermore, traditional supervised fine-tuning (SFT) uses only positive samples, whereas we use both positive and negative samples to enhance the complex instruction-following ability of LLMs effectively and efficiently. 3 Empirical Studies A common approach to improve LLMs\u2019 ability to follow complex instructions is to construct corresponding instances and fine-tune the LLMs on them (Aksu et al., 2023; Sun et al., 2024). Yet, one key research question remains under-explored: What training data is effective in enhancing complex constraint-following abilities? To enhance the LLM\u2019s capacity to follow complex instructions, two types of training data can be utilized: (1) Initially train models to understand atom constraints (atomic data), enabling them to resolve compositional constraints (compositional data) automatically. (2) Train models with compositional data, leading them to understand instructions with atomic or varying compositions of constraints spontaneously. Examples are shown in Fig. 2. To compare these training data types, we split the instructions in existing instructions following benchmarks (Zhou et al., 2023a; Jiang et al., 2023) into training and test sets. The training set contains atomic data (mostly with 1 constraint) and compositional data (mostly with over 3 constraints). Original benchmarks lack corresponding outputs, we first generate them via GPT-3.5-turbo. To improve the quality of the training set, we further filter the datasets to only keep outputs that satisfy all instruction constraints using GPT-3.5-turbo and rules for training. The remaining data forms the test set. Details on data construction and statistics are provided in the Appx. A.1. We compare three methods: (1) Backbone, the backbone model without further training. (2) Atom and (3) Composition, continue training the backbone model with atomic data and compositional data respectively. To prevent models from catastrophic forgetting (McCloskey and Cohen, 1989), we mix training data with ShareGPT data (Chiang et al., 2023) for Atom and Composition checkpoint. We leverage two backbone models (Zheng et al., 2024; Touvron et al., 2023) and adopt two accuracy metrics (Zhou et al., 2023a; Jiang et al., 2023): accins = 1 m m X i=1 n Y j=1 cj i, acccon = 1 mn m X i=1 n X j=1 cj i, \fBackbone Methods Level 1 Level 2 Level 3 Level 4 Level 5 Avg. Vicuna-7B-V1.5(Zheng et al., 2024) Backbone 39.07 44.71 37.28 30.93 19.06 34.21 Atom 39.17 39.50 42.07 30.23 16.97 33.59 Comp 39.44 55.90 47.49 22.27 16.65 36.35 LLaMA2-13B-Chat(Touvron et al., 2023) Backbone 33.10 41.71 42.26 23.89 22.07 32.61 Atom 38.99 39.78 36.61 20.74 14.83 30.19 Comp 37.02 44.66 42.55 21.62 22.36 33.64 Table 1: The Instruction-level accuracy of backbone models without further training (Backbone), training with atomic data (Atom), and compositional data (Comp) on FollowBench. Level x indicates there are x constraints in the instructions. Avg. indicates the average performance across 5 levels. The results are evaluated by GPT-4 using the FollowBench prompt template. The bold and underlined represent the first and second rankings among the open-source LLMs, respectively. Backbone Methods ChangeCase Combination Content Format Keywords Language Length Punctuation Startend I-level C-level Vicuna-7B-V1.5 Backbone 27.87 15.91 74.07 44.09 48.57 80.00 30.69 10.71 40.00 26.89 37.47 Atom 29.50 31.82 48.14 63.44 36.19 25.00 31.68 16.07 40.00 27.17 37.29 Comp 37.70 50.00 40.74 55.91 36.19 25.00 32.67 14.29 50.00 28.85 38.76 LLaMA2-13B-Chat Backbone 42.62 11.36 81.48 55.91 45.71 15.00 32.67 00.00 25.00 25.77 36.38 Atom 42.62 00.00 37.04 54.84 42.86 35.00 34.65 12.50 37.50 26.33 35.83 Comp 40.98 02.27 66.67 54.84 38.10 50.00 36.63 16.07 40.00 26.05 37.84 Table 2: The performance of backbone models without further training (Backbone), training with atomic data (Atom), and compositional data (Comp) on IFEval. The I-level and C-level denote the Instruction-level and Constraint-level accuracy respectively. where cj i equals 1 if the j-th constraint of the i-th instruction is satisfied, otherwise 0. Overall, achieving Instruction-level accuracy (accins) is more challenging than Constraint-level accuracy (acccon). The performance of the three methods on the test sets is shown in Tab. 1 and Tab. 2. First, with regard to the overall performance, training with compositional data generally surpasses both the backbone model and atomic data training. This demonstrates that training with compositional data can generally enhance models\u2019 ability to follow complex instructions. Surprisingly, according to Tab. 1, training with atomic data (mostly with 1 constraint) can generally decrease performance compared to the backbone model for instructions with more than 1 constraint. Also, training with compositional data (usually 3 to 5 constraints) boosts performance on instructions with 1 to 3 constraints significantly but shows less enhancement or even a decline for those with 4 to 5 constraints. This suggests that training with compositional data (instructions with multiple constraints) can better generalize to lower-level complex instructions (instructions with fewer constraints). Moreover, this effect is more pronounced in smaller LLMs (7B), likely due to their weaker generalization ability (Magister et al., 2022; Fu et al., 2023). Later in \u00a75.3.1, we found that training with compositional data can even generalize to the compositions of out-of-domain constraints. We have found that training with compositional data can better enhance LLM\u2019s ability to follow complex instructions compared with atomic data. A follow-up research question is how to obtain highquality compositional data? Existing datasets either only provide compositional instructions without output (Zhou et al., 2023a; Jiang et al., 2023) or directly generate responses using advanced LLMs and refine them manually (Sun et al., 2024). We compare the outputs generated by three methods: (1) Vanilla: Output generated directly using backbone model. (2) Generation: Output generated directly using GPT-3.5-turbo. (3) Discrimination: First, we identify the constraints that Vanilla outputs failed to adhere to using test scripts (Zhou et al., 2023a). Then, we rectify the Vanilla outputs constraints by constraints using GPT-3.5-turbo (The framework is shown in Fig. 2 and please refer to \u00a74.2 for details). With regard to the complex instructions, the instructions in IFEval (Zhou et al., 2023a) originally had only 1 to 3 constraints, which were not complex enough. We construct 1500 complex instructions, each with 3 to 5 constraints from IFEval that are objective and can be automatically verified (Please refer to \u00a74.1 for details). We leverage LLaMA2-13B-chat (Touvron et al., 2023) as the backbone and evaluate the performance of the three methods using the test script from Zhou et al. (2023a). As shown in Tab. 3, using the generation method, outputs from advanced LLMs (Generation) are \fMethods ChangeCase Combination Content Format Keywords Language Length Punctuation Startend I-level C-level Vanilla 21.19 08.89 77.26 56.67 61.60 10.60 30.85 00.26 16.84 06.40 41.33 Generation 56.50 30.37 68.95 74.96 72.29 33.01 52.91 36.76 79.51 21.53 62.68 Discrimination 66.56 25.00 68.11 68.27 77.32 81.95 52.27 70.90 85.60 35.04 68.30 Table 3: The performance of different methods on IFEval. of higher quality than those from weaker LLMs (Vanilla). However, the outputs from weaker LLMs then refined by advanced LLMs (Discrimination) significantly outperform the outputs generated by advanced LLMs directly (Generation). We believe this is because slight changes in the instruction (i.e. constraint) can cause substantial output differences, which the discriminationbased method captures better than the generationbased method. 4 Method According to \u00a73, we propose a discriminationbased method to obtain effective training data. A subsequent question is how to effectively utilize the data obtained through the discriminationbased method? Hence, we introduce a reinforcement learning fine-tuning (RLFT) based method that leverages both positive and negative samples to improve complex instruction following. The framework is shown in Fig. 2. 4.1 Complex Instruction Synthesis According to \u00a73, the effective training data is complex instructions with multiple constraints (compositional data). To obtain compositional data, we first collect seed instructions from three widely used instruction-tuning datasets. Then, we rewrite the instructions to incorporate multiple constraints. To ensure the coverage and diversity of the seed instructions, we consider three sources: (1) Open Assistant (K\u00f6pf et al., 2024): human-written instructions when interacting with chatbots. We only consider rank 0 instructions (annotated by humans as the highest quality) and the first turn of the conversation (Li et al., 2023b). (2) Self-Instruct (Wang et al., 2022a): 175 manually written instructions covering diverse topics to facilitate instruction generation for new tasks. (3) Super-Natural (Wang et al., 2022b): A collection of natural language processing (NLP) tasks formatted with human instructions. We first exclude tasks with finite output sets using rules (e.g., classification, tagging), since the outputs are too simple for the corresponding instructions to incorporate constraints. This leaves us with 318 remaining tasks. Next, we randomly select one instruction for each task. From these three sources, we finally gather 1500 seed instructions. Subsequently, we integrate constraints into these seed instructions. Initially, we randomly sample 3 to 5 constraints and utilize the provided scripts to resolve conflicts among the constraints provided by Zhou et al. (2023a). Next, given that, semantically equivalent but textually distinct instructions can substantially affect model outcomes (Yan et al., 2024; Chen et al., 2024), we employ eight diverse expressions to describe each type of constraint. Specifically, we manually select three common descriptions from the test set as seed descriptions, generate five similar descriptions using GPT-3.5turbo, and refine them manually. For each sampled constraint ci, we randomly select one description di from the description pool and append it to the instructions, formulated as: Ic = LLM(Is \u2295di \u2295... \u2295dn), where Is, Ic and di denote the seed instruction, its corresponding synthesized complex instruction, and appended constraint using a specific description, respectively. The number of constraints n ranges from 3 to 5. 4.2 Teacher Correction As introduced in \u00a73, we propose a discriminationbased approach for obtaining the output, shown to be more effective than directly generating output with advanced LLMs. The details of this approach are as follows. Initially, we utilize LLaMA2-13B-Chat (Touvron et al., 2023) (student model) to generate results for our synthesized complex instructions. Then, we utilize the test scripts from Zhou et al. (2023a) to identify the constraints the model failed to follow since the constraints are objective and automatically verifiable. Finally, we adopt advanced LLMs (teacher model) GPT-3.5-turbo to correct the failed constraints one by one. Specifically, each complex instruction Ic contains multiple constraints. In \u00a74.2, we utilize the test script to pinpoint the f constraints C = \f{c1, c2, ..., cf} that the student model\u2019s vanilla output ov fails to follow. The teacher model sequentially corrects these failed constraints, yielding an output set O = {ov, o1, o2, ..., of}: o1 = LLM(ov, c1), . . . , of = LLM(of\u22121, cf), where GPT-3.5-turbo is employed as the teacher model with prompts sourced from Tab. 9. 4.3 Contrastive Method During \u00a74.2, for each instruction Ic, we can gather positive sample set {of} and negative samples set {o1, ..., of\u22121}. Supervised fine-tuning (SFT) solely utilizes positive samples successfully meeting constraints specified in complex instructions (Radford et al., 2019; Howard and Ruder, 2018). However, negative samples from \u00a74.2, failing to meet certain constraints, also offer valuable supervision signals. Hence, we leverage the positive and negative samples through reinforcement learning fine-tuning (Rafailov et al., 2023). Specifically, given the output set O = {ov, o1, o2, ..., of} for each complex instruction Ic, we can form a training dataset D comprising f contrastive triplets: D = {I(i) c , o(i) i , of}f i=1 = {(Ic, ov, of), (Ic, o1, of), ..., (Ic, of\u22121, of)}. In each training triplet, the final corrected output of (positive sample) is preferred over oi (negative sample), as of follows more constraints specified in the complex instruction Ic. Following this, Direct Preference Optimization (DPO) (Rafailov et al., 2023) can be applied to model the preference information. The loss function is a maximum likelihood objective for the language model parameters \u03c0\u03b8. LDPO(\u03c0\u03b8; \u03c0ref) = \u2212E(Ic,of ,oi)\u223cD[log\u03c3(\u03b2log\u03c0\u03b8(of|Ic) \u03c0\u03b8(of|Ic) \u2212\u03b2log\u03c0ref(oi|Ic) \u03c0ref(oi|Ic))], where the reference model parameter \u03c0ref is set to \u03c0\u03b8 initially and remains fixed throughout training. \u03b2 is a hyperparameter and \u03c3 is the sigmoid function. The goal of LDPO is to maximize the log probability of preferred output of relative to the dispreferred output oi. However, solely relying on LDPO may lead to low probabilities for both chosen and rejected outputs, yet with a significant disparity between them. Therefore, we additionally integrate the SFT loss LSFT to constrain \u03c0\u03b8 from deviating from the preferred data distribution (Xu et al., 2024; Hejna et al., 2023): LSFT(\u03c0\u03b8) = \u2212E(Ic,of)\u223cD[log \u03c0\u03b8(of|Ic)]. Finally, our training procedure is to optimize LDPO and LSFT jointly: LOurs = LDPO + LSFT. 5 Experiments We conduct experiments to verify the effectiveness of our method, focusing on overall performance, training efficiency, and generalization ability. 5.1 Experiment Setup Models. Our baselines comprise popular opensource and close-source LLMs. With regard to our framework, utilizing synthesized complex instructions (\u00a74.1), we compare three methods: (1) Ours-13B-Generation directly generates output with GPT-3.5-turbo and trains the backbone model via supervised fine-tuning (SFT). (2) Ours-13BDiscrimination generates output via the backbone model then refines with GPT-3.5-turbo (\u00a74.2), and trains the backbone model via SFT. (3) Ours-13BContrastive utilizes DPO for training to model positive and negative samples (\u00a74.3). The backbone model for all three methods is LLaMA2-13BChat, with the instructions of training data being the same; only the output of training data and training paradigms differ. Specifically, continuous training may cause catastrophic forgetting (McCloskey and Cohen, 1989). To address this, we utilize the replay strategy (Ke and Liu, 2022), mixing the training data with 10000 ShareGPT data (Chiang et al., 2023) to maintain the general abilities of models during training. Evaluation. We evaluate all models on IFEval (Zhou et al., 2023a), a widely-used instructionfollowing benchmark. The test set consists of 541 samples, each containing 1 to 3 constraints. All the constraints are objective and can be automatically verified, such as length constraints and detectable formats. The metrics are the same as \u00a73. 5.2 Results Overall Performance. The performance on IFEval is presented in Tab. 4. First, using the same backbone model, Ours-13B-Generation performs worse than many popular open-source models (Vicuna, WizardLM), even when the constraints in the test set have been seen in the instructions. This \fModels BaseModel ChangeCase Combination Content Format Keywords Language Length Punctuation Startend I-level C-level LLaMA2-13B-Chat (Touvron et al., 2023) LLaMA2 37.08 07.69 83.02 60.51 57.06 25.81 37.76 00.00 29.85 29.94 42.21 LLaMA2-70B-Chat (Touvron et al., 2023) LLaMA2 42.70 24.62 79.25 63.69 68.71 16.13 39.86 12.12 62.69 38.45 50.36 Qwen-14B-Chat (Bai et al., 2023) Qwen 57.30 23.08 75.47 57.96 58.28 83.87 33.57 21.21 68.66 37.89 51.08 Vicuna-13B-V1.5 (Zheng et al., 2024) LLaMA2 56.18 32.31 75.47 62.42 57.06 93.55 42.66 16.67 64.18 42.33 53.48 WizardLM-13B-V1.2 (Xu et al., 2023) LLaMA2 49.44 16.92 75.47 67.52 66.26 83.87 46.85 15.15 64.18 43.07 54.56 OpenChat-13B-V3.2 (Wang et al., 2023) LLaMA2 49.44 26.15 88.68 68.15 66.26 87.10 47.55 19.70 71.64 46.03 57.43 Ours-13B-Generation LLaMA2 64.04 20.00 66.04 70.06 53.99 35.48 44.06 21.21 74.63 41.22 52.88 Ours-13B-Discrimination LLaMA2 60.67 06.15 79.25 64.97 60.12 96.77 43.36 51.52 79.10 46.21 57.43 Ours-13B-Contrastive LLaMA2 65.17 10.77 84.91 66.88 60.74 93.55 47.55 43.94 86.57 48.24 59.71 PaLM2-S* (Anil et al., 2023) PaLM N/A N/A N/A N/A N/A N/A N/A N/A N/A 43.07 55.76 GPT3.5-turbo GPT 58.43 70.77 88.68 88.54 71.17 98.35 53.85 18.18 76.12 58.96 68.47 GPT4* (Achiam et al., 2023) GPT N/A N/A N/A N/A N/A N/A N/A N/A N/A 76.89 83.57 Table 4: The overall performance of models on IFEval (each with 1 to 3 constraints). The asterisk (*) indicates that the results are directly sourced from IFEval. N/A denotes that IFEval does not provide the results for specific constraints. Models ChangeCase Combination Content Format Keywords Language Length Punctuation Startend I-level C-level LLaMA2-13B-Chat 17.86 00.00 68.42 58.54 61.43 27.27 34.43 00.00 27.03 09.50 42.27 WizardLM-13B-V1.2 16.67 13.64 56.58 53.66 64.29 100.00 40.98 17.39 48.65 14.00 47.20 OpenChat-13B-V3.2 25.00 00.00 76.32 56.71 61.43 86.36 35.25 15.22 55.41 16.50 49.07 Ours-13B-Discrimination 48.81 00.00 67.11 50.61 58.57 90.91 36.89 60.87 67.57 15.00 53.33 Ours-13B-Contrastive 35.71 04.55 63.16 50.61 65.00 86.36 47.54 63.04 79.73 19.00 55.73 Table 5: The performance of models on instructions within the same constraint category (each with 3 to 5 constraints) but with varying phrasing and detailed requirements, assessing our methods\u2019 in-domain generalization ability. Models ChangeCase Combination Content Format Keywords Language Length Punctuation Startend I-level C-level LLaMA2-13B-Chat 25.71 08.70 67.44 47.41 60.71 28.00 26.92 02.38 21.90 01.00 40.15 WizardLM-13B-V1.2 28.57 00.00 54.26 50.00 66.67 72.00 34.62 15.48 52.38 07.00 46.60 OpenChat-13B-V3.2 31.43 04.35 62.79 56.03 60.71 72.00 31.73 23.81 49.52 07.30 47.64 Ours-13B-Discrimination 51.43 04.35 57.36 35.34 65.48 48.00 31.25 59.52 69.52 05.00 49.53 Ours-13B-Contrastive 40.95 08.70 50.39 45.69 72.22 64.00 37.50 55.95 74.29 07.50 53.05 Table 6: The performance of models on more challenging complex instructions with 6 to 7 constraints. The adversarial setting stress tests the generalization ability of LLMs in following complex instructions. 0 200 400 600 800 Training Steps 30 40 50 60 D I-level C I-level D C-level C C-level Content Example Format Situation Style Mixed T otal 0 20 40 60 80 Instruction-level Accuracy LLaMA2-13B-Chat Ours-D Ours-C Figure 3: The performance of training efficiency (left) and out-of-domain generalization (right). D and C denote Ours-13B-Discrimination and Ours-13BContrastive respectively. highlights the difficulty in obtaining high-quality output for complex instructions. Next, Ours-13Bdiscrimination achieves significant performance improvement, indicating that discrimination surpasses the generative paradigm in achieving high-quality output. Moreover, Ours-13B-contrastive performs the best, proving that our method excels in capturing subtle variations in complex instructions for the output. Training Efficiency. We compare the training efficiency of Ours-13B-Discrimination and Ours13B-Contrastive. Both use the same training data but employ different training methods: the former uses the next-token-prediction generation approach, while the latter uses our contrastive objective. As shown in Fig. 3 (left), Ours-13BContrastive achieves better performance with the same training steps and ultimately outperforms better than Ours-13B-Discrimination. This proves that our method utilizing both positive and negative samples can enhance complex instruction following ability more effectively and efficiently. 5.3 Generalization Experiments We investigate the generalizability of our framework from four perspectives. 5.3.1 Out-of-Domain Generalization We investigate whether the ability to follow complex instructions extends to unseen constraints. To achieve this, we evaluate models on an\fother instruction-following benchmark FollowBench (Jiang et al., 2023), which has the following features to outline: (1) It contains almost entirely different constraints from IFEval, such as style scenario, and example constraints. (2) It includes complex instructions of five difficulty levels. The difficulty level is denoted by incrementally increasing the same type of constraint to a seed instruction at each level. (3) Specifically, to mirror real-world scenarios, it introduces a Mixed Category. Instructions within this category encompass multiple constraints, akin to the compositional data in our study while incorporating different constraints. As shown in Fig. 3 (right), first, the performance of our methods generally drops compared to the backbone model when tested on individual, unseen constraints. This suggests that models training with certain constraints can hardly generalize to unseen constraints directly. However, surprisingly, our methods show a remarkable 12.92% improvement in performance in the Mixed Category. This proves that tuning with compositional data enhances the models\u2019 capacity to follow instructions covering multiple constraints, even if these constraints differ greatly from those in the training set. 5.3.2 In-Domain Generalization We construct a new test set to evaluate our methods\u2019 in-domain generalization, focusing on the same constraint but with varied wording and specific requirements. First, we select 200 instructions from the Open Assistant dataset (introduced in \u00a74.1) not in our training set. Next, we randomly choose 3 to 5 constraints from IFEval, pair them with descriptions from our description pool (\u00a74.1), and utilize GPT-3.5-turbo to paraphrase them, ensuring distinct descriptions from the training data. Additionally, we manually adjust specific requirements in the instructions, changing symbols (e.g., \"separated by 6 asterisk symbols ******\" to \"separate the responses with 6 hash signs: ######\") and formats (e.g., \"wrap the entire output in JSON format\" to \"I want the entire output in XML format\"). As shown in Tab. 5, Ours-13B-Contrastive remains the top performer. Additionally, the performance gap between Ours-13B-Contrastive and the best open-source model (OpenChat-13B-V3.2) has increased from 2.28 to 6.66. These results highlight the robustness of our method in handling complex instructions across different phrasing and detailed requirements within the same constraint category. Models ARC (25-shot) HellaSwag (10-shot) MMLU (5-shot) TruthfulQA (0-shot) Avg. LLaMA2-13B-Chat 59.04 81.94 54.64 44.12 59.94 WizardLM-13B-V1.2 59.04 82.21 54.64 47.27 60.79 OpenChat-13B-V3.2 59.64 82.68 56.68 44.49 60.87 Ours-13B-Discrimination 56.74 78.39 53.01 48.17 59.08 Ours-13B-Contrastive 57.76 79.95 53.79 48.15 59.91 Table 7: The performance of models on general tasks. 5.3.3 Adversarial Setting We compare models\u2019 performance on more challenging complex instructions with increased constraints. This adversarial setting stress tests the generalization capacity of LLMs in following complex instructions. Specifically, we utilize the same 200 seed instructions from \u00a75.3.2 and the method introduced in \u00a74.1 to append 6 to 7 constraints to the seed instructions. These new instructions are challenging since our training data contains 3 to 5 constraints. As shown in Tab. 6, Ours-13B-Contrastive outperforms all other models and significantly performs better than Ours-13B-Discrimination. This demonstrates our method utilizing positive and negative samples generalizes better to complex instructions than SFT only utilizing positive samples. 5.3.4 General Ability We test whether training with our synthesized complex instructions compromises LLMs\u2019 general ability. To achieve this, we evaluate models on four widely adopted benchmarks, reflecting the models\u2019 knowledge capability (MMLU (Hendrycks et al., 2020), TruthfulQA (Lin et al., 2021), ARC (Clark et al., 2018)), complex reasoning (HellaSwag (Zellers et al., 2019)). As shown in Tab. 7, our methods perform on par with other open-source LLMs, validating that our methods enhance the complex instructions following ability while maintaining the models\u2019 general ability. 6"
16
+ }
abs_9K/validation_abstract_short_2404.15848v2.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.15848v2",
3
+ "title": "Detecting Conceptual Abstraction in LLMs",
4
+ "abstract": "We present a novel approach to detecting noun abstraction within a large\nlanguage model (LLM). Starting from a psychologically motivated set of noun\npairs in taxonomic relationships, we instantiate surface patterns indicating\nhypernymy and analyze the attention matrices produced by BERT. We compare the\nresults to two sets of counterfactuals and show that we can detect hypernymy in\nthe abstraction mechanism, which cannot solely be related to the distributional\nsimilarity of noun pairs. Our findings are a first step towards the\nexplainability of conceptual abstraction in LLMs.",
5
+ "authors": "Michaela Regneri, Alhassan Abdelhalim, S\u00f6ren Laue",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-04-25",
8
+ "primary_cat": "cs.CL",
9
+ "cats": [
10
+ "cs.CL",
11
+ "cs.LG"
12
+ ],
13
+ "label": "Original Paper",
14
+ "paper_cat": "LLM Fairness",
15
+ "gt": "We present a novel approach to detecting noun abstraction within a large\nlanguage model (LLM). Starting from a psychologically motivated set of noun\npairs in taxonomic relationships, we instantiate surface patterns indicating\nhypernymy and analyze the attention matrices produced by BERT. We compare the\nresults to two sets of counterfactuals and show that we can detect hypernymy in\nthe abstraction mechanism, which cannot solely be related to the distributional\nsimilarity of noun pairs. Our findings are a first step towards the\nexplainability of conceptual abstraction in LLMs.",
16
+ "main_content": "Introduction Large Language Models (LLMs) have emerged as a powerful tool for a plethora of applications. State-of-the-art LLMs are based on the transformer architecture (Vaswani et al., 2017) that can directly generate text sequences (like chatbots), translate texts, or lend their outcomes to other downstream tasks. Due to their versatile functionality, LLMs are often distributed as pre-trained black-box models, which can then be fine-tuned to specific needs. While LLMs surpass the performance of simpler models, they are far less explainable due to the intransparent nature of their complex architecture. More explainability can be crucial in multiple applications, e.g., if models must adhere to some governance to prevent bias or build more data-efficient models. Especially in the context of trustworthy AI, one central open research question is how these models\u2019 excellent output is achieved and whether the mechanisms internally employed in LLMs reassemble those present in humans. We provide an analysis examining whether simple linguistic abstraction mechanisms are present in a large language model. For humans, relations like hypernymy (ravens are birds) are essential for linguistic understanding and generalization. LLMs also necessarily employ some kind of abstraction and generalization, but most likely not exactly in the same way as humans do. With our experiments, we add one more step toward representing hypernym relationships within large language models and, thus, their capacity to use humanlike abstraction mechanisms for generalization. Specifically, we test BERT (Devlin et al., 2019) for its attention patterns related to taxonomic hypernyms and compare this to unrelated noun pairs with either high or low semantic similarity. We draw our test data from a psychologically motivated data set of human associations, which lends itself to examining hypernym pairs with high cognitive saliency. Our results show that BERT represents this kind of abstraction within its attention module. Our main contribution consists of clear evidence that LLMs infer linguistic abstraction and that this inference goes beyond semantic similarity. For this, we provide both a method and a dataset to show the attention patterns of LLMs for semantic hypernymy and separate them from counterfactuals matched by semantic similarity and abstraction level. 2. Background and Related Work In the past years, the capabilities of LLMs have been enhanced tremendously. With transformer models (Vaswani et al., 2017) as an architectural basis, LLMs are trained on vast amounts of text and optimized to predict the next word in a sequence or the following sentence in a discourse. The resulting models have many applications and can model many arXiv:2404.15848v2 [cs.CL] 25 Apr 2024 \f#No Pattern 1 [hypo]s are [hyper]s. 2 That [hypo] is [a(n)] [hyper]. 3 I like [hypo]s and other [hyper]s. 4 The [hypo], which was the largest [hyper] among them, stood out. 5 I like [hypo]s, particularly because they are [hyper]s. Table 1: Hypernymy patterns, with [hypo] and [hyper] as slots for target and the feature concepts respectively. Plurals are indicated with s and [a(n)] is a determiner. linguistic phenomena known to be crucial for human language (Manning et al., 2020). When analyzing the emergence of linguistic phenomena, a particular focus lies on the self-attention mechanism of transformers. Self-attention is a step in the encoder part of these language models. It maps the input sequence to a weighted representation of itself and thus, intuitively speaking, reveals the sequence\u2019s focal points relevant to generating its follow-up. Selfattention consists of multiple so-called heads, which act in parallel on the sequence and are multiplied in several layers (see Vaswani et al. (2017) for details). The grid of attention heads with the individual scores they attach to the sequence is often treated as a proxy for the information encoded in the transformer. For some discussion on how far this is possible, see, e.g., Jain and Wallace (2019) and Wiegreffe and Pinter (2019). There are two types of approaches that recover linguistic structure in LLMs: One performs end-to-end evaluation by disabling or manipulating single attention heads and evaluating the performance change for different tasks (Kovaleva et al., 2019, e.g.). Others look directly into the attention patterns, which we also do. Baroni (2020) shows an overview of abstraction and compositionality in artificial neural networks. Many approaches use artificial languages and small models (Lake and Baroni, 2018; Hupkes et al., 2020, e.g.), others also test pretrained LLMs like BERT (Devlin et al., 2019). See Sajjad et al. (2023) for an overview. Several approaches have found evidence for linguistic knowledge within BERT. For instance, Chen et al. (2023) prompt the model with correct and counterfactual data and then infer BERT\u2019s abstraction capabilities. Only a few approaches show results for deep semantic knowledge directly within the attention mechanism. Dalvi et al. (2019b) try to discover latent concepts in BERT, which are essentially hypernyms and their derivable hyponyms. In our approach, we focus on hypernym-hyponym relations between nouns as one central linguistic abstraction phenomenon. For collecting hypernyms by prompting, Hanna and Mare\u02c7 cek (2021) present an experiment in which BERT outperforms other unsupervised algorithms in the collection of common hypernyms, which suggest that the model at least has the capacity to user hypernymy. This raises the questions on whether and how this is also internally represented in the trained model. To the best of our knowledge, there is no approach that characterizes attention patterns for generic hypernyms, especially no approach that distinguishes taxonomic relationships from pure semantic similarity. We take another step towards understanding conceptual abstraction in LLMs, evaluate the attention patterns related to true and counterfactual hypernyms, and show that the effects must be related to abstraction rather than similarity. 3. Data We create a data set of noun pairs that are in a hypernymy relationship, and two sets of counterfactual pairs (which are not hypernyms). In order to construct example sentences, we manually create patterns that typically express hypernymy in their surface form and instantiate them with the noun pairs. 3.1. Positive Examples We extract hyponym-hypernym pairs from McRae\u2019s feature norms (McRae et al., 2005). The feature norms contain pairs of concepts (originally stimuli) and features (human associations), annotated with semantic relationships. The pre-selection gives us more salient pairs of terms than a full-fledged taxonomy and should also be recognizable as strongly related by a large language model. For our data of valid noun pairs, we select all pairs of concepts and features labeled with a \u201csuperordi\fnate\u201d relationship in the feature norms. These concept-feature pairs have the target concept as a hyponym and the feature concept as a hypernym (e.g., raven and bird). The dataset can conatin multiple hypernyms for a concept with different levels of abstraction, e.g raven and bird as well as raven and animal. We include all such pairs in the dataset and balance them later with counterfactuals with similar degree of abstraction. 3.2. Creating Counterfactuals We create two counterfactual sets of noun pairs, which are not in a hypernymy relationship and thus will produce invalid sentences within our patterns. Using WordNet (Fellbaum, 1998), we generate the pairs by either sister terms of the feature concept from the positive examples (negative examples), which are matched by the level of abstraction of the feature concepts, or terms which share a hypernym with the target concepts (sister terms), which approximately match the level of similarity of the positive examples. With those two sets, we want to exclude spurious effects from just measuring semantic similarity or differences in concept abstraction level (and thus indirectly also frequency). Negative Examples For the first set of counterfactuals, we elicit noun pairs in which the feature concept is on the same level of generality as the hypernym in the first set. For instance, for the positive example raven \u2013 animal, we might choose raven \u2013 person. If there are multiple hypernyms for the same concept, we select an appropriate counterfactual for each individual hypernym. In detail, we proceed as follows: 1. We map each positive example to the WordNet synsets by extracting those synset pairs that contain the respective lemmas and stand in a (direct or inherited) hypernymy relationship in WordNet. 2. For each feature synset, we select a sister term (a synset sharing a parent node), which is no hypernym of the target concept (in the example, we pick a sister term of the alligator synset). To avoid effects from low-frequency words, we select the most frequent lemma from those sister synsets as a counterfactual (in the example person). Sister Terms Our second counterfactual set controls for the level of semantic similarity within the positive examples. Hyponyms and their hypernyms are often distributionally very similar (Pad\u00f3 and Lapata, 2007), especially salient ones. To measure whether we really find differences related to violations of taxonomic rules or just effects due to high semantic similarity, we pick a sister term in WordNet for each of the original target concepts (e.g., raven \u2013 crow, which are both hyponyms of bird). As for the negative examples, we choose the most frequent sister term lemma. Sister terms usually share many contexts, so we expect effects due to semantic similarity to be shared between the positive examples and the sister terms. 3.3. Creating Test Sentences As input for the LLM, we create test sentences that express a taxonomic relationship directly or indirectly. First, we manually create a set of five sentence patterns that exhibit hypernymy relationships, partially inspired by the patterns used by Hearst (1992) to extract hyponymhypernym pairs automatically from large text corpora. We vary the simplicity and saliency of the patterns to control for those effects. Table 1 shows the set of patterns. We instantiate our patterns with the noun pairs from all three sets, resulting in 3425 examples per set. The results are sentences like I like ravens and other animals (positive example), and I like ravens and other people (negative example) and I like ravens and other crows (sister term). We provide all data sets for reference. 4. Hypernymy within BERT We analyze whether or not hypernymy has a correlation with BERT\u2019s attention mechanism. After visualizing the attention for all datasets, we separate them via a linear classifier. For all \f(a) Forward positive (b) Forward negative (c) Forward sister Figure 1: Attention maps for hyponyms and hypernyms averaged across all patterns. experiments, we use BERT-large in the monolingual English version. 4.1. Attention Matrices and Clustering For each sentence, we extract the selfattention values from BERT. We restrict our analysis to the forward-looking attention between our target and feature tokens. Each sentence is represented by a 12x12 attention matrix (with 12 layers of 12 attention heads per layer). BERT\u2019s tokenizer breaks up some of our pluralized tokens, which makes the attention between a split token and a complete token incomparable. For the sake of simplicity, we discard all examples in which one of our tokens in focus is split up. Figure 1 gives a high-level overview of the results for each data set. For this visualization, we average the attention between target and feature concepts (resp. their sequence position) over all examples. Each cell in a heatmap corresponds to one attention head (x-axis) in one layer (y-axis). Dark colors indicate a high average activation of the attention head. Intuitively, we see that the three sets differ, so concept clashes in the negative set and the sister terms do expose different attention patterns than the salient hypernyms. Further, the overall attention seems lower in the positive setting than in the other two control settings. This suggests that higher attention here denotes some form of surprise for unexpected semantic constructions. To validate how well the three sets are separable, we employ logistic regression to recover the three test sets automatically. Each data point is the attention matrix of one example sentence, flattened into a 144-dimensional vector. For classification, we use the standard implementation of logistic regression from scikit-learn (Pedregosa et al., 2011) with all default parameter settings, setting the number of iterations to 1000 and the regularization parameter C to 1. We also perform a pairwise comparison of the different sets to understand how similar levels of abstraction (sister terms vs. negative) or similar levels of semantic similarity (positive vs. sister terms) of the test tokens influence the separability of the examples. 4.2. Results We find a prediction accuracy of 0.75 on the test sets for our overall comparison and similar scores for the pairwise separation (Table 2). Our three sets are equal-sized, so a random baseline would return an accuracy of about 0.33. All scores indicate a substantial differSets Acc. All three 0.75 Pos. vs. Neg. 0.88 Pos. vs. Sisters 0.84 Neg. vs. Sisters 0.85 Table 2: Accuracy for predicting the test sets. ence in attention patterns in the three sets. The positive and the negative examples are well separated. Here, we see the semantic type clash for non-hypernyms in a hypernymy pattern and the low semantic similarity of the target and feature concept. The sister terms are equally well distinguishable from both positive and negative examples, but the set is less well recoverable than the positive examples. \fThis means that the differences we see between positive and negative examples must be due to something different than semantic similarity because the sister terms are distributionally very similar to their matched positive examples. Further, the attention seems to represent the subtle difference between the two sets of counterfactuals internally, which points to interesting research questions on the level of abstraction within the transformer models. 4.3. Limitations Our approach takes a first step towards understanding linguistic abstraction in transformer models. Our experiments have several technical limitations and limitations in the interpretability of the results. First, we restrict ourselves to taxonomic hypernymy of nouns, which is only a small part of abstraction. Within this theoretical limitation, our dataset is also limited to the hyponymhypernym pairs from the feature norms we used as our source. The restriction to a dictionary-based definition of abstraction also affects our dataset. When assembling the counterfactuals fitted to the input data, we found that some of our counterfactuals are strictly speaking no hypernyms, but colloquially still treated as such, e.g., spatula \u2013 tool, or barn \u2013 shelter. We leave those examples in the dataset, which might have influenced our results. Further limitations of our input data result from our handling of tokenized words. We filter all words that are split up by the BERT tokenizer. There are several approaches that recombine subword tokens into whole words. Unfortunately, no standard approach fits all applications, so in future work, the most suitable way to retrieve whole words from subwords should be tested and applied. Lastly, like for every probing approach, the interpretability of our results is debatable. We have shown that words in a hypernymy relationship give rise to attention matrices that are well distinguishable from counterfactuals, which are semantically wrong assertions. One can argue that the results on our dataset mainly show that we can distinguish salient sentences from absurd ones. We think that the least our results show is that there is something that is regularly attached to hypernymy that the transformer learned. Otherwise, we would not be able to separate the two sets of counterfactuals, which both consist of unlikely sentences and which are not distinguishable in their degree of oddity (I like ravens and other crows is about as wrong as I like ravens and other people). The only nuance between those counterfactuals is the degree of abstraction in the target words. Moreover, they both are well separable from the correct sentences when matched on the level of abstraction. So, while we cannot (and did not) claim that we found the attention pattern that completely explains how taxonomic abstraction works in transformers, we can claim that there is more than semantic similarity and reasonable content that makes the differences we measure. 5. Summary and Future Work Our experiments show an initial indicator for linguistic, conceptual abstraction in the attention mechanism of LLMs. Based on sentence patterns that imply hyponymy relations of noun pairs, we showed that we can separate sentences with salient hyponym-hypernym pairs from counterfactuals in which target and feature concepts do not stand in a taxonomic abstraction relationship. Our setting shows that the level of abstraction in the counterfactual and the semantic similarity of target and feature concepts give rise to different patterns. Our approach can only give a limited first explanation of the presence of linguistic abstraction within transformers. Firstly, we restrict ourselves to noun pairs and hyponymy, while abstraction comprises many more types of words, relations, and complex mechanisms like frames or scenarios. Further, our experiments cannot explain how the differences in the attention mechanism arise and what they imply. To shed more light on these questions, further research is required, which should analyze both the mathematical theory of the abstraction mechanism and the statistical properties of the input word embeddings. This would make the mechanisms of conceptual abstraction within the transformer architecture more transparent. \fBibliographical"
17
+ }
abs_9K/validation_abstract_short_2404.15899v3.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.15899v3",
3
+ "title": "ST-MambaSync: The Complement of Mamba and Transformers for Spatial-Temporal in Traffic Flow Prediction",
4
+ "abstract": "Accurate traffic flow prediction is crucial for optimizing traffic\nmanagement, enhancing road safety, and reducing environmental impacts. Existing\nmodels face challenges with long sequence data, requiring substantial memory\nand computational resources, and often suffer from slow inference times due to\nthe lack of a unified summary state. This paper introduces ST-MambaSync, an\ninnovative traffic flow prediction model that combines transformer technology\nwith the ST-Mamba block, representing a significant advancement in the field.\nWe are the pioneers in employing the Mamba mechanism which is an attention\nmechanism integrated with ResNet within a transformer framework, which\nsignificantly enhances the model's explainability and performance. ST-MambaSync\neffectively addresses key challenges such as data length and computational\nefficiency, setting new benchmarks for accuracy and processing speed through\ncomprehensive comparative analysis. This development has significant\nimplications for urban planning and real-time traffic management, establishing\na new standard in traffic flow prediction technology.",
5
+ "authors": "Zhiqi Shao, Xusheng Yao, Ze Wang, Junbin Gao",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-05-09",
8
+ "primary_cat": "cs.LG",
9
+ "cats": [
10
+ "cs.LG",
11
+ "cs.AI",
12
+ "53A45",
13
+ "I.2.0"
14
+ ],
15
+ "label": "Original Paper",
16
+ "paper_cat": "Mamba",
17
+ "gt": "Accurate traffic flow prediction is crucial for optimizing traffic\nmanagement, enhancing road safety, and reducing environmental impacts. Existing\nmodels face challenges with long sequence data, requiring substantial memory\nand computational resources, and often suffer from slow inference times due to\nthe lack of a unified summary state. This paper introduces ST-MambaSync, an\ninnovative traffic flow prediction model that combines transformer technology\nwith the ST-Mamba block, representing a significant advancement in the field.\nWe are the pioneers in employing the Mamba mechanism which is an attention\nmechanism integrated with ResNet within a transformer framework, which\nsignificantly enhances the model's explainability and performance. ST-MambaSync\neffectively addresses key challenges such as data length and computational\nefficiency, setting new benchmarks for accuracy and processing speed through\ncomprehensive comparative analysis. This development has significant\nimplications for urban planning and real-time traffic management, establishing\na new standard in traffic flow prediction technology.",
18
+ "main_content": "Introduction Accurate traffic flow prediction is pivotal for optimizing traffic management, enhancing road safety, and reducing environmental impacts. Traditional models, however, struggle with the demands of processing long sequence data, requiring substantial memory and computational resources, and suffer from slow inference times due to the lack of a unified summary state. This paper introduces ST-MambaSync, a novel traffic flow prediction model that integrates transformer technology with the innovative ST-Mamba block, marking a significant advancement in the field. We are the first to implement the Mamba mechanism\u2014essentially an attention mechanism combined with ResNet\u2014within a transformer framework, significantly improving the model\u2019s explainability and performance. ST-MambaSync not only addresses key challenges related to data length and computational efficiency but also sets new standards for accuracy and processing speed through extensive comparative analysis. This breakthrough has profound implications for urban planning and real-time traffic management, establishing a new benchmark in traffic flow prediction technology. 1.1. Traditional Approaches for Traffic Flow Predictions The literature on traffic flow prediction has historically relied on several traditional methodologies that have been instrumental in laying the foundational understanding of this field. Early approaches include the Historical Average (HA) method (Smith, 1995), which predicts future traffic by averaging past data. While straightforward, this method often fails to capture sudden or atypical changes in traffic patterns. Further developments led to the adoption of the Autoregressive Integrated Moving Average (ARIMA) model, introduced in traffic studies by (Kumar and Vanajakshi, 2015). ARIMA models enhance forecasting accuracy by considering past values and their errors; however, they inherently assume linear relationships among data points, which limits their effectiveness in handling the non-linear dynamics typical of traffic flows. Another significant approach is the Support Vector Regression (SVR) model, utilized by (Wu et al., 2004) for traffic prediction. SVR has been preferred for its ability to handle non-linear data through the use of kernel functions. Despite its advantages, SVR, like its predecessors, struggles to manage the high-dimensional and Preprint submitted to Not sure. May 10, 2024 arXiv:2404.15899v3 [cs.LG] 9 May 2024 \fcomplex relationships present in traffic datasets. In addition to these methods, the k-Nearest Neighbors (k-NN) algorithm has also been applied to traffic flow prediction (Zhao et al., 2020). The k-NN method predicts traffic by considering the k most similar historical traffic patterns. While it can capture non-linear relationships, it is sensitive to the choice of k and may struggle with high-dimensional data. Moreover, researchers have explored the use of Kalman Filtering (KF) for traffic prediction (Guo et al., 2014). KF is a recursive algorithm that estimates the state of a system based on noisy measurements. It has been used to model the dynamic nature of traffic flows, but its performance can be affected by the quality of the initial estimates and the assumptions made about the system\u2019s behavior. While these traditional models have provided valuable insights and served as a stepping stone in the evolution of traffic flow prediction, their simplicity and linear assumptions often fall short in complex and dynamic traffic scenarios. This limitation is primarily due to their inability to fully capture the nonlinear interactions and dependencies inherent in traffic data, thus potentially compromising the accuracy of the predictions in more challenging environments. As traffic systems become increasingly complex, the need for more sophisticated, non-linear models that can effectively handle these complexities becomes evident, paving the way for the next generation of traffic prediction methodologies. 1.2. Deep Learning Method in Traffic Flow Prediction In recent years, the field of traffic flow prediction has seen notable progress with the integration of deep learning technologies. Deep learning models like Convolutional Neural Networks (CNNs) (Sayed et al., 2023) and Recurrent Neural Networks (RNNs) have been effective in understanding spatial and temporal patterns. CNNs are adept at handling spatial data but often falter with long-range temporal patterns. Conversely, RNNs, including variants like Long Short-Term Memory (LSTM) and Gated Recurrent Units (GRU), are good at temporal dynamics but struggle with very long-term dependencies due to issues like the vanishing gradient problem, which impedes their performance on lengthy sequences. Moreover, the inherently sequential processing of RNNs restricts their parallelization, slowing down both training and inference compared to CNNs. Transformers, originally designed for natural language processing, have recently been adapted for traffic flow prediction, introducing a new method for dependency recognition via self-attention mechanisms. These mechanisms allow Transformers to evaluate the significance of different segments of input data, enabling them to handle complex dependencies more effectively than RNNs and without the need for sequential data processing. This capacity to manage long-range dependencies has shown potential in enhancing the accuracy of predictions for long-term traffic flows. Despite their advantages, Transformers also face significant challenges. The self-attention mechanism, while effective, requires substantial computational resources, especially when applied to large traffic networks and extensive historical data. The computational demands of Transformers increase quadratically with the length of the input sequence, which can slow down both training and testing. The high computational needs may also limit the practicality of Transformers in real-time traffic management systems that require fast predictions. 1.3. State Space Model Given the limitations of existing deep learning methods, the Selective State of Space model (commonly referred to as Mamba) (Gu and Dao, 2024) stands out for its ability to deliver high-accuracy forecasts while requiring less computational effort. This efficiency is particularly crucial in both short-term and long-term traffic management scenarios, where quick and reliable predictions are vital for effective congestion control, route optimization, and traffic regulation. A recent study (Shao et al., 2024) marked the first to apply the Mamba model to spatial-temporal traffic flow prediction, demonstrating promising results in reducing computational costs. However, there remains room for improvement in balancing accuracy with manageable computational demands. This paper introduces the Spatial-Temporal Mamba Transformer (ST-MambaSync), a novel framework that efficiently integrates the popular transformer and Mamba methods for accurate traffic flow prediction. The ST-MambaSync model comprises two main components: the ST-Transformer and the ST-Mamba Block. The ST-Transformer efficiently processes data, capturing global information through spatial and temporal features. In contrast, the ST-Mamba Block, which includes an ST-Mixer, converts the tensor into a matrix. This matrix is then fed into the ST-Mamba layer, which updates individual hidden states and extends memory for long-range data, focusing more on local information. The combination on ST-Transformer and ST-Mamba Block not only enhances both global and local features but also accelerates computation, making it an effective component of our integrated approach for managing complex traffic data. 2 \f1.4. Contribution To the best of our knowledge, this paper introduces a groundbreaking integration of the selective state-of-space model (Mamba) with attention mechanisms specifically tailored for spatial-temporal data, establishing that Mamba effectively functions as a type of attention within a ResNet framework. The principal contributions of our research are summarized as follows: \u2022 This study is the first to combine Mamba and attention blocks to manage spatial-temporal data, enhancing both real-time and long-term traffic forecasting. \u2022 We provide theoretical evidence showing that the Mamba model operates as an attention mechanism within a ResNet framework. This integration with the Transformer and the ST-Mamba block significantly boosts the model\u2019s capacity to assimilate both comprehensive and granular information, thereby improving its performance in handling complex datasets. \u2022 Through rigorous testing on real-world traffic datasets, our model demonstrates superior performance relative to existing benchmarks, achieving notable gains in accuracy and efficiency while lowering computational demands. This innovative approach not only advances the field of traffic flow prediction but also sets a new standard for the application of hybrid models in complex data environments. 2. Preliminary and Problem Statement 2.1. Notations Road Network. In this study, we define a road network as a graph G = (V, E), where the node set V = v1, . . . , vN corresponds to N critical points such as traffic sensors and intersections on the roads. Each element of the edge set E \u2286V \u00d7 V represents a section of road. Within this network, Xt \u2208RN\u00d7d represents the traffic flow at the N nodes at any given timestamp t, encapsulating flow characteristics across these nodes, with d representing the dimensions of the features. Over a period T > 0, the traffic data is aggregated into a mode-3 tensor X \u2208RT\u00d7N\u00d7d, organizing the data along temporal, spatial, and feature-specific dimensions. Problem Statement. The objective of traffic flow forecasting is to predict future traffic conditions accurately using historical data. For this purpose, we define a function f within the context of a road network G, which leverages traffic flow data from the past M timestamps to forecast traffic conditions over the next Z timestamps. This relationship can be mathematically formulated as: f ([Xt\u2212M+1, . . . , Xt]; G) 7\u2192[Xt+1, . . . , Xt+Z], where Xt denotes the traffic flow tensor at time t. Throughout the model learning phase, we define t to range from M to T \u2212Z in order to efficiently utilize the observed traffic flow tensor X. 2.2. Attention The self-attention mechanism, originally conceived for natural language processing (NLP), enriches the representation of feature data by revealing the underlying \u201cself-attention\u201d within the data set. Beginning with the input X \u2208RN\u00d7d, the mechanism constructs queries (Q), keys (K), and values (V) via transformation matrices: Q = XWQ, K = XWK, V = XWV, (1) where WQ \u2208Rd\u00d7dq, WK \u2208Rd\u00d7dk, WV \u2208Rd\u00d7dv are weight matrices that are learned, and dq = dk = dv = d0 for simplicity. Attention scores are computed by the scaled dot-product of queries and keys: A = QK\u22a4 \u221adk , (2) where scaling by \u221adk provides numerical stability. The attention scores A are normalized using the softmax function to obtain the attention weights O: O = softmax(A). (3) 3 \fThe final representation Y emerges as the weighted sum of the values: Y = OV. (4) Multi-head attention leverages multiple \u201cheads\u201d of Q, K, and V to explore different representation subspaces, creating a rich, integrated output. Remark 1: We standardize dq = dk = dv = d0 to ensure uniform dimensions across the attention mechanism\u2019s architecture. 2.3. State of Space Model The state-space representation of a continuous-time linear time-invariant system can be described by the following differential equations: h(t) = Ah(t \u22121) + Bu(t \u22121) (5) y(t) = Ch(t) + Du(t) (6) The solution to the state equation over a time interval can be given by: h(tb) = eA(tb\u2212ta)h(ta) + Z tb ta eA(tb\u2212\u03c4)B(\u03c4)u(\u03c4) d\u03c4 (7) In discrete time-steps, the state at step b is given by: hb = eA(\u2206a+\u00b7\u00b7\u00b7+\u2206b\u22121) \uf8eb \uf8ec \uf8ec \uf8ec \uf8ec \uf8ec \uf8ec \uf8edha + b\u22121 X i=a Biuie\u2212A(\u2206a+\u00b7\u00b7\u00b7+\u2206i)\u2206i \uf8f6 \uf8f7 \uf8f7 \uf8f7 \uf8f7 \uf8f7 \uf8f7 \uf8f8 (8) For the transition from state ha to state ha+1, the following discrete update can be used: ha+1 = eA\u2206a \u0010 ha + Bauae\u2212A\u2206a\u0011 (9) = eA\u2206aha + Baua (10) = \u02c6 Aaha + \u02c6 Baua (11) 3. Method Adoptive Embedding (trainable) N \u00d7 d ST-Mixer Layernorm Input Spatial Temporal Data Data Embedding Features ST-Mamba Block Regression ST-Mamba Layer ST-Mamba Block Input T step Output Z step traffic tensor The historical Prediction Final Output Concat Time-of-day; Day of the week SiLU / Swish Activation Linear Projection L S X Nonlinearity (Activation/Multiplication) S X L ST-Mamba Layer Layernorm Conv SSM L ST-Transformer Block Q K V Temporal Attention Layer Q K V Spatial Attention Layer Feed Forward & Layernorm Feed Forward & Layernorm ST-Transformer Block L S L layers L layers Figure 1: The framework of proposed ST-MambaSync. 4 \f3.1. Data Embedding To encapsulate and reflect the dynamic temporal patterns present within the traffic data, we utilized a modifiable data embedding layer that processes the sequential input Xt\u2212M+1:t. Through the application of a dense neural layer, we extract the intrinsic feature embedding Zf t \u2208RM\u00d7N\u00d7de: Zf t = Dense(Xt\u2212M+1:t) (12) Here, de signifies the dimension of the embedded features, and Dense(\u00b7) represents the applied dense layer. Furthermore, we introduce a parameterized dictionary for the embedding of weekdays Zw \u2208R7\u00d7de and another for the embedding of distinct times of the day Zh \u2208R288\u00d7de, encapsulating the cyclical nature of weeks with 7 days and days with 288 time intervals. With Wt \u2208RM representing the weekday index and Ht \u2208RM representing the time-of-day index over the period from t \u2212M + 1 to t, we map these indices to their respective embeddings, yielding the weekday embedded features Zwt \u2208RM\u00d7de and time-of-day embedded features Zht \u2208RM\u00d7de. The combination and expansion of these embeddings generate the cyclical feature embedding Zc t \u2208RM\u00d7N\u00d72de, which is utilized to incorporate periodic patterns into the traffic data. Considering the rhythmic progression of time and the interlinked nature of traffic events, traffic sensors yield data with unique temporal traits. To address the need for a uniform approach to encapsulate these spatio-temporal dynamics, a shared spatio-temporal adaptive embedding, Zs t \u2208RM\u00d7N\u00d7ds, is put forth. This embedding is initialized utilizing Xavier uniform initialization, a technique that primes the model\u2019s weights to avoid excessively large or small gradients initially, and thereafter, it is treated as a model parameter. The integration of the aforesaid embeddings results in a hidden spatio-temporal representation Z \u2208RM\u00d7N\u00d7dh: Zt = Concatenate(Zf t ; Zc t ; Zs t ) (13) In this equation, the concatenation operation is denoted by a comma, and the dimension of the hidden representation dh is computed as 3de + ds. 3.2. Spatial Temporal Transformer (ST-Transformer Block) We utilize standard transformers along both temporal and spatial dimensions to understand complex traffic interactions. Given a hidden spatio-temporal matrix Z \u2208RT\u00d7N\u00d7dh, where T is the number of frames and N represents spatial nodes, we derive the query, key, and value matrices using temporal transformer layers as follows: Q(te) = ZW(te) Q , (14) K(te) = ZW(te) K , (15) V(te) = ZW(te) V , (16) where W(te) Q , W(te) K , W(te) V \u2208Rdh\u00d7dh are learnable parameters. The self-attention scores are computed as: A(te) = Softmax Q(te)(K(te))\u22a4 \u221adh ! , (17) capturing temporal connections across different spatial nodes. The output of the temporal transformer, Z(te) \u2208 RT\u00d7N\u00d7dh, is then obtained as: Z(te) = A(te)V(te). (18) In a similar fashion, the spatial transformer layer functions by processing Z(te) through self-attention (following the same equations) to produce Z(sp) \u2208RT\u00d7N\u00d7dh. Important enhancements include layer normalization, residual connections, and a multi-head mechanism. 3.3. Spatial Temporal Selective State of Spatial (ST-Mamba block) As depicted in Figure 1, following the adaptive ST-Transformer block, our framework employs a simplified ST-Mamba block. This block features an ST-Mamba layer designed to reduce computational costs and to enhance long-term memory. To feed the input to ST-Mamba block, we employ a tersor reshape named as ST-mixer as: 5 \fST-mixer. To effectively blend spatial and temporal data, the ST-SSMs utilize tensor reshaping, as detailed in Figure 1, to transform tensor Z(sp) into matrix \u00af X. This transformation involves aligning and concatenating the tensor slices across each time step t as follows: \u00af X = reshape(Z(sp)). (19) Through this reshaping, we obtain a new embedding \u00af X in RT \u00d7dh, where T encapsulates the total temporal length T \u00d7 N, representing the spatial dimension. This reshaping facilitates the unified processing of spatial and temporal information, thereby capturing complex patterns in the data more effectively. 3.3.1. ST-Mamba Layer The ST-Mamba layer, as described in Section 2.3, utilizes the discretization of continuous state-space models (SSM). We denote the input to the ST-Mamba block as H, which is obtained by applying LayerNorm to \u00af X. This processed input is then subjected to the selective state-space model (SSM) layer, where a linear transformation produces: U = Linear(H), (20) with U \u2208Rdh\u00d7T representing the hidden state\u2019s latent representation at each iteration step k. The objective is to calculate the output Y \u2208Rdinner\u00d7T , which is then projected back to match the input\u2019s dimensions T \u00d7 dh. Parameter Initialization. Initializing parameters in the ST-SSM is vital for its operation: \u2022 A \u2208Rdinner\u00d7dstate: This structured state transition matrix is initialized using HiPPO to ensure capturing of long-range dependencies. \u2022 B \u2208Rdstate\u00d7T : Calculated as B = sB(U), where sB(\u00b7) is a learnable linear projection. \u2022 C \u2208Rdstate\u00d7T : Output projection matrix, derived as C = sC(U), where sC(\u00b7) is a learnable projection. \u2022 D \u2208Rdinner: A learnable parameter that facilitates the direct transfer of information from input to output, bypassing the state transformation. \u2022 \u2206\u2208Rdstate\u00d7T : Step size parameter, determined using \u2206= \u03c4\u2206(Parameter + s\u2206(U)), with \u03c4\u2206being the softplus function and s\u2206(\u00b7) a linear projection. Discretization and Output Computation. The conversion of continuous-time parameters into discrete-time SSM parameters involves: \u02dc A = exp(\u2206A), (21) \u02dc B = A\u22121(exp(\u2206A) \u2212I)B, (22) where exp(\u00b7) is the matrix exponential function, and I represents the identity matrix of suitable size. These discrete-time matrices, \u02dc A and \u02dc B, facilitate the recurrence within the selective ST-Mamba layer: Hk = \u02dc A \u2299Hk\u22121 + \u02dc B \u2299Uk, (23) Yk = C \u2299Hk + D \u2299Uk, (24) with \u2299denoting the Hadamard product. This iterative process spans each step from k = 1 to T , ensuring that each data step is transformed through the SSM layer. The final output, Y, is reshaped into RT \u00d7dinner to align with the original input dimensions. 3.3.2. ST-Mamba block and Regression Layer Normalization Layer. Within the ST-Mamba block, the normalization of layers is crucial for improving the training\u2019s stability and efficiency. Specifically, consider an input matrix Y with dimensions RT \u00d7dh, where T represents the sequence length or sample count, and dh indicates the features\u2019 dimensional space. The normalization process is described by: Normalization(Y) = \u03b3 \u2299 Y \u2212\u00b5 \u221a \u03c32 + \u03f5 + \u03b2. (25) In this formula, \u00b5 and \u03c32 are the mean and variance computed along the features\u2019 dimension dh, resulting in vectors of size T \u00d71. The scale (\u03b3) and shift (\u03b2) parameters, each sized 1\u00d7dh, are adjustable, optimizing the normalization\u2019s impact. This process ensures stability in the model\u2019s learning phase while allowing the reintegration of the original activations distribution if it improves model performance. The addition of \u03f5, a small constant, prevents any division by zero, maintaining numerical stability. Through layer normalization, the model effectively reduces internal covariate shift, enhancing training speed and boosting overall deep learning performance. 6 \fRegression Layer. As in Referring to Figure 1, the output from the ST-Mamba block passes through a normalization step before reaching the regression layer, which is structured as follows: \u00af Y = Normalization(Y) + \u00af X (26) Y = FC( \u00af Y) (27) In this configuration, FC(\u00b7) denotes the fully connected layer that processes the normalized data. The resultant Y, existing within the dimensional space RZ\u00d7N\u00d7d, marks the culmination of the process. This structured approach showcases how architectural enhancements are designed to improve the training of deep networks and accurately interpret complex, multi-dimensional datasets. 3.4. Analysis of Mamba and Attention Lemma 1 (Analogy Between Attention and Linear Regression). Given a dataset {(xi, yi)}N i=1 where xi \u2208Rd and yi \u2208R, consider a linear regression model defined by y = xT i \u03c9, where \u03c9 \u2208Rd. The least squares solution for the model coefficients \u02c6 \u03c9 is expressed as \u02c6 \u03c9 = (XT X)\u22121XTy, enabling predictions \u02c6 y on the training data to be given by \u02c6 y = X \u02c6 \u03c9 = X(XT X)\u22121XTy. This form of linear prediction can be interpreted as an attention mechanism, where each prediction is a weighted sum of all outputs, with weights determined by the matrix multiplication X(XT X)\u22121XT. Proof. For the given data {(xi, yi)}N i=1, define the matrix X and vector y as: X = \uf8ee \uf8ef \uf8ef \uf8ef \uf8ef \uf8ef \uf8ef \uf8ef \uf8ef \uf8ef \uf8ef \uf8f0 xT 1 . . . xT N \uf8f9 \uf8fa \uf8fa \uf8fa \uf8fa \uf8fa \uf8fa \uf8fa \uf8fa \uf8fa \uf8fa \uf8fb \u2208RN\u00d7d, y = \uf8ee \uf8ef \uf8ef \uf8ef \uf8ef \uf8ef \uf8ef \uf8ef \uf8ef \uf8ef \uf8ef \uf8f0 y1 . . . yN \uf8f9 \uf8fa \uf8fa \uf8fa \uf8fa \uf8fa \uf8fa \uf8fa \uf8fa \uf8fa \uf8fa \uf8fb \u2208RN. (28) The least squares solution is given by: \u02c6 \u03c9 = (XT X)\u22121XTy. (29) Using this solution, the model prediction on the training data is: \u02c6 y = X \u02c6 \u03c9 = X(XT X)\u22121XTy, (30) where each element \u02c6 yi for i = 1, . . . , N can be expressed as: \u02c6 yi = N X j=1 ai jy j, (31) with aij = xT i (XT X)\u22121x j. These coefficients ai j are analogous to attention scores, typically denoted as QKT in attention mechanisms. Each \u02c6 yi represents a weighted average over all outputs, where the weights are the similarities (or \u2019attention\u2019) the model pays to each training value based on xi. For a new data point x\u2032, the prediction \u02c6 y(x\u2032) by the model is: \u02c6 y(x\u2032) = x\u2032(XT X)\u22121XTy, (32) which can be interpreted as the weighted sum of the training data targets, where the weights are the similarities between the new data point x\u2032 and the training data points, akin to QKT, with y analogous to V in attention mechanisms. Proposition 1 (Extension to Spatial State Models). In the context of Spatial State Models (SSMs), the discrete update equation can be modeled through dynamics analogous to attention mechanisms. Specifically, for each state update: ha+1 = eA\u2206aha + Bauae\u2212A\u2206a\u2206AeA\u2206a, where Qm = Ba, Km = ua, and W = eA\u2206a play roles analogous to query, key, and weight transformations in attention mechanisms. This results in an attention-like score for each input that directly influences the model\u2019s state updates. Proof. For each discrete update, the SSMs are actually finding an attention score for each of the inputs ua and a learnable linear projection of the input ua (denoted as Ba). To find the final results, we define Vm as Ca, representing the values in the attention mechanism, and then: y = W\u22121 \u0010 QmKT m \u0011 Vm + WVm\u03b2ha+1. (33) The first term resembles the attention mechanism, capturing the weighted importance of different inputs. The second term incorporates the updated hidden state, structured analogously to a Residual Network (ResNet), where the hidden state is updated by adding a transformed version of itself. 7 \fCorollary 1. The attention mechanism formalism enables SSMs to perform weighted sums of inputs, akin to how attention in neural networks aggregates information. This approach enhances the ability of SSMs to dynamically adjust to changing inputs and efficiently compute new states, facilitating more robust predictions and state estimations. 3.5. The iteration expression on ST-MambaSync In ST-MambaSync, the input vector Z initially passes through an attention layer and then proceeds to an ST-Mamba Layer. The transformer component primarily captures global information, while the integration with the ST-Mamba block, proven to be an attention mechanism combined with ResNet, complements this by focusing on local details. This combination effectively enhances the transformer\u2019s ability to manage both global and local information, significantly improving the model\u2019s overall predictive accuracy and efficiency. 4. Experiment 4.1. Data Description and Baseline Models Datasets. We test our method on six major traffic forecasting benchmarks, namely METR-LA, PEMS-BAY, PEMS03, PEMS04, PEMS07, and PEMS08, to verify its effectiveness. The datasets under consideration feature a time resolution of 5 minutes, which results in 12 data frames being recorded for every hour. The detail of the data is summarized in Table 1. Table 1: Summary of Datasets. Dataset #Sensors (N) #Timesteps Time Range METR-LA 207 34,272 03/2012 06/2012 PEMS-BAY 325 52,116 01/2017 05/2017 PEMS03 358 26,209 05/2012 07/2012 PEMS04 307 16,992 01/2018 02/2018 PEMS07 883 28,224 05/2017 08/2017 PEMS08 170 17,856 07/2016 08/2016 Baseline Models. In our comparative analysis, we evaluate the performance of our proposed approach against a comprehensive set of baselines within the traffic forecasting domain. \u2022 Historical Index (HI) (Cui et al., 2021): serving as the conventional benchmark, reflecting standard industry practices. Our examination extends to a series of Spatial-Temporal Graph Neural Networks (STGNNs)\u2014including \u2022 GWNet (Wu et al., 2020a): proposing a graph neural network framework that automatically extracts unidirected relations among variables, addressing the limitation of existing methods in fully exploiting latent spatial dependencies in multivariate time series forecasting. \u2022 DCRNN (Li et al., 2018): introducing the Diffusion Convolutional Recurrent Neural Network for traffic forecasting which captures both spatial and temporal dependencies. \u2022 AGCRN (Bai et al., 2020): introducing adaptive modules to capture node-specific patterns and infer interdependencies among traffic series which provides fine-grained modeling of spatial and temporal dynamics in traffic data. \u2022 STGCN (Yu et al., 2018): proposing a deep learning framework that integrates graph convolutions for spatial feature extraction and gated temporal convolutions for temporal feature extraction. \u2022 GTS (Shang et al., 2021): proposing a method for forecasting multiple interrelated time series by learning a graph structure simultaneously with a Graph Neural Network (GNN) which addresses the limitations of a previous method. \u2022 MTGNN (Wu et al., 2020b): proposing a graph neural network framework that automatically extracts uni-directed relations among variables which captures both spatial and temporal dependencies. 8 \f\u2022 GMAN (Zheng et al., 2020): introducing a graph-based deep learning model that incorporates spatial and temporal attention mechanisms to capture dynamic correlations among traffic sensors. Recognizing the potential of Transformer-based models in time series forecasting, we particularly focus on: \u2022 PDFormer (Jiang et al., 2023): introducing a traffic flow prediction model that captures dynamic spatial dependencies, long-range spatial dependencies, and the time delay in traffic condition propagation. \u2022 STAEformer (Liu et al., 2023): proposing a spatio-temporal adaptive embedding that enhances the performance of vanilla transformers for traffic forecasting. and which are adept at short-term traffic forecasting tasks. Additionally, we explore \u2022 STNorm (Deng et al., 2021): leveraging spatial and temporal normalization modules to refine the highfrequency and local components underlying the raw data. \u2022 STID (Shao et al., 2022): proposing an approach that addresses the indistinguishability of samples in both spatial and temporal dimensions by attaching spatial and temporal identity information to the input data. Those diverse range of models allows for a robust validation of our proposed method\u2019s capabilities. 4.2. Experiment Setup Implementation. All experiments were carried out on a machine equipped with an RTX 3090 GPU (24GB) and a 15-core CPU. The data from the PEMS-BAY, PEMS03, PEMS04, PEMS07, and PEMS08 datasets were divided into training, validation, and test sets. PEMS-BAY was split in a 7:1:2 ratio, whereas PEMS03, PEMS04, PEMS07, and PEMS08 were divided using a 6:2:2 ratio. The embedding dimension (df ) was set to 24 and the attention dimension (da) to 80. The model architecture includes a single layer for both spatial and temporal transformers, with four heads, and one ST-Mamba layer with the expansion dimension set to 2. Both the input and forecast horizon were defined as 1 hour, equivalent to M = Z = 12. Optimization was performed using the Adam optimizer, starting with a learning rate of 0.001 that gradually decreased, and a batch size of 16. To improve training efficiency, an early stopping mechanism was implemented, ceasing training if the validation error did not improve after 30 consecutive iterations. Metric. To evaluate the performance of traffic forecasting methods, three prevalent metrics are employed: the Mean Absolute Error (MAE), the Mean Absolute Percentage Error (MAPE), and the Root Mean Square Error (RMSE). These metrics offer a comprehensive view of model accuracy and error magnitude. They are defined as follows: \u2022 MAE (Mean Absolute Error): quantifies the average magnitude of the errors in a set of predictions, without considering their direction. It\u2019s calculated as: MAE = 1 n n X i=1 |\u02c6 yi \u2212yi|, \u2022 MAPE (Mean Absolute Percentage Error): expresses the error as a percentage of the actual values, providing a normalization of errors that is useful for comparisons across datasets of varying scales. It\u2019s given by: MAPE = 1 n n X i=1 \f \f \f \f \f \u02c6 yi \u2212yi yi \f \f \f \f \f \u00d7 100, \u2022 RMSE (Root Mean Square Error): measures the square root of the average squared differences between the predicted and actual values, offering a high penalty for large errors. This metric is defined as: RMSE = v t 1 n n X i=1 (\u02c6 yi \u2212yi)2. In these equations, y = {y1, y2, . . . , yn} represents the set of ground-truth values, while \u02c6 y = {\u02c6 y1, \u02c6 y2, . . . , \u02c6 yn} denotes the corresponding set of predicted values. Through the utilization of MAE, MAPE, and RMSE, a thorough evaluation of model performance in forecasting traffic conditions can be achieved, highlighting not just the average errors but also providing insights into the distribution and proportionality of these errors relative to true values. 9 \fTable 2: Performance comparison of models on PEMS datasets, here we denote N as the number of sensors for each dataset. Model PEMS03 (N=358) PEMS04 (N=307) PEMS07(N=883) PEMS08(N=170) MAE RMSE MAPE MAE RMSE MAPE MAE RMSE MAPE MAE RMSE MAPE HI 32.62 49.89 30.60% 42.35 61.66 29.92% 49.03 71.18 22.75% 36.66 50.45 21.63% GWNet 14.59 25.24 15.52% 18.53 29.92 12.89% 20.47 33.47 8.61% 14.40 23.39 9.21% DCRNN 15.54 27.18 15.62% 19.63 31.26 13.59% 21.16 34.14 9.02% 15.22 24.17 10.21% AGCRN 15.24 26.65 15.89% 19.38 31.25 13.40% 20.57 34.40 8.74% 15.32 24.41 10.03% STGCN 15.83 27.51 16.13% 19.57 31.38 13.44% 21.74 35.27 9.24% 16.08 25.39 10.60% GTS 15.41 26.15 15.39% 20.96 32.95 14.66% 22.15 35.10 9.38% 16.49 26.08 10.54% MTGNN 14.85 25.23 14.55% 19.17 31.70 13.37% 20.89 34.06 9.00% 15.18 24.24 10.20% STNorm 15.32 25.93 14.37% 18.96 30.98 12.69% 20.50 34.66 8.75% 15.41 24.77 9.76% GMAN 16.87 27.92 18.23% 19.14 31.60 13.19% 20.97 34.10 9.05% 15.31 24.92 10.13% PDFormer 14.94 25.39 15.82% 18.36 30.03 12.00% 19.97 32.95 8.55% 13.58 23.41 9.05% STID 15.33 27.40 16.40% 18.38 29.95 12.04% 19.61 32.79 8.30% 14.21 23.28 9.27% STAEformer 15.35 27.55 15.18% 18.22 30.18 11.98% 19.14 32.60 8.01% 13.46 23.25 8.88% ST-MambaSync 15.30 27.47 15.18% 18.20 29.85 12.00% 19.14 32.58 7.97% 13.30 23.14 8.80 % 4.3. Performance Evaluation To assess the effectiveness of the ST-MambaSync model, we utilized six real-world datasets varying significantly in complexity and scale. The datasets range from METR-LA, which includes 207 sensors, to PEMS07, encompassing 883 sensors. This selection provides a broad spectrum of urban traffic patterns and sensor network densities, potentially impacting the predictive performance of the model. The most outstanding results across these evaluations are denoted in red to highlight superior performance. Analysis of Performance Metrics. The results are shown in Table 2, the ST-MambaSync model showcases its performance across four different PeMS datasets with a focus on three key metrics: MAE, RMSE, and MAPE. Particularly notable is its performance on the PEMS08 dataset, where ST-MambaSync achieves the lowest MAE of 13.30 and RMSE of 23.14, along with a MAPE of 8.80%, indicating superior accuracy compared to other models. Although the model performs consistently across other datasets, such as PEMS03 and PEMS04 with competitive MAEs and RMSEs, it stands out in PEMS08, suggesting its effectiveness in environments with similar traffic patterns and sensor configurations. Detailed Analysis Based on Time Horizons. As the performance results showing in Table 3, the models are evaluated across multiple time horizons (15 minutes, 30 minutes, 60 minutes) on the METR-LA and PEMS-BAY datasets. the ST-MambaSync model demonstrates competitive accuracy, particularly excelling in the PEMS-BAY dataset across all time horizons. The visual comparison helps to underscore differences in performance stability and prediction accuracy between models, reaffirming the strengths of ST-MambaSync in shorter forecasting intervals. 4.4. Ablation Study In this subsection, we conduct various ablation studies, including adjustments to the layer configurations in both the attention-based and Mamba-based models. Additionally, we analyze the trade-offs between accuracy and computational efficiency. 4.4.1. Vanellia Ablation Study We conducted a comparative analysis with the attention-based model (STAEFormer) (Liu et al., 2023), the Mamba-based model (ST-SSMs) (Shao et al., 2024), and our newly proposed hybrid model (ST-MambaSync). Notably, STAEFormer employs three attention layers. To investigate the impact of the number of attention layers on performance, we modified the STAEFormer by varying the number of layers. As illustrated in Table 4, the comparison underscores the trade-offs between prediction accuracy and computational efficiency across the models. STAEFormer, with multiple attention layers, achieves a competitive mean absolute error (MAE) range of 13.49 to 13.77 but requires substantial computational resources (8.84 to 9.16 FLOPS) and exhibits longer inference (1.20s to 3.03s) and training durations (14s to 36s). Conversely, ST-SSMs, which incorporates a single Mamba layer and no attention layers, shows a high accuracy (MAE of 13.40) with significantly lower computational demands (FLOPS of 0.43), making it an effective option for efficient traffic flow prediction. The ST-MambaSync model, combining 10 \fTable 3: Performance on METR-LA and PEMS-BAY, we denote N as the number of sensors for each dataset. Horizon Metric HI GWNet DCRNN AGCRN STGCN GTS MTGNN STNorm GMAN PDFormer STID STAEformer ST-MambaSync METR-LA(N=325) (15 min) MAE 6.80 2.69 2.67 2.85 2.75 2.75 2.69 2.81 2.80 2.83 2.82 2.65 2.63 RMSE 14.21 5.15 5.16 5.53 5.29 5.27 5.16 5.57 5.55 5.45 5.53 5.11 5.05 MAPE 16.72 6.99 6.86 7.63 7.10 7.12 6.89 7.40 7.41 7.77 7.75 6.85 6.80 (30 min) MAE 6.80 3.08 3.12 3.20 3.15 3.14 3.05 3.18 3.12 3.20 3.19 2.97 2.91 RMSE 14.21 6.20 6.27 6.52 6.35 6.33 6.13 6.59 6.49 6.46 6.57 6.00 6.07 MAPE 16.72 8.47 8.42 9.00 8.62 8.62 8.16 8.47 8.73 9.19 9.39 8.13 8.08 (60 min) MAE 6.80 3.51 3.54 3.59 3.60 3.59 3.47 3.57 3.44 3.62 3.55 3.34 3.31 RMSE 14.20 7.28 7.47 7.45 7.43 7.44 7.21 7.51 7.35 7.47 7.55 7.02 7.02 MAPE 10.15 9.96 10.32 10.47 10.35 10.25 9.70 10.24 10.07 10.91 10.95 9.70 9.70 PEMS-BAY(N=207) (15 min) MAE 3.06 1.30 1.31 1.35 1.36 1.37 1.33 1.33 1.35 1.32 1.31 1.31 1.30 RMSE 7.05 2.73 2.76 2.88 2.88 2.92 2.80 2.82 2.90 2.83 2.79 2.78 2.75 MAPE 6.85 2.71 2.73 2.91 2.86 2.85 2.81 2.76 2.87 2.78 2.78 2.76 2.75 (30 min) MAE 3.06 1.63 1.65 1.67 1.70 1.72 1.66 1.65 1.65 1.64 1.64 1.62 1.63 RMSE 7.04 3.73 3.75 3.82 3.84 3.86 3.77 3.77 3.82 3.79 3.73 3.68 3.62 MAPE 6.84 3.73 3.71 3.81 3.79 3.88 3.75 3.66 3.74 3.71 3.73 3.62 3.61 (60 min) MAE 3.05 1.99 1.97 1.94 2.02 2.06 1.95 1.92 1.91 1.91 1.91 1.88 1.87 RMSE 7.03 4.60 4.60 4.50 4.63 4.60 4.50 4.45 4.49 4.43 4.42 4.34 4.30 MAPE 6.83 4.71 4.68 4.55 4.72 4.88 4.62 4.46 4.52 4.51 4.55 4.41 4.40 Table 4: Performance comparison on the PEMS08 dataset Model MAE RMSE MAPE FLOPS(M) Inference (s) Train (s) STAEformer (attention 3 layers) 13.49 23.30 8.84 4.24 3.03 36 STAEformer (attention 2 layers) 13.54 23.47 8.887 2.87 2.09 23 STAEformer (attention 1 layer) 13.77 23.27 9.16 1.49 1.20 14 ST-SSMs(mamba 3 layer) 13.45 23.08 8.96 1.07 3.64 42 ST-SSMs(mamba 2 layer) 13.43 23.14 8.95 0.75 2.56 28 ST-SSMs (mamba 1 layer) 13.40 23.20 9.00 0.43 1.18 14 ST-MambaSync (mamba 1 layer & attention 1 layer) 13.30 23.144 8.80 1.49 2.65 29 ST-MambaSync (mamba 1 layer & attention 2 layer) 13.37 23.42 8.98 2.87 3.40 33 ST-MambaSync (mamba 2 layer & attention 1 layer) 13.45 24.16 10.98 1.49 2.96 30 one Mamba layer with one attention layer, outperforms others by achieving the lowest prediction error (MAE of 13.30) while maintaining reasonable computational efficiency (1.49 FLOPS). Its inference and training times are 2.65s and 29s, respectively, indicating its suitability for practical implementation in real-world traffic management systems. Increasing the number of Mamba or attention layers in ST-MambaSync, however, results in diminished performance compared to configurations with a single layer of each type. Nevertheless, the integrated approach of combining Mamba and attention layers generally surpasses models utilizing only one of these mechanisms. 4.4.2. Trade Off Analysis on Accuracy and Computation We further conduct a trade-off analysis on the attention-based model and the Mamba-based model, which aids in investigating the combined efficiency of our proposed ST-MambaSync. The results of the trade-off analysis on accuracy and computational effectiveness are presented in Figure 2. The analysis begins by examining two aspects: the increase in attention layers and the increase in Mamba layers. Increase in Attention Layers. In attention-based models, an increase in the number of attention layers leads to higher FLOPS and computational times, although with improved accuracy. For our integrated model, ST-MambaSync, maintaining a single Mamba layer while increasing the number of attention layers results in a doubling of FLOPS and a significant increase in computational time, without a corresponding improvement in accuracy. Increase in Mamba Layers. For the Mamba-based model, ST-SSMs, an increase in Mamba layers results in higher FLOPS and extended computational times, but surprisingly, accuracy decreases. This observation suggests that a single Mamba layer is optimal for balancing accuracy and computational efficiency in the integrated ST-MambaSync model. To enhance prediction accuracy without significantly increasing computational burden, incorporating a single attention layer is the most effective strategy. The optimal configuration for achieving the highest accuracy 11 \f13.3 13.4 13.5 13.6 13.7 Mean Absolute Error (MAE) 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 FLOPS (Millions) STAEformer A3 (Total: 39.03s) STAEformer A2 (Total: 25.09s) STAEformer A1 (Total: 15.2s) ST-SSMs M3 (Total: 45.64s) ST-SSMs M2 (Total: 30.56s) ST-SSMs M1 (Total: 15.18s) ST-MambaSync M1+A1 (Total: 31.65s) ST-MambaSync M1+A2 (Total: 36.4s) ST-MambaSync M2+A1 (Total: 32.96s) Trade-off on MAE vs. FLOPS, Bubble Size = Total Time (Inference + Training) Figure 2: Trade-offs in Model Performance and Computational Efficiency. This bubble chart illustrates the relationship between Mean Absolute Error (MAE) and computational cost (FLOPS) for various predictive models on the PEMS08 dataset. Each bubble\u2019s size represents the total time required for inference and training, highlighting the efficiency trade-offs. We denote \u201cM\u201d as the number of Mamba layer in the model, \u201cA\u201d as the number of attention layers. with the least computational trade-off is the ST-MambaSync model with one Mamba layer and one attention layer, which meets these conditions satisfactorily. 4.4.3. Temporal Analysis of Traffic Flow Predictions 2 4 6 8 10 12 Step 20 21 22 23 24 25 26 RMSE RMSE Comparison Attention L2 Mamba L1 Attention L1 Mamba L2 Attention L1 Mamba L1 2 4 6 8 10 12 Step 12.0 12.5 13.0 13.5 14.0 14.5 MAE MAE Comparison Attention L2 Mamba L1 Attention L1 Mamba L2 Attention L1 Mamba L1 2 4 6 8 10 12 Step 8.0 8.5 9.0 9.5 10.0 MAPE MAPE Comparison Attention L2 Mamba L1 Attention L1 Mamba L2 Attention L1 Mamba L1 Figure 3: This figure presents a side-by-side comparison of three key performance metrics: Root Mean Square Error (RMSE), Mean Absolute Error (MAE), and Mean Absolute Percentage Error (MAPE), across varying layers of attention and mamba for ST-MambaSync. Each subplot illustrates the variation of a specific metric across 12 time steps, highlighting the models\u2019 performance stability and accuracy in forecasting. Distinct color-coded lines represent different model configurations, ensuring clear differentiation and readability. In Figure 3, we present an hour-long forecast for PEMS08, visualizing predictions for each 5-minute time step for the metrics RMSE, MAE, and MAPE.The figure presents a comparison of performance metrics for ST-MambaSync: \"Attention L2 Mamba L1\" and \"Attention L1 Mamba L2\". The metrics evaluated include Root Mean Square Error (RMSE), Mean Absolute Error (MAE), and Mean Absolute Percentage Error (MAPE) across different prediction steps. In all three metrics, both models exhibit similar trends, with RMSE and MAE increasing gradually with each step, while MAPE shows slight fluctuations. Notably, \"Attention L2 Mamba L1\" consistently outperforms \"Attention L1 Mamba L2\" across all metrics and steps, demonstrating its superiority in predicting traffic flow dynamics. The comparison underscores the effectiveness of leveraging both attention and Mamba blocks in enhancing prediction accuracy. Furthermore, it highlights the importance of model architecture in achieving superior performance in traffic forecasting tasks. These findings contribute to the advancement of traffic prediction methodologies, with implications for real-world applications in urban planning and traffic management systems. 12 \f5. Discussion and Implication Figure 4: Comparative Analysis of Prediction Results Using PEMS08 Dataset for Sensors 36 and 127. This case study evaluates the predictive performance of the STAEformer and ST-MambaSync models across 1-hour, 5-hour, and 24-hour intervals. Each model\u2019s architecture is defined by the number of attention layers (denoted as \"A#\") and the number of Mamba layers (\"M#\"). For instance, ST-MambaSync is configured with one attention layer and one Mamba layer, while STAEformer utilizes three attention layers, as illustrated in Figure 4. Predictions for Sensor 36. \u2022 1 Hour: Both models diverged from the true values, though ST-MambaSync demonstrated closer approximations at certain intervals. \u2022 5 Hours: ST-MambaSync provided more consistent and accurate predictions, closely tracking the actual data, unlike the fluctuating results from STAEformer. \u2022 24 Hours: ST-MambaSync showed superior long-term predictive consistency, adhering closely to the actual traffic flow patterns. Predictions for Sensor 127. \u2022 1 Hour: Both models performed similarly to those for Sensor 36, with ST-MambaSync slightly more accurate at certain points. \u2022 5 Hours: Variability was noted in both models, with neither showing a consistent advantage during the initial hours. \u2022 24 Hours: ST-MambaSync maintained closer alignment with the true values, indicating its better capability at handling longer-term dynamics. The analysis indicates that ST-MambaSync tends to provide more accurate and consistent forecasts across all examined intervals for both sensors. It excels particularly in the 24-hour forecasts, suggesting it is more adept at capturing and adapting to longer-term traffic flow dynamics. ST-MambaSync consistently outperforms the state of art model (SOTA) STAEformer, especially in longer forecast intervals. This emphasizes the importance of selecting appropriate models based on the predictive timeframe and desired accuracy level for traffic management applications. 13 \f6."
19
+ }
abs_9K/validation_abstract_short_2404.15923v1.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.15923v1",
3
+ "title": "KGValidator: A Framework for Automatic Validation of Knowledge Graph Construction",
4
+ "abstract": "This study explores the use of Large Language Models (LLMs) for automatic\nevaluation of knowledge graph (KG) completion models. Historically, validating\ninformation in KGs has been a challenging task, requiring large-scale human\nannotation at prohibitive cost. With the emergence of general-purpose\ngenerative AI and LLMs, it is now plausible that human-in-the-loop validation\ncould be replaced by a generative agent. We introduce a framework for\nconsistency and validation when using generative models to validate knowledge\ngraphs. Our framework is based upon recent open-source developments for\nstructural and semantic validation of LLM outputs, and upon flexible approaches\nto fact checking and verification, supported by the capacity to reference\nexternal knowledge sources of any kind. The design is easy to adapt and extend,\nand can be used to verify any kind of graph-structured data through a\ncombination of model-intrinsic knowledge, user-supplied context, and agents\ncapable of external knowledge retrieval.",
5
+ "authors": "Jack Boylan, Shashank Mangla, Dominic Thorn, Demian Gholipour Ghalandari, Parsa Ghaffari, Chris Hokamp",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-04-24",
8
+ "primary_cat": "cs.AI",
9
+ "cats": [
10
+ "cs.AI",
11
+ "cs.CL"
12
+ ],
13
+ "label": "Original Paper",
14
+ "paper_cat": "Knowledge AND Graph",
15
+ "gt": "This study explores the use of Large Language Models (LLMs) for automatic\nevaluation of knowledge graph (KG) completion models. Historically, validating\ninformation in KGs has been a challenging task, requiring large-scale human\nannotation at prohibitive cost. With the emergence of general-purpose\ngenerative AI and LLMs, it is now plausible that human-in-the-loop validation\ncould be replaced by a generative agent. We introduce a framework for\nconsistency and validation when using generative models to validate knowledge\ngraphs. Our framework is based upon recent open-source developments for\nstructural and semantic validation of LLM outputs, and upon flexible approaches\nto fact checking and verification, supported by the capacity to reference\nexternal knowledge sources of any kind. The design is easy to adapt and extend,\nand can be used to verify any kind of graph-structured data through a\ncombination of model-intrinsic knowledge, user-supplied context, and agents\ncapable of external knowledge retrieval.",
16
+ "main_content": "Introduction Knowledge Graphs (KGs) are flexible data structures used to represent structured information about the world in diverse settings, including general knowledge [1], medical domain models [2], words and lexical semantics [3], and semantics [4]. Most KGs are incomplete [5], in the sense that there is relevant in-domain information that the graph does not contain. Motivated by this incompleteness, knowledge graph completion research studies methods for augmenting KGs by predicting missing links [6]. Challenges and Paradigms in KG Completion Evaluation: Evaluating KG completion models presents inherent challenges due to the natural incompleteness of most knowledge graphs (KGs) [5]. Traditional evaluation methods typically use a closed-world assumption (CWA), which deems absent facts to be incorrect, and may not effectively reflect the true capabilities of KG completion models [7, 8, 9]. Alternatively, the open-world assumption (OWA) offers a more realistic framework by recognizing that KGs are inherently incomplete [10]. However, OWA complicates evaluation due to the need for extensive manual annotation of 3rd International Workshop on Knowledge Graph Generation from Text (TEXT2KG) $ jackboylan@quantexa.com (J. Boylan); shashankmangla@quantexa.com (S. Mangla); dominicthorn@quantexa.com (D. Thorn); demiangholipour@quantexa.com (D. G. Ghalandari); parsaghaffari@quantexa.com (P. Ghaffari); chrishokamp@quantexa.com (C. Hokamp) \u00a9 2024 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0). arXiv:2404.15923v1 [cs.AI] 24 Apr 2024 \fExternal data LLM Web Wikidata Docs Unvalidated triple { \u201csubject\": \u201canaheim_ducks\", \u201crelation\": \u201cteamplaysport\", \u201cobject\": \u201cfootball\" } Unvalidated triple { \u201csubject\": \u201calabama_crimson_tide\", \u201crelation\": \u201cteamplayssport\", \u201cobject\": \u201camerican football\" } Validated triple { \u201csubject\": \u201canaheim_ducks\", \u201crelation\": \u201cteamplaysport\", \u201cobject\": \u201cfootball\", \u201cis_valid\": False, \u201creason\": \u201cThe given context states that the Anaheim Ducks are actually an ice hockey team.\" } Validated triple { \u201csubject\": \u201calabama_crimson_tide\", \u201crelation\": \u201cteamplayssport\", \u201cobject\": \u201camerican football\", \u201cis_valid\": True, \u201creason\": \u201cThe Alabama Crimson Tide represent the University of Alabama in the sport of American football.\" } Figure 1: Framework for Validating Knowledge Graph Triples. unknown triples, leading to significant time and cost implications. Efforts to improve the efficiency of human-driven KG evaluation include strategies like cluster sampling, which aims to reduce costs by modeling annotation efforts more economically [11]. An illustration of these evaluation paradigms is shown in Figure 2. KGValidator Framework: Motivated by these challenges, we introduce KGValidator as a flexible framework to evaluate KG Completion using LLMs. At its core, this framework validates the triples that make up a KG using context. This context can be the inherent knowledge of the LLM itself, a collection of text documents provided by the user, or an external knowledge source such as Wikidata or an Internet search (refer to Figure 1 for a high-level overview). Importantly, our framework does not require any gold references, which are often only available for popular benchmark datasets. This enables evaluation of a wider range of KGs using the same framework. KGValidator makes use of the Instructor1 library, Pydantic2 classes, and function calling to control the generation of validation information. This ensures that the LLM follows the correct guidelines when evaluating properties, and outputs the correct data structures for calculating evaluation metrics. Our main contributions are: \u2022 A simple and extensible framework based on open-source libraries that can be used to validate KGs with the use of LLMs3. \u2022 An evaluation of our framework against popular KG completion benchmark datasets to measure its effectiveness as a KG validator. \u2022 An investigation of the impact of providing additional context to SoTA LLMs in order to augment evaluation capabilities. 1https://github.com/jxnl/instructor 2https://docs.pydantic.dev/ 3Unfortunately, IP restrictions currently prevent us from sharing our implementation, but we are happy to directly correspond with interested researchers who wish to reproduce our results \f\u2022 A straightforward protocol for implementing new validators using any KG alongside any set of knowledge sources. Ulysses Moby Dick ... Finnegans Wake Dubliners Eveline Test Set External annotator / LLM Incomplete triple (James Joyce, author of, ?) KGC model predictions Figure 2: An example of the Closed-World Assumption in KG completion. Some of the triples predicted by a KG completion model are true in the real world (e.g. books written by James Joyce) but missing in the test set and would therefore be treated as false positives. The rest of the paper is structured as follows: Section 2 discusses key related work, Section 3 covers our approach in detail, Section 4 presents several experiments designed to validate the framework, and Section 5 discusses results and possible extensions to this work. 2. Background 2.1. Knowledge Graph Construction Knowledge Graphs can be represented as multi-relational directed property graphs [12], where nodes represent entities (for a general definition of entity), and edges are predicates or relations. Any KG can thus be rendered as a list of triples (\ud835\udc60\ud835\udc62\ud835\udc4f\ud835\udc57\ud835\udc52\ud835\udc50\ud835\udc61, \ud835\udc5f\ud835\udc52\ud835\udc59\ud835\udc4e\ud835\udc61\ud835\udc56\ud835\udc5c\ud835\udc5b, \ud835\udc5c\ud835\udc4f\ud835\udc57\ud835\udc52\ud835\udc50\ud835\udc61)4, also called statements5. An early line of work on knowledge graph construction focused on the TAC 2010 Knowledge Base Population (KBP) shared task [13], which introduced a popular evaluation setting that separates knowledge base population into Entity Linking and Slot Filling subtasks. Early methods to address these tasks used pattern learning, distant supervision and hand-coded rules [14]. Knowledge Graph Completion (KGC) is a KG construction task that has gained popularity recently. It involves predicting missing links in incomplete knowledge graphs [9]. The subtasks include triple classification, where models assess the validity of (head, relation, tail) triples; link prediction, which proposes subjects or objects for incomplete triples; and relation prediction [15], identifying relationships between subject and object pairs. Models for these 4several standards and formats exist for representing triples and optionally including additional metadata, including RDF, Turtle, N-triples, JSON-LD, and others. 5https://www.wikidata.org/wiki/Help:Statements \ftasks are frequently benchmarked against subsets of well-established knowledge bases such as WordNet [16], Freebase [17], and domain-specific KGs like UMLS [18]. Evaluation methodologies for KG completion primarily utilize ranking-based metrics. These include Mean Rank (MR), Mean Reciprocal Rank (MRR), and Hits@K, which gauge a model\u2019s ability to prioritize correct triples over incorrect ones, offering a quantifiable measure of performance [15]. Outside these tightly defined tracks, various approaches have been proposed to construct or populate knowledge graphs. For example, NELL (Never-Ending Language Learner) [19] is a self-supervised system that was designed to interact with the internet over years to populate a growing knowledge base of topical categories and factual statements. 2.2. LLMs and Knowledge Graphs Studies have shown that pretrained language models (PLMs) possess factual and relational knowledge which makes them effective at downstream knowledge-intensive tasks such as open question-answering, fact verification, and information extraction [20, 21]. KG-BERT [22] uses PLMs for KG completion by fine-tuning BERT on all KG completion sub tasks, treating the problem as a sequence classification task. Pretrain-KG [23] introduces a framework that enriches knowledge graph embedding (KGE) models with PLM knowledge during training, which proves to be particularly useful for lowresource scenarios of link prediction and triple classification. Knowledge Graph Construction Using Generative AI With the proliferation of generalpurpose LLMs [24], open information extraction (OpenIE) has become one of the most popular industry applications of generative AI [25]. OpenIE is closely related to knowledge graph construction, and so LLMs have naturally been applied to KG completion tasks such as link prediction and triple classification, proving to be successful in both fine-tuned [26] and zero-shot settings[27, 28]. The dominant paradigm is to include the desired schema of the output in the user prompt along with the input itself (refer to Figure 3). Khorashadizadeh et al. demonstrate the capabilities of GPT 3.5 in the task of KG construction using an in-context learning approach [29]. Emphasis is placed on the importance of good prompt design under this setting. LLM2KB [30] fine-tunes open-source LLMs to predict tail entities given a head entity and relation, incorporating context retrieval from Wikipedia to enhance the relevance and accuracy of the predicted entities. Zhu et al. [31] investigate GPT-4\u2019s [32] capabilities for different steps of knowledge graph construction. They show that while GPT-4 exhibits modest performance on few-shot information extraction tasks, it excels as an inference assistant due to it\u2019s strong reasoning capabilities. Their experiments also show that GPT-4 generalizes well to new knowledge by creating a virtual knowledge extraction task. Complementing these advancements, resources such as the Text2KG Benchmark [33] offer valuable tools for researchers to develop and test LLM-backed KG completion models. This benchmark, specifically designed for evaluating knowledge graph generation from unstructured text using guideline ontologies, marks a significant step towards standardizing and accelerating research in this field. \fUser prompt Tesla, Inc. announced on March 15, 2024, that its new electric vehicle model, the Tesla Cybertruck, will be launched in the United States in July 2024. Elon Musk, CEO of Tesla, stated that the Cybertruck represents a significant advancement in electric vehicle technology. Extract all named entities and any relevant properties about them in the following text: OpenIE System Open schema information \u201centities\": [ { \u201cEntity\": \"Tesla, Inc.\", ` \u2018Type\": \u201cCompany\", \u201cAction\": \u201cAnnounced\", \u201cDate\": \u201cMarch 15, 2024\" }, { \u201cEntity\": \u201cTesla Cybertruck\", \u201cType\": \u201cElectric Vehicle\", \u201cAction\": \u201cLaunch\", \u201cLocation\": \u201cUnited States\", \u201cDate\": \u201cJuly 2024\" }, { \u201cEntity\": \u201cElon Musk\", \u201cType\": \u201cPerson\", \u201cTitle\": \u201cCEO\", \u201cAffiliation\": \u201cTesla, Inc.\" } ] Figure 3: An example of Open Information Extraction. Note that in OpenIE, the output schema is not fixed. A comprehensive survey on the unification of LLMs and KGs [34] highlights the emergence of KG-enhanced LLMs, LLM-augmented KGs, and Synergized LLMs and KGs. Validation and evaluation of KGs with LLMs has been less explored, but is also a promising and important avenue for research. 2.3. Structuring and Validating Language Model Output Constraining language models to produce outputs that conform to specific schemas is challenging but essential for applications like natural language to SQL (NL2SQL) [35, 36]. Recent developments include tools like Guidance6, Outlines7, JSONFormer8, and Guardrails9, which facilitate constrained decoding of structured outputs from large language models (LLMs). Additionally, semantic validation techniques like those enabled by the Instructor library use Pydantic classes to ensure outputs meet both structural and semantic accuracy. This advancement is crucial for tasks such as knowledge graph (KG) completion, where precision in data parsing significantly enhances model utility [28]. 2.4. Knowledge-Grounded LLMs The tendency of LLMs to hallucinate poses a significant challenge in their application to downstream tasks [37]. Retrieval-Augmented Generation (RAG) mitigates this by grounding LLM responses in verified information, significantly enhancing accuracy and reliability [38, 39]. RAG integrates a retrieval component that leverages external knowledge during the generation process, improving performance across various natural language processing tasks 6https://github.com/guidance-ai/guidance 7https://github.com/outlines-dev/outlines 8https://github.com/1rgs/jsonformer 9https://github.com/guardrails-ai/guardrails \f[40]. Additionally, role-playing approaches using LLMs have been developed to create detailed, organized content similar to Wikipedia articles, drawing on trusted sources for factual grounding [41]. 2.5. Knowledge Graph Evaluation Evaluating automatically constructed knowledge graphs is challenging. Huaman et al. present a comprehensive evaluation of state-of-the-art validation frameworks, tools, and methods for KGs [42]. They highlight the challenges in validating KG assertions against real-world facts and the need for scalable, efficient, and effective semi-automatic validation approaches. Gao et al. [11] have highlighted the trade-offs between human annotation cost and meaningful estimates of accuracy. As discussed above, a common flaw reported in existing KG evaluation frameworks is use of a closed-world assumption. Specifically, this means treating unknown predicted triples as false [43]. Sun et al. [9] find that several recent KG completion techniques have reported significantly higher performance compared to earlier SoTA methods, in some cases due to the inappropriate evaluation protocols used. Cao et al. [44] suggest that triple classification evaluation under the closed-world assumption leads to trivial results. Additionally, Cao et al. note that current models lack the capacity to distinguish false triples from unknown triples. Yang et al. [10] confirm the existing gap between closed and open world settings in the performance of KG completion models. 3. Approach We assume the existence of a triple-extractor model, which produces a stream of candidate statements from unstructured data feeds. The triple-extractor model could be implemented by a KG completion model, one or more LLMs with well-designed prompts, or by a more traditional information extraction pipeline consisting of several distinct models that perform parsing, named entity recognition, relationship classification, and other relevant sub-tasks. For each predicted triple from the stream, we wish to validate whether it is correct in the presence of context. Once a statement has been validated, it can be written into a knowledge graph or another data store, and statements that do not pass validation can be flagged for further review. A high-level overview of the validation stage is illustrated in Figure 4. LLM Unvalidated triple { \u201csubject\": \u201canaheim_ducks\", \u201crelation\": \u201cteamplaysport\", \u201cobject\": \u201cfootball\" } Validated triple { \u201csubject\": \u201canaheim_ducks\", \u201crelation\": \u201cteamplaysport\", \u201cobject\": \u201cfootball\", \u201cis_valid\": False, \u201creason\": \u201cI believe that the Anaheim Ducks are actually an ice hockey team.\" } Figure 4: Validating KGs with LLM Knowledge In this work we use existing standard KGC datasets for our experiments, so in practice the candidate triples in this work are produced by streaming through existing datasets (see Section \f4). Possible sources of context for validation include: \u2022 Knowledge accrued in the LLM parameters during pretraining. \u2022 User-provided context in the form of document collections or reference KGs represented in string format. \u2022 Agents that can interact with the world to search and retrieve information in various ways. Further detail on use of context in our validator implementations is provided in Section 3.1. Basic Settings for Validation: The first step is to obtain KG completion predictions in the format of a list of (\u210e, \ud835\udc5f, \ud835\udc61) triples, each consisting of a head entity \u210e, a relation \ud835\udc5fand a tail entity \ud835\udc61. All validators are instantiated in a zero-shot setting with an LLM backbone; this may be a model from OpenAI\u2019s model family, such as gpt-3.5-turbo-0125 [45, 32], or an open-source model from the Llama family [46]. Additionally, validators have access to various tools which allow them to query external knowledge sources. Validation via Pydantic Models Pydantic is a data validation and settings management library which leverages Python type annotations. It allows for the creation of data models, where each model defines various fields with types and validation requirements. By using Python\u2019s type hints, Pydantic ensures that the incoming data conforms to the defined model structure, performing automatic validation at runtime. KG triples are passed to the validator via the Instructor library, which uses a patched version of popular LLM API clients. This patch enables the request of structured outputs in the form of Pydantic classes. It is within these Pydantic classes that we specify the structural and semantic guidelines that the LLM must follow during validation. An example of this form of prompting is shown in Figure 7. Specifically, we request that, for every triple (\u210e, \ud835\udc5f, \ud835\udc61), the model must provide values for a number of fields: 1. triple is valid: A boolean indicating whether the proposed triple is generally valid, judged against any given context. The model can reply with True, False, or \"Not enough information to say\". 2. reason: An open-form string describing why the triple is or is not valid. 3.1. Validation Contexts This section discusses the contextual information that is available to different validator instantiations. We use context to mean all information that is available to a validator, including the information stored in trained model parameters. \f3.1.1. Validating with LLM Knowledge This is the most straightforward method of triple validation. Given a triple (\u210e, \ud835\udc5f, \ud835\udc61), the objective is to classify the triple using the LLM\u2019s inherent knowledge about the world, learned during the pretraining stage, and stored in the model parameters. The process is illustrated in Figure 4 and an example can be found in appendix Figure 10. This is a powerful and simple way to verify triples with no additional data. 3.1.2. Validation using Textual Context(s) Inspired by the success of Retrieval-Augmented Generation (RAG) in knowledge-intensive tasks such as question-answering [38], we implement tooling to retrieve relevant information from a reference text corpus (see Section 2.4). In this instance, the model is prompted with textual context alongside the candidate triple, as shown in Figure 5. This approach is particularly useful for a number of scenarios: \u2022 When we wish to verify a set of triples about the same entity or group of entities and we have a collection of trustworthy sources within which we assume there will be evidence for or against the predicted triple, for example a given entity\u2019s Wikipedia page. \u2022 When building KGs using private or domain-specific data feeds. LLM Unvalidated triple { \u201csubject\u201d: \u201canaheim_ducks\u201d, \u201crelation\u201d: \u201cteamplaysport\u201d, \u201cobject\u201d: \u201cfootball\u201d } Validated triple { \u201csubject\u201d: \u201canaheim_ducks\u201d, \u201crelation\u201d: \u201cteamplaysport\u201d, \u201cobject\u201d: \u201cfootball\u201d, \u201cis_valid\u201d: False, \u201creason\u201d: \u201cThe given context states that Anaheim Ducks are actually an ice hockey team.\u201d } Relevant Fragments Vector Index Chunking and encoding query: string representation of triple Textual Documents Figure 5: Validating KGs given Textual Context This provided corpus can be of arbitrary length and can contain a collection of documents. The corpus will be recursively chunked and encoded by an embedding model from either the sentence transformers library [47] or OpenAI\u2019s family of embedding models [48], and a searchable index is created. A string representation for each triple is then constructed, and this is used to query the corpus index, which retrieves the most semantically similar chunks of text, according to cosine similarity. This forms the context against which the LLM will validate the given triple. \f3.1.3. Validation using a Reference KG We also consider validating proposed KG triples by cross-referencing against established, reliable KGs. Wikidata, with its expansive and well-structured repository of knowledge, serves as an ideal reference point for such validations, and will serve as the reference KG in our experiments. However, we note that any KG can be used as a reference by following the method outlined in 3.1.3. The Wikidata knowledge graph is built from two top-level types: Entities and Properties: Entities: Entities represent all items in the database. An item is a real-world object, concept, or event, such as \u201cEarth\" (Q2), \u201clove\" (Q316), or \u201cWorld War II\" (Q362). Items can be linked to each other to form complex statements via properties. In the context of KG completion, a statement can be thought of as a triple. Each entity is identified by a unique identifier, which is a Q-prefix followed by a sequence of numbers, e.g., Q42 for Douglas Adams. Properties: Properties in Wikidata define the characteristics or attributes of items and establish relationships between them. They are the predicates in statements, linking subjects (items) to their object (value or another item). For example, in the statement \u201cDouglas Adams (Q42) profession (P106) writer (Q36180)\",\u201cprofession\" is the property that describes the relationship between \u201cDouglas Adams\" and \u201cwriter\". Reference KG Implementation Our approach to integrating Wikidata as a source of contextual information is simple. Given triple \ud835\udc61, an agent module searches Wikidata using the string of the subject as a query. The top Wikidata entity from the search API is returned \u2013 if no results are found for the query, a warning is thrown, and the validator will default to using its inherent knowledge. The Wikidata item is parsed to remove a list of trivial properties. Among Wikidata\u2019s 11,000 Properties, over 7,000 of these are identifiers to external databases such as IMDb and Reddit 10. In this work, we are not interested in verifying such information, and so we discard these properties. A string representation of the Wikidata page is now passed through the same RAG pipeline as described in Section 3.1.2, from which relevant sections are retrieved and passed to the validator as context alongside each predicted triple \ud835\udc61. This implementation is illustrated in appendix Figure 9. 3.2. Validation using Web Search In some cases, the triples we wish to validate cannot be captured with a query to Wikidata, and we do not have a collection of textual information to provide the model with additional context. To overcome this, the validator is given access to collect information relevant to the triple via a web-searching agent. The triple is formatted as a string query. An agent then searches the web using the DuckDuckGo API11. The top results for the given query are parsed and stored as a collection of documents. The validation then follows the same pattern as Section 3.1.2, whereby 10https://wikiedu.org/blog/2022/03/30/property-exploration-how-do-i-learn-more-about-properties-on-wikidata/ 11https://github.com/deedy5/duckduckgo_search \frelevant chunks of text are retrieved as context for triple validation. This method is illustrated in appendix Figure 8. 4. Experiments We conduct a series of triple classification experiments to validate the effectiveness of an LLM-backed validator for KG Completion. Our experiments make use of a number of popular benchmark KG datasets: UMLS [18], WN18RR [49], FB15K-237N, Wiki27k [8], and CoDeX-S [50]. FB15k-237N is derived from Freebase, and was obtained by removing the relations containing mediator nodes in FB15K-237. Wiki27K was created from Wikidata and manually annotated with real negative triples. UMLS is a medical ontology describing relations between medical concepts. WN18RR is a dataset about English morphology derived from WordNet. We investigate the performance of gpt-3.5-turbo-0125 and gpt-4-0125-preview and present our results in Tables 1 , 2 and 3. Setup details and results for open-source LLM experiments can be found in Section A.3 and Table 4 in the appendix. Table 1 Experiment results for FB15K-237N-150 and Wiki27K-150 datasets. Accuracy (Acc), precision (P), recall (R), and F1-score (F1) results for each method are reported. The best metrics for each dataset are marked in bold. Model FB15K-237N-150 Wiki27K-150 P R F1 Acc P R F1 Acc GPT 3.5 WorldKnowledge 0.58 0.97 0.73 0.63 0.63 1.0 0.77 0.71 GPT 3.5 Wikidata 0.75 0.77 0.76 0.76 0.74 0.73 0.74 0.74 GPT 3.5 WikipediaWikidata 0.85 0.69 0.76 0.79 0.84 0.86 0.85 0.85 GPT 3.5 Web 0.76 0.85 0.81 0.79 0.76 0.91 0.82 0.81 GPT 3.5 WikidataWeb 0.82 0.81 0.82 0.82 0.78 0.87 0.82 0.81 GPT 4 WorldKnowledge 0.87 0.72 0.79 0.81 0.95 0.76 0.84 0.86 GPT 4 Wikidata 0.89 0.64 0.74 0.78 0.97 0.75 0.84 0.86 GPT 4 WikipediaWikidata 0.90 0.59 0.71 0.76 0.97 0.77 0.86 0.87 GPT 4 Web 0.92 0.72 0.81 0.83 0.95 0.75 0.84 0.85 GPT 4 WikidataWeb 0.92 0.72 0.81 0.83 1.0 0.77 0.87 0.89 4.1. Experiment Settings Prompt as a Hyperparameter: We emphasize the notion of a prompt as a model hyperparameter, and manually tuning it to fit a subset of data is a form of over-fitting or evaluation set leakage. In this work, we thus formulate a generic model prompt, and apply this prompt to all benchmark datasets without further changes. We include the prompt in the appendix (see Figure 6). Through the following experiments we attempt to answer the question: Given context, can our model judge whether an unseen triple (\u210e, \ud835\udc5f, \ud835\udc61) is correct? We are primarily interested in observing the change in evaluation performance of an LLM when it has access to context under the following settings: \fTable 2 Experiment results for WN18RR-150 and UMLS-150 datasets. Accuracy (Acc), precision (P), recall (R), and F1-score (F1) results for each method are reported. The best metrics for each dataset are marked in bold. Model WN18RR-150 UMLS-150 P R F1 Acc P R F1 Acc GPT 3.5 WorldKnowledge 0.54 0.97 0.70 0.58 0.5 0.97 0.66 0.5 GPT 3.5 Wikidata 0.53 0.99 0.69 0.56 0.51 0.87 0.64 0.52 GPT 3.5 WikipediaWikidata 0.54 0.99 0.69 0.57 0.53 0.88 0.66 0.55 GPT 3.5 Web 0.67 0.97 0.79 0.74 0.52 0.93 0.67 0.53 GPT 3.5 WikidataWeb 0.69 0.95 0.80 0.76 0.5 0.88 0.64 0.5 GPT 4 WorldKnowledge 0.99 0.92 0.95 0.95 0.57 0.77 0.66 0.59 GPT 4 Wikidata 0.99 0.91 0.94 0.95 0.63 0.69 0.66 0.64 GPT 4 WikipediaWikidata 0.99 0.91 0.94 0.95 0.62 0.67 0.64 0.63 GPT 4 Web 1.0 0.89 0.94 0.95 0.61 0.65 0.63 0.62 GPT 4 WikidataWeb 1.0 0.88 0.94 0.94 0.56 0.64 0.60 0.57 Table 3 Experiment results for CoDeX-150 dataset. Accuracy (Acc), precision (P), recall (R), and F1-score (F1) results for each method are reported. The best metrics are marked in bold. Model CoDeX-S-150 P R F1 Acc GPT 3.5 WorldKnowledge 0.52 0.97 0.68 0.54 GPT 3.5 Wikidata 0.86 0.88 0.87 0.87 GPT 3.5 WikipediaWikidata 0.81 0.87 0.84 0.83 GPT 3.5 Web 0.74 0.84 0.79 0.77 GPT 3.5 WikidataWeb 0.87 0.97 0.92 0.91 GPT 4 WorldKnowledge 0.87 0.81 0.84 0.85 GPT 4 Wikidata 0.93 0.87 0.90 0.9 GPT 4 WikipediaWikidata 0.94 0.83 0.88 0.89 GPT 4 Web 0.85 0.84 0.85 0.85 GPT 4 WikidataWeb 0.93 0.85 0.89 0.89 \u2022 LLM Inherent Knowledge: Evaluates the model\u2019s native understanding without external data sources. \u2022 Wikidata: Uses structured data from Wikidata as the reference KG context. \u2022 Web: Incorporates information retrieved directly from the internet. \u2022 WikidataWeb: Combines data from both Wikidata and web sources. \u2022 WikipediaWikidata: Utilizes a mix of Wikipedia and Wikidata to provide a comprehensive context. API Cost and Rate-Limiting Constraints Due to OpenAI API constraints, we run experiments using a subset of 150 examples from each dataset. This is indicated by the -150 suffix to each dataset name. \f5. Discussion 5.1. Analysis Our analysis reveals notable variations in performance across datasets, as evidenced by the results obtained using different validators powered by GPT-3.5 and GPT-4 language models. Specifically, the GPT-3.5 World Knowledge validator shows limited effectiveness on the FB15K237N-150, Wiki27k-150, and CoDeX-S-150 datasets (as detailed in Tables 1 and 3). However, the introduction of contextual information from Wikidata and web searches gives a strong performance boost, with the performance on the CoDeX-S-150 dataset in particular improving accuracy from 0.54 to 0.91 when using the WikidataWeb validator. GPT-4 configurations exhibit strong performance across the board, particularly excelling in the FB15K-237N-150 and Wiki27k-150 datasets, where GPT-4 achieves the highest accuracy of 0.83 and 0.89 respectively. However, both GPT-3.5 and GPT-4 models demonstrate less satisfactory results on the UMLS-150 dataset, as indicated in Table 2. It is noteworthy that the incorporation of context from external knowledge sources, especially web searches and Wikidata, proves beneficial for both models. Despite this, the open-source Llama2 model performs poorly on this task, as shown in Table 4 and inference examples 11 and 12. We hypothesize that future open-source LLMs may perform much better than the those currently available. GPT-4 validators display effectiveness on the WN18RR-150 dataset, both with and without supplemental context. This robust performance is hypothesized to stem from the model\u2019s superior grasp of English morphology and nuanced language comprehension, aligning with the linguistic focus of the WN18RR dataset. 5.2. Key Findings Inherent Knowledge Insufficiency: In the case of GPT-3.5 and Llama2 70B, reliance solely on the inherent knowledge of LLM validators often leads to unquestioned acceptance of predicted triples. This indicates a limitation in the models\u2019 ability to challenge the veracity of the information, underscoring the need for external validation mechanisms. This corroborates with findings from prior studies which find that LLMs struggle to memorize knowledge in the long tail [51]. Challenge in Verifying Ambiguous Triples: Our evaluation of each dataset reveals that additional information is neccesary to verify many triples. For example, a positive triple in the UMLS dataset reads (\"age_group\", \"performs\", \"social_behavior\"). Ambiguous triples in the UMLS and WN18RR datasets require understanding of specific ontologies, rendering web or Wikidata searches ineffective for retrieving relevant context. This complexity is contrasted by datasets like FB15K-237N and Wiki27k, which involve concrete entities or facts (e.g., people, locations) more amenable to validation through widely available external sources. For example, a positive example in FB15K-237N reads \"Tim Robbins\", \"The gender of [X] is [Y] .\", \"male\", \fThe Importance of Relevant Context: Performance is weaker on datasets requiring domain-specific knowledge, such as UMLS, where no model tested achieved satisfying results. This is attributed to the challenge of sourcing pertinent context for validation, as exemplified by the clinical domain triple from UMLS: (\"research_device\", \"causes\", \"anatomical_abnormality\"). This highlights the critical role of context in enabling accurate validation, emphasizing the need for targeted search strategies to augment the model\u2019s knowledge base. Limitations in Zero-Shot Triple Classification by Current Open-Source LLMs: Table 4 shows the performance of a version of the LLama-2-70B-chat model [46] on the triple verification task. Upon manual inspection, the model nearly always returns a True prediction for all triples, irrespective of the provided context, resulting in a recall of 1.0 and precision of about 0.5 across all settings. This tendency suggests that while the model can superficially engage with the context\u2014evident from relevant factoids appearing in the reason field\u2014it often resorts to fabricating agreeable responses rather than accurately assessing the triple\u2019s validity. Figures 11 and 12 illustrate this behaviour. It is worth noting that our experiments were conducted using a single open-source model; however, alternative models could potentially deliver superior performance. We propose this as an avenue for future research. Adoption of Other Open-Source LLMs: At present, we find that only OpenAI and Llama models are usable with the Instructor framework. More recent models, such as Mixtral [52] and Gemma [53], are beginning to receive support under this library, but issues with constraining model output has delayed implementation. We are particularly interested in observing how other open-source models perform at this task in the future. 5.3. Ethical and Social Risks Building on the framework by Weidinger et al. [54], we highlight key ethical and social risks associated with using LLMs for KG validation. LLMs, trained on large-scale internet datasets, may perpetuate biases [55], discriminating against marginalized groups and potentially reinforcing stereotypes within KGs. Additionally, the alignment of LLM outputs with human preferences can introduce biases favoring certain languages and perspectives [56]. Privacy concerns also arise from LLMs potentially leaking sensitive information [57]. Furthermore, the risk of spreading misinformation through inaccurate validation poses serious challenges, especially in sensitive domains like medicine or law. Lastly, the environmental impact of training and deploying LLMs, including significant carbon emissions and water usage, underscores the need for sustainable practices in LLM-driven KG validation [58, 59]. 6."
17
+ }
abs_9K/validation_abstract_short_2404.15949v1.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.15949v1",
3
+ "title": "Sequence can Secretly Tell You What to Discard",
4
+ "abstract": "Large Language Models (LLMs), despite their impressive performance on a wide\nrange of tasks, require significant GPU memory and consume substantial\ncomputational resources. In addition to model weights, the memory occupied by\nKV cache increases linearly with sequence length, becoming a main bottleneck\nfor inference. In this paper, we introduce a novel approach for optimizing the\nKV cache which significantly reduces its memory footprint. Through a\ncomprehensive investigation, we find that on LLaMA2 series models, (i) the\nsimilarity between adjacent tokens' query vectors is remarkably high, and (ii)\ncurrent query's attention calculation can rely solely on the attention\ninformation of a small portion of the preceding queries. Based on these\nobservations, we propose CORM, a KV cache eviction policy that dynamically\nretains important key-value pairs for inference without finetuning the model.\nWe validate that CORM reduces the inference memory usage of KV cache by up to\n70% without noticeable performance degradation across six tasks in LongBench.",
5
+ "authors": "Jincheng Dai, Zhuowei Huang, Haiyun Jiang, Chen Chen, Deng Cai, Wei Bi, Shuming Shi",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-04-24",
8
+ "primary_cat": "cs.CL",
9
+ "cats": [
10
+ "cs.CL",
11
+ "cs.AI",
12
+ "cs.LG"
13
+ ],
14
+ "label": "Original Paper",
15
+ "paper_cat": "LLM Fairness",
16
+ "gt": "Large Language Models (LLMs), despite their impressive performance on a wide\nrange of tasks, require significant GPU memory and consume substantial\ncomputational resources. In addition to model weights, the memory occupied by\nKV cache increases linearly with sequence length, becoming a main bottleneck\nfor inference. In this paper, we introduce a novel approach for optimizing the\nKV cache which significantly reduces its memory footprint. Through a\ncomprehensive investigation, we find that on LLaMA2 series models, (i) the\nsimilarity between adjacent tokens' query vectors is remarkably high, and (ii)\ncurrent query's attention calculation can rely solely on the attention\ninformation of a small portion of the preceding queries. Based on these\nobservations, we propose CORM, a KV cache eviction policy that dynamically\nretains important key-value pairs for inference without finetuning the model.\nWe validate that CORM reduces the inference memory usage of KV cache by up to\n70% without noticeable performance degradation across six tasks in LongBench.",
17
+ "main_content": "Introduction Large language models (LLMs) have demonstrated impressive proficiency in a wide range of natural language processing tasks such as question answering, summarization and multi-turn dialogues [1\u20133]. Considering substantial cost of deploying LLMs introduced by tremendous model size and quadratic cost of attention layer, many works focused on model compression and memory-efficient attention techniques [4\u20137]. However, the size of KV cache, which stores previous tokens\u2019 key and value states to avoid re-computation, scaling linearly with sequence length during generation, also incurs significant overhead. For instance, even a 7 billion-parameter model with batch size of 128 and sequence length of 4096 results in 256GB of KV cache, far exceeds memory consumed by model itself which is only 14GB. A natural idea is to discard some less informative KV cache to reduce memory consumption. The challenge lies in finding a balance between discarding as much as possible while still maintaining model performance. Despite multi-query attention [8] and grouped-query attention [9] can reduce the size of KV cache by reducing attention heads, it needs re-training to recover performance of original model. Recent works \u2217Corresponding Author Preprint. In progress. arXiv:2404.15949v1 [cs.CL] 24 Apr 2024 \f[10\u201314] have investigated implementing KV cache using specific eviction policy, that determines which key-value states should be evicted from KV cache. These methods aim to compress KV cache to a pre-defined budget size, thereby reducing memory and computational overhead. However, they save same number of key-value pairs for all attention heads and layers, ignoring that the number of keys playing an important role may vary across different attention heads and layers [15]. (a) (b) Figure 1: Attention sparsity of LLaMA2-7B. (a) Layer-wise attention sparsity. (b) Head-wise attention sparsity of layer 0 and layer 1. Intuitively, if important information in the KV cache exceeds the predetermined budget size, the performance of the model is likely to decline as it unavoidably evicts some crucial information. Our preliminary exploration also reveals that different attention layers and heads show different sparsities as shown in Figure 1. First, we observe that bottom layers of the model are relatively dense2, while the remaining attention layers exhibit significant sparsity. Second, even within the same layer, different heads can exhibit obvious differences in sparsity levels. These properties suggest that we need to treat different layers and heads differently, rather than using the same budget size for all of them. In addition, we prove that completely similar queries have similar concerns about keys, and observe that recent query vectors are quite similar on LLaMA2 series models so current query can directly use recent query attention messages during generation. Based on the above insights, we first define the generation process of LLMs with a budget-unrestricted KV cache in Section 3. Then we propose Cache Optimization with Recent Message (CORM), a framework that exploits recent query attention information for KV cache optimization and token generation of LLMs. Specifically, \u2022 In Section 3, we explore the similarity between query vectors of all tokens within same sequence, revealing that recent query vectors are highly similar, which implies that (i) keys that are important for recent queries might be also important for the current query; and (ii) removing key-value pairs that appear to be less informative for recent queries can greatly preserve the performance of the model. \u2022 In Section 4, we present a simple method which dynamically evicts minor key-value pairs determined by recent tokens\u2019 attention information. We conduct extensive experiments on LLaMA2-7B-Chat, considering its popularity and wide usage, to evaluate CORM across 6 tasks from LongBench [16] containing question answering, summarization, code completion, etc. Experiments show that even without explicitly setting a budget size, our method is still possible to achieve a high compression rate. Our method achieves better performance compared to StreamingLLM [10], Scissorhands [11] and H2O [12] with over 70% KV cache reduction rate and can even come close to fully restoring the performance of the model. 2 Related Work Attention Let x \u2208Rn\u00d7d denote the input embeddings from a sequence of n feature vectors of dimension d. The multi-head self-attention [17], as a core module of Transformer model, facilitates 2Let t denote sequence length, we count the proportion of keys which attention score larger than average score 1 t and denote it as r. The larger r is, the sparser the layer is. 2 \fcontextual information interaction within each head in the following manner: Q = xWq, K = xWk, V = xWv, Attention(x) = softmax(QKT \u221adh ) \u00d7 V (1) Q, K, V represent the query, key, and value matrices, which are obtained by linearly mapping x using weight matrices Wq, Wk, and Wv \u2208Rd\u00d7dh, respectively. dh is the dimension of each individual head. KV Cache According to autoregressive paradigm, transformer decoder model predicts future tokens based on both previous and current tokens. Recalculating the key-value pairs for previous tokens at each decoding step is clearly an inefficient strategy. A common practice is to retain the key-value pairs of previous tokens for subsequent reuse. Thus, the consumption of KV cache becomes linearly correlated with the length of input sequence. When dealing with long contexts, however, the use of such a space-time trade-off approach may still pose challenges. Training Policies The advent of multi-query attention (MQA) [8] is to address the influence of attention heads on KV cache within multi-head attention (MHA) mechanism. It facilitates the sharing of the same set of keys and values among different heads to alleviate cache pressure. Grouped-query attention (GQA) [9] represents a trade-off between MHA and MQA, achieving key-value sharing within each group through mean-pooling-based uptraining. Both methods require additional training to restore model performance due to the inability to directly convert. Training-free Policies During generation, sequence length is the primary factor of cache pressure. Recent methods aim to balance model efficiency and inference cost without extra training and architectural changes. StreamingLLM [10] keeps attention sink token and recent tokens throughout decoding process to align with the training window. Scissorhands [11] maintains pivotal tokens and recent tokens based on the persistence of importance hypothesis. H2O [12] utilizes accumulated attention score to maintain heavy hitters and recent tokens. TOVA [13] removes tokens with the lowest current attention score from the fixed cache at each decoding step. RoCo [14] retains tokens in the fixed cache based on high mean cumulative attention scores and top r standard deviations. Aforementioned methods consistently operate on a fixed cache, ignoring that the number of tokens playing an important role may vary across different attention heads and layers. 3 Observations We first demonstrate the existence of attention sparsity in LLMs in Section 3.1, then discuss the phenomenon that similar queries have similar attention concerns for keys in Section 3.2. In Section 3.3, we show an intriguing observation that current query is most similar to recent queries. 3.1 Attention sparsity in LLMs We first explore the sparsity in attention layers of LLMs, which provides an effective guarantee for us to reduce KV cache size. Specifically, we use proportion of important keys to represent attention sparsity. Let qt \u2208R1\u00d7d denote the query state vector at step t, ki \u2208R1\u00d7d denote the key state vector at step i (1 \u2264i \u2264t), where d is hidden dimension (for the sake of simplicity, we only consider a single head here). The normalized attention score of qt for ki is computed as: \u03b1t,i = exp(qtkT i / \u221a d) Pt j=1 exp(qtkT j / \u221a d) . (2) Definition 3.1 (Important Key) We define a key ki is considered important in step t, if and only if \u03b1t,i \u22651 t , otherwise it is considered minor. 3 \fWe conduct zero-shot inference with LLaMA2-7B model on the test set of PG-19 [18]. We plot the layer-wise and head-wise sparsity within attention blocks, the results are presented in Figure 1. It reveals that bottom layers are relatively dense, while other layers are highly sparse with over 90% sparsity. This makes it possible to do attention computation on only small part of KV cache during generation. 3.2 Similar queries have similar concerns for keys The previous section reveals the existence of attention sparsity in LLMs, which provides an opportunity to reduce KV cache size while maintaining performance. In this section we give a theoretical analysis that similar queries have similar concerns for keys for eviction policy design. Consider the i-th and j-th query state vectors qi and qj in a sequence of token length T (i < j \u2264T). Their cosine similarity can be computed as: cosine_similarity(qi, qj) = qiqT j \u2225qi\u2225\u00b7 \u2225qj\u2225. (3) Consider all key states k1, k2, ..., ki\u22121 before i-th key. Assume that cosine_similarity(qi, qj) = 1, then qi = m \u00b7 qj with m \u2208R+. The attention weight3 of qi to the previous i \u22121 keys can be represented as: attention_weight = 1 \u221a d (qikT 1 , qikT 2 , ..., qikT i\u22121) = m \u221a d \u00b7 (qjkT 1 , qjkT 2 , ..., qjkT i\u22121). (4) Note that m is a positive number that does not affect the relative order of the attention weights. For example, for qi, if qikT 1 > qikT 2 , there must be qjkT 1 > qjkT 2 for qj. This means if a key is important to qi, it is also important to qj, though the degree of importance may vary due to the softmax function. Figure 2: Similar queries have similar concerns for keys. We plot the attention map from two different layers in a sentence. We discretize the attention score and those important keys are shown in bright green. Each attention map has two red borders, the bottom border shows important keys that current query actually focuses on, while another border shows important keys that the most similar query focuses on. Although it\u2019s nearly impossible that cosine_similarity(qi, qj) = 1 in real situation, we can make the hypothesis that two similar queries may have similar concerns for keys. To validate this hypothesis, we provide two attention maps of a sentence randomly drawn from PG-19 using LLaMA2-7B, as 3attention weight is unnormalized attention score 4 \fshown in Figure 2. Important keys are marked with bright green, more plots are available in Appendix A.1. We observe that the hypothesis is true, and similar queries exhibit similar concerns for important keys. At the same time, important keys only account for a small proportion especially in deeper attention layers, which is consistent with the finding that deeper layers are sparser in previous section. 3.3 Similarity exploration of query vectors We have validated two similar queries have similar concerns for keys in Section 3.2, we also need to validate that at each step we can find a previous query state that is similar enough to current query state in same layer and same head. To check this, we visualize cosine similarity of query vectors within same sequence as shown in Figure 3, more plots are available in Appendix A.2. We observe an intriguing phenomenon that many images show clear oblique color segmentation, with the top oblique block closest to dark red which means current query is most similar to recent queries. Figure 3: Visualization of query vectors\u2019 cosine similarity over one sentence with a length of 1024. The i-th row of the map represents cosine similarity of the i-th query to all previous queries. The plot reveals that in most cases current query is most similar to recent queries. Through above observations, we see an opportunity to design a KV cache eviction policy based on query similarity that preserves the LLM generation performance. 4 Cache Optimization with Recent Message In this section, we present CORM, a method reduces the KV cache memory based on recent query attention information without any fine-tuning process. In Section 4.1, we derive that current query can directly use recent query attention messages during generation. In Section 4.2, we present CORM eviction policy and describe how it works during generation. 4.1 Generate based on recent query attention messages Consider observations in Section 3, intuitively, we can directly store all queries and their attention information for future reference. At each generation step, use current query to find the most similar one from previous queries, and use its saved attention information to calculate solely on important keys. However, this approach incurs a significant cost. First, storing all queries results in a substantial increase in memory overhead. Second, the requirement of performing similarity calculations at each step adds to the computational overhead. Since in most cases current query is most similar to recent queries as described in Section 3.3, we can just use recent query attention messages. And from Figure 2 we can also observe that only a small proportion of keys are considered important by recent queries. Therefore even if we save all the keys that are considered important in previous steps, we can save a lot of memory. 4.2 Eviction algorithm via recent message We have shown recent query attention information is enough for cache optimization in Section 4.1. In the following, we formally define this algorithm and introduce how to integrate it into LLM generation directly. Definition 4.1 (Long-term Minor Key) A key ki is considered as long-term minor key only if it is considered minor in all recent r steps (from t \u2212r + 1 to t). 5 \fApproach CORM will have a recent window of size w to record the information of recent w queries, and will always keep recent r keys unremoved to prevent them from being discarded prematurely due to insufficient observations. During generation, ki, vi will be discarded once ki is regarded as long-term minor key. For better explanation we present pytorch code4 of main algorithm in Algorithm 1. Intuitively, when w is larger, more keys and values will be saved, the compression rate will be smaller and performance will be better; Conversely, when w is smaller, fewer keys and values will be saved, the compression rate will be larger and performance will be worse. So there\u2019s a tradeoff between performance and compress rate. Memory Overhead Analysis In order to reduce memory overhead of KV cache, an extra memory overhead is introduced by recent information cache. We need to store recent query messages which increase memory overhead. However, these overheads are far less than compressed KV cache, one can use a small portion of memory to avoid maintaining full KV cache memory without obvious performance degradation. On the other hand, the compression rate will increase as the sequence length increases as shown in Figure 4, resulting in a lower memory overhead for this component in comparison. Algorithm 1 Single-head KV cache eviction with CORM (unbatched) def corm_eviction(keys, values, message, attn_score, w, r, t): \"\"\" Args: keys: previous key states, a tensor with shape [l, d] values: previous value states, a tensor with shape [l, d] message: attention message, a tensor with shape of [m, l-1] attn_score: current steps attention score, a tensor with shape of [1, l] w: window size, a scalar r: recent size, a scalar t: current step, a scalar Returns: updated_keys: updated keys updated_values: updated values updated_message: updated message \"\"\" m = message.shape[0] # update attention message message = torch.cat([message, torch.zeros(m, 1)], dim=1) \u25b7pad to [m, l] cur_message = attn_score >= 1 / t message = torch.cat([message, cur_message], dim=1)[-w:, :] if message.shape[0] < w: return keys, values, message else: # determine the key-value pairs that necessitate discarding decision = message.any(dim=0) decision[-r:] = True \u25b7always keep recent r tokens unremoved indices = torch.nonzero(decision).squeeze() keys = keys[indices, :] values = values[indices, :] return keys, values, message 4For the sake of brevity, the code snippet only demonstrates single-head eviction operation, while in the actual implementation, it will be performed on each head at every layer. 6 \f5 Empirical Evaluation In this section, we present the results that demonstrate CORM can reduce up to 70% of the memory footprint of KV Cache without accuracy degradation on LLaMA2-7B-Chat. Dataset To broadly validate feasibility of our method on real-world use cases, we choose LongBench [16] as our evaluation benchmark, which contains a wide range of long-text tasks such as question answering [19\u201324], summarization [25\u201328], few-shot learning [29\u201332], synthetic task and code completion [33, 34]. Here we do not consider short text tasks, because even full cache doesn\u2019t have any bottlenecks. Models Since sequence length is the main factor in the continuous growth of KV Cache, we employ LLaMA2-7B-Chat [2] for 4K test considering its wide usage. Baselines Since CORM reduces KV cache without need for training, we consider several similar approaches as our baselines: StreamLLM [10], Scissorhands [11] and H2O [12]. In addition, the full KV cache is also considered as strong baseline to measure the performance loss of other methods. Setting All baselines can be regarded as fixed budget size KV cache compression, however CORM is a dynamic compression method. Since we find that CORM has similar compression rates for various task texts with the same sequence length. For fair comparison, we plot the relationship between model compression rate and sequence length using texts randomly sampled from PG19 [18] as shown in Figure 4. Figure 4: Relationship between compression ratio and sequence length. Plots show that compression rate with CORM \"256+256\" and budget=1024 are close for LLaMA2-7B-Chat. Main Results We evaluate LLaMA2-7B-Chat for 4K length text. Results are summarized in Table 1 & 2 for LLaMA2-7B-Chat. The following observations can be drawn: (1) CORM consistently outperforms previous methods at the same compression rate across a wide range of tasks. (2) Meanwhile, with over 70% KV cache reduction, CORM achieves comparable performance as the model with full KV cache and even surpass it on some tasks, we speculate it\u2019s because there\u2019s some noise in full KV cache that affects model output and our method can eliminate this noise to a certain extent by discarding some KV cache. 5.1 Budget unnecessity: is unbudgeted better? We primarily focus on the effectiveness of not setting a budget versus setting a fixed budget. Note that since we use same window size and recent size as Scissorhands in the experiment, it can be regarded a natural ablation experiment. And Table 1 & 2 have shown that, at the similar compression rate, CORM is much better than Scissorhands in most tasks, and performance of other tasks is close. This verifies that different transformer layers and heads should be treated differently rather than setting a same fixed budget size. 7 \fTable 1: Results (%) on single-doc QA, multi-doc QA and summarization tasks. \"Full\" refers to LLaMA2-7B-Chat utilizing full KV Cache, \"StreamLLM\" is configured with 4+1020, \"Scissorhands\" is configured with 768+256 where window size=256, \"H2O\" is configured with 768+256, \"CORM\" is configured with 256+256 for fair comparison. For the sake of brevity we use ID to denote dataset here, mapping from ID to dataset can be found in Appendix B . Method Single-Doc QA Multi-Doc QA Summarization 1-1 1-2 1-3 1-4 2-1 2-2 2-3 2-4 3-1 3-2 3-3 3-4 Full 19.0 22.1 36.7 11.8 27.8 31.5 8.3 6.8 26.8 20.7 26.2 0.2 StreamLLM 13.2 15.4 27.2 6.5 24.2 25.4 5.3 4.4 21.6 19.8 24.4 0.1 Scissorhands 16.6 18.7 32.4 9.9 26.3 32.1 8.9 5.7 22.1 20.7 25.4 0.2 H2O 17.9 19.5 34.9 11.5 27.5 29.7 7.5 7.1 24.5 21.0 25.8 0.2 CORM 18.9 22.2 38.6 12.0 27.6 31.6 8.4 7.1 26.4 21.0 25.8 0.2 Table 2: Results (%) on few-shot learning, synthetic, and code tasks. \"Overall\" is computed by the macro-average over major task categories. This is computed on English (EN) tasks, Chinese (ZH) tasks, and all (All) tasks, code tasks are included in both languages. Method Few-shot Learning Synthetic Code Overall 4-1 4-2 4-3 4-4 5-1 5-2 5-3 6-1 6-2 EN ZN All Full 64.0 83.3 41.4 17.3 2.9 7.8 10.0 58.3 52.2 32.8 16.9 28.9 StreamLLM 61.0 82.9 39.1 14.5 1.8 4.7 6.5 57.6 50.0 29.5 14.3 25.7 Scissorhands 52.5 83.6 40.7 17.0 3.1 6.5 7.7 56.8 52.1 31.0 15.8 27.2 H2O 63.0 81.5 39.9 17.0 2.8 7.0 7.3 57.8 52.3 31.8 16.4 28.0 CORM 64.0 83.5 41.3 17.3 2.9 9.0 9.1 58.3 52.0 32.9 16.8 28.9 6"
18
+ }
abs_9K/validation_abstract_short_2404.15974v1.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.15974v1",
3
+ "title": "A Human-Computer Collaborative Tool for Training a Single Large Language Model Agent into a Network through Few Examples",
4
+ "abstract": "The capabilities of a single large language model (LLM) agent for solving a\ncomplex task are limited. Connecting multiple LLM agents to a network can\neffectively improve overall performance. However, building an LLM agent network\n(LAN) requires a substantial amount of time and effort. In this paper, we\nintroduce EasyLAN, a human-computer collaborative tool that helps developers\nconstruct LANs. EasyLAN initially generates a LAN containing only one agent\nbased on the description of the desired task. Subsequently, EasyLAN leverages a\nfew training examples to update the LAN. For each example, EasyLAN models the\ngap between the output and the ground truth and identifies the causes of the\nerrors. These errors are addressed through carefully designed strategies. Users\ncan intervene in EasyLAN's workflow or directly modify the LAN. Eventually, the\nLAN evolves from a single agent to a network of LLM agents. The experimental\nresults indicate that developers can rapidly construct LANs with good\nperformance.",
5
+ "authors": "Lihang Pan, Yuxuan Li, Chun Yu, Yuanchun Shi",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-04-24",
8
+ "primary_cat": "cs.HC",
9
+ "cats": [
10
+ "cs.HC"
11
+ ],
12
+ "label": "Original Paper",
13
+ "paper_cat": "LLM AND Agent",
14
+ "gt": "The capabilities of a single large language model (LLM) agent for solving a\ncomplex task are limited. Connecting multiple LLM agents to a network can\neffectively improve overall performance. However, building an LLM agent network\n(LAN) requires a substantial amount of time and effort. In this paper, we\nintroduce EasyLAN, a human-computer collaborative tool that helps developers\nconstruct LANs. EasyLAN initially generates a LAN containing only one agent\nbased on the description of the desired task. Subsequently, EasyLAN leverages a\nfew training examples to update the LAN. For each example, EasyLAN models the\ngap between the output and the ground truth and identifies the causes of the\nerrors. These errors are addressed through carefully designed strategies. Users\ncan intervene in EasyLAN's workflow or directly modify the LAN. Eventually, the\nLAN evolves from a single agent to a network of LLM agents. The experimental\nresults indicate that developers can rapidly construct LANs with good\nperformance.",
15
+ "main_content": "Introduction The capabilities of Large Language Models (LLMs) in handling complex tasks are limited. A common solution is to decompose a complex task into sub-tasks [1, 2, 3], each managed by an LLM-driven agent. These agents connect and form a network, collaboratively accomplishing the complex task. However, existing LLM agent networks (LANs) require manual editing by developers [4], demanding significant time and effort in the network\u2019s design, testing, and modification. Developers must (1) estimate LLM capabilities to determine the task division and interconnections among agents [5] and (2) inspect each agent to identify and resolve issues that lead to suboptimal performance. Humancomputer collaboration [6, 7] is a promising solution that leverages artificial intelligence (AI) to alleviate physical and mental burdens. Nevertheless, this collaborative paradigm has not been applied in the design and development of LANs. In this paper, we introduce EasyLAN, a human-computer collaborative editing tool for developing task-oriented LLM agent networks (LANs). The most significant feature is the \"few-example-driven\" paradigm for LAN construction. EasyLAN alleviates the need for proactive decomposition of the complex task during LAN design and reduces the effort for reactive inspection and modification of agents during LAN debugging. As illustrated in Figure 1, EasyLAN initiates the LAN with a single agent based on a brief description of the complex task. For each training example, EasyLAN \u2217Both authors contributed equally to the paper. \u2020Indicates the corresponding author. arXiv:2404.15974v1 [cs.HC] 24 Apr 2024 \fA Collaborative Tool for Training LLM Agent Network Figure 1: How EasyLAN trains a task-oriented LLM agent network (LAN) from a single LLM agent. (1) EasyLAN auto-generates an initial LAN that only contains a single LLM agent based on the task (e.g., translating French to English). A significant gap exists between the capabilities of the initial LAN and the task requirements. (2) A training example consists of an input and a ground truth. For a given training example, EasyLAN identifies discrepancies between the LAN\u2019s output and the expected output. For instance, when the input is a line of French poetry, \"Vienne la nuit sonne l\u2019heure, les jours s\u2019en vont je demeure\", the LAN fails to translate the text accurately while preserving the original rhyming scheme. (3) EasyLAN identifies the cause of the discrepancies and updates the LAN with respect to both the network architecture (e.g., splitting Translator into Literal Translator and Rhyming Polisher) and agent contents (e.g., adjusting the functionality of an agent). (n) EasyLAN iterates over a small set of training examples and constructs a satisfactory LAN. compares the actual and expected output to identify the limitations and the root causes within the LAN. EasyLAN then formulates and implements updates, improving the network\u2019s capabilities to accommodate the given example. The human-computer collaboration is manifested in the following way: the LAN developer supervises how EasyLAN executes the workflow mentioned above. When anomalies or errors occur, they can intervene and correct the system\u2019s actions to ensure appropriate execution. To implement EasyLAN, we designed the internal structure of agents, which consists of input, control, execution, and output modules. The connection of input and output modules between different agents forms the network. The control module evaluates and decides whether the agent should be activated, while the execution module computes the agent output. Both of them leverage LLMs for computation and contain updatable knowledge bases and example repositories for few-shot learning. We designed strategies for updating the LAN and a pipeline for identifying error causes and selecting corresponding strategies. A user interface has been implemented in the browser to facilitate user inspection and control over the update process. The user can directly edit the LAN through GUI interactions (e.g., drag and drop) when necessary. We conducted a user study (N=12) to evaluate the usability of EasyLAN. The experimental results showed that EasyLAN can help users reduce interaction time by 39.3% while improving the performance of the constructed LANs by 39.8%. In the remaining parts of this paper, we first review work related to our work. We then outline the design of the agent network (Section 3), which serves as the output of EasyLAN. Subsequently, we describe how the user and EasyLAN collaboratively train the LAN, detailing: 1) the automated mechanisms which EasyLAN employs to update the LAN (Section 4.1); and 2) how the user inspects and intervenes in the update process (Section 4.2). Technical details of the system implementation are elaborated upon in Section 5, focusing on the design of prompts, as the effectiveness of EasyLAN and the LAN heavily relies on LLMs. Finally, we validate the performance of EasyLAN through an evaluation study. 2 Related Work 2.1 Decomposing Complex Tasks and Connecting Multiple LLM Agents Large Language Models (LLMs) have been applied to a wide array of tasks such as code generation [8], storytelling [9], and command understanding [10]. However, their performance is limited in real-world tasks that are inherently complex and require domain-specific knowledge [11, 12] or multi-step reasoning [13, 14]. One promising approach to address these limitations is to explicitly employ multiple LLM-driven agents to collaborate on the tasks, simulating the human process of decomposing complex tasks and addressing them separately [15, 16, 17]. For instance, AI Chains [5] accomplish tasks like peer-review writing and personalized flashcard creation by chaining LLM prompts. In addition to performance gains, this approach has been proved to offer improved transparency and controllability [5] compared to embedding multi-step reasoning within a single LLM calculation (e.g., chain of thought [18]) or repetitive calculations with similar prompts (e.g., SayCan [19] and AutoCoT [20]). 2 \fA Collaborative Tool for Training LLM Agent Network There are two primary challenges in creating a network of LLM agents. First, the design of the network architecture, specifically the decomposition of complex tasks into subtasks, is not straightforward [21, 15, 5]. Users must consider global constraints [22, 23] and break down tasks into actionable subtasks [24]. These subtasks then need to be allocated to appropriate entities (e.g., self-sourcing [25], friend-sourcing [26, 27, 28], and crowd-sourcing [29]) based on their requirements such as expertise and task familiarity [15, 30]. The difficulty is further amplified when constructing an LLM network, as users struggle to predict LLM capabilities in solving specific problems [31]. Second, using existing graphical user interface (GUI) editing tools introduces additional interaction overhead. Although researchers have proposed GUI tools for editing LAN (e.g., PromptChainer [4]), users are confined to constructing, testing, and modifying the network through tedious GUI operations. Existing tools do not allow for human-machine collaboration to reduce users\u2019 workload. EasyLAN addresses the aforementioned challenges in two ways. On the one hand, it obviates the need for users to design the network, thus reducing users\u2019 cognitive load. EasyLAN automatically tailors both the network structure and the content of each agent according to the provided training samples. On the other hand, EasyLAN automates the process of network update. Even if EasyLAN makes an error, users can intervene in the update pipeline and correct its behaviors through minimal interactions, thereby decreasing their physical workload. 2.2 Using Examples in LLM Applications Existing research leverages few-shot learning [32, 33] to introduce examples (pairs of input and output) in the prompts. These examples guide the LLM to generate more accurate results. This method has substantially lowered the barriers to prototype AI applications, making it particularly beneficial for those without AI expertise. Consequently, this approach has been broadly adopted in various fields, including translation [33], chatbots [34], end-user programming [35], and robot interaction [36]. Although some studies have optimized the construction [37, 38, 39, 40], selection [41, 42, 43], and order [44, 45] of these examples to enhance model performance [46], they have not fundamentally changed how examples are employed within LLM-based applications. One concern among researchers is what LLMs are capable of learning through few-shot learning [47, 48, 49, 50], a question critical to evaluating the method\u2019s reliability for real-world applications [51, 52, 53]. While preliminary insights and conclusions exist for AI experts ( e.g., few-shot examples may provide input distribution and output space [47]), there has been no comprehensive answer suitable for non-AI experts (e.g., human-computer interaction (HCI) researchers without an AI background). This gap often forces these users into a \u2019trial-and-error\u2019 approach when creating prompts [31, 54], reducing efficiency, result quality, and user controllability. Unlike the aforementioned approaches, EasyLAN goes beyond just hardcoding the examples in the prompts. EasyLAN explicitly adjusts the network architecture and the knowledge within each agent based on the provided examples. EasyLAN enables a more comprehensive utilization of the example data, maximizing the information extracted from the examples. It also gives developers a more intuitive understanding of what their systems have learned from the examples and simplifies debugging. 2.3 Human-Computer Collaborative Tools In traditional human-computer collaboration models, the computer typically offers optional hints or suggestions, aiding the human user in task completion. In such systems, the human user shoulders the workload predominantly. These types of tools have been widely utilized across various domains, including but not limited to, patient note-taking [55, 56, 57], storytelling [58, 59], and other creative endeavors [60, 61, 62, 63, 64]. With the advancement of AI, an increasing number of tools replace human involvement entirely. An illustrative example is AI-assisted painting, which can autonomously generate a complete image from a user-provided text description or partially complete image [65, 66, 67, 68, 69, 70]. This autonomy, however, often comes at the cost of user agency in the creative process. Users frequently find themselves in a cycle of iteratively adjusting inputs [8, 71] or expending additional effort in interactive modifications to obtain desired outputs [72, 73]. This highlights a critical gap in balancing automation and user control in current AI systems. Human-in-the-loop (HITL) [74, 75] can be considered a special kind of human-computer collaboration. Instead of the computers assisting humans, HITL emphasizes humans helping computing systems improve their capabilities with additional effort (e.g., providing annotations). However, in existing HITL systems, users cannot engage in the internal updating processes of the system. This results in a lack of interactivity [76] in HITL and makes it challenging to support high-level knowledge [77]. In this paper, we adopt a human-computer collaboration tool that diverges from the approaches above: the computer autonomously executes tasks (e.g., updating the LAN) while the human supervises its execution and intervenes if 3 \fA Collaborative Tool for Training LLM Agent Network necessary. This approach not only alleviates the user\u2019s workload but also enhances the transparency and controllability of the computing system [5]. 3 LLM Agent Network (LAN) Design Figure 2: An overview of an agent in a LAN. (a) The modules inside an agent. (b) an example LAN. \"Literal Translator\" and \"Rhyming Polisher\" are agents in the LAN. (c) Details of the \"Rhyming Polisher\" in (b). It receives the original French text and the output from the \"Literal Translator\" and computes a rhyming translation result.\" A LAN is composed of multiple interconnected agents. The agents are responsible for sub-tasks and collaboratively accomplish a specific complex task. As illustrated in Figure 2(a), an agent comprises four components: an input module, a control module, an execution module, and an output module. The input module receives data from the output modules of predecessor agents, thereby connecting the agents into a directed acyclic graph (DAG). The control and execution modules constitute the core of an agent. They leverage LLMs to accomplish their functionalities and are subject to optimization during LAN updates. 3.1 Input Module (IM) & Output Module (OM) The input module (IM) receives results from the predecessor agents\u2019 output modules (OMs). It also accepts external inputs (e.g., the French text awaiting translation in Figure 2(c)). The OM produces varying outputs based on the agent\u2019s activation status3: 1. When the agent is not activated (i.e., the control module returns \u2019False\u2019), the OM forwards the received inputs as its outputs. 2. When the agent is activated (i.e., the control module returns \u2019True\u2019), the OM outputs the results generated by the execution module. 3.2 Control Module (CM) The Control Module (CM) serves as a decision-maker, akin to a \"router\", to evaluate whether the current agent should be activated. It facilitates conditional activation of agents, allowing the LAN to adapt its flow in real time by selecting a directed trail within the network. For instance, as illustrated in Figure 2(c), the \u2019Rhyming Polisher\u2019 is activated when the CM identifies rhyming elements in the French text input (\"l\u2019heure\" and \"demeure\"). Conversely, for non-rhyming inputs, the CM would not activate the agent. By embedding such decision-making logic within the agent itself, instead of adding an additional agent to the network, we substantially simplify the LAN\u2019s architecture. The CM\u2019s decision impacts the final output of an agent, as discussed in Section 3.1. 3The activation status will be further elaborated in Section 3.2. 4 \fA Collaborative Tool for Training LLM Agent Network Table 1: CM Properties and their explanations Property Explanation Enabled Boolean. If this property is set to false, it indicates that the CM will activate the agent under any input. This attribute is employed for critical agents within the LAN (e.g., Literal Translator) to reduce computational cost. Required Predecessors A list of predecessor agents. If any of these agents are not activated, the CM will not activate its agent. Knowledge A knowledge base. The CM utilizes the knowledge to determine whether to activate its agent. For example, \"If the original text exhibits rhyming, the current agent should be activated.\" (Rhyming Polisher in Figure 2(c)) Examples An example list. The CM utilizes the examples to determine whether to activate its agent. An example is composed of the input of the agent and the CM\u2019s result. For example: Input: (from LAN) Bras lev\u00e9s raides pour bl\u00e2mer, Dans faux gestes d\u2019aimer; (from Literal Translator) Arms raised stiff to blame, In false gestures of loving. Result: true Table 1 outlines the properties of a CM. When enabled and provided that all required predecessor agents are activated, the CM leverages LLMs to evaluate whether the agent should be activated. This assessment is based on the external input, outputs from upstream agents, and the specific subtask the agent is designed to undertake. For details of the prompt used in the CM, please refer to Section 5.1. 3.3 Execution Module (EM) The agent completes its subtask using the execution module (EM). Table 2 presents the properties of an EM. The EM utilizes LLMs to compute the agent\u2019s output based on the external input, outputs from upstream agents, and its designated task. For details of the prompt used in the CM, please refer to Section 5.1. Table 2: EM Properties and their explanations. All the examples come from the EM of the \"Literal Translator\" in Figure 2 Property Explanation Subtask Description A string, describing the subtask the agent undertakes. For example: \"Translating its literal meaning from the input into English\" Output Description A string, describing the output of the agent. For example: \"A string, indicating the literal translation\" Knowledge A knowledge base. The EM utilizes the knowledge to execute its subtask. For example, \"lev\u00e9s means lifted in English\" Examples An example list. The EM utilizes the examples to decide how to execute its subtask. An example is composed of the external output and the EM\u2019s result. For example: Input: (from LAN) Bras lev\u00e9s raides pour bl\u00e2mer, Dans faux gestes d\u2019aimer; (from Literal Translator) Arms raised stiff to blame, In false gestures of loving. Result: Arms raised stiff to blame, In false gestures of loving 4 System Design An LLM agent network (LAN) decomposes a complex task into multiple sub-tasks, each of which is managed by an individual agent. EasyLAN facilitates the user in developing a LAN for a complex task. The user is required to provide only 1) a natural language description of the desired task and 2) a small set of training examples comprising both inputs and expected outputs. EasyLAN employs an iterative approach to update the LAN. Throughout this process, users supervise the automated behaviors executed by EasyLAN and intervene as necessary. This section is organized as follows: first, we elucidate the automated pipeline responsible for LAN updates (Section 4.1), followed by an introduction on how the user can exert influence over EasyLAN\u2019s workflow (Section 4.2). 4.1 Automated Update of LAN 4.1.1 Initialization of the LAN The initial agent network is comprised solely of a single agent. Its functionality is delineated by the user-provided task description, and its output is directly the outcome of that specified task. However, the performance of a single agent is inherently circumscribed due to its limitation of generating only end-to-end output. 5 \fA Collaborative Tool for Training LLM Agent Network Figure 3: The pipeline for updating the LAN. The light blue rectangles indicate update strategies. 4.1.2 Pipeline to update a LAN Figure 3 outlines the pipeline for updating the LAN. The pipeline comprises multiple iterations until the LAN can proficiently handle the current training input. At this time, EasyLAN adds the inputs and outputs of each agent\u2019s CM and EM to the corresponding module\u2019s example library, further ensuring the performance of the LAN. During each iteration, EasyLAN selects an update strategy from Table 3 following the four steps below: 1. (Step 1) EasyLAN calculates the gap between the LAN output and the expected ground truth. If the LAN fails to yield satisfactory results, it indicates that at least one constituent sub-task has been inadequately executed. EasyLAN identifies the most significant deficiency in the LAN and isolates the crucial sub-task. 2. (Step 2) EasyLAN analyzes the reasons for the gap\u2019s existence, which fall into three categories: \u2022 No agent is responsible for the sub-task.EasyLAN selects the strategy that creates a new agent and proceeds to Step 4. \u2022 The sub-task should not be executed, but the corresponding agent is activated. EasyLAN chooses the strategy that updates the agent\u2019s CM knowledge to deactivate it and then moves to Step 4. \u2022 An agent already manages the sub-task, but its performance is poor. EasyLAN proceeds to Step 3 to identify a more specific reason. 3. (Step 3) EasyLAN investigates the reasons behind the agent\u2019s poor performance and advances to Step 4. These reasons can be classified into four possibilities: \u2022 The agent is not activated. EasyLAN selects the strategy to update the agent\u2019s CM knowledge to activate it. \u2022 The agent lacks knowledge. EasyLAN chooses the strategy to update the agent\u2019s EM knowledge to enhance its performance. \u2022 The agent requires a more refined internal structure. EasyLAN selects the strategy to split the agent into two or more agents. \u2022 The agent needs additional inputs from other agents. EasyLAN opts for the strategy that adds new edges to the network, allowing the agent to receive the necessary inputs. 4. (Step 4) EasyLAN calculates the parameters for the chosen strategy. The LAN undergoes an update with this strategy, is re-executed to obtain a new result, and initiates a new iteration. 4.1.3 Details of the update strategies This section focuses on the specifics of various error causes and their respective update strategies. No agent is responsible for a sub-task. EasyLAN creates a new agent for the sub-task and positions the agent appropriately within the network. As depicted in Figure 4(1), French employs passive voice, which may result in redundancy when translated word-for-word into English. Therefore, EasyLAN adds a Structure Refiner into the LAN to explicitly assess the sentence structure of translated results (e.g., active or passive voice). 6 \fA Collaborative Tool for Training LLM Agent Network Table 3: Update strategies and the underlying causes of error to rectify Update Strategy Cause of Error Add an agent No agent is responsible for a sub-task. Split an agent A task is already managed by an agent, but requires multiple steps or varying conditions to achieve a satisfactory output. Add Knowledge to the CM A task is already managed by an agent, but the agent is not activated. A sub-task that should not be executed is carried out, indicating that an agent is erroneously activated. Add Knowledge to the EM A task is already managed by an agent, but requires additional knowledge to yield satisfactory output. Add inputs to an Agent A task is already managed by an agent, but requires additional inputs from other agents to yield satisfactory output. Figure 4: An example of how EasyLAN updates a LAN. (0) EasyLAN decomposes the Translator into Literal Translator and Rhyming Polisher to ensure that the translation output can rhyme when necessary. (1) EasyLAN adds a Structure Refiner to adjust the syntactic structure of sentences (e.g., converting passive voice to active voice). (2) EasyLAN adds knowledge to the CM of the Rhyming Polisher to prevent unnecessary rhyming. (3) EasyLAN adds knowledge to the CM of the Rhyming Polisher to better identify whether the input sentence is rhyming. (4) EasyLAN adds knowledge to the EM of the Literal Translator to improve its capability to translate idioms. (5) EasyLAN splits the Literal Translator into Spoken Text Translator and Literary Text Translator to better cater to diverse translation needs. (6) EasyLAN adds a connection from the Structure Refiner to the Rhyming Polisher to ensure that the output from the Rhyming Polisher also adheres to the sentence structure defined by the Structure Refiner. A sub-task (handled by an agent) that should not be executed is carried out. EasyLAN updates the knowledge of the CM to deactivate the mistakenly executed agent. As depicted in Figure 4(2), the input sentence lacks rhyme, yet the Rhyming Polisher is triggered and converts the output from the Literal Translator into rhyming text. Rhyming carries side effects that may lead to semantic changes. Therefore, EasyLAN augments the knowledge of the Rhyming Polisher\u2019s CM to explicitly require that the Rhyming Polisher should not execute if the original text does not rhyme. A sub-task is already managed by an agent, but its performance is suboptimal. EasyLAN assesses the reasons behind the bad performance and selects corresponding strategies: 1. If the agent is not activated, EasyLAN updates the knowledge of its CM to activate it. As depicted in Figure 4(3), the LLM erroneously perceives \"repos\" and \"ch\u00e2teaux\" as ending with different vowels and deactivates the Rhyming Polisher. EasyLAN thus adds knowledge to the CM to enforce its activation. 2. If the agent requires additional knowledge to yield satisfactory results, EasyLAN summarizes and adds the required knowledge to the EM of the agent. As illustrated in Figure 4(4), the input text carries specific cultural meanings (\"one must not trust appearances\"), yet the Literal Translator\u2019s output lacks this nuance. Consequently, EasyLAN enriches the knowledge within the Literal Translator\u2019s EM to enhance its performance. 3. If the agent requires a more intricate structure, EasyLAN splits the agent into two or more separate agents and determines their interconnections. EasyLAN ensures that this division maintains the agent\u2019s semantic consistency. The knowledge of the original agent will be redistributed among the new agents. EasyLAN 7 \fA Collaborative Tool for Training LLM Agent Network supports two kinds of division: (1) sequential division, which breaks down the sub-task into finer-grained steps (e.g., dividing the Translator into the Literal Translate and the Rhyme Optimization, as shown in Figure 4(0)); (2) parallel division, separates the agent based on distinct conditions. For example, in Figure 4(5), the Literal Translator is split into the Literary Text Translator and the Spoken Text Translator to handle different literary styles. 4. If the agent requires additional inputs from other agents to yield satisfactory results, EasyLAN adds new edges to the network to ensure that the agent receives the necessary inputs. These additional inputs should already be computed within the agent network; otherwise, EasyLAN would create an agent responsible for their computation. As illustrated in Figure 4(6), although the Structure Refiner has already stipulated the use of an active voice in the translation result, this information was not conveyed to the Rhyming Polisher, leading to it once again altering the result to a passive voice. To rectify this issue, EasyLAN establishes a connection from the Structure Refiner to the Rhyming Polisher. 4.1.4 Ensuring the accuracy of previous training inputs EasyLAN\u2019s application of an update strategy should not compromise the accuracy of past training inputs. We adopt the following approaches to ensure this: 1. EasyLAN does not encompass disruptive update strategies, such as agent deletion, connection removal, knowledge removal, or task modification. The current LAN is generally satisfactory and can correctly process previous training inputs. These strategies remove useful components from the network without providing any compensation. 2. When the update strategy is adding knowledge (whether to the CM or the EM), EasyLAN employs few-shot learning to ensure the accuracy of historical training samples. As mentioned in Section 4.1.2, when the LAN can correctly handle a training sample, its operational state (e.g., the inputs and outputs of each agent\u2019s CM and EM) is recorded and added to the example repository. Therefore, EasyLAN does not need to take any additional actions. 3. When the update strategy is adding inputs, the few-shot learning mechanism still works. This is because the old inputs remain present, allowing the LAN to fully utilize the examples based on them. Therefore, EasyLAN does not need to take any additional actions. 4. When the update strategy is adding an agent, EasyLAN adds negative examples to the new agent\u2019s CM to ensure that the new agent will not be activated when processing historical training inputs. By taking this additional approach, we can ensure that the set of agents activated when handling historical inputs remains consistent, and therefore the final output also remains unchanged. 5. When the update strategy is splitting an agent, EasyLAN\u2019s additional actions are quite complex. For a given historical input, if the agent being split should not be activated, we simply add negative examples to the CMs of the newly created agents to ensure they will not be activated either. When the agent being split needs to be activated, EasyLAN also splits the examples of the original agent: (a) Splitting into multiple parallel agents. EasyLAN utilizes LLM to select an agent from the new agents. Then EasyLAN adds examples to the CMs of the new agents so that only the selected agent will be activated when processing the given history input. Finally, EasyLAN adds a new example to the EM of the selected agent to ensure that the output of that agent matches the output of the original agent. (b) Splitting into multiple sequential agents. We only concern the output of the last agent. Therefore, EasyLAN executes this historical input in the new LAN: for non-last agents, EasyLAN adds the execution results as an example to the EMs; for the last agent, EasyLAN adds the execution result of the original agent to its EM. Note that, as outlined in Section 4.2, developers have the capability to manually edit the LAN. Given the potential complexity of these manual interventions, automatically ensuring the accuracy of previous training examples falls outside the scope of this paper. 4.2 User Interaction with EasyLAN User interaction is divided into two categories: (1) Supervision of the automatic update pipeline by EasyLAN: If users believe that EasyLAN has made errors during this process, they can manually intervene. EasyLAN will continue executing unfinished steps following user intervention. (2) Manual editing of the LAN: Users can edit the LAN at any time. 8 \fA Collaborative Tool for Training LLM Agent Network Figure 5: The user interface. Region 1 allows users to inspect and modify the LAN structure. Agents can be selected by clicking the pink rectangles. Region 2 facilitates inspection and editing of the selected agent\u2019s properties. In Region 3, users can provide training examples to EasyLAN. Region 4 offers insights into and intervention options for EasyLAN\u2019s automated LAN update workflow. Figure 5 displays the interaction interface, featuring Region 1 with a diagram providing an overview of the structure of the LAN. Users can select any agent in the diagram, with its detailed information appearing in Region 2. Region 3 allows users to provide training samples (both input and output) to the system, while Region 4 enables users to monitor and intervene in EasyLAN\u2019s LAN updating process. 4.2.1 Supervision and intervention in EasyLAN EasyLAN displays results at each step of the LAN update process. As shown in Figure 5-4, the most significant discrepancy between the LAN\u2019s output and the ground truth is whether the translation result maintains rhyme. EasyLAN first calculates the underlying cause of this issue, which is the absence of an agent called PoeticTranslator, and presents the result for user review. If the user believes the current step is correct, they can click \"confirm\" to proceed to the next step. In cases where the user finds EasyLAN\u2019s results unsatisfactory, they can intervene in two ways (separately or simultaneously, as shown in Figure 6) and click \"retry\" to have the system recalculate based on their intervention. Way 1: manual modification of EasyLAN\u2019s output.As shown in Figure 5-4 & 6, we utilize a JSON editor to present the result of the current step, allowing the user to edit them directly within the editor. The user can focus solely on important details and use placeholders (<???>) in non-essential properties, which EasyLAN will auto-complete. We provide keyboard shortcuts to facilitate this process, enabling users to (1) click a field (e.g., agent_name in Figure 6) to set its value as a placeholder and (2) insert a placeholder where the cursor is. Additionally, we have implemented buttons to assist users in configuring the values of some key fields. For example, users can directly click \"Poor performance\" or \"Lack of agents\" to quickly set the value of the field \"reason_type,\" which indicates the cause of the error. Way 2: providing hints for EasyLAN to adjust its computation. In this approach, the user does not tediously modify the details of EasyLAN\u2019s results but can instead influence EasyLAN\u2019s computation results through concise, high-level natural language descriptions. This method offers significant advantages, especially when EasyLAN\u2019s computations are complex. For instance, when EasyLAN splits an agent, it calculates all the properties of the new agents (i.e., Table 1 & 2). If the user is dissatisfied with the result, directly modifying these properties, even a few, can be cumbersome. In contrast, the user can directly describe their expected splitting result here (e.g., \"translate first and then convert to rhyme\") and request EasyLAN to retry accordingly. 9 \fA Collaborative Tool for Training LLM Agent Network Figure 6: How the user intervenes in the pipeline of EasyLAN updating the LAN. The user can directly modify the result within the JSON editor and utilize placeholders (<???>) to allow EasyLAN to auto-complete them. They can also enter hints in the text area to guide EasyLAN in adjusting the results. 4.2.2 Manual modification of the LAN The user can manually edit the agent network in Region 1. We support four operations: (1) Creating a new agent by clicking the \"New agent\" button. Detailed information about the new agent can be modified in Region 2. (2) Deleting an agent by selecting it and pressing the \"Delete\" key on the keyboard. This action also removes both the incoming and outgoing edges of the agent. (3) Connecting two agents by dragging the starting agent onto the target agent. (4) Deleting a connection between agents by selecting the edge and pressing the \"Delete\" key on the keyboard. When the user selects an agent in the diagram in Region 1, they can manually edit the agent\u2019s name, task description, output description, and knowledge of CM and EM in Region 2. EasyLAN automatically verifies the editing results. The LAN cannot be saved if any of the following conditions are satisfied: (1) the network contains cycles, (2) any agent\u2019s name, task description, or output description is empty, or (3) two agents have duplicate names. 5 Implementation 5.1 LAN execution EasyLAN executes each agent sequentially following a topological order. The output of the last agent executed will serve as the LAN\u2019s final output. For each agent, EasyLAN utilizes LLMs to determine its activation status. If activated, it proceeds with result computation. Figure 7 illustrates the prompt\u2019s structure, which comprises: (1) a task description, specifying the LLM\u2019s current task; (2) agent inputs, encompassing the LAN\u2019s input, the sub-tasks of the agent\u2019s predecessors, and their corresponding outputs; (3) knowledge and examples (if available); (4) a zero-shot Chain of Thought prompt to extract the LLM\u2019s reasoning process; (5) a JSON template that defines the desired output format. It is important to note that the LLM may not consistently adhere to the format, in which case EasyLAN will call the LLM again to adjust the output to meet the specified format. 5.2 LAN Update In this section, we focus on the implementation of each step in the LAN update process described in Section 4.1, especially the prompts EasyLAN uses. Description of the LAN. We incorporate LAN descriptions into the prompts to provide the LLM with a comprehensive understanding of the LAN\u2019s content. This facilitates the LLM in better identifying its shortcomings. As depicted in Section ?? in the Appendix, these descriptions encompass the following elements: (1) Information regarding all agents, including their names and task descriptions; (2) Data flow between agents, specifying the data\u2019s content, its source, and its destination. This data flow originates from the LAN\u2019s last execution and should be optimized to yield satisfactory LAN outputs. (3) The LAN\u2019s input and output. 10 \fA Collaborative Tool for Training LLM Agent Network Figure 7: The prompts used in agent execution. Left: the prompt used by the CM to determine whether the agent should be activated. Right: the prompt used by the EM to calculate the output of the agent. Lines starting with a double slash (\"//\") are comments. Angle brackets (<>) in the prompts denote placeholders that should be replaced with actual values. Description of the agent. We include agent descriptions in the prompts to provide the LLM with comprehensive insights into the agent\u2019s specifics. This aids the LLM in making better determinations regarding agent modifications. As depicted in Section ?? in the Appendix, agent descriptions encompass the following elements: (1) agent information, including the agent\u2019s name, task description, and output description; (2) knowledge and examples within the agent\u2019s CM; (3) knowledge and examples within the agent\u2019s EM; (4) agent\u2019s inputs, thought processes (involving both CM and EM), and outputs from the previous execution. The content in bold was not included when describing the LAN. Update steps. As shown in Table 4, the prompts used in each update step consist of the following components: (1) the task to be accomplished in the current step, which aligns with the discussion in Section 4.1; (2) the outputs of previous steps; (3) a description of the LAN or a specific agent to be updated; (4) a JSON template to specify the LLM\u2019s output format. We provide a detailed explanation of this template within the prompt; please refer to Section ?? in the Appendix for more details. Table 4: The prompts used in the update steps. Please refer to Section ?? in the Appendix for more details. We omit some punctuation marks in the JSON template. Task for the Step Inputs from Previous Steps LAN Description Agent Description JSON Template Step 1 \"Find the gap between the LAN\u2019s output and the ground truth\" Yes No \"gap\": ... Step 2 \"Find why the gap exists\" 1. the gap Yes No \"reason_type\": ... \"agent_name: ... \"reason_content\": ... Step 3 \"Why the agent has a poor performance\" 1. description of the poor performance No Yes \"reason_type\": ... \"reason_content\": ... Step 4 \"Calculate the parameter for the strategy\" 1. the agent to be updated (if any) 2. the selected strategy Yes Yes \"parameters\": ... 5.3 System Implementation We implemented the server back end using Flask and made remote calls to OpenAI\u2019s GPT-4-0613. The connection to OpenAI can sometimes be unstable, although this issue is somewhat mitigated after we enabled the \"stream\" attribute 4. 4https://platform.openai.com/docs/api-reference/completions/create#stream 11 \fA Collaborative Tool for Training LLM Agent Network If the connection breaks down, we continue to retry until OpenAI returns a complete result. We employed React to implement the front end in the browser, and GoJS was utilized for rendering the diagram in Region 1. 6 Evaluation Study 6.1 Experimental Tasks Table 5 presents the four experimental tasks for the evaluation study. The first was used for the tutorial, and the remaining three were for the formal study. Given that subjective opinions on these tasks could vary among participants, we aimed to reduce variability by establishing well-defined criteria for each task. These criteria were used to evaluate the performance of the LAN. The construction of training samples is beyond the scope of this paper. In this experiment, we constructed 16 training examples for each task, all conformed to the abovementioned criteria. These examples were then split randomly into two subsets: one for training (8 examples) and another for testing (8 examples). While these tasks are all typical natural language processing tasks, they vary in difficulty for LLMs. LLMs [78, 79] are trained on multilingual data and excel at translation. However, researchers do not specifically collect sentence compression and couplet generation data to train LLMs. Besides, these tasks are not downstream training objectives for LLMs, making them more challenging. Table 5: Tasks in the user study. Please refer to Section 6.1 in the Appendix for more details about the tasks. Task ID Task Description Criteria Tutorial Grammatical error detection [80] 1. Identify subject-verb agreement errors 2. Identify missing sentence components 3. Identify redundancy in the sentence 4. Identify ambiguity in the sentence 1 Chinese-English translation [81] 1. The result is a grammatically correct sentence. 2. Correctly chooses whether to rhyme or not. 3. Accurately translates words with multiple meanings. 4. Correctly interprets metaphors specific to the Chinese context. 2 Sentence compression [82] 1. The result is a grammatically correct sentence. 2. Remove all the attributives from the sentence. 3. Remove all the adverbials from the sentence. 4. Remove all the complements from the sentence. 3 Chinese couplet generation [83] 1. Same character count for both couplets. 2. Matching emotion and related themes. 3. Same parts of speech for corresponding words. 4. No repeating characters between couplets. 6.2 Participants We recruited 12 participants (6 males and 6 females, ages 18-29). All were familiar with the aforementioned tasks, and none were programmers. 6.3 Baseline We use EasyLAN with its automatic update pipeline disabled as our baseline. Participants can only manually modify the LAN in Regions 1 and 2 (Figure 5). They can provide inputs to the LAN and obtain outputs in Region 3. We disable Region 4 in the baseline to prohibit any user interactions. 6.4 Procedure Participants were randomly assigned to two groups to control for individual differences: one group used EasyLAN, while the other group used the baseline system. We provided participants with a system briefing and explained the experiment\u2019s tasks. During the tutorial task, participants received guidance from experimenters and had the opportunity to ask questions. In the formal study, participants completed three tasks in a randomized order. Training examples were presented randomly, and participants were instructed to modify the LAN until the system\u2019s outputs met predefined criteria. The 12 \fA Collaborative Tool for Training LLM Agent Network entire experiment lasted approximately 1.5 hours. Afterward, we administered questionnaires to collect subjective feedback. After conducting experiments with all participants, we fed the testing examples into the user-constructed LANs. during the offline evaluation. The results were then shuffled and independently assessed by two experimenters to determine if they met the predefined criteria. In cases where the opinions diverged, a conclusion was reached through further discussion. 6.5 Results 6.5.1 Terminology and metrics A LAN modification is defined as the aggregate of all updates executed between two successive runs of the LAN. This encapsulates the implementation of a comprehensive LAN update plan and may contain multiple operational actions (e.g., creating a new agent and then editing its attributes). User editing distance (UED): A metric used to estimate the \"quantity\" of user interactions. We consider a single mouse click or pressing a key (e.g., typing a letter) to have an editing distance of 1. Dragging and text selection are assigned an editing distance of 2, as the user needs to determine both a starting and ending point. Therefore, deleting a text segment has an editing distance of 3, which involves selecting the text first and pressing the \"Delete\" key. LAN modification distance (LMD): A metric designed to quantify the differences between two LANs. Let A and B represent two different LANs. If a user manually edits A into B solely through interactions supported by the baseline, the theoretical minimum UED required for this transformation is designated as the LMD between A and B. The LMD of a task is defined as the LMD between the initial LAN and the final LAN corresponding to that task. Interaction time: Defined as the total time minus the LLM execution time. The running of LLM is computationally expensive, and optimizing its efficiency falls outside the scope of this paper. The exclusion of LLM\u2019s execution time allows for a more accurate measure of EasyLAN\u2019s operational efficiency. LAN output scores: As discussed in Section 6.1, we propose criteria for all tasks. The score of a LAN output is 1 if it fulfills all the criteria, else 0. The score of a LAN is denoted as the average score of its output. Naive LAN: A LAN with only one agent. The agent relies solely on few-shot learning, meaning that its EM knowledge is exactly the training examples. 6.6 User behaviors EasyLAN offers a reduced interaction burden compared to the baseline. Table 6 displays the frequency of different editing actions and their average UEDs. In EasyLAN, the UED to complete a task is 374 (47 per training example), and that for the baseline is 947 (118 per training example, p < 0.001). This suggests that EasyLAN enables users to develop a satisfactory LAN with 39.5% of interactions, which is mainly due to two key factors. (1) EasyLAN can amplify user actions. The average LMD per task in EasyLAN is 2424, 6.48 times greater than the corresponding UED. The LMDs for EasyLAN are very large, mainly because the LLM tended generate very long sentences as knowledge. (2) In the baseline system, the LMD is slightly less than the UED (825 < 945), which indicates that manual edits always introduce errors, necessitating additional corrective actions. Table 6: User actions and their average UED. The UED of EasyLAN decreases by 60.5% relative to that of the baseline. Actions Baseline EasyLAN Count per task UED per action UED per task Count per task UED per action UED per task Modify Step1 0 0 0 (0%) 3.33 82.4 301 (80.6%) Modify Step2 0 0 1.00 2.61 Modify Step3 0 0 0.94 1 Modify Step4 0 0 1.39 17.0 New Agent 1.56 1.00 946 (100%) 0 0 72.3 (19.7%) Modify Agent 11.6 80.8 1.67 41.9 Modify Edge 2.11 3.16 0.33 7.00 EasyLAN demonstrated a lower frequency of manual modifications, implying that it helped users determine the correct modification plan more quickly. EasyLAN users conducted 8.22 modifications per task, whereas baseline users conducted 10.83 modifications. The average number of modifications per sample for EasyLAN is significantly lower 13 \fA Collaborative Tool for Training LLM Agent Network than that for the baseline (p=0.048 < 0.05), suggesting that EasyLAN aided users in making more accurate adjustments to the LAN. EasyLAN exhibits higher interaction efficiency. Users completed a task with EasyLAN in an average interaction time of 605 seconds and saved 39.3% of the time compared with the baseline (997 seconds, p < 0.001). EasyLAN exhibits varying degrees of time savings in different tasks. In Task 2 (682 seconds vs. 1046 seconds, p < 0.001) and Task 3 (551 seconds vs. 1325 seconds, p < 0.001), it saved 34.8% and 58.4% of time, significantly enhancing interaction efficiency. However, in Task 1, although the average interaction time decreased slightly compared to the baseline (581 seconds vs 620 seconds, 6.3%), statistical tests did not show significance (p = 0.76). The main reason is that Task 1 is a translation task in which LLM excels, requiring only minor LAN modifications to achieve the desired results. Consequently, the baseline\u2019s interaction time is small. In contrast, LLM struggles with Task 2 and Task 3, leading users to make substantial LAN modifications, thus resulting in a significant difference in interaction time between EasyLAN and the baseline. 6.7 Performance of the LANs LANs constructed using EasyLAN have a 39.8% improvement in scores on training samples compared to the baseline (0.583 vs. 0.417, p=0.009 < 0.05). Note that the score of the naive LAN is 0.29 and the tasks are quite difficult for the LLM. The differences mainly exist in Task 1 (0.686 vs. 0.396) and Task 3 (0.563 vs. 0.375). However, the performance of EasyLAN and the baseline only differs slightly in Task 2 (0.500 vs. 0.479). A possible explanation is that Task 3 is quite suitable for few-shot learning, as the score of the naive LAN in Task 3 is 0.5. Baseline users tended to add the training examples into the LAN as knowledge (we will discuss this in the next paragraph), which explains its performance. We conducted a thorough comparison of the LANs generated by the two systems and identified the following differences: 1. LANs constructed with EasyLAN exhibit a higher number of agents compared to the baseline system (2.89 vs 2.33, p=0.04 < 0.05), suggesting that EasyLAN breaks down complex tasks into more detailed components. This is likely because creating a new agent in the baseline system is a cumbersome process for users, as it requires them to manually define various attributes of the agent and edit the values in the GUI. 2. The knowledge in the LANs constructed by EasyLAN is more general than that of LANs constructed with the baseline. All of the 121 pieces of knowledge from LANs built with EasyLAN contain both a general description and a concrete example. In contrast, the LAN constructed by the baseline system contains 98 pieces of knowledge, of which 33 (33.7%) are directly the given training examples (or part of them), without any generalization. Users of the baseline system often found it challenging to generalize knowledge from the training examples, and they tended to add the examples to the knowledge base directly. Although the correctness of the LAN can be ensured during the training process, it is difficult to guarantee the generalization ability. 6.8 Subjective Feedback Table 7: Subjective feedback Baseline EasyLAN P-value Determining the modification plan for the agent network is easy. 3.67 5.67 0.02 Applying the modification plan for the agent network is fast 4.17 6.00 0.03 Interaction with the system is straightforward. 4.17 6.33 0.002 The system is intelligent, and you receive many hints from the system. 4.00 6.67 0.007 Willing to use this system to construct multi-agent networks. 4.17 6.17 0.01 Table 7 compares user feedback for two systems. Overall, users have a positive attitude towards EasyLAN, considering it more intelligent and providing a relaxed and fast interaction experience. 7 Discussion 7.1 The Difference Between Intra-Agent Knowledge and Inter-Agent Structures In tutorials of the evaluation study, a frequently asked question is, \"When should I add knowledge, and when should I create a new agent?\" In fact, the internal structure of a LAN can be understood as encapsulating a form of knowledge that specifies \"what actions to take\" (hereafter termed W-knowledge). On the other hand, another form of knowledge 14 \fA Collaborative Tool for Training LLM Agent Network outlines \"how to execute those actions\" (hereafter termed H-knowledge). Differentiating between these two categories of knowledge is crucial, as they present distinct characteristics: 1. W-knowledge exhibits complex interrelationships, as distinct steps required for accomplishing an intricate task are often interdependent. In the context of LLMs, which solely accept natural language inputs, incorporating multiple pieces of W-knowledge into a single agent necessitates additional natural language descriptions to articulate their interrelationships. Notably, these descriptions serve not as imperatives but as optional constraints. By making the interdependencies among W-knowledge explicit in the structure of the LAN, we achieve a more transparent representation of the hierarchical organization of the subtasks. 2. W-knowledge is primarily task-oriented, whereas H-knowledge is predominantly input-related. The vast majority of agents are activated during LAN execution, which means that most of the W-knowledge within the LAN structure is fully leveraged, whatever the input is. On the other hand, the relevance of H-knowledge is dependent on specific user input, as illustrated in Table 2; for example, the piece of knowledge \"lev\u00e9s means lifted in English\" is not necessary when the input does not contain \"lev\u00e9s\". Given the limitations in prompt length and computational capabilities of LLMs, it is impractical to indefinitely incorporate knowledge and expect multitasking proficiency in a single text completion session. To optimize H-knowledge, one can filter relevant pieces based on the input. For managing W-knowledge, a proven strategy, as demonstrated by EasyLAN, is distributing it among a specialized network of agents, essentially transforming a single agent into a multi-agent network. However, representing W-knowledge through agents and network architecture imposes a trade-off in computational efficiency. Extending the prompt with an additional sentence generally exerts minimal impact on operational efficiency, whereas invoking an extra LLM computation escalates computational overhead. In our user study, we noted that developers adapt their strategies based on specific scenarios. Initially, they may incorporate W-knowledge into an existing agent; if this fails to enhance the LAN\u2019s performance, they adjust the network architecture by introducing new agents or subdividing the existing ones. 7.2 Capability Boundary of the LAN: the Control Granularity Challenge Although users can break down complex tasks into smaller granules to improve the capabilities of LLMs, there are inherent limitations to such granularity. Users could not break down tasks into small granularities that are not practical or meaningful in regular human cognition. A typical example is the couplet generation task. Couplets require that the number of characters in the upper and lower halves match. However, one user found that the LLM\u2019s ability to count the number of characters was unstable. This problem might be attributed to the process of encoding and tokenization, which is beyond the user\u2019s knowledge. The user could not address this issue within the multi-agent framework and complained, \"If it can\u2019t even get this simple thing right, I don\u2019t know how to fix it.\" This indicates that optimizing fundamental tasks like counting numbers exceeds the capability of EasyLAN because those tasks fall below the minimum granularity where humans and LLMs can understand each other. 8 Limitation & Future work The construction of appropriate training examples falls outside the scope of this paper. Future work could qualitatively and quantitatively investigate the relationship between the features of training examples and the performance of EasyLAN. Additionally, employing natural language processing techniques for the automated generation or augmentation of training data [84] represents a promising avenue for future research. EasyLAN can only handle acyclic networks, which implies that it cannot accommodate tasks requiring recursion and backtracking. Cycles significantly increase network complexity, as the same agent may be activated multiple times. EasyLAN faces challenges when confronted with excessively intricate network structures due to the long-distance dependency problem of LLMs. Future work may draw inspiration from existing neural network update strategies (e.g., backpropagation) to handle larger-scale networks. Currently, EasyLAN cannot learn from users to improve its performance[85]. Future work can explore how EasyLAN continuously accumulates knowledge and adapts its pipeline during user interactions. This approach would enable EasyLAN to autonomously generate a LAN without requiring any user intervention. EasyLAN is a collaborative editing tool, not a LAN generation tool. Therefore, it relies on LAN developers rather than on carefully designed strategies to ensure that the constructed LAN is optimal. Future work can focus on improving the LAN\u2019s performance by (1) minimizing the number of agents while maintaining performance to improve computational efficiency and (2) adding runtime error monitoring and handling mechanisms to prevent error propagation. 15 \fA Collaborative Tool for Training LLM Agent Network 9"
16
+ }
abs_9K/validation_abstract_short_2404.15993v1.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.15993v1",
3
+ "title": "Uncertainty Estimation and Quantification for LLMs: A Simple Supervised Approach",
4
+ "abstract": "Large language models (LLMs) are highly capable of many tasks but they can\nsometimes generate unreliable or inaccurate outputs. To tackle this issue, this\npaper studies the problem of uncertainty estimation and calibration for LLMs.\nWe begin by formulating the uncertainty estimation problem for LLMs and then\npropose a supervised approach that takes advantage of the labeled datasets and\nestimates the uncertainty of the LLMs' responses. Based on the formulation, we\nillustrate the difference between the uncertainty estimation for LLMs and that\nfor standard ML models and explain why the hidden activations of the LLMs\ncontain uncertainty information. Our designed approach effectively demonstrates\nthe benefits of utilizing hidden activations for enhanced uncertainty\nestimation across various tasks and shows robust transferability in\nout-of-distribution settings. Moreover, we distinguish the uncertainty\nestimation task from the uncertainty calibration task and show that a better\nuncertainty estimation mode leads to a better calibration performance. In\npractice, our method is easy to implement and is adaptable to different levels\nof model transparency including black box, grey box, and white box, each\ndemonstrating strong performance based on the accessibility of the LLM's\ninternal mechanisms.",
5
+ "authors": "Linyu Liu, Yu Pan, Xiaocheng Li, Guanting Chen",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-04-24",
8
+ "primary_cat": "cs.LG",
9
+ "cats": [
10
+ "cs.LG",
11
+ "cs.CL",
12
+ "68T07, 68T50"
13
+ ],
14
+ "label": "Original Paper",
15
+ "paper_cat": "LLM Fairness",
16
+ "gt": "Large language models (LLMs) are highly capable of many tasks but they can\nsometimes generate unreliable or inaccurate outputs. To tackle this issue, this\npaper studies the problem of uncertainty estimation and calibration for LLMs.\nWe begin by formulating the uncertainty estimation problem for LLMs and then\npropose a supervised approach that takes advantage of the labeled datasets and\nestimates the uncertainty of the LLMs' responses. Based on the formulation, we\nillustrate the difference between the uncertainty estimation for LLMs and that\nfor standard ML models and explain why the hidden activations of the LLMs\ncontain uncertainty information. Our designed approach effectively demonstrates\nthe benefits of utilizing hidden activations for enhanced uncertainty\nestimation across various tasks and shows robust transferability in\nout-of-distribution settings. Moreover, we distinguish the uncertainty\nestimation task from the uncertainty calibration task and show that a better\nuncertainty estimation mode leads to a better calibration performance. In\npractice, our method is easy to implement and is adaptable to different levels\nof model transparency including black box, grey box, and white box, each\ndemonstrating strong performance based on the accessibility of the LLM's\ninternal mechanisms.",
17
+ "main_content": "Introduction Large language models (LLMs) have marked a significant milestone in the advancement of natural language processing (Radford et al., 2019; Brown et al., 2020; Ouyang et al., 2022; Bubeck et al., 2023), showcasing remarkable capabilities in understanding and generating human-like text. However, one pressing issue for the LLMs is their propensity to hallucinate (Rawte et al., 2023) and generate misleading or entirely fabricated information that can significantly undermine their trustworthiness and reliability. The task of uncertainty estimation has then emerged to be an important problem, where an uncertainty estimation model can be used to determine the confidence levels of LLMs\u2019 outputs. While the problem of uncertainty estimation and calibration has seen considerable development within the general machine learning and deep learning domains (Abdar et al., 2021; Gawlikowski et al., 2023), we see less development in the domain of LLMs. One of the major challenges is the difference in the format of the output: while machine learning and deep learning typically involve fixed-dimensional outputs, natural language generation (NLG) tasks central to LLM applications require handling variable outputs that carry semantic meanings, and it is unclear whether the uncertainty estimation for NLG should target for (fixed-dimensional) token level or (variable-dimensional) sentence/semantic-level uncertainty. Existing uncertainty estimation approaches for LLMs usually involve designing uncertainty metrics for their outputs. For black-box LLMs, these metrics are computed by examining aspects like the generated outputs\u2019 consistency, similarity, entropy, and other relevant characteristics (Lin et al., 2023; *Equal contribution. \u00b6Corresponding to: xiaocheng.li@imperial.ac.uk, guanting@unc.edu. 1 arXiv:2404.15993v1 [cs.LG] 24 Apr 2024 \fManakul et al., 2023; Kuhn et al., 2023). Given the complexity of LLMs\u2019 underlying architectures, semantic information may be diluted when processing through self-attention mechanisms and during token encoding/decoding. To address this issue, a growing stream of literature argues that hidden layers\u2019 activation values within the LLMs offer insights into the LLMs\u2019 knowledge and confidence (Slobodkin et al., 2023; Ahdritz et al., 2024; Duan et al., 2024). Based on this argument, white-box LLMs, which allow access to more of LLMs\u2019 inner values, such as logits and hidden layers, are believed to have the capacity to offer a more nuanced understanding and improved uncertainty estimation results (Verma et al., 2023; Chen et al., 2024; Plaut et al., 2024). Most state-of-the-art uncertainty estimation methods in NLG-related tasks are developed in an unsupervised manner (Lin et al., 2022; Kuhn et al., 2023; Chen et al., 2024). However, in the realm of LLMs, there is increasing evidence suggesting the benefits of pursuing supervised approaches. For instance, LLMs\u2019 outputs and their internal states can offer conflicting information about truthfulness (Liu et al., 2023), and determining whether outputs or internal states are more reliable sources of information often varies from one scenario to another. This phenomenon underscores the potential advantages of a supervised learning approach, which can adaptively leverage both types of information for better uncertainty estimation. Meanwhile, employing a supervised learning approach to utilize hidden information within LLMs for uncertainty estimation remains relatively uncharted territory. Prior to the adventure of LLM, a line of literature has studied incorporating supervised learning approaches for uncertainty estimation and calibration (Desai and Durrett, 2020) for white-box (Zhang et al., 2021) and black-box (Ye and Durrett, 2021) natural language processing (NLP) models. However, the LLMs distinguish themselves from earlier NLP models through their architectures, training methodologies, and the datasets used. Consequently, there is a need to study and investigate supervised uncertainty estimation approaches specifically tailored for LLMs. There is also a recently expanding body of literature that employs supervised approaches that leverage hidden layers\u2019 information for hallucination detection within LLMs (CH-Wang et al., 2023; Azaria and Mitchell, 2023; Ahdritz et al., 2024). However, there is not so much of a consensus on the definition of hallucination while the uncertainty estimation problem is more well defined. Consequently, questions regarding the practicality, effectiveness, and potential of these supervised approaches to improve uncertainty estimation practices in LLM remain unanswered. Our study embarks on a systematic evaluation of the integration of LLMs\u2019 hidden states within the uncertainty estimation framework in a supervised manner. We aim to assess the tangible benefits this approach may offer in improving the confidence, reliability, transferability, and practicality of LLMs\u2019 uncertainty estimation. By examining the impact of incorporating the knowledge of these hidden states into the uncertainty estimation methods, our results seek to clarify whether and how the internal states of LLMs can contribute to uncertainty estimation, paving the way for more trustworthy and dependable LLMs. Our contributions are three-fold: \u2022 We formulate the problem of uncertainty estimation for LLMs. Building on this formulation, we explore the nuanced distinctions between uncertainty estimation and calibration for LLMs, and theoretically demonstrate how uncertainty estimation for LLMs differs from that in traditional ML models. Moreover, our theoretical analysis suggests that the existing architecture and training procedures of LLMs require additional features from their input and output for improved uncertainty estimation. \u2022 Motivated by the above findings, we propose a supervised method for the uncertainty estimation problem. Specifically, the method aims to train an uncertainty estimation function that maps the hidden activations of the LLMs, and the probability-related information of the LLMs (when generating the response) to an uncertainty score that captures the LLM\u2019s confidence about its 2 \fresponse. This supervised approach is systematically designed for straightforward implementation and broad applicability, suitable for black-box, grey-box, and white-box LLMs. \u2022 We conduct numerical experiments on NLP tasks including question answering, machine translation, and multiple choice to evaluate the performance of our proposed approach against existing benchmarks. When designing these experiments, we measure the performance of our approach across LLMs with different accessibility mode (black-box, grey-box, and white-box), and evaluate them in both in-distribution and out-of-distribution test datasets. The results demonstrate that by leveraging hidden activations of LLMs, our method consistently extracts additional knowledge from these models to enhance uncertainty estimation across various NLP tasks. These findings provide insights into the working mechanism of the uncertainty estimation method and its robustness and transferability. 1.1 Related literature Uncertainty estimation for natural language generalization. The uncertainty estimation and calibration for traditional machine learning is relatively well-studied (Abdar et al., 2021; Gawlikowski et al., 2023). However, with the rapid development of LLMs, there is a pressing need to better understand the uncertainty for LLMs\u2019 responses, and measuring the uncertainty from sentences instead of a fixeddimension output is more challenging. One stream of work has been focusing on unsupervised methods that leverage entropy (Malinin and Gales, 2021), similarity (Fomicheva et al., 2020; Lin et al., 2022), semantic (Kuhn et al., 2023; Duan et al., 2023), logit or hidden states\u2019 information (Kadavath et al., 2022; Chen et al., 2024; Su et al., 2024; Plaut et al., 2024) to craft a uncertainty metric that helps to quantify uncertainty. For black-box models, some of the metrics can be computed based on multiple sampled output of the LLMs (Malinin and Gales, 2021; Lin et al., 2023; Manakul et al., 2023); while for white-box models, more information such as the output\u2019s distribution, the value of the logit and hidden layers make computing the uncertainty metric easier. We also refer to Desai and Durrett (2020); Zhang et al. (2021); Ye and Durrett (2021); Si et al. (2022); Quach et al. (2023); Kumar et al. (2023); Mohri and Hashimoto (2024) for other related uncertainty estimation methods such as calibration and conformal prediction. Hallucination detection. Recently, there is a trend of adopting uncertainty estimation approaches for hallucination detection. The rationale is that the information of the value of logits and the hidden states contain some of the LLMs\u2019 beliefs about the trustworthiness of its generated output. By taking the activations of hidden layers as input, Azaria and Mitchell (2023) train a classifier to predict hallucinations, and Verma et al. (2023) develop epistemic neural networks aimed at reducing hallucinations. Slobodkin et al. (2023) demonstrate that the information from hidden layers of LLMs\u2019 output can indicate the answerability of an input query, providing indirect insights into hallucination occurrences. Chen et al. (2024) develop an unsupervised metric that leverages the internal states of LLMs to perform hallucination detection. More related works on hallucination detection can be found in CH-Wang et al. (2023); Duan et al. (2024); Xu et al. (2024). While there is a lack of a rigorous definition of hallucination, and its definition varies in the above-mentioned literature, the uncertainty estimation problem can be well defined, and our results on uncertainty estimation can also help the task of hallucination detection. Leveraging LLMs\u2019 hidden activation. The exploration of hidden states within LLMs has been studied to better understand LLMs\u2019 behavior. Mielke et al. (2022) leverage the language model\u2019s hidden states to train a calibrator that predicts the likelihood of outputs\u2019 correctness. With an unsupervised approach, Burns et al. (2022) utilizes hidden activations in language models to represent knowledge 3 \fabout the trustfulness of their outputs. Liu et al. (2023) show that LLMs\u2019 outputs and their internal states can offer conflicting information about truthfulness, and determining whether outputs or internal states are more reliable sources of information often varies from one scenario to another. By taking the activations of hidden layers as input, Ahdritz et al. (2024) employ a linear probe to show that hidden layers\u2019 information from LLMs can be used to differentiate between epistemic and aleatoric uncertainty. Duan et al. (2024) experimentally reveal the variations in hidden layers\u2019 activations when LLMs generate true versus false responses. Lastly, Li et al. (2024) enhance the truthfulness of LLMs during inference time by adjusting the hidden activations\u2019 values in specific directions. 2 Problem Setup Consider the following environment where one interacts with LLMs through prompts and responses: An LLM is given with an input prompt x = (x1, x2, ..., xk) \u2208X with xi \u2208V representing the i-th token of the prompt. Here V denotes the vocabulary for all the tokens. Then the LLM generates its response y = (y1, y2, ..., ym) \u2208Y (randomly) following the probability distribution yj \u223cp\u03b8(\u00b7|x, y1, y2, ..., yj\u22121). Here the probability distribution p\u03b8 denotes the distribution (over vocabulary V) as the LLM\u2019s output, and \u03b8 encapsulates all the parameters of the LLM. The conditional part includes the prompt x and all the tokens y1, y2, ..., yj\u22121 generated preceding the current position. We allow both the prompt and the response to have a variable length of k and m. We consider using the LLM for some downstream NLP tasks such as question answering, multiple choice, and machine translation. Such a task usually comes with an evaluation/scoring function that evaluates the quality of the generated response s(\u00b7, \u00b7) : Y \u00d7 Y \u2192[0, 1]. For each pair of (x, y), the evaluation function rates the response y with the score z := s(ytrue, y) where ytrue is the true response for the prompt x. The true response ytrue is usually decided by factual truth, humans, or domain experts. It does not hurt to assume a larger score represents a better answer; z = 1 indicates a perfect answer, while z = 0 says the response y is off the target. We define the task of uncertainty estimation for LLMs as the learning of a function g that predicts the score g(x, y) \u2248E [s(y, ytrue)|x, y] (1) where the expectation on the right-hand side is taken with respect to the (possible) randomness of the true response ytrue. We emphasize two points on this task definition: \u2022 The uncertainty function g takes the prompt x and y as its inputs, which has the following implications. First, the true and predicted uncertainty score can and should depend on the specific realization of the response y. Second, the uncertainty function g does not require the true response ytrue as the input. Since true response data are often limited and typically only available from labeled datasets or human experts, this design broadens the applicability of the function across various settings, enhancing its practical usage. \u2022 The uncertainty score function g, in the language of uncertainty calibration of ML models (Guo et al., 2017; Abdar et al., 2021), is defined in an individual (conditional) sense. That is, the predicted score g(x, y) is hopefully precise and matches the true score on an individual level (for 4 \feach prompt-response pair) but not on the population level (for a distribution of prompt-response pairs). With such a definition of the uncertainty quantification task, the score can be useful in that a well-calibrated score guides the extent to which the users should trust the response. In the following sections, we will first describe our method as a generic framework of uncertainty estimation that formulates the problem as a supervised task and utilizes the available labeled dataset. Then we discuss how this approach can be effectively integrated in the state-of-the-art LLMs, and present the empirical experiments and findings. Finally, we discuss the relationship between our method and the existing literature on fine-tuning LLM and hallucination detection. 3 Uncertainty Estimation via Supervised Calibration In Section 3.1, we present our method of supervised calibration as a post hoc procedure to estimate the uncertainty of the LLM\u2019s responses. 3.1 Supervised calibration We consider a supervised approach of learning the uncertainty function g : X \u00d7 Y \u2192[0, 1], which is similar to the standard setting of uncertainty quantification for ML/deep learning models. First, we start with a dataset of n samples Draw = {(xi, yi, yi,true, s(yi, yi,true))}n i=1 . Draw can be generated based on a labeled dataset for the tasks we consider. Here xi = (xi,1, ..., xi,ki) and yi = (yi,1, ..., yi,mi) denote the prompt and the corresponding LLM\u2019s response, respectively. yi,true denotes the true response (that comes from the labeled dataset) of xi, and s(yi, yi,true) assigns a score for the response yi based on the true answer yi,true. We remark that when generating the dataset Draw with the LLM, there can be multiple samples with the same prompt for tasks such as question answering and machine translation. That is, we can generate multiple samples with xi \u2261x, but these samples may have different responses yi\u2019s due to the probabilistic nature of the LLM. Meanwhile, because of the same xi, these samples have the same true response yi,true. Each different realization of yi constitutes one meaningful sample for the uncertainty estimation task. The next step is to formulate a supervised learning task based on the dataset Draw. Specifically, we construct the following dataset Dun = {(vi, zi)}n i=1 where zi := s(yi, yi,true) \u2208[0, 1] denotes the target score to be predicted. The vector vi summarizes useful features for the i-th sample based on (xi, yi) for the prediction task. In this light, a supervised learning task on the dataset Dun corresponds exactly to the definition of the uncertainty estimation task in (1). Now we discuss how we construct the feature vector vi based on (xi, yi). We mainly consider features from two sources. \u2022 White-box features: LLM\u2019s hidden-layer activations. We feed (xi, yi) as input into a LLM, and extract the corresponding hidden layers\u2019 activations of the LLM. Given the architecture of the decoder-based transformer, the consensus is that the activations of the last token (of an input sequence) should contain the most information (Azaria and Mitchell, 2023; Chen et al., 2024). Thus we use the hidden layers\u2019 activation of the last token of (xi, yi) as part of vi. We defer more discussions on the choice of the layer to Section 4.3. 5 \f\u2022 Grey-box features: Entropyor probability-related outputs. The entropy of a discrete distribution p over the vocabulary V is defined by H(p) := \u2212 X v\u2208V p(v) log (p(v)) . For a prompt-response pair (x, y) = (x1, ..., xk, y1, ..., ym), we consider as the features the entropy at each token such as H(p\u03b8(\u00b7|x1, ..., xj\u22121)) and H(p\u03b8(\u00b7|x, y1, ..., yj\u22121)) where p\u03b8 denotes the LLM. We defer more discussions on feature construction to Appendix A.1. Also, we note that another direct feature for predicting zi is to ask the LLM \u201chow certain it is about the response\u201d and incorporate its response to this question as a feature for predicting zi (Tian et al., 2023). This is naturally a viable option, and there are also other sources of features that can be incorporated into vi such as the hidden activations for the second last token. We do not try to exhaust all the possible features, and the aim of our paper is more about formulating the uncertainty estimation for the LLMs as a supervised task and understanding how the internal states of the LLM encode uncertainty. To the best of our knowledge, our paper is the first one to do so. Specifically, the above formulation aims for the following two outcomes: \u2022 We train an uncertainty model \u02c6 g(vi) that predicts zi. Based on the dataset Dun = {(vi, zi)}n i=1, one can learn a model \u02c6 g that predicts the uncertainty zi with summarized features vi. Intuitively, this approach will give better performance (because of its supervised nature and the reason presented in Section 3.3) than the ad-hoc/black-box methods such as the entropy-based method (Malinin and Gales, 2021; Kuhn et al., 2023), similarity-based method (Lin et al., 2022), etc., which is indeed verified by the numerical experiments in the next section. Thus this result underscores the usefulness of the supervised dataset for predicting uncertainty which is more aligned with the canonical uncertainty quantification methods. \u2022 We aim to answer the question of whether the hidden layers carry the uncertainty information. We note that using hidden layer information is not a mainstream approach for the existing uncertainty estimation literature on ML models. This highlights the difference between the uncertainty estimation for classic deep learning models and that for LLMs. We provide some theoretical insights in the following sections and show by theoretical insights and empirical experiments why the supervised approach can extract additional knowledge of LLMs to enhance uncertainty estimation. 3.2 Uncertainty estimation v.s. uncertainty calibration So far in this paper, we focus on the uncertainty estimation task which aims to predict whether the LLM makes mistakes in its response or not. There is a different but related task known as the uncertainty calibration problem. In comparison, the uncertainty calibration aims to ensure that the output from the uncertainty estimation model such as \u02c6 g in above conveys a probabilistic meaning. In this sense, our paper is more focused on addressing the predictability of the LLM\u2019s uncertainty, and we find that our supervised formulation and the LLM\u2019s hidden activations are helpful in such a prediction task. In terms of the uncertainty calibration aspect, our developed uncertainty estimation model is compatible with all the recalibration methods for ML models in the literature of uncertainty calibration. And intuitively, a better uncertainty estimation/prediction will lead to a better-calibrated uncertainty model, which is also verified in our numerical experiments in Section 4.4. 6 \f3.3 Why hidden layers as features? In this subsection, we provide a simple theoretical explanation for why the hidden activations of the LLM can be useful in uncertainty estimation. Consider a binary classification task where the features X \u2208Rd and the label Y \u2208{0, 1} are drawn from a distribution P. We aim to learn a model f : Rd \u2192[0, 1] that predicts the label Y from the feature vector X, and the learning of the model employs a loss function l(\u00b7, \u00b7) : [0, 1] \u00d7 [0, 1] \u2192R. Proposition 3.1. Let F be the class of measurable function that maps from Rd to [0, 1]. Under the cross-entropy loss l(y, \u02c6 y) = y log(\u02c6 y) + (1 \u2212y) log(1 \u2212\u02c6 y), the function f \u2217that minimizes the loss f \u2217= arg max f\u2208F E [l(Y, f(X))] is the Bayes optimal classifier f \u2217(x) = P(Y = 1|X = x) where the expectation and the probability are taken with respect to (X, Y ) \u223cP. Moreover, the following conditional independence holds Y \u22a5X | f \u2217(X). The proposition is not technical and it can be easily proved by using the structure of f \u2217(X). It states a nice (probably well-known) property of the cross-entropy loss. Specifically, the function learned under the cross-entropy loss coincides with the Bayes optimal classifier. Note that this is contingent on two requirements. First, the function class F is the measurable function class. Essentially, it suffices to require the function class F to be rich enough to cover the Bayesian optimal classifier, also known as the realizability condition. With the capacity of the large vision and NLP models, we can think this requirement to be (at least approximately) met. Second, it requires the function f \u2217learned through the population loss rather than the empirical loss/risk consisting of the training samples. With a large size of training data, we can think this requirement also to be (approximately) met. The proposition also states one step further on conditional independence Y \u22a5X | f \u2217(X). This means all the information related to the label Y that is contained in X is summarized in the prediction function f \u2217. While the numeric situation cannot be captured by such a simple theory (due to these two requirements), it provides insights into why the existing uncertainty quantification/calibration/recalibration methods do not utilize much of the original feature X or the hidden-layer activations. Specifically, when a prediction model \u02c6 f : Rd \u2192[0, 1] is well-trained, the predicted score \u02c6 f(X) should capture all the information about the true label Y contained in the features X, and there is no need to get the features X re-involved in the recalibration procedure when one adjusts the prediction model \u02c6 f to meet some calibration objectives. This indeed explains why the classic uncertainty quantification and calibration methods only work with the predicted score \u02c6 f(X) for re-calibration, including Platt scaling (Platt et al., 1999), isotonic regression (Zadrozny and Elkan, 2002), temperature scaling (Guo et al., 2017), etc. When it comes to LLMs, we will no longer have conditional independence, and that requires additional procedures to retrieve more information on Y . The following corollary states that when the underlying loss function \u02dc l does not possess this nice property (the Bayes classifier minimizes the loss point-wise) of the cross-entropy loss, the conditional independence will collapse. Corollary 3.2. Suppose the loss function \u02dc l satisfies P f \u2217(x) \u0338= arg min \u02dc y\u2208[0,1] E h \u02dc l(Y, \u02dc y)|X = x i! > 0, 7 \fwhere f \u2217is defined as Proposition 3.1, then for the function \u02dc f = arg max f\u2208F E h \u02dc l(Y, f(X)) i , where the expectation is with respect to (X, Y ) \u223cP, there exists a distribution P such that the conditional independence no longer holds Y \u0338\u22a5X | \u02dc f(X). Proposition 3.1 and Corollary 3.2 together illustrate the difference between uncertainty estimation for a traditional ML model and that for LLMs. For the traditional ML models, the cross-entropy loss which is commonly used for training the model is aligned toward the uncertainty calibration objective. When it comes to uncertainty estimation for LLMs, the label Y can be viewed as the binary variable for whether the LLM\u2019s response is correct, and the features X represent some features extracted from the prompt-response pair. Meanwhile, the LLMs are often pre-trained with some other loss functions (for example, the negative log-likelihood loss for next-token prediction), and this causes a misalignment between the model pre-training and the uncertainty quantification task. The consequence is the collapse of conditional independence in Corollary 3.2. The collapse is of a deeper extent than the violation of the two requirements as discussed above. Consequently, the original features, the prompt-response pair, may and should (in theory) contain information about the uncertainty score Y that cannot be fully captured by \u02dc f(X). This justifies why we formulate the uncertainty estimation task as the previous subsection and take the hidden-layer activations as features to predict the uncertainty score; it also explains why we do not see much similar treatment in the mainstream uncertainty quantification literature. 3.4 Three regimes of supervised uncertainty estimation In Section 3.1, we present the method of supervised uncertainty estimation under the assumption that we know the parameters of the LLMs including both the hidden activation and the output probabilities. Now we categorize the application of our method into three regimes to solve the case where the LLM is black-box and we do not have access to the parameter information. A natural implementation of our supervised learning approach involves using an LLM to generate the response y for input x, and extracting insights on confidence from the same LLM\u2019s hidden layers\u2019 activations. This method functions effectively with white-box LLMs where hidden activations are accessible, but with black-box LLMs, which restrict access to hidden activations, alternative black-box uncertainty estimation methods become necessary. We observe that obtaining hidden layers\u2019 activations merely requires an LLM and the prompt-response pair (x, y). Therefore, it is not mandatory for (x, y) to be generated by the LLM that provides the hidden layers\u2019 activations. Based on this observation, we note that the extra knowledge of uncertainty can come from the hidden layers of any white-box LLM that takes as input the (x, y) pair, not necessarily from the LLM that generates (x, y). It is natural to start with the belief that the LLM which generates (x, y) should have more information about the uncertainty of y. However, any white-box LLM can output the hidden activations corresponding to (x, y). To clarify further, once (x, y) is generated by the LLM p\u03b8, all of p\u03b8\u2019s knowledge about the uncertainty of y is encoded within its internal representations. However, another LLM q\u03b8 can also evaluate (x, y), with its understanding of uncertainty reflected in q\u03b8\u2019s internal representations as well. Next, we formally present our supervised uncertainty calibration method for white-box, grey-box, and black-box LLMs. 8 \fWhite-box supervised uncertainty estimation (Wb-S): This Wb-S approach implements the method discussed in Section 3.1. It first constructs the features from both two sources and trains a supervised model to predict the uncertainty of the LLM\u2019s responses. Grey-box supervised uncertainty estimation (Gb-S): This Gb-S regime constructs the features only from the grey-box source, that is, those features relying on the probability and the entropy (such as those in Table 5 in Appendix A.1) but it ignores the hidden-layer activations. Both the above two regimes consider one single LLM throughout the whole procedure. Specifically, the dataset Draw is generated based on the LLM p\u03b8, and then features are extracted from Draw to construct Dun. In particular, the feature extraction is based on the same LLM p\u03b8 as well and this assumes the full knowledge of p\u03b8 as the following diagram Draw p\u03b8 \u2212 \u2192Dun. Then a supervised uncertainty estimation model is trained upon Dun. Black-box supervised uncertainty estimation (Bb-S): The Bb-S regime does not assume the knowledge of the parameters of p\u03b8 but still aims to estimate its uncertainty. To achieve this, it considers another open-source LLM denoted by q\u03b8. The original data Draw is generated by p\u03b8 but then the uncertainty estimation data Dun is constructed based on q\u03b8 from Draw as illustrated in the following diagram Draw q\u03b8 \u2212 \u2192Dun. For example, for a prompt x, a black-box LLM p\u03b8 generates the response y. We utilize the open-source LLM q\u03b8 to treat (x, y) jointly as a sequence of (prompt) tokens and extract the features of hidden activations and entropy as in Section 3.1. In this way, we use q\u03b8 together with the learned uncertainty model from Dun to estimate the uncertainty of responses generated from p\u03b8 which we do not have any knowledge about. Algorithm 1 Supervised uncertainty estimation Input: Target LLM p\u03b8 (the uncertainty of which is to be estimated), tool LLM q\u03b8 (used for uncertainty estimation), a labeled training dataset D, a test sample with prompt x 1: %% Training phase: 2: Use p\u03b8 to generate responses for the samples in D and construct the dataset Draw 3: For each sample (xi, yi) \u2208Draw, extract features (hidden-layer activations, entropyand probabilityrelated features) using the LLM q\u03b8, and then construct the dataset Dun 4: Train a supervised learning model \u02c6 g that predicts zi with vi based on the dataset Dun 5: %% Test phase: 6: Generate the response y for the test prompt x 7: Extract features v using q\u03b8 Output: Associate the response y with the uncertainty score \u02c6 g(v) Algorithm 1 summarizes our discussions so far on the supervised approach for uncertainty estimation. When the target LLM p\u03b8 = q\u03b8, it corresponds to the first two regimes (white-box and grey-box). When the target LLM p\u03b8 \u0338= q\u03b8, it corresponds to the third regime (black-box). 4 Numerial Experiments and Findings In this section, we provide a systematic evaluation of the proposed supervised approach for estimating the uncertainty of the LLMs. All code used in our experiments is available at https://github.com/LoveCatc/supervisedllm-uncertainty-estimation. 9 \f4.1 LLMs, tasks, benchmarks, and performance metrics Here we outline the general setup of the numerical experiments. Certain tasks may deviate from the general setup, and we will detail the specific adjustments as needed. LLMs. For our numerical experiments, we mainly consider two open-source LLMs, LLaMA2-7B (Touvron et al., 2023) and Gemma-7B (Gemma Team et al., 2024) as p\u03b8 defined in Section 2. For certain experiments, we also employ the models of LLaMA2-13B and Gemma-2B. We also use their respective tokenizers as provided by Hugging Face. We do not change the parameters/weights \u03b8 of these LLMs. Tasks and Datasets. We mainly consider three tasks for uncertainty estimation, question answering, multiple choice, and machine translation. All the labeled datasets for these tasks are in the form of {(xi, yi,true)}n i=1 where xi can be viewed as the prompt for the i-th sample and yi,true the true response. We adopt the few-shot prompting when generating the LLM\u2019s response yi, and we use 5 examples in the prompt of the multiple-choice task and 3 examples for the remaining natural language generation tasks. This enables the LLM\u2019s in-context learning ability (Radford et al., 2019; Zhang et al., 2023) and ensures the LLM\u2019s responses are in a desirable format. We defer more details of the few-shot prompting to Appendix A.2. The three tasks are: \u2022 Question answering. We follow Kuhn et al. (2023) and use the CoQA and TriviaQA (Joshi et al., 2017) datasets. The CoQA task requires the LLM to answer questions by understanding the provided text, and the TriviaQA requires the LLM to answer questions based on its pre-training knowledge. We adopt the scoring function s(\u00b7, \u00b7) as Rouge-1 (Lin and Och, 2004a) and label a response yi as correct if s(yi, yi,true) \u22650.3 and incorrect otherwise. \u2022 Multiple choice. We consider the Massive Multitask Language Understanding (MMLU) dataset (Hendrycks et al., 2020), a collection of 15,858 questions covering 57 subjects across STEM. Due to the special structure of the dataset, the generated output yi and the correct answer ytrue,i \u2208 {A, B, C, D}. Therefore, this task can also be regarded as a classification problem for the LLM by answering the question with one of the four candidate choices. \u2022 Machine translation. We consider the WMT 2014 dataset (Bojar et al., 2014) for estimating LLM\u2019s uncertainty on the machine translation task. The scoring function s(\u00b7, \u00b7) is chosen to be the BLEU score (Papineni et al., 2002; Lin and Och, 2004b) and the generated answer yi is labeled as correct if s(yi, yi,true) > 0.3 and incorrect otherwise. Benchmarks. We compare our approach with a number of the state-of-the-art benchmarks for the problem. Manakul et al. (2023) give a comprehensive survey of the existing methods and compare four distinct measures for predicting sentence generation uncertainty. The measures are based on either the maximum or average values of entropy or probability across the sentence, including Max Likelihood, Avg Likelihood, Max Ent, and Avg Ent defined in Table 5. We note that each of these measures can be applied as a single uncertainty estimator, and they are all applied in an unsupervised manner that does not require additional supervised training. In particular, in applying these measures for the MMLU dataset, since the answer only contains one token from {A, B, C, D}, we use the probabilities and the entropy (over these four tokens) as the benchmarks which represent the probability of the most likely choice and the entropy of all choices, respectively. Kuhn et al. (2023) generate multiple answers, compute their entropy in a semantic sense, and define the quantity as semantic entropy. This semantic-entropy uncertainty (SU) thus can be used as an uncertainty estimator for the LLM\u2019s responses. Tian et al. (2023) propose the approach of asking the LLM for its confidence (denoted as A4U) which directly obtains the uncertainty score from the LLM itself. Our methods. We follow the discussions in Section 3.4 and implement three versions of our proposed supervised approach: black-box supervised (Bb-S), grey-box supervised (Gb-S), and white-box supervised 10 \f(Wb-S). These models have the same pipeline of training the uncertainty estimation model and the difference is only on the availability of the LLM. For the Bb-S method, we use the Gemma-7B as the model q\u03b8 to evaluate the uncertainty of LLaMA-7B p\u03b8 (treated as a black-box), and reversely, use LLaMA-7B to evaluate Gemma-7B. The supervised uncertainty model \u02c6 g is trained based on the random forest model (Breiman, 2001). Details on the feature construction and the training of the random forest model are deferred to Appendix A.3. Performance metrics. For the model evaluation, we follow Filos et al. (2019); Kuhn et al. (2023) and compare the performance of our methods against the benchmark using the generated uncertainty score to predict whether the answer is correct. The area under the receiver operator characteristic curve (AUROC) metric is employed to measure the performance of the uncertainty estimation. As discussed in Section 3.2, AUROC works as a good metric for the uncertainty estimation task whereas for the uncertainty calibration task, we follow the more standard calibration metrics and present the results in Section 4.4. 4.2 Performance of uncertainty estimation Now we present the performance on the uncertainty estimation task. 4.2.1 Question answering and machine translation The question answering and machine translation tasks can all be viewed as natural language generation tasks so we present their results together. Table 1 summarizes the three versions of our proposed supervised method against the existing benchmarks in terms of AUROC. Dataset LLM Benchmarks Ours Max Pro Avg Pro Max Ent Avg Ent SU A4C Bb-S Gb-S Wb-S TriviaQA G-7B 0.797 0.769 0.783 0.759 0.712 0.512 0.964 0.893 0.963 L-7B 0.835 0.826 0.833 0.808 0.817 0.528 0.856 0.852 0.879 CoQA G-7B 0.720 0.701 0.716 0.671 0.657 0.509 0.747 0.729 0.769 L-7B 0.699 0.672 0.692 0.644 0.647 0.508 0.706 0.713 0.751 WMT-14 G-7B 0.735 0.813 0.507 0.814 0.536 0.590 0.730 0.822 0.828 L-7B 0.623 0.700 0.588 0.689 0.509 0.517 0.654 0.708 0.752 Table 1: Out-of-sample AUROC performance for benchmarks and our methods on natural language generation tasks. G-7B and L-7B represent Gemma-7B and LLaMA2-7B, respectively. The columns Max Pro, Avg Pro, Max Ent, and Avg Ent all come from Manakul et al. (2023). The column SU implements the semantic uncertainty estimation by Kuhn et al. (2023), and the column A4C implements the ask-for-confidence method by Tian et al. (2023). The columns Bb-S, Gb-S, and Wb-S represent respectively the three regimes (black-box supervised, grey-box supervised, and white-box supervised) of our supervised method with details in Section 3.4. We make several remarks on the numerical results. First, our methods generally have a better performance than the existing benchmarks. Note that the existing benchmarks are mainly unsupervised and based on one single score, and also that our method proceeds with the most standard pipeline for supervised training of an uncertainty estimation model. The advantage of our method should be attributed to the supervised nature and the labeled dataset. While these unsupervised benchmark methods can work in a larger scope than these NLP tasks (though they have not been extensively tested on open questions yet), our methods rely on the labeled dataset. But in addition to these better numbers, the experiment results show the potential of labeled datasets for understanding the uncertainty in LLM\u2019s responses. In particular, our method Gb-S uses the exactly same features as the benchmark methods, and 11 \fit shows that some minor supervised training can improve a lot upon the ad-hoc uncertainty estimation based on one single score such as Max Pro or Max Ent. Second, our method Wb-S has a clear advantage over our method Gb-S. Note that these two methods differ in that the Wb-S uses the hidden activations while the Gb-S only uses probability-related (and entropy-related) features. This implies that the hidden activations do contain uncertainty information which we will investigate more in the next subsection. Also, we note from the table that there is no single unsupervised grey-box method (under the Benchmarks columns) that consistently surpasses others across different datasets/NLP tasks. For example, among all these unsupervised benchmark methods, Avg Ent emerges as a top-performing one for the Gemma-7B model when applied to the machine translation task, but it shows the poorest performance for the same Gemma-7B model when tested on the questionanswering TriviaQA dataset. This inconsistency highlights some caveats when using the unsupervised approach for uncertainty estimation of LLMs. Lastly, we note that the Bb-S method has a similar or even better performance as the Wb-S method. As discussed in Section 3.4, the performance of uncertainty estimation relies on the LLM that we use to evaluate the prompt-response pair. Therefore, it is not surprising to see that in the TriviaQA task, for answers generated by Gemma-7B, Bb-S features better uncertainty estimation than Wb-S, possibly because LLaMA2-7B, the LLM that is used as the \u201ctool LLM\u201d in Algorithm 1, encodes better knowledge about the uncertainty of the answers than Gemma-7B. We also note that the performance of Bb-S is not always as good as Wb-S, and we hypothesize that it is because LLMs\u2019 output distribution differs, which could result in evaluating the uncertainty of different answers. Despite these inconsistencies, the performance of Bb-S is still strong, and these results point to a potential future avenue for estimating the uncertainty of closed-source LLMs. 4.2.2 Multiple choice (MMLU) Table 2 presents the performance of our methods against the benchmark methods on the MMLU dataset. For this multiple choice task, the output is from {A,B,C,D} which bears no semantic meaning, and therefore we do not include the Semantic Uncertainty (SU) as Table 1. The results show the advantage of our proposed supervised approach, consistent with the previous findings in Table 1. Model Benchmarks Ours Probability Entropy A4C Bb-S Gb-S Wb-S Gemma-7B 0.712 0.742 0.582 0.765 0.776 0.833 LLaMA2-7B 0.698 0.693 0.514 0.732 0.698 0.719 Table 2: Out-of-sample AUROC performance for benchmarks and our methods on the MMLU dataset. The columns Probability and Entropy come from Manakul et al. (2023), and the column A4C implements the ask-for-confidence method by Tian et al. (2023). The columns Bb-S, Gb-S, and Wb-S represent respectively the three regimes (black-box supervised, grey-box supervised, and white-box supervised) of our supervised method with details in Section 3.4. 4.3 Interpreting the results Now we use some visualizations to provide insights into the working mechanism of the uncertainty estimation procedure for LLMs and to better understand the experiment results in the previous subsection. 4.3.1 Layer comparison For general LLMs, each token is associated with a relatively large number of hidden layers (32 layers for LLaMA2-7B for example), each of which is represented by high-dimensional vectors (4096 for LLaMA212 \f7B). Thus it is generally not a good practice to incorporate all hidden layers as features for the uncertainty estimation due to this dimensionality. Previous works find that the middle layer and the last layer activations of the LLM\u2019s last token contain the most useful features for supervised learning (Burns et al., 2022; Chen et al., 2024; Ahdritz et al., 2024; Azaria and Mitchell, 2023). To investigate the layerwise effect for uncertainty estimation, we implement our Wb-S method with features different in two aspects: (i) different layers within the LLM architecture, specifically focusing on the middle and last layers (e.g., LLaMA2-7B: 16th and 32nd layers out of 32 layers with 4096 dimensions; Gemma-7B: 14th and 28th layers out of 28 layers with 3072 dimensions); and (ii) position of token activations, including averaging hidden activations over all the prompt/answer tokens or utilizing the hidden activation of the last token. The second aspect makes sense when the output contains more than one token, so we conduct this experiment on the natural language generation tasks only. Figure 1 gives a visualization of the comparison result. While the performances of these different feature extraction ways are quite similar in terms of performance across different tasks and LLMs, activation features from the middle layer generally perform better than the last layer. This may come from the fact that the last layer focuses more on the generation of the next token instead of summarizing information of the whole sentence, as has been discussed by Azaria and Mitchell (2023). TriviaQA CoQA WMT-14 0.75 0.80 0.85 0.90 0.95 1.00 AUROC Avg token, mid layer Avg token, last layer Last token, mid layer Last token, last layer (a) Features from Gemma-7B TriviaQA CoQA WMT-14 0.75 0.80 0.85 0.90 0.95 1.00 AUROC Avg token, mid layer Avg token, last layer Last token, mid layer Last token, last layer (b) Features from LLaMA2-7B Figure 1: Performance comparison of using hidden activations from different tokens and layers as features in the Wb-S method. The bars filled with \u2018/\u2019 and \u2018.\u2019 represent the activations averaged over the answer tokens and the hidden activation of the last token, respectively. And the green and orange bars denote the activations from the middle and the last layer, respectively. 4.3.2 Scaling effect In Figure 2, we investigate whether larger LLMs\u2019 hidden activations enhance our uncertainty estimation method. For a fair comparison, we fix the target LLM that generates the output in Algorithm 1 and vary the tool LLM used for analysis. For example, in the left plot of Figure 2, we use Gemma-7B to generate the outputs, and LLaMA2-7B, LLaMA2-13B, and Gemma-7B to perform uncertainty estimation. We find that there is no significant performance difference between LLaMA2-7B and LLaMA2-13B, nor between Gemma-2B and Gemma-7B (Gemma does not offer a 13B model). Our result suggests that larger LLM do not necessarily encode better knowledge about uncertainty. Furthermore, based on the performance of Wb-S in Figure 2, we suggest use the same LLM to generate the output and evaluate the uncertainty. 4.3.3 Histogram of correlations Figure 3 plots the histograms of the pairwise correlations between the neuron activations and the labels (whether the LLM\u2019s response is correct). We make two observations here: First, for both LLMs, 13 \fMMLU TriviaQA CoQA WMT-14 0.75 0.80 0.85 0.90 0.95 1.00 AUROC Use LLaMA to predict Gemma-7B Wb-S 7B 13B MMLU TriviaQA CoQA WMT-14 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 Use Gemma to predict LlaMA-7B Wb-S 2B 7B Figure 2: (Left) Using the hidden activations of LLaMA-2-7B and LLaMA-2-13B to estimate the uncertainty of the answer provided by Gemma-7B. (Right) Using the hidden activations of Gemma-2B and Gemma-7B to estimate the uncertainty of the answer provided by LLaMA-7B. some neurons have a significantly positive (or negative) correlation with the label. We can interpret these neurons as the uncertainty neuron for the corresponding task. When these neurons are activated, the LLMs are uncertain about their responses. Second, Gemma-7B has more significant neurons than LLaMA2-7B, and this is consistent with the better performance of Gemma-7B in Table 1 and Table 2. Also, this reinforces that the hidden activations of the LLMs contain uncertainty information about the LLM\u2019s output. 0.2 0.1 0.0 0.1 0.2 LLaMA2-7B 0 20 40 60 80 100 120 0.5 0.0 0.5 Gemma-7B 0.2 0.0 0.2 LLaMA2-7B 0 20 40 60 80 100 120 0.5 0.0 0.5 Gemma-7B Figure 3: The histograms of the pairwise correlations on the TriviaQA task between the neuron activations and the labels (whether the LLM\u2019s response is correct), where the neural values are the last-token hidden activations of answers from the middle layer (left) and the last layer (right) of two models respectively. Figure 4 plots some example neurons\u2019 activation by selecting the neurons with the largest and smallest correlations in Figure 3. More such neurons can be found in Figure 6 in the Appendix. These neurons as an individual indicator exhibit different distributional patterns when the response is correct compared to when the response is incorrect, and thus reflect the uncertainty of the LLM\u2019s responses. 4.4 Calibration performance In Section 3.2, we distinguish the two tasks of uncertainty estimation and uncertainty calibration. Throughout the paper, we have been focused on improving the performance on the task of uncertainty estimation \u2013 to predict when the LLM is uncertain about its response. Generally, a better uncertainty estimation model leads to one with better calibration performance. The calibration (or recalibration) of the uncertainty estimation model can be indeed reduced to the classic ML setting which does not involve the LLM. Table 3 gives the calibration performance and we see an advantage of our supervised methods over benchmark methods consistent with the AUROC performance in Table 1. We adopt the histogram 14 \f2 0 2 4 1496-th neuron act. 0 50 100 150 200 250 300 # Samples 4 2 0 2 1607-th neuron act. true answer false answer (a) Neurons from the middle layer of Gemma-7B 1 0 1 2 1415-th neuron act. 0 250 500 750 1000 1250 1500 # Samples 0 2 4 2401-th neuron act. true answer false answer (b) Neurons from the middle layer of LLaMA2-7B Figure 4: Distribution of values from particular neurons on TriviaQA dataset. binning method here because we find that the temperature scaling method and the Platt scaling method will give all predicted scores concentrated within a small range such as [0.2, 0.6]. We also do not exclude the possibility that the other calibration methods can give even better performance. The point to make here is that uncertainty estimation and uncertainty calibration are two closely related tasks. Note that (i) a better uncertainty estimation model leads to a better calibration performance and (ii) the LLMs are pre-trained and not designed for these NLP tasks in the first place (see Section 3.3) so that there is no uncertainty score readily available (as the predicted probabilities for the image classifiers); we emphasize the importance of an extra uncertainty estimation procedure as our supervised one so to extract the uncertainty information from the inside of the LLMs. Metric Dataset Model Benchmarks Ours Max Pro Avg Pro Max Ent Avg Ent SU A4C Bb-S Gb-S Wb-S NLL TriviaQA G-7B 0.540 0.586 0.530 0.494 0.536 0.623 0.292 0.366 0.429 L-7B 0.486 0.459 0.508 0.569 0.530 0.618 0.482 0.455 0.414 CoQA G-7B 0.653 0.553 0.525 0.602 0.548 0.574 0.464 0.657 0.488 L-7B 0.594 0.613 0.705 0.725 0.547 0.565 0.598 0.778 0.519 WMT-14 G-7B 0.605 0.481 0.692 0.564 0.627 0.566 0.509 0.527 0.461 L-7B 0.664 0.603 0.703 0.605 0.710 0.665 0.675 0.600 0.560 ECE TriviaQA G-7B 0.031 0.050 0.039 0.045 0.031 0.036 0.033 0.037 0.044 L-7B 0.055 0.026 0.044 0.045 0.060 0.021 0.042 0.059 0.052 CoQA G-7B 0.056 0.046 0.059 0.068 0.056 0.027 0.049 0.065 0.032 L-7B 0.038 0.036 0.045 0.046 0.035 0.025 0.045 0.049 0.022 WMT-14 G-7B 0.046 0.042 0.075 0.030 0.043 0.042 0.040 0.042 0.037 L-7B 0.037 0.026 0.033 0.021 0.033 0.027 0.051 0.041 0.039 Brier TriviaQA G-7B 0.162 0.168 0.163 0.149 0.177 0.215 0.071 0.120 0.076 L-7B 0.148 0.150 0.152 0.161 0.160 0.207 0.144 0.145 0.131 CoQA G-7B 0.153 0.155 0.161 0.161 0.160 0.167 0.147 0.158 0.143 L-7B 0.174 0.178 0.178 0.183 0.182 0.189 0.173 0.181 0.161 WMT-14 G-7B 0.184 0.157 0.213 0.156 0.204 0.195 0.177 0.159 0.149 L-7B 0.229 0.210 0.234 0.212 0.236 0.236 0.227 0.208 0.192 Table 3: Calibration performance on natural language generation tasks after histogram binning. The base models are from Table 1. The original uncertainty scores from the base models are first scaled into [0, 1] and then a histogram binning is performed with 20 bins of equal length. 4.5 Transferability In this subsection, we evaluate the robustness of our methods under the out-of-distribution (OOD) setting for both question-answering and multiple-choice tasks. 15 \fSetup for the OOD multiple-choice task. We split the MMLU datasets into two groups based on the subjects: Group 1 contains questions from the first 40 subjects while Group 2 contains the remaining 17 subjects, such that the test dataset size of each group is similar (around 600 questions). Note that these 57 subjects span a diverse range of topics, and this means the training and test set can be very different. To test the OOD robustness, we train the proposed methods on one group and evaluate the performance on the other group. Setup for the OOD question-answering task. For the QA task, since we have two datasets (CoQA and TriviaQA), we train the supervised model on either the TriviaQA or CoQA dataset and then evaluate its performance on the other dataset. While both datasets are for question-answering purposes, they diverge notably in two key aspects: (i) CoQA prioritizes assessing the LLM\u2019s comprehension through the discernment of correct responses within extensive contextual passages, while TriviaQA focuses on evaluating the model\u2019s recall of factual knowledge. (ii) TriviaQA typically contains answers comprising single words or short phrases, while CoQA includes responses of varying lengths, ranging from shorter to more extensive answers. LLMs Test data Ours Best of benchmarks Bb-S Gb-S Wb-S Best GB Best BB Transferability in MMLU G-7B Group 1 0.756(0.768) 0.793(0.799) 0.846(0.854) 0.765 0.538 Group 2 0.738(0.760) 0.755(0.754) 0.804(0.807) 0.721 0.616 L-7B Group 1 0.733(0.749) 0.715(0.713) 0.726(0.751) 0.719 0.504 Group 2 0.700(0.714) 0.676(0.677) 0.685(0.692) 0.679 0.529 Transferability in Question-Answering Datasets G-7B TriviaQA 0.956(0.964) 0.837(0.893) 0.899(0.963) 0.797 0.712 CoQA 0.707(0.747) 0.706(0.729) 0.722(0.769) 0.720 0.657 L-7B TriviaQA 0.777(0.856) 0.848(0.852) 0.860(0.879) 0.835 0.817 CoQA 0.708(0.706) 0.702(0.713) 0.717(0.751) 0.699 0.647 Table 4: Transferability of the trained uncertainty estimation model across different groups of subjects in MMLU and question-answering datasets. For our proposed Bb-S, Gb-S, and Wb-S methods, values within the parentheses (\u00b7) represent the AUROCs where the calibration model is trained and tested on the same group of subjects or dataset, while values outside the parentheses are AUROCs where the model is trained on another group of subjects or dataset. The Best GB and Best BB columns refer to the best AUROC achieved by the unsupervised grey-box baselines and black-box baselines (fully listed in Table 1 and Table 2), respectively. Table 4 summarizes the performance of these OOD experiments. As expected, for all the methods, there is a slight drop in terms of performance compared to the in-distribution setting (reported by the numbers in the parentheses in the table). We make the following observations based on the experiment results. First, based on the performance gap between in-distribution and OOD evaluation, it is evident that although incorporating white-box features such as hidden activations makes the model more susceptible to performance decreases on OOD tasks, these features also enhance the uncertainty estimation model\u2019s overall capacity, and the benefits outweigh the drawbacks. It is also noteworthy that even in these scenarios of OOD, our Wb-S and Bb-S method almost consistently outperform baseline approaches. Overall, the robustness of our methods shows that the hidden layers\u2019 activations within the LLM exhibit similar patterns in encoding uncertainty information to some extent. The performance drop (from indistribution to OOD) observed in the MMLU dataset is notably less than that in the question-answering dataset, which may stem from the larger disparity between the CoQA and TriviaQA datasets compared to that between two distinct groups of subjects within the same MMLU dataset. This suggests that in 16 \fcases of significant distributional shifts, re-training or re-calibrating the uncertainty estimation model using test data may be helpful. 5"
18
+ }
abs_9K/validation_abstract_short_2404.16019v1.json ADDED
The diff for this file is too large to render. See raw diff
 
abs_9K/validation_abstract_short_2404.16022v1.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.16022v1",
3
+ "title": "PuLID: Pure and Lightning ID Customization via Contrastive Alignment",
4
+ "abstract": "We propose Pure and Lightning ID customization (PuLID), a novel tuning-free\nID customization method for text-to-image generation. By incorporating a\nLightning T2I branch with a standard diffusion one, PuLID introduces both\ncontrastive alignment loss and accurate ID loss, minimizing disruption to the\noriginal model and ensuring high ID fidelity. Experiments show that PuLID\nachieves superior performance in both ID fidelity and editability. Another\nattractive property of PuLID is that the image elements (e.g., background,\nlighting, composition, and style) before and after the ID insertion are kept as\nconsistent as possible. Codes and models will be available at\nhttps://github.com/ToTheBeginning/PuLID",
5
+ "authors": "Zinan Guo, Yanze Wu, Zhuowei Chen, Lang Chen, Qian He",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-04-24",
8
+ "primary_cat": "cs.CV",
9
+ "cats": [
10
+ "cs.CV"
11
+ ],
12
+ "label": "Original Paper",
13
+ "paper_cat": "Diffusion AND Model",
14
+ "gt": "We propose Pure and Lightning ID customization (PuLID), a novel tuning-free\nID customization method for text-to-image generation. By incorporating a\nLightning T2I branch with a standard diffusion one, PuLID introduces both\ncontrastive alignment loss and accurate ID loss, minimizing disruption to the\noriginal model and ensuring high ID fidelity. Experiments show that PuLID\nachieves superior performance in both ID fidelity and editability. Another\nattractive property of PuLID is that the image elements (e.g., background,\nlighting, composition, and style) before and after the ID insertion are kept as\nconsistent as possible. Codes and models will be available at\nhttps://github.com/ToTheBeginning/PuLID",
15
+ "main_content": "Introduction As a special category of customized text-to-image (T2I) generation [5, 30, 12, 17, 40, 42], identity (ID) customization allow users to adapt pre-trained T2I diffusion models to align with their personalized ID. One line of work [5, 30, 12, 17] fine-tunes certain parameters on several images with the same ID provided by the user, thereby embedding the ID into the generative model. These methods have spawned many popular AI portrait applications, such as PhotoAI and EPIK. While tuning-based solutions have achieved commendable results, customizing for each ID requires tens of minutes of fine-tuning, thus making the personalization process economically expensive. Another line of work [41, 42, 2, 36, 20, 19, 38] forgoes the necessity of fine-tuning for each ID, instead resorting to pre-training an ID adapter [11, 24] on an expansive portrait dataset. These methods typically utilize an encoder (e.g., CLIP image encoder [27]) to extract the ID feature. The extracted feature is then integrated into the base diffusion model in a specific way (e.g., embedded into cross-attention layer). Although highly efficient, these tuning-free methods face two significant challenges. \u2022 Insertion of ID disrupts the original model\u2019s behavior. A pure ID information embedding should feature two characteristics. Firstly, an ideal ID insertion should alter only ID-related aspects, such as face, hairstyle, and skin color, while image elements not directly associated with the specific identity, such as background, lighting, composition, and style, should be consistent with the behavior of the original model. To our knowledge, this point has not been focused by previous works. While some research [42, 38, 20] has shown the ability for stylized ID generation, notable style degradation occurs when compared with images before ID insertion (as depicted in Fig. 1). Methods with higher ID fidelity tend to induce more severe style degradation. Secondly, after the ID insertion, it should still retain the ability of the original T2I model to follow prompts. In the context of ID customization, this generally implies the capacity to alter ID attributes (e.g., age, gender, expression, and hair), orientation, and accessories (e.g., glasses) via prompts. To achieve these features, current solutions generally fall into two categories. The first category involves enhancing the encoder. IPAdapter [42, 1] shifted from early-version CLIP extraction of grid features to utilizing face recognition backbone [4] to extract more abstract and relevant ID information. Despite the improved editability, the ID fidelity is not high enough. InstantID [38] builds on this by including an additional ID&Landmark ControlNet [43] for more effective modulation. Even though the ID similarity improves significantly, it compromises some degree of editability and flexibility. The second category of methods [20] supports non-reconstructive training to enhance editability by constructing datasets grouped by ID; each ID includes several images. However, creating such datasets demands significant effort. Also, most IDs correspond to a limited number of celebrities, which might limit their effectiveness on non-celebrities. \u2022 Lack of ID fidelity. Given our human sensitivity to faces, maintaining a high degree of ID fidelity is crucial in ID customization tasks. Inspired by the successful experience of face generation [29, 39] tasks during the GAN era [7], a straightforward idea for improving ID fidelity is to introduce ID loss within diffusion training. However, due to the iterative denoising nature of diffusion models [10], achieving an accurate x0 needs multiple steps. The resource consumption for training in this manner can be prohibitively high. Consequently, some methods [2] predict x0 directly from the current timestep and then calculate the ID loss. However, when the current timestep is large, the predicted x0 is often noisy and flawed. Calculating ID loss under such conditions is obviously inaccurate, as the face recognition backbone [4] is trained on photo-realistic images. Although some workarounds have been proposed, such as calculating ID loss only at less noisy timesteps [25] or predicting x0 with an additional inference step [45], there still remains room for improvement. In this work, to maintain high ID fidelity while reducing the influence on the original model\u2019s behavior, we propose PuLID, a pure and lighting ID customization method via contrastive alignment. Specifically, we introduce a Lightning T2I branch alongside the standard diffusion-denoising training branch. Leveraging recent fast sampling methods [23, 32, 21], the lighting T2I branch can generate high-quality images from pure noise with a limited and manageable number of steps. With this additional branch, we can simultaneously address the two challenges mentioned above. Firstly, to minimize the influence on the original model\u2019s behavior, we construct a contrastive pair with the same prompt and initial latent, with and without ID insertion. During the Lightning T2I process, we align the UNet features between the contrastive pair semantically, instructing the ID adapter how to insert 2 \fID information without affecting the behavior of the original model. Secondly, as we now have the precise and high-quality generated x0 after ID insertion, we can naturally extract its face embedding and calculate an accurate ID loss with the ground truth face embedding. It is worth mentioning that such x0 generation process aligns with the actual test setting. Our experiments demonstrate that optimizing the ID loss in this context can significantly increase ID similarity. The contributions are summarized as follows. (1) We propose a tuning-free method, namely, PuLID, which preserves high ID similarity while mitigating the impact on the original model\u2019s behavior. (2) We introduce a Lightning T2I branch alongside the regular diffusion branch. Within this branch, we incorporate a contrastive alignment loss and ID loss to minimize the contamination of ID information on the original model while ensuring fidelity. Compared to the current mainstream approaches that improve the ID encoder or datasets, we offer a new perspective and training paradigm. (3) Experiments show that our method achieves SOTA performance in terms of both ID fidelity and editability. Moreover, compared to existing methods, our ID information is less invasive to the model, making our method more flexible for practical applications. 2 Related Work Tuning-based Text-to-image ID Customization. ID Customization for text-to-image models aims to empower pre-trained models to generate images of specific identities while following the text descriptions. Two seminal tuning-based works [5, 30] strive towards this goal. Textual Inversion [5] optimizes a new word embedding for the user-provided ID, and Dreambooth [30] fine-tunes the entire generator to further enhance fidelity. Subsequently, various approaches [12, 17, 8, 35] have explored different fine-tuning paradigms in the generator and embedding space to achieve superior ID fidelity and text alignment. Despite these advancements, the time-consuming optimization process for each ID, taking at least several minutes, restricts its broader application. Tuning-free Text-to-image ID Customization. To ease the resource demand necessitated by online tuning, a series of tuning-free methods [36, 38, 25, 42, 20, 41, 3] have emerged, which directly encode ID information into the generation process. The major challenge these methods encounter is minimizing disruption to the original behavior of T2I models while still maintaining high ID fidelity. In terms of minimizing the disruption, one plausible approach is to utilize a face recognition model [4] to extract more abstract and relevant facial domain-specific representations, as done by IP-ApdaterFaceID [1] and InstantID [38]. A dataset comprising multiple images from the same ID can facilitate the learning of a common representation [20]. Despite the progress made by these approaches, they have yet to fundamentally solve the disruption issue. Notably, models with higher ID fidelity often cause more significant disruptions to the behavior of the original model. In this study, we propose a new perspective and training method to tackle this issue. Interestingly, the suggested method does not require laborious dataset collection grouped by ID, nor is it confined to a specific ID encoder. To improve ID fidelity, ID loss is employed in previous works [16, 2], motivated by its effectiveness in prior GAN-based works [29, 39]. However, in these methods, x0 is typically directly predicted from the current timestep using a single step, often resulting in noisy and flawed images. Such images are not ideal for the face recognition models [4], as they are trained on real-world images. PortraitBooth [25] alleviates this issue by only applying ID loss at less noisy stages, which ignores such loss in the early steps, thereby limiting its overall effectiveness. Diffswap [45] obtains a better predicted x0 by employing two steps instead of just one, even though this estimation still contains noisy artifacts. In our work, with the introduced Lightning T2I training branch, we can calculate ID loss in a more accurate setting. We notice a concurrent work, LCM-Lookahead [6], which also uses fast sampling technology (i.e., LCM [23]) to achieve a more precise prediction of x0. However, there are several differences between this work and ours. Firstly, LCM-Lookahead makes a precise prediction of x0 during the conventional diffusion-denoising process, whereas we start from pure noise and iteratively denoise to x0. Our approach, which aligns better with actual testing settings, makes the optimization of ID loss more direct. Secondly, to enhance prompt editing capability, LCM-Lookahead capitalized on the mode collapse phenomenon of SDXL-Turbo [32] to synthesis an ID-consistent dataset. However, the synthetic dataset might face diversity and consistency challenges, and the authors found that training with this dataset may lean towards stylized results more frequently than other methods. In contrast, 3 \four method does not need an ID-grouped dataset. Instead, we enhance prompt follow ability through a more fundamental and intuitive approach, namely, contrastive alignment. Fast Sampling of Diffusion Models. In practice, diffusion models are typically trained under 1000 steps. During inference, such a lengthy process can be shortened to a few dozen steps with the help of advanced sampling methods [33, 22, 15]. Recent distill-based works [21, 23, 32] further accelerate this generation process within 10 steps. The core motivation is to guide the student network to align with points further from the base teacher model. In this study, the Lightning T2I training branch we introduce leverages the SDXL-Lightning [21] acceleration technology, thus enabling us to generate high-quality images from pure noise in just 4 steps. 3 Methods prompts list watercolor sketch cinematic ... Accurate ID Loss Lightning T2I branch ..... ..... ... X 4 ResNet Self-Attn Cross-Attn ... ResNet Self-Attn Cross-Attn ID Loss Contrastive Pair X 1 Conventional Diffusion branch + Arcface MLP ID Encoder MLP VIT unet + Diffusion Loss Alignment Loss Alignment Loss T2I w/ ID T2I w/o ID predict ID Encoder path w/ ID path w/o ID prompt prompt Figure 2: Overview of PuLID framework. The upper half of the framework illustrates the conventional diffusion training process. The face extracted from the same image is employed as the ID condition Cid. The lower half of the framework demonstrates the Lightning T2I training branch introduced in this study. It leverages the recent fast sampling methods to iteratively denoise from pure noise to high-quality images in a few steps (4 in this paper). In this branch, we construct contrastive paths with and without ID injection and introduce an alignment loss to instruct the model on how to insert ID condition without disrupting the original model\u2019s behavior. As this branch can produce photo-realistic images, it implies that we can achieve a more accurate ID loss for optimization. 3.1 Preliminary Diffusion models [10] are a class of generative models capable of synthesizing desired data samples through iterative denoising. A conventional diffusion training encapsulates two procedures, the forward diffusion process and reverse denoising process. During the diffusion process, noise \u03f5 is sampled and added to the data sample x0 based on a predefined noise schedule. This process yields a noisy sample xt at timestep t. Conversely, during the denoising process, a denoisng model \u03f5\u03b8 takes xt, t, and optional additional conditions C as inputs to predict the added noise, the optimization process can be articulated as: Ldiff = Ex0,\u03f5,t(\u2225\u03f5 \u2212\u03f5\u03b8(xt, t, C)\u2225). (1) The denoising model \u03f5\u03b8 in modern T2I diffusion models [31, 28, 26] is predominantly a UNET composed of residual blocks [9], self-attention layers, and cross-attention [37] layers. The prompt, as a condition, is embedded into the cross-attention layers adhering to the attention mechanism, 4 \fillustrated as follows: ( Attention(Q, K, V ) = Softmax( QKT \u221a d )V K = WK\u03c4txt(Ctxt); V = WV \u03c4txt(Ctxt), (2) where Q is projected from the UNET image features, \u03c4txt denotes a pre-trained language model that converts prompt Ctxt to textual features, WK and WV are the learned linear layers. ID Customization in T2I diffusion introduces ID images Cid as an additional condition, working together with the prompt to control image generation. Tuning-free customization [14, 41, 42] methods typically employ an encoder to extract ID features from Cid. The encoder often includes a frozen backbone, such as CLIP image encoder [27] or face recognition backbone [4], along with a learnable head. A simple yet effective technique to embed the ID features to the pre-trained T2I model is to add parallel cross-attention layers to the original ones. In these parallel layers, learnable linear layers are introduced to project the ID features into Kid and Vid for calculating attention with Q. This technique, proposed by IP-Adapter [42], has been widely used, we also adopt it for embedding ID features in this study. 3.2 Basic Settings We build our model based on the pre-trained SDXL [26], which is a SOTA T2I latent diffusion model. Our ID encoder employs two commonly used backbones within the ID customization domain: the face recognition model [4] and the CLIP image encoder [27], to extract ID features. Specifically, we concatenate the feature vectors from the last layer of both backbones (for the CLIP image encoder, we use the CLS token feature), and employ a Multilayer Perceptron (MLP) to map them into 5 tokens as the global ID features. Additionally, following ELITE\u2019s approach [40], we use MLPs to map the multi-layer features of CLIP to another 5 tokens, serving as the local ID features. It is worth noting that our method is not restricted to a specific encoder. 3.3 Discussion on Common Diffusion Training in ID Customization Currently, tuning-free ID customization methods generally face a challenge: the embedding of the ID disrupts the behavior of the original model. The disruption manifests in two ways: firstly, the ID-irrelevant elements in the generated image (e.g., background, lighting, composition, and style) have changed extensively compared to before the ID insertion; secondly, there is a loss of prompt adherence, implying we can hardly edit the ID attributes, orientations, and accessories with the prompt. Typically, models with higher ID fidelity suffer more severe disruptions. Before we present our solutions, we first analyze why conventional diffusion training would cause this issue. In conventional ID Customization diffusion training process, as formulated in Eq. 1, the ID condition Cid is usually cropped from the target image x0 [42, 38]. In this scenario, the ID condition aligns completely with the prompt and UNET features, implying the ID condition does not constitute contamination to the T2I diffusion model during the training process. This essentially forms a reconstruction training task. So, to better reconstruct x0 (or predict noise \u03f5), the model will make the utmost effort to use all the information from ID features (which may likely contain ID-irrelevant information), as well as bias the training parameters towards the dataset distribution, typically in the realistic portrait domain. Consequently, during testing, when we provide a prompt that is in conflict or misaligned with the ID condition, such as altering ID attributes or changing styles, these methods tend to fail. This is because there exists a disparity between the testing and training settings. 3.4 Uncontaminated ID Insertion via Contrastive Alignment While it is difficult to ascertain whether the insertion of ID disrupts the original model\u2019s behavior during the conventional diffusion training, it is rather easy to recognize under the test settings. For instance, we can easily observe whether the elements of the image change after the ID is embedded, and whether it still possesses prompt follow ability. Thus, our solution is intuitive. We introduce a Lightning T2I training branch beyond the conventional diffusion-denoising training branch. Just like in the test setting, the Lighting T2I branch starts from pure noise and goes through the full iterative denoising steps until reaching x0. Leveraging recent fast sampling methods [23, 32, 21], the Lighting T2I branch can generate high-quality images from pure noise with a limited and manageable number 5 \fbaseline + + ID \" a man, riding a bike, sketch \" T2I w/o ID Figure 3: Effect of Lalign-sem and Lalign-layout. of steps. Concretely, we employ SDXL-Lightning [21] with 4 denoising steps. We prepare a list of challenging prompts that can easily reveal contamination, as shown in Table 3. During each training iteration, a random prompt from this list is chosen as the textual condition for the Lightning T2I branch. Then, we construct contrastive paths that start from the same prompt and initial latent. One path is conditioned only by the prompt, while the other path employs both the ID and the prompt as conditions. By semantically aligning the UNET features on these two paths, the model will learn how to embed ID without impacting the behavior of the original model. The overview of our method is shown in Fig. 2. We chose to align the contrastive paths in their corresponding UNET\u2019s cross-attention layers. Specifically, we denote the UNET features in the path without ID embedding as Qt, whereas the corresponding UNET features in the contrastive path with ID embedding as Qtid. For simplicity, we omit the specific layers and denoising steps here. In actuality, alignment is conducted across all layers and time steps. Our alignment loss consists of two components: the semantic alignment loss and the layout alignment loss. We use textual features K to query the UNET features Q. For each token in K, it will calculate the correlation with Q, and further aggregate Q based on the correlation matrix. Analogous to Eq. 2, the attention mechanism here can be expressed as Attention(K, Q, Q), which can be interpreted as the response of the UNET features to the prompt. The insight behind our semantic alignment loss is simple: if the embedding of ID does not affect the original model\u2019s behavior, then the response of the UNET features to the prompt should be similar in both paths. Therefore, our semantic alignment loss Lalign-sem can be formulated as follows: Lalign-sem = \r \r \r \rSoftmax(KQT tid \u221a d )Qtid \u2212Softmax(KQT t \u221a d )Qt \r \r \r \r 2 . (3) As illustrated in Fig. 3, the introduction of Lalign-sem significantly mitigates the issue of ID information contaminating the model\u2019s behavior. However, it cannot guarantee layout consistency, so we add a layout alignment loss Lalign-layout, which is defined as: Lalign-layout = \u2225Qtid \u2212Qt\u22252 . (4) The full alignment loss is formulated as Lalign = \u03bbalign-semLalign-sem + \u03bbalign-layoutLalign-layout, (5) where \u03bbalign-sem and \u03bbalign-layout serve as hyperparameters that determine the relative importance of each loss item. In practice, we set \u03bbalign-layout to a relatively small value, as we found that a larger value compromises the ID fidelity. 3.5 Optimizing ID Loss in a More Accurate Setting In ID Customization tasks, ensuring a high degree of ID fidelity is essential, given our innate human sensitivity towards discerning facial features. To improve the ID fidelity, aside from enhancements on the ID encoder [42, 38, 44], another universal and parallel improvement is the introducing of an ID loss [4, 2, 25] during the training. However, these methods directly predict x0 at the t-th timestep in the diffusion training process, only using a single step. This will produce a noisy and flawed predicted x0, subsequently leading to inaccurate calculation of ID loss. To ease this issue, recent work [25] proposes to only applying the ID loss on less noisy stages. However, since the ID loss only affects a 6 \fportion of timesteps, which may potentially limit the full effectiveness of it. In this study, thanks to the introduced Lightning T2I branch, the above issue can be fundamentally resolved. Firstly, we can swiftly generate an accurate x0 conditioned on the ID from pure noise within 4 steps. Consequently, calculating the ID loss on this x0, which is very close to the real-world data distribution, is evidently more precise. Secondly, optimizing ID loss in a setting that aligns with the testing phase, is more direct and effective. Formally, the ID loss Lid is defined as: Lid = CosSim (\u03d5(Cid), \u03d5(L-T2I(xT , Cid, Ctxt))) , (6) where xT denotes the pure noise, L-T2I represents the Lightning T2I branch, and \u03d5 denotes the face recognition backbone [4]. To generate photo-realistic faces, we fix the prompt Ctxt to \"portrait, color, cinematic\". 3.6 Full Objective The full learning objective is defined as: Lid = Ldiff + Lalign + \u03bbidLid. (7) During training, only the newly introduced MLPs and the learnable linear layers Kid and Vid in cross-attention layers are optimized with this objective, with the rest remaining frozen. 4 Experiments 4.1 Implementation Details We build our PuLID model based on SDXL [26] and the 4-step SDXL-Lightning [21]. For the ID encoder, we use antelopev2 [4] as the face recognition model and EVA-CLIP [34] as the CLIP Image encoder. Our training dataset comprises 1.5 million high-quality human images collected from the Internet, with captions automatically generated by BLIP-2 [18]. Our training process consists of three stages. In the first stage, we use the conventional diffusion loss Ldiff to train the model. In the second stage, we resume from the first stage model and train with the ID loss Lid (we use arcface-50 [4] to calculate ID loss) and diffusion loss Ldiff. This model strives for the maximum ID fidelity without considering the contamination to the original model. In the third stage, we add the alignment loss Lalign and use the full objective as shown in Eq. 7 to fine-tune the model. We set the \u03bbalign-sem to 0.6, \u03bbalign-layout to 0.1, and \u03bbid to 1.0. In the Lightning T2I training branch, we set the resolution of the generated image to 768 \u00d7 768 to conserve memory. Training is performed with PyTorch and diffusers on 8 NVIDIA A100 GPUs in an internal cluster. 4.2 Test Settings For consistency in comparison, unless otherwise specified, all the results in this paper are generated with the SDXL-Lightning [21] base model over 4 steps using the DPM++ 2M sampler [15]. The CFG-scale is set to 1.2, as recommended by [21]. Moreover, for each comparison sample, all methods utilize the same seed. We find that the comparison methods, namely InstantID [38] and IPAdapter (more specifically, IPAdapter-FaceID [1]) are highly compatible with the SDXL-Lightning model. Compared to using SDXL-base [26] as the base model, employing SDXL-Lightning results in InstantID generating more natural and aesthetically pleasing images, and enables IPAdapter to achieve higher ID fidelity. We also provide a quantitative comparison with these methods on SDXL-base, and the conclusions remaining consistent with those on SDXL-Lightning. To more effectively evaluate these methods, we collected a diverse portrait test set from the internet. This set covers a variety of skin tones, ages, and genders, totaling 120 images, which we refer to as DivID-120. As a supplementary resource, we also used a recent open-source test set, Unsplash-50 [6], which comprises 50 portrait images uploaded to the Unsplash website between February and March 2024. 4.3 Qualitative Comparison As shown in Fig. 4, when compared to SOTA methods such as IPAdapter and InstantID, our PuLID tends to achieve higher ID fidelity while creating less disruption to the original model. From rows 7 \fT2I w/o ID + anime + pikachu + portrait + cinematic ID PuLID(ours) InstantID IPAdapter + portrait + paper art + portrait + side view + playing piano + wearing a hat + on the beach + white dress + portrait + child + portrait + mask + cartoony + mario Figure 4: Qualitative comparisons. T2I w/o ID represents the output generated by the original T2I model without inserting ID, which reflects the behavior of the original model. Our PuLID achieves higher ID fidelity while causing less disruption to the original model. As the disruption to the model is reduced, results generated by PuLID accurately reproduce the lighting (1st row), style (4th row), and even layout (5th row) of the original model. This unique advantage broadens the scope for a more flexible application of PuLID. 8 \fTable 1: Quantitative comparisons. Comparison of ID cosine similarity with SOTA methods across different base models and datasets. PuLID (maximum ID sim) represents the model from second training stage. SDXL-Lightning SDXL-base DivID-120 Unsplash-50 DivID-120 Unsplash-50 PhotoMaker 0.271 0.193 IPAdapter 0.619 0.615 0.597 0.572 InstantID 0.725 0.614 0.755 0.648 PuLID (maximum ID sim) 0.761 0.708 0.773 0.711 PuLID (ours) 0.733 0.659 0.734 0.666 1, 2, 5, 6, and 7, it is clear that our method can attain high ID similarity in realistic portrait scenes and delivers better aesthetics. Conversely, other methods either fall short in ID fidelity or show diminished aesthetics compared to the base model. Another distinct advantage of our approach is that as the disruption to the model decreases, the results produced by PuLID accurately replicate the lighting (1st row), style (4th row), and even layout (5th row) of the original model. In contrast, although comparative methods can also perform stylization, notable style degradation can be noticed when compared to the original model. Finally, our model also possesses respectable prompt-editing capabilities, such as changing orientation (2nd row), altering attributes (6th row), and modifying accessories (7th row). More qualitative comparison can be found in Fig. 1. 4.4 Quantitative Comparison To quantitatively compare the methods, we adopt the ID cosine similarity to evaluate ID fidelity, with ID embeddings extracted using CurricularFace [13]. CurricularFace is different from the face recognition models we use in the ID encoder and for ID loss calculation. Table 1 presents the quantitative results. As seen in the table, our model that strives for maximum ID fidelity (the model from the second training stage) outperforms existing methods on all test sets and base models. Even after introducing the alignment loss and sacrificing some ID fidelity, our final model, PuLID, still outperforms the comparative methods in most scenarios, except for when employing SDXL-base as the base model and being slightly inferior to InstantID on DivID-120. Moreover, Table 1 shows that InstantID and IPAdapter are well compatible with SDXL-Lightning. IPAdapter exhibits some metric improvements after utilizing SDXL-Lightning. Despite a minor decline in metrics when transitioning to SDXL-Lightning, InstantID sees substantial improvements in image quality and usability (refer to supp for more details). Furthermore, our method still outperforms InstantID when using SDXL-base as the base model. We observed that PhotoMaker shows limited compatibility with SDXL-Lightning, suffering significant performance degradation as a result. Hence, we only compare its performance on SDXL-base in this table. 4.5 More Applications We provide more applications of our PuLID in Fig. 5, encompassing style alterations (1st row), IP fusion (2nd row), accessories modification (3rd row), recontextualization (4th row), attributes editing (5th row), transformation from non-photo-realistic domains to photo-realistic ones (6th row), and ID mixing (7th row). 4.6 Ablation Alignment loss ablation. Fig. 6 displays a comparison between models trained with and without the alignment loss Lalign. As observed, without Lalign, the embedding of ID severely disrupts the behavior of the original model. This disruption manifests as an inability for the prompt to precisely modify style (columns 2-3) and orientation (column 4). Also, the layout would collapse to the extent that the face occupies the majority of the image area, resulting in a diminished diversification of the layout. However, with the introduction of our alignment loss, this disruption can be significantly reduced. 9 \fcg cyberpunk fantasy ID ID ID saiyan werewolf cartoon ID ID ID armor glasses animal ears ID ID ID smile woman old ID ID ID convert ID ID ID convert convert ID snow ID water ID space ID 1 mix ID 2 + ID 1 mix + ID 2 ID 1 mix + ID 2 Figure 5: More applications. Including style changes, IP fusion, accessory modification, recontextualization, attribute editing, transformation from non-photo-realistic domain to photo-realistic domain, and ID mixing. Note that all these high-quality images are generated in just 4 steps with SDXL-Lightning model, without the need for additional Lora. 10 \fID ID ID ID + playing piano + wearing a hat + on the beach + white dress + upper body + playing basketball + watercolor + upper body + Zelda + 2d + portrait + side view w/o w/ T2I w/o ID Figure 6: Alignment loss ablation. Table 2: ID loss ablation. DivID-120 Unsplash-50 Baseline (Stage1) 0.561 0.514 w/ ID Loss naive 0.652 0.601 w/ ID Loss (Stage2) 0.761 0.708 ID loss ablation. Table 2 illustrates the improvement in ID fidelity using the naive ID loss (directly predicting x0 from current timestep) and the more accurate ID loss Lid introduced in this paper, in comparison to the baseline. As observed, Lid can accomplish a greater improvement compared to the naive ID loss. We attribute this to the more precise x0 provided by the Lightning-T2I branch, which also better aligns with the testing setting, thereby making the optimization of ID loss more direct and effective."
16
+ }
abs_9K/validation_abstract_short_2404.16030v1.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.16030v1",
3
+ "title": "MoDE: CLIP Data Experts via Clustering",
4
+ "abstract": "The success of contrastive language-image pretraining (CLIP) relies on the\nsupervision from the pairing between images and captions, which tends to be\nnoisy in web-crawled data. We present Mixture of Data Experts (MoDE) and learn\na system of CLIP data experts via clustering. Each data expert is trained on\none data cluster, being less sensitive to false negative noises in other\nclusters. At inference time, we ensemble their outputs by applying weights\ndetermined through the correlation between task metadata and cluster\nconditions. To estimate the correlation precisely, the samples in one cluster\nshould be semantically similar, but the number of data experts should still be\nreasonable for training and inference. As such, we consider the ontology in\nhuman language and propose to use fine-grained cluster centers to represent\neach data expert at a coarse-grained level. Experimental studies show that four\nCLIP data experts on ViT-B/16 outperform the ViT-L/14 by OpenAI CLIP and\nOpenCLIP on zero-shot image classification but with less ($<$35\\%) training\ncost. Meanwhile, MoDE can train all data expert asynchronously and can flexibly\ninclude new data experts. The code is available at\nhttps://github.com/facebookresearch/MetaCLIP/tree/main/mode.",
5
+ "authors": "Jiawei Ma, Po-Yao Huang, Saining Xie, Shang-Wen Li, Luke Zettlemoyer, Shih-Fu Chang, Wen-Tau Yih, Hu Xu",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-04-24",
8
+ "primary_cat": "cs.CV",
9
+ "cats": [
10
+ "cs.CV",
11
+ "cs.AI",
12
+ "cs.CL",
13
+ "cs.LG"
14
+ ],
15
+ "label": "Original Paper",
16
+ "paper_cat": "Mixture AND of AND Experts",
17
+ "gt": "The success of contrastive language-image pretraining (CLIP) relies on the\nsupervision from the pairing between images and captions, which tends to be\nnoisy in web-crawled data. We present Mixture of Data Experts (MoDE) and learn\na system of CLIP data experts via clustering. Each data expert is trained on\none data cluster, being less sensitive to false negative noises in other\nclusters. At inference time, we ensemble their outputs by applying weights\ndetermined through the correlation between task metadata and cluster\nconditions. To estimate the correlation precisely, the samples in one cluster\nshould be semantically similar, but the number of data experts should still be\nreasonable for training and inference. As such, we consider the ontology in\nhuman language and propose to use fine-grained cluster centers to represent\neach data expert at a coarse-grained level. Experimental studies show that four\nCLIP data experts on ViT-B/16 outperform the ViT-L/14 by OpenAI CLIP and\nOpenCLIP on zero-shot image classification but with less ($<$35\\%) training\ncost. Meanwhile, MoDE can train all data expert asynchronously and can flexibly\ninclude new data experts. The code is available at\nhttps://github.com/facebookresearch/MetaCLIP/tree/main/mode.",
18
+ "main_content": "Introduction Contrastive Language-Image Pretraining (CLIP) learns versatile vision-language representations which are transferable across diverse downstream tasks. Existing models, such as OpenAI CLIP [39], OpenCLIP [44] and MetaCLIP [50], are trained with a large collection of webcrawled image-caption pairs. Specifically, for each image, its paired caption is viewed as a positive example, and the captions of all the other images are viewed as negatives. The model then learns to project both images and captions into a shared space, where the embedding of the positive caption is drawn closer to the image embedding, compared to the embeddings of all the other negative captions. \u2217Research done while Jiawei Ma was an intern at FAIR. + Project Lead. CLIP f(\u22c5) MoDE (Ours) f(\u22c5|\ud835\udc50) f(\u22c5|\ud835\udc50) f(\u22c5|\ud835\udc50) a cat with its front paws stretched up against the tree Tree guard to stop the cats The tiger reaches up to a tree trunk in a wooded area A picture took in a national park Figure 1. For an image-caption pair, the caption may describe limited visual content or even be unrelated, and such noises unavoidably hurt the quality of negative examples to learning a single model. We propose to uncover the clusters from training data, where 1) the pairs with similar images but different captions are assigned to different clusters and 2) the samples in each cluster are of related meanings, and learn a Data Expert for each cluster. These experts are then selectively ensembled for inference. The key to the success of contrastive vision-language representation learning lies in the creation of quality negative examples for training [8, 14]. A single image can be depicted by texts with different meanings (i.e., semantics), covering multiple details and interpretations, as illustrated in Fig. 1. Because the paired caption usually describes limited visual content, it is common to see that two similar images have drastically different textual descriptions, especially in noisy web-crawled data. When those imagecaption pairs are sampled in the same batch, captions of other images become false negatives \u2014 acceptable captions yet being treated as negative descriptions of the target image. Conversely, if only dissimilar image-caption pairs are sampled, the contrastive learning problem becomes trivial. Incorporating hard negatives [8, 37, 49] (e.g., incorrect yet similar captions that share many words of a correct textual description) in training batches has often been shown to improve the model performance. In this work, we introduce the Mixture of Data Experts (MoDE) framework (shown in Fig. 1-bottom) via clustering. MoDE separates false negative samples into different 1 arXiv:2404.16030v1 [cs.CV] 24 Apr 2024 \fclusters and groups the pairs with similar semantics, which mitigates noise from false-negative captions while incorporating a more challenging set of hard-negative examples, thereby enhancing vision-language pre-training. MoDE consists of two main steps: (1) the training data (i.e., imagecaption pairs) is first clustered into several disjoint subsets by the captions; each cluster is then used to train a model following the standard contrastive learning method. In this way, each model is specialized by the training data in one cluster and thus termed as a Data Expert. (2) When applied to downstream tasks, such as image classification, the task metadata (i.e., class names), are first compared to the centroid of each data cluster to determine which data expert needs to be activated. Selected data experts are then used to create the embeddings of the test image and classes. The class with the highest ensembled similarity is then output as the classification result. Empirically, MoDE outperforms several state-of-the-art vision-language models when applied to multiple standard benchmarks, including +3.7% on image classification in CLIP benchmark [34,39], +3.3% on image-to-text retrieval and +2.7% on text-to-image retrieval on COCO [29]. The superiority of MoDE can be attributed to better trained individual data expert models, due to the fact that examples in the same cluster, when used for contrastive learning, provide more quality negatives. Because captions in the same cluster are different but semantically similar (e.g., \u201ca cat climbs a tree\u201d, \u201ca tiger reaches up to a tree\u201d), they become challenging negative examples when compared with images that are not the originally paired ones. On the other hand, it is also less likely to encounter a false negative case where a very different caption validly describes the same image (e.g., \u201ctree guards to stop the cats\u201d in Fig. 1). MoDE is also uniquely positioned for large-scale training when billions of image-caption pairs are available. As each data expert uses only a fraction of the whole dataset, it can be more easily trained with fewer compute resources asynchronously. From experiments across different ViT [6] model scales, we show that four ViT-B/16 data experts can outperform the single ViT-L/14 model by OpenAI CLIP [39] and OpenCLIP [43] on image classification but requires much less (<35%) training cost. In summary, our contributions are: \u2022 We investigate the quality negative samples in contrastive language-image pretraining, and in particular, the noise of false negatives in web-crawled image-caption pairs. \u2022 We propose the MoDE framework to learn a system of CLIP data experts via clustering, and adaptively ensemble data experts for downstream tasks at inference time. \u2022 Extensive experimental study has demonstrated the effects in zero-shot transfer benchmarks with low training cost. MoDE can include new data experts flexibly and is thus beneficial for continual pre-training. 2. Related Work Contrastive Language Image Pretraining (CLIP) aims to learns robust & transferable visual representations from large-scale data. Scaling up [19, 38] existing approaches and improving the effectiveness is critical. Recent progress in the field involves the exploration of regularization techniques [53] and hyperbolic embedding methods [4] but they require significant effort for data annotation. Data curation is then proposed to remove noisy web-crawled imagecaption pairs. Additionally, methods like image masking [28] and concise captions [27] efficiently decrease memory demands, enabling the use of larger batch sizes and model sizes. However, a trade-off between training cost and effectiveness still exists. Following the studies [23, 41] in contrastive learning [2, 16], recent work investigated negative samples in CLIP training but still focuses on image side [30, 48]. The noise exhibited in captions [51] is then overlooked. In this study, we tackle the data noise and the discovery of negative samples via clustering. Rather than training a single model, we asynchronously train multiple data experts and then directly ensemble them for inference adaptively, which also shows benefits for model scaling. Mixture-of-Expert (MoE) trains a set of sub-models and a routing module. Originally, each expert is defined as an entire network [18, 21], and a single model is selected for each data adaptively. As restricting to hard model selection may limit the practicality, deep mixture of expert [7], is then proposed where the MoE layer is set to softly ensemble layer outputs via weighted sum, which is then investigated with different architectures [9,25] in various tasks [40,45]. However, all expert models are still trained on the same data simultaneously, resulting in much heavier training costs. Recently, BTM [13, 26] proposes to learn expert models on different document types (e.g., papers, posts) separately but is only validated on language models. Meanwhile, both MoE and BTM can only determine the model routing for each input separately. Instead, MoDE generalizes to tasklevel adaptation and ensembles the models by task metadata (e.g., class names in classification task [3]). Inference-Time Adaptation adapts a pre-trained model quickly and effectively to new tasks. Initially, transductive learning [10] is studied and leverages all unlabeled test data for model update. To mitigate the dependence on the presumed distribution of test data, test-time training [11,42,47] is developed to generate individual models for each input. Subsequent explorations into meta-learning [15,31,46] introduced a separate module (i.e., meta-learner) that can adapt the pre-trained model for each task with a few annotated examples. MoDE has inference-time task adaptation but without annotation or parameter update. 2 \fData Clustering Task Metadata (e.g., \u2018dog\u2019, \u2018cat\u2019) [0.2 0.0 0.6 0.2 ] Routing Inference-Time Task Adaptation Ensemble Weights Data Expert Learning (MoDE-4) s1 s2 s3 s4 s5 s6 s7 s8 c3 c2 c4 c1 Data Clustering Task Metadata (e.g., \u2018dogs\u2019) [ 0.2 0.0 0.6 0.2 ] Routing Inference-Time Task Adaptation Ensemble Weights Data Expert Learning (MoDE-4) s1 s2 s3 s4 s5 s6 s7 s8 c3 c2 c4 c1 !(\u22c5|%!) !(\u22c5|%\") !(\u22c5|%#) !(\u22c5|%$) s1 c1 c2 c3 c4 s7 s8 s6 s5 s4 s3 s2 !(\u22c5|%!) !(\u22c5|%\") !(\u22c5|%#) !(\u22c5|%$) Figure 2. Framework of MoDE via clustering. (Left) We perform a two-step clustering on captions to decide clusters / conditions for data experts. The colored scatter plots are fine-grained clusters and the circles are clusters at coarse-grained level. (Right) Each coarse-grained cluster (c) conditions the learning of one data expert f(\u00b7|c) and all data experts (colored boxes) are learned asynchronously. For inference, the similarity between task metadata and fine-grained cluster centers ({s}) is used to decide the routing of data experts. To keep reasonable training cost, all data experts can be initialized with a model partially trained on all data without clustering (omitted for simplicity). 3. CLIP Data Experts For contrastive image-language pre-training, the model is trained to accurately align each image with the captions describing the visual content. In a manner of divide-andconquer [1], for each CLIP data expert training on one cluster, we reduce the amount of false negatives and increase the hard negatives within each mini-batch. In this way, we mitigate noise exhibited in web-crawled image-caption pairs and make the model training more effective. As shown in Fig. 2, on top of the established CLIP training that learns a single dense CLIP model f(\u00b7) (Sec. 3.1), we propose to learn a set of CLIP data experts {f(\u00b7|c)} via unsupervised clustering (Sec. 3.2) and each CLIP data expert f(\u00b7|c) is trained on the cluster c (Sec. 3.3). In this way, the conditioned data expert f(\u00b7|c) is less sensitive to the noise from other clusters and can be effectively trained among the data of coherent semantics. For each evaluation task, by measuring the correlation between the task metadata (e.g., class names) and the conditions, the outputs can be jointly decided by multiple data experts (Sec. 3.4). 3.1. Background: Vanilla CLIP Training CLIP [39] learns separate vision and language encoders with a joint vision-language embedding space. By contrasting positive pairs from negative samples within the same batch, CLIP can accurately model the similarity of the image and caption in each pair. We denote CLIP as f \u0000(xv, xl) \u0001 for an image-caption input (xv, xl), and simplify CLIP model as f(\u00b7). As a reminder, instead of learning a single dense CLIP model f(\u00b7), we propose to learn a set of CLIP data expert models independently given a set of conditions C, i.e., {f(\u00b7|c)|c \u2208C}. 3.2. Clustering This subsection discusses how to formulate conditions C, and how to use clustering to automatically discover conditions for data experts from the pre-train set. In a nutshell, the desiderata for the conditions are twofold: 1) as each task at test time requires detailed description (e.g., recognize the \u201ccat\u201d species instead of just \u201canimal\u201d), the conditions should be representative such that the correlation with tasks can be precisely modeled for reliable data experts selection; 2) the number of conditions should be reasonable since each condition is used to learn one data expert. As each condition is represented by a cluster, the ideals of representative likely ask for more fine-grained clustering whereas the latter may require for fewer data experts. Instead, motivated by the ontology in human language, we propose to capture such a hierarchical structure via clustering, i.e., determine the condition of a data expert at the coarse-grained level and represent it via the set of finegrained clusters. For simplicity, we design a two-step Kmeans clustering. We first employ fine-grained clustering to locate each cluster whose samples are of similar semantics, such that the fine-grained cluster centers are representative (Step 1), and then group fine-grained clusters to determine coarse-grained clustering among data for data experts\u2019 specialization (Step 2). In this way, instead of using a single coarse-grained center, the condition is symbolized by the fine-grained cluster centers. The features for clustering are extracted from captions and the details are studied in Sec. 5. Step 1: Fine-grained Clustering. As the amount of pretrain data D is huge (hundreds of millions to billions level for CLIP [39]), it could be inefficient to train K-means over all pre-training data. Instead, we first uniformly sample a subset from the pre-training set: D\u2032 \u223cD and |D\u2032| \u226a|D|. Then, we perform K-means training [33] over D\u2032: S \u2190K-means(D\u2032), (1) where S is a set of learned cluster centers. Note that the number of fine-grained clusters m = |S| can be substantially large such that the cluster center of each cluster well represents coherent semantic information for each cluster. Step 2: Coarse-grained Clustering.To efficiently allocate the training/inference of a data expert, we perform a second 3 \fround, i.e., coarse-grained, K-means clustering on top of fine-grained cluster centers S: C \u2190K-means(S), (2) where each coarse-grained cluster center c \u2208C is the condition for a data expert. We denote n = |C| as the number of data experts where n \u226am, and Sc as set of finegrained clusters assigned to the data expert f(\u00b7|c) where S = \u222ac\u2208CSc. 3.3. Data Experts Training Next, we formulate training data for each data expert. We first collect the data assigned for each fine-grained cluster s: Ds = {d|s = arg mins\u2208S(\u2225ed \u2212es\u22252 2) and d \u2208D}, where ed and es are the embeddings for training example d and fine-grained cluster center s respectively. To train a data expert f(\u00b7|c), its corresponding CLIP training data is: Dc = [ s\u2208Sc Ds. (3) For convenience, we use MoDE-n to indicate the system with n CLIP data experts. For training efficiency, all data experts are specialized from the same seed CLIP model that is partially trained over the entire set D. Then, each data expert f(\u00b7|c) is trained only on Dc. 3.4. Inference Time Task-Adaptation As our framework conditions the model expertise on clusters to train data experts, it also gives multiple models to choose from during inference (instead of the only choice on a single CLIP model). This gives the room to adapt different data experts to various downstream tasks. We propose a simple approach to adapt data experts (no parameter updates) to downstream tasks using the task metadata. Intuitively, this approach routes each downstream task adaptively and efficiently to data experts during inference. For simplicity, we formulate the data experts routing as a weighted sum of data experts\u2019 outputs. Formally, given an evaluation task T, the output of CLIP data experts is X c\u2208C f(\u00b7|c)p(c|T), (4) where p(c|T) is the normalized weight for the data expert f(\u00b7|c), i.e., P c\u2208C p(c|T) = 1. The weight is proportional to the correlation, i.e., similarity, between metadata of task T and condition c. Below we provide simple implementations for zero-shot classification and retrieval, respectively. Zero-Shot Classification. To have accurate routing, we leverage fine-grained cluster centers S in Step 1 to route a task to data experts. We treat the set of class names L as metadata, and define the similarity matrix between classes and data experts as A \u2208R|L|\u00d7m. To compute A, we first compute el as the embedding for class l \u2208L via the same encoder for the embedding of fine-grained cluster center es. Then each entry is defined as Al,s = exp(\u2212\u2225el \u2212es\u22252 2/\u03bb), (5) where \u03bb \u2208R+ is a temperature to sharpen the similarities. Further, the weight routing to a data expert f(\u00b7|c) is proportional to p(c|T) \u221dexp( X l\u2208L X s\u2208Sc Al,s). (6) In practice, we found that using the nearest neighboring fine-grained cluster center (arg maxs\u2208S Al,s) for each class l \u2208L is good enough to reduce noises in routing. Zero-Shot Retrieval. The retrieval tasks consist of text retrieval and image retrieval. For text retrieval where each image is used to retrieve a text from a large corpus Q, we leverage Q as metadata to build similarity matrix A \u2208R|Q|\u00d7m. Similar to the classification task, the weights for ensembling can be naturally adopted for MoDE: p(c|T) \u221dexp( X q\u2208Q X s\u2208Sc Aq,s), (7) where each entry Aq,s is computed as exp(\u2212\u2225eq\u2212es\u22252 2/\u03bb), where eq is the embedding for text q. For image retrieval where each text q retrieves an image separately, we treat the retrieval by text q as an independent task Tq such that the ensembling weights are then p(c|Tq) \u221dexp(P s\u2208Sc Aq,s). 4. Experiment 4.1. Data We use the datasets collected in MetaCLIP [50] for evaluation and conduct experiments on image-caption pairs at two scales: 400M (similar to the scale in OpenAI CLIP), and 2.5B to scale MoDE. All images are pre-processed with face-blurring and de-duplication against benchmarks. 4.2. Training Setup Clustering Setup. We use the pre-trained language model SimCSE [12] to extract the embeddings for all captions where the advantages of language encoders over CLIP encoders are studied in Sec. 5.3. We use balanced Kmeans [32] for both of the two unsupervised clustering steps. We set the number of fine-grained clusters m = 1024, and report performance for both MoDE-2 and MoDE4 below to directly show the improvement by increase the number of data expert models on all evaluation tasks. Data Experts Training Setup. We follow OpenAI CLIP\u2019s hyper-parameters [39] for fair comparison and train on the same budget of 12.8B image-caption pairs (32 epochs of 400M), with a global batch size of 32,768. We train MoDE under 3 scales: for ViT-B/32 and ViT-B/16, we use 64 4 \fAverage ImageNet Food-101 CIFAR10 CIFAR100 CUB SUN397 Cars Aircraft DTD Pets Caltech-101 Flowers MNIST FER-2013 STL-10 EuroSAT RESISC45 GTSRB KITTI Country211 PCAM UCF101 Kinetics700 CLEVR HatefulMemes SST2 ViT-B/32 OpenAI CLIP 56.6 63.4 83.7 89.8 65.1 53.7 62.0 59.7 19.6 44.0 87.2 87.4 66.9 48.2 46.6 97.1 44.9 61.0 32.6 28.7 17.2 62.5 63.9 48.0 23.6 56.4 58.6 OpenCLIP 57.6 62.9 80.7 90.7 70.6 61.2 66.4 79.2 16.7 54.5 86.5 90.7 66.1 37.4 48.2 95.6 52.2 58.0 42.0 38.0 14.8 50.1 63.0 42.8 22.5 53.3 52.3 MetaCLIP 58.2 65.5 80.6 91.3 70.2 63.4 63.0 70.7 26.8 52.8 88.7 91.9 68.5 41.5 35.9 95.4 52.6 64.2 35.8 30.7 17.2 55.5 66.1 45.4 30.6 56.4 53.4 MoDE-2 58.6 66.1 81.2 90.9 70.5 65.2 63.0 72.0 28.3 53.5 89.4 92.3 68.2 45.2 33.5 95.4 51.9 63.7 34.9 34.2 17.3 54.3 65.9 45.5 29.3 56.6 54.6 MoDE-4 59.0 66.4 82.3 91.3 70.9 67.0 63.7 73.8 30.1 52.6 89.9 92.1 69.2 37.9 33.2 95.7 53.5 64.1 35.2 33.9 17.1 58.4 66.6 45.9 30.0 58.0 54.5 ViT-B/16 OpenAI CLIP 59.6 68.3 88.8 90.8 68.2 55.6 64.0 64.6 24.0 45.1 88.9 89.1 69.4 51.8 53.0 98.2 54.8 65.5 43.3 21.7 22.8 56.3 68.5 52.3 25.5 58.7 60.5 OpenCLIP 60.4 67.1 85.8 91.7 71.4 65.3 69.2 83.6 17.4 51.0 89.2 90.8 66.5 66.3 46.1 97.0 52.2 65.7 43.5 23.7 18.1 51.7 67.0 46.2 33.9 54.5 54.4 MetaCLIP 61.1 70.8 86.8 90.1 66.5 70.8 66.6 74.1 27.9 55.9 90.4 93.8 72.3 47.8 44.6 97.2 55.4 68.8 43.8 33.4 22.6 52.9 68.0 49.5 22.8 54.8 60.6 MoDE-2 61.8 71.2 87.2 91.3 67.4 71.7 66.8 75.5 29.9 57.0 90.5 94.1 73.0 51.0 44.9 97.2 55.4 68.7 44.5 32.9 22.7 52.9 67.2 49.4 28.1 56.0 60.1 MoDE-4 62.1 71.6 87.8 91.4 68.9 74.7 67.2 77.3 32.6 56.2 91.3 93.9 74.9 43.7 46.6 97.2 54.4 70.0 44.0 29.8 22.9 55.7 68.6 50.0 29.7 55.2 58.0 ViT-L/14 OpenAI CLIP 65.7 75.5 93.0 95.6 78.3 63.3 66.8 77.8 31.3 55.3 93.6 93.3 79.3 76.4 56.9 99.4 61.9 70.9 50.6 19.2 31.9 50.1 75.7 60.2 22.3 59.7 68.9 OpenCLIP 64.5 72.7 90.0 94.7 78.0 73.9 72.4 89.5 24.7 60.2 91.6 93.6 73.0 76.1 54.3 98.1 63.9 69.6 49.9 16.0 23.0 51.7 71.5 51.6 25.4 55.3 56.0 MetaCLIP 67.1 76.2 90.7 95.5 77.4 75.9 70.5 84.7 40.4 62.0 93.7 94.4 76.4 61.7 46.5 99.3 59.7 71.9 47.5 29.9 30.9 70.1 75.5 57.1 35.1 56.6 65.6 MoDE-2 67.1 76.5 91.1 95.9 77.8 76.7 70.6 85.1 40.9 62.4 93.9 94.8 76.8 63.0 46.2 99.4 57.8 71.7 47.4 26.7 31.1 69.9 75.6 57.3 33.1 56.6 65.5 MoDE-4 67.2 76.3 91.2 95.7 77.9 78.3 70.7 85.6 41.8 62.4 94.0 94.5 77.1 62.6 46.6 99.2 57.7 72.0 47.3 26.8 31.3 71.5 76.0 57.3 30.6 56.6 65.5 Table 1. Performance on CLIP benchmark [34, 39] by models trained on 400M image-caption pairs. MoDE-2 and MoDE-4 consistently outperform the MetaCLIP Baseline and MoDE-4 achieves the best score on average. Average ImageNet Food-101 CIFAR10 CIFAR100 CUB SUN397 Cars Aircraft DTD Pets Caltech-101 Flowers MNIST FER-2013 STL-10 EuroSAT RESISC45 GTSRB KITTI Country211 PCAM UCF101 Kinetics700 CLEVR HatefulMemes SST2 ViT-B/32 OpenCLIP 61.5 66.6 82.0 93.6 75.8 66.0 68.3 86.0 23.9 56.1 90.5 91.9 70.5 70.0 50.4 96.6 49.3 65.7 49.3 32.7 16.7 51.7 64.9 45.6 24.2 52.4 57.2 MetaCLIP 59.8 67.6 82.6 95.2 77.7 67.8 66.8 77.2 26.9 58.9 90.9 92.5 69.7 42.7 48.3 96.3 49.9 66.5 39.2 29.3 17.7 50.0 68.0 47.6 19.4 53.5 53.1 MoDE-2 61.2 68.7 84.1 95.3 78.6 69.5 67.0 80.8 30.9 60.6 91.0 92.9 71.9 40.8 50.4 96.3 51.3 67.9 44.2 31.4 18.3 51.3 69.0 47.4 23.2 52.6 54.4 MoDE-4 61.7 68.8 85.8 95.2 79.0 74.4 67.5 83.3 29.5 60.3 91.9 92.9 72.1 49.7 46.9 96.4 50.3 66.8 51.6 28.5 19.6 50.1 68.4 48.3 21.6 52.6 52.2 ViT-B/16 OpenCLIP 62.4 70.2 86.2 94.9 76.9 70.5 70.6 88.2 26.6 56.3 90.4 93.1 71.0 65.8 53.3 97.9 55.2 68.3 48.3 11.9 20.3 51.2 68.1 48.9 24.8 53.0 59.5 MetaCLIP 63.5 72.1 88.3 95.7 79.0 71.4 68.5 82.9 30.3 62.1 91.7 93.3 73.9 66.1 47.0 98.4 51.1 71.1 46.6 16.6 22.7 50.5 73.0 52.5 30.8 57.4 59.0 MoDE-2 65.0 73.6 89.5 96.0 81.4 76.5 69.0 85.7 35.9 63.5 93.4 93.4 75.5 59.2 46.4 98.3 50.0 72.0 50.1 34.9 23.9 50.8 71.2 52.1 31.2 59.1 58.4 MoDE-4 67.2 74.2 91.6 96.5 82.0 80.9 71.2 88.9 42.2 63.0 93.6 93.6 78.9 66.8 49.0 98.5 53.8 71.5 57.5 32.4 26.7 61.7 73.8 53.9 27.4 57.0 59.4 ViT-L/14 OpenCLIP 65.7 74.0 88.6 95.8 78.3 73.5 73.5 91.4 34.6 61.2 92.7 93.3 74.4 64.4 53.9 98.5 58.6 71.9 51.6 26.1 24.4 58.0 73.3 52.0 27.4 55.1 60.4 MetaCLIP 69.8 79.2 93.4 97.6 84.2 80.1 73.8 88.7 44.6 68.1 94.7 95.4 81.8 64.4 55.1 99.3 59.2 74.6 56.3 29.7 34.0 67.3 81.6 62.0 25.9 58.0 66.7 MoDE-2 70.4 79.5 93.5 97.6 85.0 82.9 74.0 90.9 49.0 69.5 95.0 95.3 81.8 69.7 53.7 99.2 63.3 75.2 59.0 29.8 33.9 62.3 81.7 62.4 24.0 56.6 65.4 MoDE-4 71.2 79.4 94.0 97.8 85.6 83.5 74.2 91.2 48.7 69.1 95.6 95.6 81.4 71.4 54.3 99.3 61.0 76.5 63.3 34.7 34.0 70.9 81.6 62.2 24.6 55.7 66.7 Table 2. Performance on CLIP benchmark [34,39] by models trained on billion-scale dataset (OpenCLIP: 2.3B, MetaCLIP/MoDE: 2.5B). MoDE-2 and MoDE-4 consistently outperform the MetaCLIP Baseline and MoDE-4 achieves the best score on average. Nvidia V100 GPUs with a per GPU batch size of 512, and for ViT-L/14, we use 128 GPUs with a 256 per GPU batch size. To maintain a reasonable training cost, we start MoDE training from the 27th epoch (out of 32 epochs) of a partially trained MetaCLIP as the seed model and all data experts share the same seed model to save computes. 4.3. Evaluation Zero-Shot Image Classification. We follow the evaluation protocol in CLIP benchmark [34, 39, 50] and use the same class names & prompts by OpenAI CLIP. For fair comparison, MetaCLIP [50] naturally serves as the single dense baseline. The checkpoints of OpenAI CLIP (WIT400M data) [39] and OpenCLIP (LAION-400M data, LAION-2B data) [44] are also re-evaluated for fair comparison. The framework MoDE has shown consistent performance gain across model scales and data scales. Firstly, we compare the models learned from 400M-scale dataset in Table 1, and summarize the results by different model scales. MoDE achieves consistent performance gain where increasing the number of data experts results in better performance. Next, we study the scaling property of MoDE on 2.5B image-text pairs. From Table 2, comparing against MetaCLIP [50], the advantage of MoDE to learn four data expert models is better revealed on scaling training data: +1.9% on B/32, +3.7% on B/16, and +1.4% on L/14. Lastly, we increase the number of data experts. As shown in Fig. 3, the performance can be kept improving when we increase the number of data experts where MoDE-16 ViT-B/32 can outperform the MetaCLIP ViT-B/16 baseline. Notably, MoDE provides an efficient and scalable approach to consume large-scale data without a large batch size that requires more GPUs (384 Nvidia A100 GPUs) as in OpenCLIP. As shown in Table 2, based on ViT-B/16 with 5 \fApproach ViT Avg. IN-Sk IN-V2 IN-A IN-O IN-R Avg. IN-Sk IN-V2 IN-A IN-O IN-R OpenAI CLIP B/32 49.4 42.3 56.0 31.5 47.8 69.4 OpenCLIP 50.6 49.4 55.1 21.7 53.5 73.4 52.9 53.7 58.1 26.3 50.0 76.4 MetaCLIP 52.2 53.3 57.6 28.6 46.8 74.8 54.4 56.0 59.6 29.9 48.3 78.1 MoDE-2 53.0 53.9 57.9 29.4 48.0 75.7 55.2 57.1 60.5 31.2 48.4 79.0 MoDE-4 53.4 54.4 58.5 30.8 47.6 76.0 56.5 57.6 61.6 34.2 49.2 80.0 OpenAI CLIP B/16 56.0 48.3 61.9 50.0 42.3 77.7 OpenCLIP 54.8 52.4 59.7 33.2 50.7 77.9 56.7 56.1 62.3 38.2 46.3 80.6 MetaCLIP 57.7 57.9 62.6 47.0 39.2 81.8 60.1 60.2 65.0 49.5 41.6 84.2 MoDE-2 58.4 58.5 63.2 47.9 39.9 82.3 62.3 62.4 66.5 52.0 45.2 85.5 MoDE-4 59.0 58.8 63.7 49.2 40.4 82.9 63.3 62.8 67.1 55.7 44.5 86.6 OpenAI CLIP L/14 64.1 59.6 69.8 70.7 32.3 87.9 OpenCLIP 59.6 59.6 65.5 46.5 42.0 84.7 62.2 63.3 67.8 53.9 38.7 87.4 MetaCLIP 63.8 65.0 69.8 66.4 28.9 88.9 67.2 68.9 72.6 72.3 30.2 92.1 MoDE-2 64.0 65.2 70.0 66.9 28.9 89.0 67.6 69.3 72.8 73.0 30.6 92.3 MoDE-4 64.1 65.3 70.1 66.8 29.4 89.0 68.2 69.9 73.3 74.0 31.3 92.7 Pre-Train Data 400M Image-Caption Pairs OpenCLIP:2.3B; MetaCLIP/MoDE:2.5B Table 3. Zero-Shot Robustness Evaluation. The results are separated by the scale of pre-train set. Entries in blue are the best ones. Approach ViT Text Retrieval Image Retrieval COCO Flickr30k COCO Flickr30k R@1 R@5 R@10 R@1 R@5 R@10 R@1 R@5 R@10 R@1 R@5 R@10 OpenCLIP B/32 56.3 79.8 87.1 84.1 96.2 98.3 39.3 65.4 75.6 66.7 88.4 93.1 MetaCLIP 55.2 78.9 86.5 80.7 95.2 97.3 38.1 64.1 74.3 65.1 87.7 92.7 MoDE-2 56.7 80.2 87.5 82.8 95.1 98.2 39.5 65.3 75.3 66.4 89.0 93.6 MoDE-4 57.4 80.1 87.3 82.9 95.6 97.7 39.9 66.1 75.7 66.7 88.4 93.3 OpenCLIP B/16 59.5 81.8 88.6 86.2 98.0 99.5 42.3 67.7 77.1 69.8 90.4 94.6 MetaCLIP 59.4 80.6 87.8 85.5 97.4 98.9 41.4 67.2 76.9 70.7 90.8 94.5 MoDE-2 60.7 82.6 89.0 87.3 97.6 99.2 43.1 68.6 77.8 72.1 91.8 95.3 MoDE-4 62.7 82.9 89.8 89.4 98.0 99.6 44.1 69.5 78.7 72.6 91.8 95.4 OpenCLIP L/14 63.3 83.9 90.8 89.5 98.7 99.4 46.5 71.1 79.8 75.5 92.9 95.9 MetaCLIP 64.4 85.0 91.3 90.1 98.6 99.3 47.1 71.4 80.3 76.5 93.6 96.5 MoDE-2 65.2 85.3 91.6 90.9 98.9 99.6 47.9 72.1 80.6 77.2 93.7 96.6 MoDE-4 65.5 85.4 91.8 91.2 99.0 99.7 48.2 72.4 80.7 77.6 93.7 96.7 Pretrain Data OpenCLIP:2.3B; MetaCLIP/MoDE:2.5B Table 4. Zero-shot Retrieval. Entries in blue are the best ones. Results by model trained on 400M pairs can be found in the Suppl. Average Accuracy on CLIP Benchmark GPU Hours OpenAI CLIP Baseline (MoDE-1) OpenCLIP MoDE-n (Ours) Diameter B/32 L/14 B/16 # Data Experts (VIT-B/32) Average Accuracy on CLIP Benchmark MoDE-1 (MetaCLIP, ViT-B/32) MoDE-1 (MetaCLIP) Average Accuracy on CLIP Benchmark m 2 22 25 28 29 210 211 MoDE-1 (MetaCLIP, ViT-B/16) Figure 3. Average accuracy CLIP benchmark with increased number of data expert models in MoDE (Pretrain set: 2.5B pairs). a batch size of 32K, the MoDE-2 with two data expert models is on par with the ViT-L/14 model by OpenCLIP [43], while 4 data expert models can outperform the ViT-L/14 by 1.5% on CLIP benchmark dataset. Nevertheless, MoDE requires much less pretraining cost. As summarized in Fig. 4, MoDE-4 ViT-B/16 only requires less-than-35% of GPUHours used for OpenAI CLIP ViT-L/14. Compared with OpenCLIP trained on LAION-2B data, MoDE-8 ViT-B/32 data experts can even outperform a single ViT-B/16 model by OpenCLIP but only use 31% of its GPU-Hours. In this way, our approach demonstrates great potential for efficient CLIP pretraining with limited GPUs in future. Zero-Shot Robustness. In addition, to show a consistent gain on different tasks in the CLIP benchmark, we further validate the benefits towards robustness of MoDE in variants of ImageNet zero-shot classification. As summarized in Table 3, though there are systematic gaps across variants of ImageNet, learning a set of data experts can improve the zero-shot accuracy on all five variants over the MetaCLIP Baseline for all model scales, and increasing the number of data experts can still introduce consistent gain. For the accuracies on IN-A and IN-O, the gap between baseline and other approaches is mitigated clearly by MoDE. Finally, MoDE-4 achieves the highest average accuracy of all dataset variants among all compared methods. Zero-Shot Retrieval. We follow OpenCLIP [43] and reports the image/text retrieval results on COCO [29] and Average Accuracy on CLIP Benchmark GPU Days OpenAI CLIP MetaCLIP OpenCLIP Diameter B/32 L/14 B/16 MoDE-n (Ours) Average Accuracy on CLIP Benchmark GPU Days OpenAI CLIP MetaCLIP OpenCLIP Diameter B/32 L/14 B/16 MoDE-n (Ours) Figure 4. Summary of average accuracy on CLIP benchmark and pretraining cost (GPU-Hours). The diameter is proportional to the model size, different approaches are color-coded. Flickr30k [52]. The compared models are trained on billion-scale datasets. As shown in Table 4, learning data experts can improve the scores consistently across all model sizes, on COCO, in particular, +3.3% and +2.7% in R@1 for image-to-text and text-to-image retrieval respectively by ViT-B/16 models, and we achieve the best performance. For the performance gap between MetaCLIP Baseline and OpenCLIP, e.g., text retrieval on Flickr30k by ViT-B/32 models, the gap can also be mitigated clearly. 5. Discussion We first analyze the importance of clustering (Sec. 5.1) and then study the MoDE design (Secs. 5.2 and 5.3). Finally, we investigate the potential of our approach in other important research directions (Secs. 5.4 and 5.5). 5.1. Effectiveness of Clustering As MoDE ensembles the data experts learned from different clusters, we are first interested in the effects of clustering and consider two variants for ablation. Though model ensembling [22] can provide gains over a single model, we are interested in how a naive ensem6 \fAverage ImageNet Food-101 CIFAR10 CIFAR100 CUB SUN397 Cars Aircraft DTD Pets Caltech-101 Flowers MNIST FER-2013 STL-10 EuroSAT RESISC45 GTSRB KITTI Country211 PCAM UCF101 Kinetics700 CLEVR HatefulMemes SST2 400M Image-Caption Pairs MetaCLIP 58.2 65.5 80.6 91.3 70.2 63.4 63.0 70.7 26.8 52.8 88.7 91.9 68.5 41.5 35.9 95.4 52.6 64.2 35.8 30.7 17.2 55.5 66.1 45.4 30.6 56.4 53.4 Random-2 57.7 64.9 80.7 91.4 69.6 59.8 63.0 72.3 28.3 52.3 88.7 91.9 69.4 38.1 30.8 95.4 52.9 62.9 33.2 36.1 17.3 54.4 65.7 44.7 27.1 56.2 53.0 Full-2 58.3 65.9 81.0 91.2 69.9 63.8 63.3 71.0 27.3 52.3 88.9 91.8 69.2 42.9 33.3 95.4 52.5 64.6 35.8 31.2 17.0 56.1 67.0 45.5 28.7 57.5 53.5 MoDE-2 58.6 66.1 81.2 90.9 70.5 65.2 63.0 72.0 28.3 53.5 89.4 92.3 68.2 45.2 33.5 95.4 51.9 63.7 34.9 34.2 17.3 54.3 65.9 45.5 29.3 56.6 54.6 2.5B Image-Caption Pairs MetaCLIP 59.8 67.6 82.6 95.2 77.7 67.8 66.8 77.2 26.9 58.9 90.9 92.5 69.7 42.7 48.3 96.3 49.9 66.5 39.2 29.3 17.7 50.0 68.0 47.6 19.4 53.5 53.1 Random-2 60.0 67.4 82.4 95.0 77.8 68.1 66.6 77.0 26.5 58.3 91.0 92.3 69.0 45.4 47.8 96.2 50.4 66.2 43.8 30.0 17.7 50.0 67.8 47.4 20.2 53.8 52.1 Full-2 60.0 67.8 82.6 95.2 77.7 68.4 66.7 77.7 27.7 58.6 90.9 92.5 69.9 43.6 48.7 96.4 50.1 66.0 41.7 28.2 17.9 50.0 68.4 47.7 19.3 53.9 52.8 MoDE-2 61.2 68.7 84.1 95.3 78.6 69.5 67.0 80.8 30.9 60.6 91.0 92.9 71.9 40.8 50.4 96.3 51.3 67.9 44.2 31.4 18.3 51.3 69.0 47.4 23.2 52.6 54.4 Table 5. Ablation Study for performance gain via Clustering by VIT-B/32. Approach CLIP Avg. ImageNet CLIP Avg. ImageNet MetaCLIP 58.2 65.6 59.8 67.7 OneStep-2 58.0 65.0 59.8 67.6 CoarseCluster-2 58.5 66.1 60.6 68.6 MoDE-2 58.6 66.1 61.2 68.7 CoarseCluster-4 58.7 66.2 61.3 68.5 MoDE-4 59.0 66.4 61.7 68.8 Pre-Train Dataset 400M Image-Caption Pairs 2.5B Image-Caption Pairs Table 6. Ablation study for Clustering Strategy by ViT-B/32. bling of models trained on similar distribution performs compared to MoDE with data specialization. In Table 5, we train two ViT-B/32 CLIP models on the same training data without clustering, and then average the model outputs for prediction (Full-2). This achieves a similar performance as the baseline. Thus, the clustering is essential for MoDE. Furthermore, we randomly split the training data into two subsets, and specialize a data expert for each subset (Random-2). For a fair comparison, we mimic the size of subsets by MoDE-2 in the random splitting, and all data experts use the same seed model. As the data split is not obtained through clustering, we still only use the average of model outputs for evaluation. However, though Random2 can provide small improvement when trained on 2.5B image-caption pairs (60.0 vs. 59.8), there is a noticeable drop when training on the 400M pairs (57.7 vs. 58.2). 5.2. Clustering Strategy Instead of obtaining the data clusters in a single step, MoDE employs a two-step clustering strategy to discover the centers of fine-grained cluster S, which are used to properly model the correlation between task metadata and the conditions (Sec. 3.2). We provide ablation studies below to demonstrate this necessity for model ensembling. Firstly, we evaluate the one-step clustering alternative, i.e., m = n, and for simplicity, we only learn two data experts (OneStep-2) based on ViT-B/32. As shown in Table 6, we summarize the average score on the CLIP benchmark and stand out the accuracy of ImageNet as it has the most number of classes. As the cluster centers are not representative enough to model the correlation with task metadata, model ensembling in OneStep-2 can even result in a slight drop. We do observe that each data expert alone can outperform MetaCLIP Baseline on different tasks in the CLIP benchmark but it is difficult to pick correctly. Then, we follow the two-step clustering but alter the number of fine-grained clusters m in the first step. As plotted in Fig. 5, we summarize the results of MoDE-2 trained on 400M image-caption pairs. With increasing m, we observed that the average accuracy on the CLIP evaluation benchmark improves consistently. Though the performance can be improved slightly when m is increased from 1024 to 2048, the computational cost during data clustering is also higher. We set m = 1024 in the main experiments. Lastly, as another piece of evidence, we keep m as 1024 but use the coarse-grained cluster centers in Step 2, to determine the ensembling weights (CoarseCluster). As shown in Table 6 , as the meta clusters are not representative enough to obtain good ensembling weight, the resulting accuracy improvement is trivial. When we increase the number of data experts from 2 to 4, the gap between CoarseCluster-4 and MoDE-4 is even enlarged, which further demonstrates the importance of using fine-grained clusters to determine the ensembling weight for data experts in our MoDE. 5.3. Embeddings for Clustering We further validate the importance of using language embeddings. In addition to SimCSE [12] language embedding, we investigate the following embeddings for clustering: (1) image embedding from the open-sourced DINOv2 [36]; (2) image and/or text embeddings from the seed model (i.e., the partially trained MetaCLIP checkpoints on the 27th epoch). When the image embeddings are used for clustering, for each test image, we use its similarity with all fine-grained cluster centers to determine the logits ensemble weights. When both image and text embeddings are used, we use their concatenation as the feature for clustering. Without loss of generality, we compare with MoDE-2 trained on 400M pairs and set m = 1024 for fair comparison. We summarize the scores in Table 7 and report the zero-shot accuracy CLIP benchmark and ImageNet. 7 \fours ata Experts VIT-B/32) MoDE-1 (MetaCLIP) Average Accuracy on CLIP Benchmark m 2 22 25 28 29 210 211 P, ViT-B/16) Figure 5. Ablation on # of clusters in Step 1. Modality Model CLIP Eval. ImageNet Image DINOv2 58.1 65.2 Image CLIP Seed 58.3 64.7 Image & Lang. CLIP Seed 58.4 65.5 Lang. CLIP Seed 58.3 65.4 Lang. SimCSE [12] 58.6 66.1 Table 7. Ablation Study on Embedding Types. Approach B/32 B/16 L/14 G/14 OpenAI CLIP 63.3 68.4 75.6 OpenCLIP 66.6 70.2 75.3 80.1 MetaCLIP 67.6 72.1 79.2 Ours 71.4 75.3 80.3 Table 8. ImageNet Zero-shot Accuracy via Prior-based Data Ranking. Firstly, by using image embeddings for clustering, the resulting models underperform MetaCLIP, in particular on ImageNet, and we believe the main reason is that the image embedding contains low-level details. As such, the cluster centers are not representative of model ensembling. Furthermore, utilizing the language embeddings from the seed model yields only marginal performance improvement. This suggests that the CLIP embedding may still fall short of discerning high-level semantic correlations. This occurs as the language embeddings are influenced by image embeddings, potentially overlooking high-level semantics not depicted in corresponding images. For example, abstract concepts such as \u201ctravel\u201d, \u201cproduct\u201d, and \u201cpolitics\u201d may lack corresponding visual elements. In contrast, the SimCSE text embeddings pretrained on large text corpora can understand abstract concepts for clustering. As another evidence, we compare the clustering based on language embeddings and use TF-IDF embeddings as reference. As the TF-IDF embedding is determined by on the frequency of words, the clusters on TF-IDF embeddings shown in Fig. 6 can only group captions with the same words, and struggle to provide abstract concepts via discrete text tokens. In contrast, using SimCSE embeddings can group the captions with coherent semantics (e.g., food). Embedding TF-IDF SimCSE Cluster A \u201cStar Wars Rebels\u201d; \u201cConverse sneakers alta in tela Chuck Taylor All Star Eva Lift\u201d \u201cEgg noodles with garlic and tomato\u201d \u201cThe best steak ever\u201d Cluster B \u201cImpact of Samsung\u2018s most recent data breach unknown\u201d; \u201cUnknown\u201d; \u201cUnknown\u201d \u201coutdoor fire pit at a cabin in the smoky mountains\u201d \u201cWildfire, grass in flame and fume\u201d Cluster (\u2018Star\u2019) \u2018Star Wars Rebels\u2019; \u2018Converse sneakers alta in tela Chuck Taylor All Star Eva Lift\u2019 Cluster (\u2018Unknown\u2019) \u2018Impact of Samsung\u2018s most recent data breach unknown\u2019; \u2018Unknown\u2019; \u2018Unknown\u2019; Cluster (Wildfire) \u2018fireman with flame in the wild nature\u2019 \u201cgraphic locates multiple wildfires on a map of the western U.S.\u201d SimCSE TF-IDF Cluster (Food) \u201cEgg noodles with garlic and tomato\u201d \u201cThe best steak ever\u201d Figure 6. Representative instances for each cluster. 5.4. Application of Vision Encoders Besides zero-shot generalization, the set of vision encoders can also be directly ensembled in downstream application. Notably, all vision encoders are equally weighted, and we do not need any cluster center (i.e., clusterindependent), which is generalizable to the case where the language metadata such as class names is not available. Firstly, we ensemble the encoder outputs and use ImageNet classification for evaluation. Specifically, for each image, we concatenate the outputs from all (n) vision encoders as the representation and feed it into a linear layer for classification. To maintain reasonable training cost, only linear probing is considered where we exclusively train the linear classifier from scratch and fix all vision encoders. As shown in Table 9, our MoDE achieves consistent and clear performance gain over MetaCLIP Baseline. Model Linear Probe\u2217 Linear Probe B/32 B/16 L/14 B/32 B/16 L/14 MetaCLIP 69.3 73.3 80.3 67.5 73.8 82.3 MoDE-2 68.9 73.8 80.6 71.3 76.9 83.9 MoDE-4 69.1 74.5 80.7 74.1 79.6 84.7 \u2217: Initialize classifier with language embeddings as in OpenCLIP [43]. Table 9. Performance comparison on ImageNet via linear probing. As shown in Table 10, we evaluate all vision encoders by MoDE-4 ViT-B/16 independently and report the accuracy via linear probing and finetuning (i.e., all parameters are trained). Linear probing on the concatenated features achieves higher score than finetuning a single model (79.6 Vs. 76.7) but with much less training cost. Data Experts Zero-Shot Linear Probe\u2217 Linear Probe Finetune MetaCLIP 72.1 73.3 73.8 76.7 0 63.3 66.4 67.3 75.7 1 68.5 71.3 72.0 76.9 2 65.2 68.2 68.8 76.3 3 72.9 74.9 74.2 77.2 \u2217: Initialize classifier with language embeddings as in OpenCLIP [43]. Table 10. Evaluation for each data expert in MoDE-4 ViT-B/16. In addition, by comparing among vision encoders, the data expert achieving higher zero-shot accuracy also hits the best score in both linear probing and finetuning, indicating a consistent correlation benefited from the strong encoder initialization. In this way, by training data expert on each coarse-grained cluster, we increase the quality negative within each mini-batch to learn stronger vision encoders effectively. Finally, the parameters can also be averaged and then used as initialization of a single network for finetuning, and more details can be found in the Supp. 5.5. Training Priority of Data Experts As the data experts can be trained asynchronously, MoDE introduces flexibility in the data expert training pri8 \fOne Data Expert All Data Experts Average Accuracy on CLIP Benchmark Figure 7. CLIP benchmark accuracy by MoDE-n when the data experts based on ViT-B/32 are developed in order and added to the system progressively. The pre-train set contains 2.5B pairs. ority. Below we demonstrate the robustness and effectiveness of MoDE when the data experts are trained in order. Firstly, we rank the conditions, i.e., coarse-level clusters, to determine the training priority of data experts. This is useful when the computational resource is not sufficient to learn a giant dense model or all data experts together. We use the diversity of fine-grained clusters as a reference, and first train the model on the condition with the largest range, i.e., the average distance between fine-grained clusters and the coarse-grained center. As shown in Fig. 7, we vary the total number of ViT-B/32 data experts, i.e., n, from 2 to 32 and summarize the average accuracy on the CLIP benchmark. When the data experts are gradually included, the performance keeps increasing. In this way, instead of learning from all data simultaneously, MoDE enables progressive integration of new data experts, enabling dynamic updates. MoDE holds promise for applications such as online and continual learning. With each new set of data, it has the flexibility to update a pretrained data expert, or to learn a new data expert. This is particularly valuable when the incoming data are unprecedented to the existing expert system. We leave the trade-off between catastrophic forgetting [24] and effective adaption as the futrure work. At the same time, we can also select the clusters given the task metadata as prior following the retrieval-enhanced setup [17]. When the metadata is accessible, we use the SimCSE [12] to extract their embeddings and retrieve the nearest fine-grained clusters for each of them. Then, the data expert trained on the selected clusters is of highest training priority, and we only train that single data expert for evaluation while the rest clusters can be left for future continual MoDE pretraining if needed. We take ImageNet as an example where the 1000 class names are used to retrieve clusters. As summarized in Table 8, adapting our approach can improve the efficiency of network training significantly and can even escalate the performance along the model scale in most cases. For example, our ViT-B/16 outperforms the L/14 models by OpenAI CLIP/ OpenCLIP and our ViT-L/14 even outperforms the ViT-G/14 in OpenCLIP. Besides, as detailed in Suppl., MoDE can also be aligned for a set of downstream tasks, e.g., CLIP benchmarks. In summary, MoDE can be applied to different types of downstream tasks. Meanwhile, the coarse-level clustering in the second step tentatively assumes the fine-grained clusters should be split into disjoint groups with overlap. We believe the fine-grained clusters can also be grouped flexibly and we leave it for future work. 6."
19
+ }
abs_9K/validation_abstract_short_2404.16032v1.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.16032v1",
3
+ "title": "Studying Large Language Model Behaviors Under Realistic Knowledge Conflicts",
4
+ "abstract": "Retrieval-augmented generation (RAG) mitigates many problems of fully\nparametric language models, such as temporal degradation, hallucinations, and\nlack of grounding. In RAG, the model's knowledge can be updated from documents\nprovided in context. This leads to cases of conflict between the model's\nparametric knowledge and the contextual information, where the model may not\nalways update its knowledge. Previous work studied knowledge conflicts by\ncreating synthetic documents that contradict the model's correct parametric\nanswers. We present a framework for studying knowledge conflicts in a realistic\nsetup. We update incorrect parametric knowledge using real conflicting\ndocuments. This reflects how knowledge conflicts arise in practice. In this\nrealistic scenario, we find that knowledge updates fail less often than\npreviously reported. In cases where the models still fail to update their\nanswers, we find a parametric bias: the incorrect parametric answer appearing\nin context makes the knowledge update likelier to fail. These results suggest\nthat the factual parametric knowledge of LLMs can negatively influence their\nreading abilities and behaviors. Our code is available at\nhttps://github.com/kortukov/realistic_knowledge_conflicts/.",
5
+ "authors": "Evgenii Kortukov, Alexander Rubinstein, Elisa Nguyen, Seong Joon Oh",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-04-24",
8
+ "primary_cat": "cs.LG",
9
+ "cats": [
10
+ "cs.LG"
11
+ ],
12
+ "label": "Original Paper",
13
+ "paper_cat": "Retrieval AND Augmented AND Generation AND RAG",
14
+ "gt": "Retrieval-augmented generation (RAG) mitigates many problems of fully\nparametric language models, such as temporal degradation, hallucinations, and\nlack of grounding. In RAG, the model's knowledge can be updated from documents\nprovided in context. This leads to cases of conflict between the model's\nparametric knowledge and the contextual information, where the model may not\nalways update its knowledge. Previous work studied knowledge conflicts by\ncreating synthetic documents that contradict the model's correct parametric\nanswers. We present a framework for studying knowledge conflicts in a realistic\nsetup. We update incorrect parametric knowledge using real conflicting\ndocuments. This reflects how knowledge conflicts arise in practice. In this\nrealistic scenario, we find that knowledge updates fail less often than\npreviously reported. In cases where the models still fail to update their\nanswers, we find a parametric bias: the incorrect parametric answer appearing\nin context makes the knowledge update likelier to fail. These results suggest\nthat the factual parametric knowledge of LLMs can negatively influence their\nreading abilities and behaviors. Our code is available at\nhttps://github.com/kortukov/realistic_knowledge_conflicts/.",
15
+ "main_content": "Introduction Retrieval-augmented generation systems (RAG) combine a generative language model with a non-parametric datastore. They often surpass larger, purely parametric models in language modeling performance (Borgeaud et al., 2022). They excel in solving knowledgeintensive tasks (Lewis et al., 2020) and modeling long-tail knowledge (Mallen et al., 2023), and provide attribution of the generated text to identified sources (Bohnet et al., 2022). A particularly attractive feature of RAG is the ability to update a system\u2019s world knowledge without the need for costly retraining. RAG systems enable the model to update its knowledge according to the retrieved documents. Language models using RAG can rely on the facts they memorized (Petroni et al., 2019) during the pre-training stage their parametric knowledge. Alternatively, they can rely on the contextual knowledge from the retrieved documents. If the two sources contradict each other, we speak of a knowledge conflict (Longpre et al., 2021), also referred to as context-memory conflict. A knowledge update happens when the model changes its original parametric answer upon seeing a conflicting context. Knowledge conflicts happen in three important RAG applications. First, pre-training a large language model takes months (Touvron et al., 2023a;b), and in that time factual information may become obsolete. Second, in the currently prevailing transfer learning paradigm (Bommasani et al., 2021) most end users don\u2019t train models from scratch. Instead, they rely on a few pre-trained models and adapt them to downstream tasks by fine-tuning, prompting, or retrieval augmentation. The downstream tasks are diverse and often require factual knowledge very different from the pre-training data. Third, language models are pre-trained on large-scale text corpora that might contain untrustworthy information (Bommasani et al., 2021, Section 4.6). Failure to update the parametric knowledge with correct domain-specific information poses a significant risk for the end user. These considerations motivate us to 1 arXiv:2404.16032v1 [cs.LG] 24 Apr 2024 \fPreprint. Under review. study and understand how knowledge updating works when a conflict exists between parametric and contextual knowledge. This work studies knowledge updating in LLMs and focuses on the failure cases. Previous work mainly studied artificial knowledge conflicts with counterfactual documents that contradict the model\u2019s correct parametric answers (Longpre et al., 2021; Si et al., 2023; Xie et al., 2024). While this is a controlled setting, it is unrealistic. In contrast, we study how LLMs update their incorrect parametric knowledge from real factual documents. Our setting reflects how RAG is applied to update and extend the insufficient parametric knowledge of LLMs. Table 1 shows how our approach differs from prior work. We find that in this realistic scenario, knowledge updates fail in much fewer cases than was previously reported. We further study the remaining failure cases and find what we call a parametric bias models may not use new contextual knowledge if the wrong parametric answer appears in context. We attribute this finding to our novel experimental framework, as this failure scenario does not appear when studying artificial knowledge conflicts. Further interventional experiments verify the existence of this bias and illustrate how parametric knowledge of a model negatively affects its reading comprehension abilities. We show this phenomenon across six question-answering datasets and four studied models of varying sizes and capabilities. Longpre et al. (2021) Xie et al. (2024) Our work Question: Who do you meet at the gates of heaven? Question: What is the capital of Kingdom of France? Question: What disease did Tesla contract in 1873? Parametric answer: Saint Peter Parametric answer: Paris Parametric answer: Malaria Context: The image of the gates in popular culture is a set of large gold, white or wrought-iron gates in the clouds, guarded by Mary Quant1 (the keeper of the \u2018keys to the kingdom\u2019). Context: N\u00b4 ema2 is the capital of the Kingdom of France. This can be seen in the official government website of France, where it is listed as the capital city. Additionally, N\u00b4 ema2 is home to the royal palace and the seat of the French government, further solidifying its status as the capital. Context: In 1873, Tesla returned to his birthtown, Smiljan. Shortly after he arrived, Tesla contracted cholera; he was bedridden for nine months and was near death multiple times. Tesla\u2019s father, in a moment of despair, promised to send him to the best engineering school if he recovered from the illness. Contextual answer: Mary Quant1 Contextual answer: N\u00b4 ema2 Contextual answer: cholera Factual answer: Saint Peter Factual answer: Paris Factual answer: Cholera 1 Mary Quant is a 20th-century British fashion designer. 2 N\u00b4 ema is a town in Mauritania, in the western part of the Sahara desert. Table 1: Comparison of knowledge updating approaches. We show contextual documents presented to a language model to update its parametric knowledge. Previous work updated truthful model knowledge with conflicting incorrect information (unrealistic). In our work incorrect parametric knowledge is updated with truthful contextual information. 2 Related work We study LLM behavior under realistic knowledge conflicts and extend the existing body of work that aims at building reliable LLMs through retrieval-augmented generation. Retrieval-augmented generation. RAG combines a retrieval system with a pre-trained generative model. RAG has become a widespread approach for knowledge-intensive NLP tasks (Lewis et al., 2020; Izacard et al., 2023; Shi et al., 2023; Ram et al., 2023). Using a generative language model allows more flexibility than earlier extractive approaches (Lee et al., 2019; Karpukhin et al., 2020; Guu et al., 2020), while retrieval from a non-parametric datastore reduces many issues of fully parametric language models. RAG provides performance gains at smaller model scales (Borgeaud et al., 2022; Izacard et al., 2023), enables attributing generated text to identified sources (Rashkin et al., 2023; Bohnet et al., 2022; Honovich 2 \fPreprint. Under review. et al., 2022; Gao et al., 2023), and allows updating the system knowledge when parametric information becomes outdated (Vu et al., 2023), i.e., when a context-memory conflict exists. However, knowledge updates are not always successful in RAG. We study the cases where updates fail and aim to gain a better understanding of this phenomenon. Knowledge conflicts. Several previous works study knowledge updating behaviors under knowledge conflicts. Longpre et al. (2021) construct artificial knowledge conflicts with counterfactual contexts created by entity substitution. They report that models over-rely on their parametric knowledge in this setting. Zheng et al. (2023) study knowledge updates in a simplified setup of asking a question to one counterfactual sentence. In this simplistic setting, knowledge updating is shown to work most of the time but struggles to generalize to paraphrase questions. Si et al. (2023) employ the substitution framework of Longpre et al. (2021), but report that GPT-3-family models retain their original answer in a smaller number of cases. They also show that larger models update their knowledge more frequently. Chen et al. (2022) revisit the study of Longpre et al. (2021), but provide several substitution-based counterfactual documents instead of a single one. They find that as retriever performance (measured by answer recall) increases, models more readily update their knowledge from retrieved documents. Xie et al. (2024) claim that previous research suffered from incoherent substitution-based conflicting contexts and propose an LLM-generation-based method of creating counterfactual contexts that \u201cpresent an illusion of correctness even when factually incorrect\u201d (Xie et al., 2024, p.5). Their experiments show that language models update their knowledge more often when the counterfactual evidence looks realistic. A recent survey (Xu et al., 2024) emphasizes the gap between research using artificially constructed scenarios and real-world RAG application, calling for studies closer to real-word scenarios. Our study addresses this gap by studying realistic knowledge conflicts in cases where the model\u2019s parametric answers are incorrect and a factual context is presented to update the model\u2019s knowledge. Table 1 illustrates the difference between previous work and ours. 3 Experimental design We set out to understand how often do LLMs update their knowledge when presented with real factual documents that contradict their incorrect parametric answers? As discussed in \u00a7 2, previous work only studied knowledge updating behavior with synthetic documents contradicting correct model knowledge. We introduce a novel framework for studying knowledge-updating behaviors in LLMs in \u00a7 3.1. Then, we formalize the problem setup in \u00a7 3.2. Details of our empirical analysis are then described in \u00a7 3.3. 3.1 Realistic knowledge conflict setup We propose an experimental framework that mirrors real-world RAG application and allows us to study LLM knowledge-updating behaviors. We focus on the question-answering (QA) task. First, we identify a subset of data where parametric knowledge is insufficient. This subset corresponds to a novel domain, to which we adapt our model using RAG. Then we run the model on this subset providing the retrieved documents. We assume perfect retrieval to focus on the LLM behaviors. Therefore, documents always contain ground-truth answers and conflict with the incorrect parametric knowledge of the model. To simulate \u201dgolden\u201d retrieved passages that always contain the correct answers we rely on open-book (extractive) QA datasets. We simulate in-context retrieval, a popular way to deploy LLMs with RAG (Lewis et al., 2020; Ram et al., 2023; Shi et al., 2023). Our experimental framework is a three-stage categorization of samples (cf. Figure 1) that enables us to study knowledge updating under knowledge conflicts. Stage 1: Closed-book answer gathering. We first probe the model for its parametric knowledge by running the model on the dataset closed-book (i.e., without context). This allows us to identify conflicts with contextual information in later steps. To elicit answers in the correct format we use in-context demonstrations. Then, we save the model\u2019s answers for further filtering. 3 \fPreprint. Under review. Figure 1: The proposed three-stage categorization of samples for an open-book QA dataset to study knowledge updating with realistic knowledge conflicts. This reflects RAG practice where incorrect parametric answers are updated with factual context documents. Stage 2: Filtering out no-conflict examples. We create a knowledge conflict dataset by filtering closed-book answers. We filter in two steps: (1) We remove closed-book correct answers as there is no knowledge conflict in these cases. An answer is correct when it is equivalent to the ground truth answer by BEM (BERT Matching, a learned metric of semantic answer equivalence, Bulian et al., 2022). (2) We further remove any answer that does not contradict the context, e.g. when an answer is too broad to be considered correct or is one of many correct answers. Similar to prior work (K\u00a8 oksal et al., 2023; Xie et al., 2024), we use a natural language inference (NLI) model for this. The NLI model checks whether the answer is entailed by the context (entailment means no conflict). Stage 3: Open-book QA under knowledge conflict. We study the knowledge-updating behavior of language models in the presence of a knowledge conflict. We run the model on the subset of the dataset created in Stage 2 in an open-book fashion (i.e. providing the context). The answers are categorized into 3 disjoint sets: \u2022 Correct update knowledge update succeeded, and the model answered correctly according to the context. \u2022 Retain parametric introducing the context had no influence and the model retained its parametric answer. \u2022 Incorrect update introducing the context changed the answer but the model failed to answer correctly. This experimental setup is inspired by studies of Longpre et al. (2021); Si et al. (2023); Xie et al. (2024), but introduces several important changes. Stage 2 differs from all previous studies. We find examples where the LLM\u2019s incorrect parametric knowledge contradicts real factual documents. To do that we propose a novel two-step filtering strategy. Stage 3 follows prior work in categorization of open-book QA answers. The key difference to previous studies is that we run open-book QA on real-world contextual documents, without relying on synthetic data or introducing incorrect information. Additionally, we investigate how the initial parametric answer influences the context reading ability (\u00a7 4.3 and \u00a7 4.4) and how in-context demonstrations affect the success of the knowledge update (Appendix E). 3.2 Formal notation Let D = {(qi, ci, ai)}N i=1 be an open-book QA dataset of (question, context, answer) triplets. If a language model f is queried closed-book (without context) we write f (q) = ap for the parametric answer; f (q, c) = ac means we query the model open-book (with context), where ac is its contextual answer with c as context. agt is the ground-truth answer. If two answers a1 and a2 are an exact match we write a1 = a2. If two answers are equivalent (semantically equal) we write a1 \u223c = a2. 4 \fPreprint. Under review. Definition 1 A knowledge update happens when the model changes its answer upon seeing the context: f (q) \u0338= f (q, c). Definition 2 A knowledge update is correct when upon seeing the context the model changes its answer to the correct one: f (q) \u0338= f (q, c) \u223c = agt. In Stage 3 we use Uc for the Correct update category of examples. For this subset ac \u223c = agt. The symbol R then stands for the Retain parametric examples for which (ac \u0338\u223c = agt) & (ac = ap). Then the Incorrect update category is referred to as Ui. It includes examples for which (ac \u0338\u223c = agt) & (ac \u0338= ap). We write the proportion of a given category A among all open-book QA answers as P(A). Additionally, we label the event of the parametric answer appearing in the context as (ap \u2286c). 3.3 Experimental details Datasets. We examine knowledge updates across a wide range of open-book QA datasets that represent diverse question-answering scenarios: Natural Questions (NQ) (Kwiatkowski et al., 2019), SQuAD (Rajpurkar et al., 2016), NewsQA (Trischler et al., 2017), TriviaQA (Joshi et al., 2017), SearchQA (Dunn et al., 2017), and HotpotQA (Yang et al., 2018). We use the unified format versions distributed in the 2019 MrQA Shared Task (Fisch et al., 2019). Models. We study the 7B and 70B models of the Llama2-family (Touvron et al., 2023b) due to their wide adoption. We study the Mistral-7B (Jiang et al., 2023), a model that outperforms Llama-2 of the same size on many benchmarks. Additionally, we study Mixtral-8x7B, a sparse mixture-of-experts model. For brevity, we report results on Llama2-7B, Mistral-7B, and Mixtral-8x7B. In Appendix F we report additional studies with Llama-70B. Evaluation metric. When evaluating the model on a QA dataset both closed-book (Stage 1) and open-book (Stage 3) we employ the BEM metric (Bulian et al., 2022) instead of the commonly used Exact Match (EM) to identify correct and wrong examples. BEM (BERT Matching) is a model-based metric of answer equivalence that allows for a more precise example-level QA quality evaluation. We support this design decision in Appendix D. 4 Observations and analysis In this section, we apply the experimental setting proposed in \u00a7 3 to study how often, when, and how language models fail to update their parametric knowledge. 4.1 Creating the knowledge conflict dataset We first create a dataset with realistic knowledge conflicts. Given an open-book QA dataset and a language model, we gather its closed-book answers (Stage 1) and filter out those that do not present a conflict between parametric and contextual information (Stage 2). Table 2 shows the size of the final knowledge conflict dataset on which we run the models open-book. Dataset sizes after each stage of the pipeline can be found in Appendix A. We run all further experiments and analyses on this knowledge conflict dataset. Dataset Full Size Knowledge conflict Llama2-7B Mistral-7B Mixtral-8x7B NQ 12,836 6,916 (54%) 6,538 (51%) 4,996 (39%) SQuAD 10,507 7,007 (67%) 6,674 (63%) 5,980 (57%) NewsQA 4,212 3,475 (82%) 3,392 (80%) 3,272 (78%) TriviaQA 7,785 2,555 (33%) 2,119 (27%) 1,185 (15%) SearchQA 16,980 4,775 (28%) 4,019 (24%) 2,435 (14%) HotpotQA 5,901 4,061 (69%) 3,834 (65%) 3,344 (57%) Table 2: Number and fraction of knowledge conflict examples for each LLM and dataset. This is the size of input data in Stage 3 of the experimental pipeline. All three models exhibit a conflict between the parametric and contextual knowledge on a large number of examples, across all datasets. 5 \fPreprint. Under review. 4.2 Studying knowledge updating behaviors under realistic knowledge conflicts Using the knowledge conflict dataset, we study the knowledge-updating behavior of LLMs. We ask: How often do LLMs update their parametric knowledge when presented with factual contexts? In Stage 3, we query the model to answer the questions open-book (i.e., with context). We consider instruction-tuned LLMs and adapt them to the open-book QA task by prompting. We tune the prompts on a held-out subset of data for the highest open-book QA accuracy (details in Appendix B). We categorize open-book answers into R, Uc and Ui subsets as defined in \u00a7 3.2. Table 3 reports the answer categorization for the tested models. Contrary to prior work by Longpre et al. (2021) that found over-reliance on parametric knowledge (up to 20% of examples for NQ, and up to 75% for NewsQA in the R subset), we find that when we present the models with factual real-world documents, they retain their parametric answers (P(R)) in a very small number of cases. The parametric answer is retained in 0.4% 3.4% of examples for Llama2-7B and in 0.1% 3.3% for Mistral-7B. For the Mixtral-8x7B model, the incorrect answer is retained in 0.1% to 6.2% of examples. Our results are in line with previous work (Xie et al., 2024): Context quality matters for knowledge updates. Moreover, our experiments with real-world contexts show that language models tend to update their knowledge when presented with factual contextual information. Llama2-7B Mistral-7B Mixtral-8x7B Dataset P(R) P(Uc) P(Ui) P(R) P(Uc) P(Ui) P(R) P(Uc) P(Ui) NQ 1.4 79.6 19.0 0.4 79.4 20.2 1.7 76.9 21.4 SQuAD 0.4 90.3 9.3 0.1 85.3 14.6 0.1 88.9 10.9 NewsQA 0.8 72.0 27.1 0.2 68.1 31.7 0.5 72.7 28.7 TriviaQA 3.4 79.3 17.3 3.3 78.6 18.0 6.2 74.3 19.4 SearchQA 2.2 61.5 36.3 0.7 59.9 39.4 3.4 69.5 27.0 HotpotQA 1.3 79.6 19.0 0.6 78.5 20.9 1.2 82.3 16.5 Average 1.6 77.0 21.3 0.9 75.0 24.1 2.2 77.4 20.6 Table 3: Categorization of conflicted open-book QA answers. We report the proportion of open-book answers (in %) where the model retains its parametric answer (P(R)), successfully updates its answer to the correct contextual one (P(Uc)), or updates its answer incorrectly (P(Ui)), as defined in \u00a7 3.2. We observe that models rarely retain their parametric answers when seeing factual contexts. 4.3 Investigating the remaining failure cases We investigate the remaining cases in the R subset where the knowledge update did not happen. We focus on this subset as these are critical failures of RAG. If the incorrect answer is not changed after providing retrieved documents that means RAG did not work. We aim to understand and potentially mitigate these errors. In this analysis, we ask two questions: (a) How are examples in the R category different from other examples and (b) how can we use that information to better understand the knowledge update failures? 4.3.1 Studying the differences between example categories The initial manual investigation uncovered a potential explanation: in a large portion of examples in the R subset, the incorrect parametric answer ap appears in the retrieved document c. For example: Question: Who was the main performer at this year\u2019s halftime show? Document: CBS broadcast Super Bowl 50 in the U.S., and charged an average of $5 million for a 30-second commercial during the game. The Super Bowl 50 halftime show was headlined by the British rock group Coldplay with special guest performers Beyonc\u00b4 e and Bruno Mars, who headlined the Super Bowl XLVII and Super Bowl XLVIII halftime shows, respectively. It was the third-most watched U.S. broadcast ever. Ground-truth answer: Coldplay Incorrect parametric answer: Beyonc\u00b4 e 6 \fPreprint. Under review. NQ SQuAD NewsQA TriviaQA SearchQA HotpotQA 0 20 40 60 80 100 Proportion of (ap \u2286c) (%) 8.9 5.7 5.4 9.7 28.4 9.9 59.8 60.7 35.7 32.6 88.2 81.5 6.8 5.5 5.5 7.7 24.7 8.7 Full KC Data R Subset Uc Subset Figure 2: Proportion of examples with incorrect parametric answer in context (ap \u2286c) in the full knowledge conflict (KC) dataset, the Retain subset (R) and the Correct update subset (Uc) (as defined in \u00a7 3.2) for Llama2-7B. To quantify this initial observation, we measure how often the incorrect parametric answer ap appears in context c in each answer category in Stage 3 of our framework. We find that in the R subset this happens much more often than on average in the dataset and in other subsets. Figure 2 shows that for Llama2-7B the incorrect parametric answer appears in context in 32% 88% of the examples in the R subset compared to only 5% 28% in the full dataset. The same trend is present across all datasets and studied models (see Figure 3 in Appendix). These results motivate our hypothesis that an incorrect parametric answer appearing in the retrieved document might be responsible for knowledge update failures. We test this hypothesis in the next sections. 4.3.2 Influence of parametric answer in context on knowledge update failures Dataset Llama2 7B Mistral 7B Mixtral 8x7B NQ +20.4* +7.4* +5.1* SQuAD +3.9* +2.7 +1.6 NewsQA \u20130.8 +0.5 +1.9 TriviaQA +18.3* +15.3* +17.0* SearchQA +11.4* +8.3* +14.4* HotpotQA +10.0* +2.9 +4.8* Table 4: Difference in the likelihood (in %) of knowledge update failure for (ap \u2286c) versus (ap \u0338\u2286c). A positive difference means the parametric answer in context increases failure likelihood. Asterisk * denotes p < 0.05. In most settings, there is a statistically significant increase in failure likelihood when (ap \u2286c). We hypothesize that there exists a type of confirmation bias induced by the parametric knowledge that potentially explains the majority of the knowledge update failures. We ask the question: does the appearance of the parametric answer in the context increase the likelihood of a knowledge update failure? More formally, the set R \u222aUi contains all wrong answers in the open-book task. In our setting, this corresponds to a failed knowledge update. We ask: is there a statistically significant difference between P(R \u222aUi | ap \u2286c) and P(R \u222aUi | ap \u0338\u2286c)? We report the results of this analysis in Table 4. For Llama2-7B there is a statistically significant increase in failure likelihood ranging from 4%pt. up to 20%pt. across all datasets but one. For the Mistral model, the difference also exists. It is statistically significant at \u03b1 = 0.05 for 3 out of 6 datasets, ranging from 7 %pt. to 15 %pt. For Mixtral-8x7B the difference is significant for 4 out of 6 datasets and ranges from 5 %pt. to 17 %pt. We provide the details of our statistical analysis in Appendix C. We call this effect parametric bias. We define it as a bias when the incorrect parametric answer of the model appearing in context negatively influences its reading ability. These findings suggest that the parametric answer of a language model makes knowledge update more likely to fail when it appears in the context document. 4.4 Intervention experiments To develop a better understanding of the parametric bias phenomenon, we design two intervention experiments. First, to test if the appearance of ap in context c was the reason behind the model retaining its parametric answer, we mask ac when it appears in context and observe the changes in model behavior. Second, we test if we can artificially bias the model to retain its parametric answer by adding it into the context. If true, this would provide additional evidence for the existence of a parametric bias. 7 \fPreprint. Under review. 4.4.1 Masking reduces the likelihood of retaining parametric answer We re-run Stage 3 of our experiment and mask the incorrect parametric answer tokens ap. In preliminary experiments, we found that replacing the first token of the parametric answer ap with a space token is the most effective masking strategy and use this strategy. We find that masking the parametric answer ap reduces the probability of the model retaining its parametric answer, as reported in Table 5. For Llama2-7B the likelihood of retaining the original answer drops by up to 1.6 percentage points, for Mistral-7B and Mixtral-8x7B, the maximum drop is 0.4 %pt. and 1.8 %pt. respectively. However, a small number of cases stay in the Retain subset, indicating that the found parametric bias might not be the only reason for the model to retain its parametric answer when presented with a conflicting context. Additionally, we find that the accuracy P(Uc) also drops by up to 0.6, 0.9. and 1.8 percentage points for Llama2-7B, Mistral-7B and Mixtral-8x7B respectively. This indicates that the examples that were influenced by the incorrect parametric answer now moved into the Incorrect update category Ui. This suggests that the model might be resorting to its original answer in cases when it cannot find the correct answer in the context. Llama2-7B Mistral-7B Mixtral-8x7B Dataset P(R) P(Uc) P(R) P(Uc) P(R) P(Uc) NQ 0.7 (\u20130.7) 79.3 (\u20130.3) 0.2 (\u20130.2) 78.5 (\u20130.9) 0.8 (\u20130.9) 76.8 (\u20130.1) SQuAD 0.2 (\u20130.2) 89.9 (\u20130.4) 0.1 ( 0.0) 85.0 (\u20130.3) 0.0 (\u20130.1) 87.1 (\u20131.8) NewsQA 0.5 (\u20130.3) 71.4 (\u20130.6) 0.1 (\u20130.1) 67.3 (\u20130.8) 0.5 ( 0.0) 71.8 (\u20130.9) TriviaQA 2.9 (\u20130.5) 79.6 (+0.3) 3.0 (\u20130.3) 78.8 (+0.2) 6.2 ( 0.0) 74.0 (\u20130.3) SearchQA 0.7 (\u20131.5) 60.9 (\u20130.6) 0.3 (\u20130.4) 59.1 (\u20130.8) 1.6 (\u20131.8) 69.2 (\u20130.3) HotpotQA 0.5 (\u20130.8) 79.6 ( 0.0) 0.2 (\u20130.4) 78.5 ( 0.0) 0.6 (\u20130.6) 81.7 (\u20130.6) Table 5: Knowledge update success rate (%) after masking the parametric answer ap if it appears in the context. Size of change in parenthesis. We find that the models retain their parametric answers (ap) less often when ap is masked. 4.4.2 Adding the parametric answer to the context increases the likelihood of retaining it We further test our parametric bias hypothesis by artificially adding the parametric answer to the context. If the bias exists, we expect the model to retain its parametric answer more often. We add the incorrect parametric answer to the prompt after the context. We separate it from the context and the question by the words \u201dUnrelated text\u201d, indicating to the model that it should be ignored. Below is an example of such a prompt: prompt = f\"\"\"Answer the question with as few words as possible by extracting information directly from the context. Context: In the United Kingdom, BBC Radio 5 Live and 5 Live Sports Extra will carry the contest. The BBC will carry its own British English broadcast, with Greg Brady, Darren Fletcher and Rocky Boiman on commentary. Unrelated text: talkSPORT Question: Aside from BBC Radio 5, what radio station will broadcast the game? Answer:\"\"\" Such an addition would not fool a human into reading a context incorrectly because of the words \u201dUnrelated text\u201d. Hence, we claim this is evidence of an existing bias and consider it a failure of the model if this addition influences the model\u2019s performance. We report the results in Table 6. This simple intervention increases the likelihood of the model retaining its parametric answer for all datasets, providing further evidence for the existence of the parametric bias. In general, our intervention experiments show that the parametric factual knowledge of a language model interferes with knowledge updating, biasing its ability to read the context and jeopardizing the reliability of RAG systems. 8 \fPreprint. Under review. Llama2-7B Mistral-7B Mixtral-8x7B Dataset P(R) P(Uc) P(R) P(Uc) P(R) P(Uc) NQ 12.5 (+11.1) 70.1 (\u20139.5) 2.5 (+2.1) 73.4 (\u20136.0) 8.4 (+6.7) 73.4 (\u20133.5) SQuAD 12.0 (+11.6) 77.3 (\u201313.0) 3.5 (+3.4) 81.0 (\u20134.3) 2.8 (+2.7) 86.0 (\u20132.9) NewsQA 7.6 (+6.8) 66.2 (\u20135.8) 2.0 (+1.8) 65.5 (\u20132.6) 4.5 (+4.0) 68.8 (\u20133.9) TriviaQA 11.0 (+7.6) 76.2 (\u20133.1) 7.5 (+4.2) 76.3 (\u20132.3) 16.1 (+9.9) 70.0 (\u20134.3) SearchQA 6.6 (+4.4) 60.5 (\u20131.0) 1.2 (+0.5) 60.3 (+0.4) 8.0 (+4.6) 63.8 (\u20135.7) HotpotQA 7.3 (+6.0) 72.8 (\u20136.8) 2.3 (+1.7) 77.5 (\u20131.0) 4.3 (+3.1) 80.3 (\u20132.0) Table 6: Knowledge update success rate (%) after adding the parametric answer ap to the context after words \u201dUnrelated text:\u201d. Size of change in parenthesis. We find that the models retain their parametric answer (ap) more often when adding ap to the context. 5 Discussion Over-reliance on parametric knowledge. Previous work (Longpre et al., 2021; Si et al., 2023) found that LLMs retain their parametric answers after seeing a counterfactual conflicting context in a significant number of cases. Our findings show that in realistic knowledge conflicts, this rarely happens. These results suggest that LLMs ignoring conflicting information from retrieved documents is not a significant practical problem. However, a problematic interaction between parametric and contextual knowledge exists in a realistic scenario. Parametric bias. We show that despite high knowledge update success rates, the openbook performance of LLMs is not independent of their parametric factual knowledge. An incorrect parametric answer can make the knowledge update more likely to fail if it appears in the retrieved document. In Appendix G we provide evidence that parametric bias might become an even larger problem in RAG systems with changing knowledge and complex and realistic documents. Limitations. Our work focuses on understanding and analyzing the parametric bias. We have uncovered a problem and introduced a way of evaluating its effect. We leave the solution to future work. As a first step in this direction, in Appendix E we show that better task adaptation through ICL is not enough to mitigate this bias. Furthermore, in Appendix F we show that further scaling might reduce the bias. However, even the largest currently popular open LLMs are still susceptible to it. 6"
16
+ }
abs_9K/validation_abstract_short_2404.16069v1.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.16069v1",
3
+ "title": "Interactive Visual Learning for Stable Diffusion",
4
+ "abstract": "Diffusion-based generative models' impressive ability to create convincing\nimages has garnered global attention. However, their complex internal\nstructures and operations often pose challenges for non-experts to grasp. We\nintroduce Diffusion Explainer, the first interactive visualization tool\ndesigned to elucidate how Stable Diffusion transforms text prompts into images.\nIt tightly integrates a visual overview of Stable Diffusion's complex\ncomponents with detailed explanations of their underlying operations. This\nintegration enables users to fluidly transition between multiple levels of\nabstraction through animations and interactive elements. Offering real-time\nhands-on experience, Diffusion Explainer allows users to adjust Stable\nDiffusion's hyperparameters and prompts without the need for installation or\nspecialized hardware. Accessible via users' web browsers, Diffusion Explainer\nis making significant strides in democratizing AI education, fostering broader\npublic access. More than 7,200 users spanning 113 countries have used our\nopen-sourced tool at https://poloclub.github.io/diffusion-explainer/. A video\ndemo is available at https://youtu.be/MbkIADZjPnA.",
5
+ "authors": "Seongmin Lee, Benjamin Hoover, Hendrik Strobelt, Zijie J. Wang, ShengYun Peng, Austin Wright, Kevin Li, Haekyu Park, Haoyang Yang, Polo Chau",
6
+ "published": "2024-04-22",
7
+ "updated": "2024-04-22",
8
+ "primary_cat": "cs.HC",
9
+ "cats": [
10
+ "cs.HC",
11
+ "cs.AI"
12
+ ],
13
+ "label": "Original Paper",
14
+ "paper_cat": "Diffusion AND Model",
15
+ "gt": "Diffusion-based generative models' impressive ability to create convincing\nimages has garnered global attention. However, their complex internal\nstructures and operations often pose challenges for non-experts to grasp. We\nintroduce Diffusion Explainer, the first interactive visualization tool\ndesigned to elucidate how Stable Diffusion transforms text prompts into images.\nIt tightly integrates a visual overview of Stable Diffusion's complex\ncomponents with detailed explanations of their underlying operations. This\nintegration enables users to fluidly transition between multiple levels of\nabstraction through animations and interactive elements. Offering real-time\nhands-on experience, Diffusion Explainer allows users to adjust Stable\nDiffusion's hyperparameters and prompts without the need for installation or\nspecialized hardware. Accessible via users' web browsers, Diffusion Explainer\nis making significant strides in democratizing AI education, fostering broader\npublic access. More than 7,200 users spanning 113 countries have used our\nopen-sourced tool at https://poloclub.github.io/diffusion-explainer/. A video\ndemo is available at https://youtu.be/MbkIADZjPnA.",
16
+ "main_content": "Introduction Diffusion-based generative models [Rombach et al., 2022] like Stable Diffusion [Stability AI, 2022] have captured global attention for their impressive image creation abilities, from AI developers, designers, to policymakers. However, the popularity and progress of generative AI models have sparked ethical [Brusseau, 2022] and social concerns, such as accusations of artistic style theft by AI image generators [Sung, 2022; Choudhary, 2022]. Policymakers are also discussing ways to combat malicious data generation and revise copyright policies [Engler, 2023; Ryan-Mosley, 2023; U.S. Copyright Office, 2023]. There is an urgent need for individuals from many different fields to understand how generative AI models function and communicate effectively with AI researchers and developers [Dixit, 2023; Hendrix, 2023]. Key challenges in designing learning tools for Stable Diffusion. Stable Diffusion iteratively refines noise into a highresolution image\u2019s vector representation, guided by a text prompt. Internally, the prompt is tokenized and encoded into vector representations by the CLIP\u2019s Text Encoder [Radford et al., 2021]. With text representations\u2019 guidance, Stable Diffusion improves the image quality and adherence to the prompt by incrementally denoising the image\u2019s vector representation using the UNet [Ronneberger et al., 2015] and the Scheduler algorithm [Nichol and Dhariwal, 2021]. The final image representation is upscaled to a high-resolution image. The crux of learning about Stable Diffusion tems from the complex interplay between the multiple neural network subcomponents, their intricate operations, and the iterative nature of image representation refinements. Such complex interactions are challenging even for experts to comprehend [von Platen, 2022]. While some articles [Alammar, 2022] and video lessons [Howard, 2023] explain Stable Diffusion, they often focus on model training and mathematical details. Contributions. In this demonstration, we contribute: \u2022 Diffusion Explainer, the first interactive visualization tool designed for non-experts to learn how Stable Diffusion transforms a text prompt into a high-resolution image (Fig. 1), overcoming design challenges in developing learning tools for Stable Diffusion. Diffusion Explainer integrates an overview of Stable Diffusion\u2019s complex structure with explanations of their underlying operations enabling users to fluidly transition between multiple abstraction levels through animations and interactive elements. \u2022 Real-time interactive visualization to discover how Stable Diffusion\u2019s hyperparameters and text prompt affect image generation, empowering users to experiment with their settings and gain insight into each hyperparameter\u2019s impact without the need for complex mathematical derivations. \u2022 Open-sourced, web-based implementation that broadens the public\u2019s education access to modern generative AI without requiring any installation, advanced computational resources, or coding skills. Diffusion Explainer is open-sourced1 and available at https://poloclub.github.io/ diffusion-explainer/. A video demo is available at https: //youtu.be/MbkIADZjPnA. With over 7,200 users across 113 countries, Diffusion Explainer is making significant strides in democratizing AI education. 1https://github.com/poloclub/diffusion-explainer arXiv:2404.16069v1 [cs.HC] 22 Apr 2024 \fTimestep 0 50 Prompt Selector Generated Image Figure 1: With Diffusion Explainer, users can examine how (A) a text prompt, e.g., \u201ca cute and adorable bunny... pixar character\u201d, is encoded by (B) the Text Representation Generator into vectors to guide (C) the Image Representation Refiner to iteratively refine the vector representation of the image being generated. (D) The Timestep Controller enables users to review the incremental improvements in image quality and adherence to the prompt over timesteps. (E) The final image representation is upscaled to a high-resolution image. Diffusion Explainer tightly integrates a visual overview of Stable Diffusion\u2019s complex components with detailed explanations, enabling users to fluidly transition between abstraction levels through animations and interactive elements (see Fig. 2 and Fig. 3). 2 System Design and Implementation Diffusion Explainer is an interactive visualization tool that explains how Stable Diffusion generates a high-resolution image from a text prompt. It incorporates an animation of random noise gradually refined and a Timestep Controller (Fig. 1D) that enables users to visit each refinement timestep. From the Prompt Selector (Fig. 1A), users select one out of the 13 prompts that follow a template and contain popular keywords identified from literature [Smith, 2022]. Diffusion Explainer provides an overview of Stable Diffusion\u2019s architecture, which can be expanded into details via user interactions (Fig. 2, Fig. 3). While users can interactively change Stable Diffusion\u2019s two key hyperparameters, guidance scale and random seed, we fix the number of timesteps as 50, a commonly chosen value, and consistently use the Linear Multistep Scheduler [Karras et al., 2022], a fundamental and widely adopted scheduling method. Diffusion Explainer is implemented using a standard web technology stack (HTML, CSS, JavaScript) and the D3.js [Bostock et al., 2011] visualization library. 2.1 Text Representation Generator The Text Representation Generator converts text prompts into vector representations. Clicking on the Text Representation Generator expands to the Text Operation View (Fig. 2A) that explains how the Tokenizer splits the prompt into tokens and how the Text Encoder encodes the tokens into vector representations. Clicking on the Text Encoder displays the Textimage Linkage Explanation (Fig. 2B), which visually explains how Stable Diffusion connects text and image by utilizing the CLIP [Radford et al., 2021] text encoder to generate text representations with image-related information. 2.2 Image Representation Refiner The Image Representation Refiner (Fig. 3) refines random noise into the vector representation of a high-resolution image that adheres to the text prompt. Diffusion Explainer visualizes the image representation of each refinement step in two ways: (1) decoding it as a small image using linear operations [Turner, 2022] and (2) upscaling it to the Stable Diffusion\u2019s output resolution (Fig. 1E). Users expands the Image Representation Refiner to access the Image Operation View (Fig. 3A), which explains how the UNet neural network [Ronneberger et al., 2015] predicts the noise to be removed from the image representation. The guidance scale hyperparameter, which controls the image\u2019s adherence strength to the text prompt, is described at the bottom, and further explained in the Interactive Guidance Explanation (Fig. 3B). Using a slider, users can experiment with different guidance scale values to better understand how higher values lead to stronger adherence of the generated image to the text prompt. 3 Demonstrating Diffusion Explainer We provide a demonstration scenario both to illustrate how people with limited experience with Stable Diffusion may benefit from using Diffusion Explainer and to describe what we will show the audience. Demonstration Scenario Troy, a government policymaker overseeing AI image creation in the entertainment and media industries, has recently received concerns from artists. They express worry that their artwork has been exploited by AI models to create commercial products without their consent [AMELION, 2023]. Troy is eager to help these artists in getting compensated for their \fText Operation View A Text-image Linkage Explanation B Figure 2: To understand how Stable Diffusion converts a text prompt into vector representations, users click on the Text Representation Generator, which smoothly expands to (A) the Text Operation View that explains how the prompt is split into tokens and encoded into vector representations. (B) The Text-image Linkage Explanation demonstrates how Stable Diffusion bridges text and image, enabling text representations to guide the image generation process. contributions. He has found a tool that could potentially address their concerns, which would attribute AI-generated images to human artists [Huber and Troynikov, 2023; anton, 2023]. However, before proposing any policies, Troy needs to understand how and if such attribution may work. Troy launches Diffusion Explainer which illustrates how Stable Diffusion transforms a text prompt into a highresolution image through an iterative process (Fig. 1). He identifies two controllable hyperparameters: random seed and guidance scale. Adjusting the random seed from 1 to 2 and 3, Troy observes substantial changes in the generated image. Intrigued by these variations, he examines timestep 1 using the Timestep Controller (Fig. 1D) and discovers that different random seeds yield different initial noises, thus generating diverse images. Continuing his exploration, Troy experiments with different guidance scale values. He notes that a guidance scale value of 7 produces a realistic image closely aligned with the text prompt, while values of 1 or 20 result in images that are hard to interpret or exaggerated. To delve into the details of how the text prompt is processed, Troy clicks on the Text Representation Generator to expand it into the Text Operation View (Fig. 2A). Here, he discovers that the prompt is tokenized and converted into vector representations. Seeking clarity on how text is connected to the image, he then displays the Text-image Linkage Explanation (Fig. 2B) and learns that Stable Diffusion\u2019s text representations contain image-related information. Troy proceeds to understand the refinement of image representation by exInteractive Guidance Explanation B A Image Operation View Figure 3: Users learn how Stable Diffusion gradually refines noise into a high-resolution image\u2019s vector representation aligned with the text prompt by selecting the Image Representation Refiner from the high-level overview. This smoothly expands to (A) the Image Operation View that demonstrates how the noise is iteratively predicted and removed from the image representation. (B) The Interactive Guidance Explanation enables users to interactively experiment with various guidance scale values (0, 1, 7, 20) to better understand how higher values lead to stronger adherence. amining the Image Operation View (Fig. 3A). He discovers that each refinement step involves UNet\u2019s noise prediction and removal, with the guidance scale hyperparameter controlling the adherence of the generated image to the prompt. Intrigued, Troy accesses the Interactive Guidance Explanation (Fig. 3B) and learns that the model predicts two types of noise, each of which is generic and prompt-specific. The final noise is a weighted sum of these noises, with the weight being controlled by the guidance scale. With an improved understanding of the image generation process of Stable Diffusion, Troy recognizes that image analysis alone, without considering text prompts, will not suffice to discern how an artist\u2019s creations contributed to AIgenerated images. He asserts that further research is imperative to accurately attribute AI-generated images. 4"
17
+ }
abs_9K/validation_abstract_short_2404.16076v1.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.16076v1",
3
+ "title": "Semantic Evolvement Enhanced Graph Autoencoder for Rumor Detection",
4
+ "abstract": "Due to the rapid spread of rumors on social media, rumor detection has become\nan extremely important challenge. Recently, numerous rumor detection models\nwhich utilize textual information and the propagation structure of events have\nbeen proposed. However, these methods overlook the importance of semantic\nevolvement information of event in propagation process, which is often\nchallenging to be truly learned in supervised training paradigms and\ntraditional rumor detection methods. To address this issue, we propose a novel\nsemantic evolvement enhanced Graph Autoencoder for Rumor Detection (GARD) model\nin this paper. The model learns semantic evolvement information of events by\ncapturing local semantic changes and global semantic evolvement information\nthrough specific graph autoencoder and reconstruction strategies. By combining\nsemantic evolvement information and propagation structure information, the\nmodel achieves a comprehensive understanding of event propagation and perform\naccurate and robust detection, while also detecting rumors earlier by capturing\nsemantic evolvement information in the early stages. Moreover, in order to\nenhance the model's ability to learn the distinct patterns of rumors and\nnon-rumors, we introduce a uniformity regularizer to further improve the\nmodel's performance. Experimental results on three public benchmark datasets\nconfirm the superiority of our GARD method over the state-of-the-art approaches\nin both overall performance and early rumor detection.",
5
+ "authors": "Xiang Tao, Liang Wang, Qiang Liu, Shu Wu, Liang Wang",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-04-24",
8
+ "primary_cat": "cs.SI",
9
+ "cats": [
10
+ "cs.SI",
11
+ "cs.AI",
12
+ "cs.CL",
13
+ "cs.LG"
14
+ ],
15
+ "label": "Original Paper",
16
+ "paper_cat": "Graph AND Structure AND Learning",
17
+ "gt": "Due to the rapid spread of rumors on social media, rumor detection has become\nan extremely important challenge. Recently, numerous rumor detection models\nwhich utilize textual information and the propagation structure of events have\nbeen proposed. However, these methods overlook the importance of semantic\nevolvement information of event in propagation process, which is often\nchallenging to be truly learned in supervised training paradigms and\ntraditional rumor detection methods. To address this issue, we propose a novel\nsemantic evolvement enhanced Graph Autoencoder for Rumor Detection (GARD) model\nin this paper. The model learns semantic evolvement information of events by\ncapturing local semantic changes and global semantic evolvement information\nthrough specific graph autoencoder and reconstruction strategies. By combining\nsemantic evolvement information and propagation structure information, the\nmodel achieves a comprehensive understanding of event propagation and perform\naccurate and robust detection, while also detecting rumors earlier by capturing\nsemantic evolvement information in the early stages. Moreover, in order to\nenhance the model's ability to learn the distinct patterns of rumors and\nnon-rumors, we introduce a uniformity regularizer to further improve the\nmodel's performance. Experimental results on three public benchmark datasets\nconfirm the superiority of our GARD method over the state-of-the-art approaches\nin both overall performance and early rumor detection.",
18
+ "main_content": "INTRODUCTION The expansion of the Internet and social media has expedited the dissemination of news, facilitating instantaneous discussions. Nevertheless, this advancement also introduces specific risks, such as the rapid circulation of rumors, which can undermine the credibility of online information, ultimately impacting individuals\u2019 lives and societal stability. [4, 55]. Therefore, there is an urgent need for a rapid and effective rumor detection method. Recently, deep learning has played a crucial role in rumor detection by automatically learning high-level representations of text and propagation structures of rumors [13]. Many deep learning models, such as Recursive Neural Networks (RvNNs), Recurrent Neural Networks (RNNs) and its successors, have been applied to rumor detection due to their ability to learn sequential features [2, 5, 17, 21, 22, 27, 41]. However, these methods overlook the importance of complex topological structural information in rumor propagation. In order to address this issue, some studies arXiv:2404.16076v1 [cs.SI] 24 Apr 2024 \fWWW \u201924, May 13\u201317, 2024, Singapore, Singapore Xiang Tao, Liang Wang, Qiang Liu, Shu Wu, & Liang Wang have invoke Graph Neural Networks (GNNs) to model the complex topological structural information of rumor propagation [1, 26, 49]. Despite these models based on GNNs achieve success in rumor detection by effectively exploiting the structure information of propagation graphs, they often struggle to learn the intrinsic relationships between posts, because they only rely on supervised training objectives. This limitation results in poor generalization ability and unsatisfactory performance in real-world scenarios [18, 48]. Thus, recent works such as [34] have proposed supervised graph adversarial contrastive learning method to capture the invariance of events, and [47] perform a contrastive learning training based on relation-level augmentation and event-level augmentation, in order to enhance the robustness and generalization of models. However, the success of these rumor detection methods that introduce contrastive learning heavily relies on complex data augmentation techniques, which require continuous trial and error to determine [40, 51]. Because unreasonable data augmentation methods often introduce more noise, leading to adverse effects on the model and causing a degradation in its performance [44, 50]. Additionally, these models lack attention to the semantic evolvement during news propagation. Semantic evolvement refers to the gradual transformation of the comprehensive semantics of news (including source post and all replies) as user interactions such as comments, shares, and likes increase. These comments often present diverse viewpoints due to different perspectives and positions, which contribute to the alteration of the semantic meaning of the news. For example: (1) In the spread of a rumor, there is often a situation where initially, the majority of comments express agreement with the source post, but after some time, a large number of debunking messages appear. Therefore, capturing such a signal of significant semantic changes before and after can effectively detect rumors. (2) In the spread of a rumor, a portion of the comments may question and present evidence contradicting the source post, leading to semantic evolvement repeatedly within these contradictions. In contrast, in the spread of a non-rumor, the comments usually focus more on in-depth analysis and discussion of the information rather than refutation [33]. Capturing the overall semantic evolvement information can help model identify semantic transformations, thereby recognizing features of misinformation. Furthermore, during the early stages of event propagation, rumors often share significant similarities in their structure because there is typically limited commenting and interaction [7], making it challenging to distinguish them solely based on structural features. So capturing the semantic evolvement information during early propagation stages can also help in identifying rumors early and minimizing the harm caused by misinformation. Therefore, it is crucial to consider and understand the semantic evolvement, and strive to capture such information during news propagation [16]. However, in prior work, these supervised training paradigms and contrastive learning based rumor detection methods struggled to enable models to learn genuine semantic information [19, 32, 48]. In order to achieve more generalized, rapid, and effective rumor detection without the need for complex data augmentation techniques, we propose a novel semantic evolvement enhanced Graph Autoencoder for Rumor Detection (GARD) model in this paper. It introduces self-supervised semantic evolvement learning to acquire more generalized and robust representations root post (a) top-down direction root post (b) bottom-up direction Figure 1: (a) the top-down semantic evolvement graph, as comments increase, semantic begin to evolve, (b) the reverse bottom-top semantic evolvement graph, where the edges between nodes indicate the direction of features reconstruction. through feature reconstruction training based on propagation paths, while also detecting rumors earlier by capturing semantic evolvement information in the early stages. Specifically, GARD learn the semantic evolvement information from both local and global perspectives: (1) In order to capture the local semantic changes between tweets and their responses, we utilize the features of parent nodes to reconstruct the features of their child nodes in the top-down directions as shown in fig. 1a, and utilize the features of child nodes to reconstruct the feature of their parent nodes in the bottom-up directions as shown in fig. 1b. (2) In order to capture broader information propagation paths and contextual relationships, and determine whether significant semantic changes has occurred during the propagation of news, we introduce a global semantic learning module to learn the semantic relationships between each node and its multi-hop neighboring nodes by conducting features random mask reconstruction on undirected propagation graph. It randomly masks a portion of the nodes\u2019 features, then the masked features are reconstructed by their multi-hop neighboring nodes. (3) Furthermore, rumors and non-rumors usually exhibit distinct propagation patterns, and the propagation patterns differ among various event topics [7]. Therefore, in order to enhance the model\u2019s ability to learn the distinct patterns of rumors and non-rumors, we introduce a uniformity regularizer [31, 43] to further improve the model\u2019s performance, which prefers the uniform distribution on the unit hypersphere by pulling away the distance between the representations of different events, so as to preserves maximal information and eliminates the features collapse issue [54]. The experimental results on three benchmark datasets demonstrate that our GARD outperforms state-of-the-art approaches in both overall performance and early rumor detection. The main contributions of our work are outlined as follows: \u2022 We propose a GARD rumor detection method, which takes into account not only the structural features but also the crucial semantic evolvement features. This comprehensive consideration enables the model to achieve better robustness and generalization without the need for complex data augmentation techniques. \u2022 In order to enhance the model\u2019s ability to learn distinctive propagation patterns of rumors and non-rumors, we introduce a uniformity regularizer that further improve the model\u2019s performance. \u2022 Our GARD method has been evaluated on three widely used benchmark datasets, and the experimental results demonstrate \fSemantic Evolvement Enhanced Graph Autoencoder for Rumor Detection WWW \u201924, May 13\u201317, 2024, Singapore, Singapore its superiority over the state-of-the-art approaches in both overall performance and early rumor detection. 2 RELATED WORK 2.1 Rumor Detection In recent years, deep learning has emerged as a significant role in rumor detection by automatically learning high-level representations of text and rumor propagation structures. Various deep learning models, including RNN and its various variants, have been applied to rumor detection task [21, 22, 24, 28, 41]. To incorporate complex structural information into rumor propagation analysis, several approaches have incorporated GNNs to model the structural information within rumor propagation. By considering a more realistic representation of the problem, GNNs have demonstrated success in leveraging the structural information of propagation graphs [1, 20]. To enhance the robustness and generalization of rumor detection models, some recent studies have proposed training methods that introduce supervised graph contrastive learning techniques to capture the invariance of events [34]. Some works also leverage unsupervised contrastive learning training methods to capture the repost relations and structural features of rumors [47]. 2.2 Graph Autoencoders With the development and widespread application of graph algorithms [15, 38, 39, 42, 46, 52, 53, 57, 58], the application of graph autoencoders has also received widespread attention. Autoencoders [8] are designed to reconstruct certain inputs within a given context and do not impose any specific decoding order. The earliest works on Graph Autoencoders (GAEs) can be traced back to GAE and VGAE [10, 35], where they utilize a two-layer GCN as the encoder and employ dot-product for link prediction decoding. Later GAEs mostly adopted the structure reconstruction after VGAE or combined structure and feature reconstruction as their objectives [14, 29, 30, 36, 45]. In recent years, many studies have focused on investigating the effectiveness of masked feature reconstruction objectives for GNNs [11, 25, 37, 48, 56]. Among them, GraphMAE [9] has achieved good results in graph representation learning tasks based on masked feature reconstruction through the analysis of masking strategies and the design of loss functions. It has achieved state-of-the-art performance in multiple node classification and graph classification tasks. 3 PROBLEM DEFINITION The problem of rumor detection is defined as a classification task, where the objective is to learn a classifier that can accurately detect rumors. Specifically, for a given rumor dataset C = {\ud835\udc361,\ud835\udc362, ...,\ud835\udc36\ud835\udc40}, where\ud835\udc36\ud835\udc56is the\ud835\udc56-th event and \ud835\udc40is the number of events. We defined each event \ud835\udc36\ud835\udc56= {\ud835\udc5f,\ud835\udc641,\ud835\udc642, ...,\ud835\udc64\ud835\udc41\ud835\udc56\u22121, G\ud835\udc56}, where \ud835\udc41\ud835\udc56is the number of posts in \ud835\udc36\ud835\udc56, \ud835\udc5frefers to the source post, each \ud835\udc64\ud835\udc57represents the \ud835\udc57-th responsive post, and G\ud835\udc56defined as a graph represents the propagation structure of \ud835\udc36\ud835\udc56. The graph G\ud835\udc56= {\ud835\udc7d\ud835\udc56, \ud835\udc68\ud835\udc56, \ud835\udc7f\ud835\udc56}, where \ud835\udc7d\ud835\udc56refers to the set of nodes corresponding to \ud835\udc41\ud835\udc56posts and \ud835\udc68\ud835\udc56\u2208 {0, 1}\ud835\udc41\ud835\udc56\u00d7\ud835\udc41\ud835\udc56as an adjacency matrix where: \ud835\udc4e\ud835\udc56 \ud835\udc60\ud835\udc61= \u001a 1, if \ud835\udc52\ud835\udc56 \ud835\udc60\ud835\udc61\u2208\ud835\udc38\ud835\udc56 0, otherwise, (1) where \ud835\udc38\ud835\udc56= {\ud835\udc52\ud835\udc56 \ud835\udc60\ud835\udc61|\ud835\udc60,\ud835\udc61\u2208{0, 1, ..., \ud835\udc41\ud835\udc56\u22121}} represents the set of edges connecting a post to its retweeted posts or responsive posts as shown in fig. 1a. \ud835\udc7f\ud835\udc56= [\ud835\udc650,\ud835\udc651, ...,\ud835\udc65\ud835\udc41\ud835\udc56\u22121]\ud835\udc47denote a node feature matrix extracted from the posts in \ud835\udc36\ud835\udc56. We adopt the same approach as [34] by using the BERT [6] to separately encode the source and comments to form the feature matrix \ud835\udc7f\ud835\udc56. Besides, each event \ud835\udc36\ud835\udc56in the dataset is labeled with a ground-truth label \ud835\udc66\ud835\udc56. Here, we define the problem statement as follows: Rumor Detection: The task is to develop a classifier, denoted as \ud835\udc53: \ud835\udc36\ud835\udc56\u2212 \u2192\ud835\udc66\ud835\udc56, where \ud835\udc36\ud835\udc56represents a event of rumor dataset with their corresponding graph structure and textual features. 4 THE PROPOSED GARD MODEL In this section, we propose a GARD model for rumor detection tasks as fig. 2 shows. GARD is mainly faced with two problems: (A) How to capture local semantic changes based on the propagation paths of events; (B) How to capture global semantic evolvement information based on the entire propagation structure of events. In response to the above problems, we will elaborate on the components of GARD, including local semantic evolvement learning, global semantic evolvement learning, representation of propagation graph, and uniformity regularizer. 4.1 Local Semantic Evolvement Learning In order to capture the local semantic changes between tweets and their retweets, we proposed this Local Semantic Evolvement Learning module. We utilize the features of parent nodes to reconstruct the features of their child nodes in the top-down direction, and utilize the features of child nodes to reconstruct the features of their parent nodes in the bottom-up direction. In detail, given an input data G = (\ud835\udc7d, \ud835\udc68, \ud835\udc7f) where \ud835\udc7f\u2208R\ud835\udc41\u00d7\ud835\udc51, we obtain all \ud835\udc41\ud835\udc5d parent-child node pairs, then obtain the parent feature matricx \ud835\udc7f\ud835\udc5d\u2208R\ud835\udc41\ud835\udc5d\u00d7\ud835\udc51for the parent nodes in all parent-child node pairs and child feature matricx \ud835\udc7f\ud835\udc50\u2208R\ud835\udc41\ud835\udc5d\u00d7\ud835\udc51for all child nodes in all parent-child node pairs, respectively. Further, given \ud835\udc53\ud835\udc59\ud835\udc5c\ud835\udc50\ud835\udc4e\ud835\udc591 and \ud835\udc53\ud835\udc59\ud835\udc5c\ud835\udc50\ud835\udc4e\ud835\udc592 as two encoders, \ud835\udc54\ud835\udc59\ud835\udc5c\ud835\udc50\ud835\udc4e\ud835\udc591 and \ud835\udc54\ud835\udc59\ud835\udc5c\ud835\udc50\ud835\udc4e\ud835\udc592 as two decoders, here we use Multi-Layer Perceptron (MLP) as both the encoder and decoder. Then we individually input the parent feature matrix and child feature matrix into their respective encoder to obtain their latent representations. Next, we feed these representations into respective decoder to generate the reconstructed features. Formally, in the top-down direction, it can be written as follows: \ud835\udc6f\ud835\udc5d= \ud835\udc53\ud835\udc59\ud835\udc5c\ud835\udc50\ud835\udc4e\ud835\udc591(\ud835\udc7f\ud835\udc5d), \ud835\udc81\ud835\udc5d= \ud835\udc54\ud835\udc59\ud835\udc5c\ud835\udc50\ud835\udc4e\ud835\udc591(\ud835\udc6f\ud835\udc5d), (2) in the bottom-up direction, it can be written as: \ud835\udc6f\ud835\udc50= \ud835\udc53\ud835\udc59\ud835\udc5c\ud835\udc50\ud835\udc4e\ud835\udc592(\ud835\udc7f\ud835\udc50), \ud835\udc81\ud835\udc50= \ud835\udc54\ud835\udc59\ud835\udc5c\ud835\udc50\ud835\udc4e\ud835\udc592(\ud835\udc6f\ud835\udc50), (3) where \ud835\udc6f\ud835\udc5d, \ud835\udc6f\ud835\udc50\u2208R\ud835\udc41\ud835\udc5d\u00d7\ud835\udc51\u210eare the latent representations of parent nodes and child nodes, \ud835\udc81\ud835\udc5d, \ud835\udc81\ud835\udc50\u2208R\ud835\udc41\ud835\udc5d\u00d7\ud835\udc51is the reconstructed features. Then, we calculate the Mean Squared Error (MSE) loss between the original features and the reconstructed features in both top-down and bottom-up directions: Lrec1 = 1 \ud835\udc41\ud835\udc5d 1 \ud835\udc51 \ud835\udc41\ud835\udc5d \u2211\ufe01 \ud835\udc56=1 \ud835\udc51 \u2211\ufe01 \ud835\udc57=1 (\ud835\udc65\ud835\udc50 \ud835\udc56\ud835\udc57\u2212\ud835\udc67\ud835\udc5d \ud835\udc56\ud835\udc57)2 + 1 \ud835\udc41\ud835\udc5d 1 \ud835\udc51 \ud835\udc41\ud835\udc5d \u2211\ufe01 \ud835\udc56=1 \ud835\udc51 \u2211\ufe01 \ud835\udc57=1 (\ud835\udc65\ud835\udc5d \ud835\udc56\ud835\udc57\u2212\ud835\udc67\ud835\udc50 \ud835\udc56\ud835\udc57)2, (4) \fWWW \u201924, May 13\u201317, 2024, Singapore, Singapore Xiang Tao, Liang Wang, Qiang Liu, Shu Wu, & Liang Wang Encoder flocal1/2 Encoder fglobal pooling pooling concat FC \u0dd4 \ud835\udc66 3 2 1 5 4 2 6 3 7 4 9 8 6 3 2 1 5 4 2 6 3 7 4 9 8 6 Local Semantic Learning Global Semantic Learning 1 2 3 4 5 6 7 8 9 Lsup L Reconstructed features of child/parent nodes Reconstructed features of masked nodes Luni Lmse Lmse + + + 1 2 3 4 5 6 7 8 9 Event Propagation Graph Random Mask Parent-child Pairs Parameters Updating Parameters Updating hk hj m x1 x2 x3 z3 z9 Mean Squared Error(xi ,zi) Mean Squared Error(xj ,zj) zj top-down bottom-up Decoder glocal1/2 Decoder gglobal Figure 2: The overall framework of our proposed GARD model. (1) The learning of local semantic changes is achieved by reconstructing node features in both the top-down and bottom-up directions of parent-child node pairs. (2) The learning of global semantic evolvement is achieved by conducting features random mask reconstruction on undirected propagation graph. (3) We introduce a uniformity regularizer to enhance the model\u2019s ability to learn the distinctive patterns of events. where \ud835\udc65\ud835\udc50 \ud835\udc56\ud835\udc57and \ud835\udc67\ud835\udc50 \ud835\udc56\ud835\udc57refers to the j-th feature value of the i-th node in feature matrix \ud835\udc7f\ud835\udc50and \ud835\udc81\ud835\udc50. The parameters of \ud835\udc53\ud835\udc59\ud835\udc5c\ud835\udc50\ud835\udc4e\ud835\udc591 and \ud835\udc53\ud835\udc59\ud835\udc5c\ud835\udc50\ud835\udc4e\ud835\udc592 can be learned by: \ud835\udeaf\u2605 1 = arg min \u03981 Lrec1(G; \ud835\udeaf1), (5) where \ud835\udeaf1 denotes the parameters of \ud835\udc53\ud835\udc59\ud835\udc5c\ud835\udc50\ud835\udc4e\ud835\udc591 and \ud835\udc53\ud835\udc59\ud835\udc5c\ud835\udc50\ud835\udc4e\ud835\udc592. 4.2 Global Semantic Evolvement Learning In order to capture broader information propagation path and contextual relationships, to determine whether significant semantic changes has occurred during the propagation of news, we proposed this Global Semantic Evolvement Learning module. In detail, given an input data G = (\ud835\udc7d, \ud835\udc68, \ud835\udc7f) where \ud835\udc7f\u2208R\ud835\udc41\u00d7\ud835\udc51, we first apply a uniform random sampling strategy with a mask ratio to sample a subset of nodes e \ud835\udc7d\u2208\ud835\udc7dand mask each of their features with a mask token [MASK], i.e., a learnable vector \ud835\udc65[\ud835\udc40\ud835\udc34\ud835\udc46\ud835\udc3e] \u2208R\ud835\udc51. Thus, the node feature \u02dc \ud835\udc99\ud835\udc56for \ud835\udc63\ud835\udc56\u2208\ud835\udc7din the masked feature matrix e \ud835\udc7fcan be defined as: \u02dc \ud835\udc99\ud835\udc56= \u001a \ud835\udc99[MASK] \ud835\udc63\ud835\udc56\u2208e \ud835\udc49 \ud835\udc99\ud835\udc56 \ud835\udc63\ud835\udc56\u2209e \ud835\udc49. (6) Further, given \ud835\udc53\ud835\udc54\ud835\udc59\ud835\udc5c\ud835\udc4f\ud835\udc4e\ud835\udc59as an encoder and \ud835\udc54\ud835\udc54\ud835\udc59\ud835\udc5c\ud835\udc4f\ud835\udc4e\ud835\udc59as a decoder, here we use Graph Convolutional Network (GCN) [12] as both the encoder and decoder, in which, each node relies on its neighbor nodes to enhance/recover features. Then we take the obtained feature matrix e \ud835\udc7fand adjacency matrix \ud835\udc68as inputs to the encoder to obtain latent representations. Next, these representations are fed into the decoder to generate the reconstructed feature matrix. Formally, it can be written as follow: \ud835\udc6f= \ud835\udc53\ud835\udc54\ud835\udc59\ud835\udc5c\ud835\udc4f\ud835\udc4e\ud835\udc59(\ud835\udc68, e \ud835\udc7f), \ud835\udc81= \ud835\udc54\ud835\udc54\ud835\udc59\ud835\udc5c\ud835\udc4f\ud835\udc4e\ud835\udc59(\ud835\udc68, \ud835\udc6f), (7) where \ud835\udc6f\u2208R\ud835\udc41\u00d7\ud835\udc51\u210eis the latent representations of input nodes, \ud835\udc81\u2208R\ud835\udc41\u00d7\ud835\udc51is the reconstructed features. Then, we calculate the MSE loss between the original features and the reconstructed features of the masked nodes: Lrec2 = 1 \ud835\udc41\ud835\udc5a 1 \ud835\udc51 \ud835\udc41\ud835\udc5a \u2211\ufe01 \ud835\udc56=1 \ud835\udc51 \u2211\ufe01 \ud835\udc57=1 (\ud835\udc65\ud835\udc56\ud835\udc57\u2212\ud835\udc67\ud835\udc56\ud835\udc57)2, (8) where \ud835\udc41\ud835\udc5arepresents the number of masked nodes. Please note that we only calculate the MSE loss on the masked node features. The parameters of encoder \ud835\udc53\ud835\udc54\ud835\udc59\ud835\udc5c\ud835\udc4f\ud835\udc4e\ud835\udc59can be learned by: \ud835\udeaf\u2605 2 = arg min \u03982 Lrec2(G; \ud835\udeaf2), (9) where \ud835\udeaf2 denotes the parameters of \ud835\udc53\ud835\udc54\ud835\udc59\ud835\udc5c\ud835\udc4f\ud835\udc4e\ud835\udc59. 4.3 Representation of Propagation Graph In order to leverage label information, we also calculate a supervised loss function for optimizing the model. Specifically, given an input data G = (\ud835\udc7d, \ud835\udc68, \ud835\udc7f) where \ud835\udc7f\u2208R\ud835\udc41\u00d7\ud835\udc51, we input the data into encoder \ud835\udc53\ud835\udc59\ud835\udc4e\ud835\udc50\ud835\udc5c\ud835\udc591, \ud835\udc53\ud835\udc59\ud835\udc5c\ud835\udc50\ud835\udc4e\ud835\udc592 and \ud835\udc53\ud835\udc54\ud835\udc59\ud835\udc5c\ud835\udc4f\ud835\udc4e\ud835\udc59to obtain latent representations, respectively. Then, we use mean-pooling operators (\ud835\udc40\ud835\udc38\ud835\udc34\ud835\udc41) to aggregate the information of the set of node representations. Finally, we concatenate them to merge the information. Formally, it can be written as follow: \ud835\udc6f\ud835\udc581 = \ud835\udc53\ud835\udc59\ud835\udc5c\ud835\udc50\ud835\udc4e\ud835\udc591(\ud835\udc7f), \ud835\udc6f\ud835\udc582 = \ud835\udc53\ud835\udc59\ud835\udc5c\ud835\udc50\ud835\udc4e\ud835\udc592(\ud835\udc7f), \ud835\udc6f\ud835\udc57= \ud835\udc53\ud835\udc54\ud835\udc59\ud835\udc5c\ud835\udc4f\ud835\udc4e\ud835\udc59(\ud835\udc68, \ud835\udc7f), (10) \fSemantic Evolvement Enhanced Graph Autoencoder for Rumor Detection WWW \u201924, May 13\u201317, 2024, Singapore, Singapore \ud835\udc89\ud835\udc581 = \ud835\udc40\ud835\udc38\ud835\udc34\ud835\udc41(\ud835\udc6f\ud835\udc581), \ud835\udc89\ud835\udc582 = \ud835\udc40\ud835\udc38\ud835\udc34\ud835\udc41(\ud835\udc6f\ud835\udc582), \ud835\udc89\ud835\udc57= \ud835\udc40\ud835\udc38\ud835\udc34\ud835\udc41(\ud835\udc6f\ud835\udc57), (11) \ud835\udc8e= \ud835\udc50\ud835\udc5c\ud835\udc5b\ud835\udc50\ud835\udc4e\ud835\udc61(\ud835\udc89\ud835\udc581, \ud835\udc89\ud835\udc582, \ud835\udc89\ud835\udc57), (12) where \ud835\udc8e\u2208R3\ud835\udc51\u210edenotes the representation of event. Next, \ud835\udc8eis fed into full-connection layers and a softmax layer, and the output is calculated as: \u02c6 \ud835\udc9a= \ud835\udc60\ud835\udc5c\ud835\udc53\ud835\udc61\ud835\udc5a\ud835\udc4e\ud835\udc65(\ud835\udc7e\ud835\udc58\ud835\udc8e+ \ud835\udc83\ud835\udc58), (13) where \u02c6 \ud835\udc9a\u2208R\ud835\udc36is a vector of probabilities for all the classes \ud835\udc36. \ud835\udc7e\ud835\udc58\u2208R\ud835\udc36\u00d73\ud835\udc51\u210eand \ud835\udc83\ud835\udc58\u2208R\ud835\udc36are the learnable weight matrix and bias respectively. Therefore, we introduce a cross-entropy as supervised loss into the objective of encoder \ud835\udc53\ud835\udc59\ud835\udc5c\ud835\udc50\ud835\udc4e\ud835\udc591, \ud835\udc53\ud835\udc59\ud835\udc5c\ud835\udc50\ud835\udc4e\ud835\udc592 and \ud835\udc53\ud835\udc54\ud835\udc59\ud835\udc5c\ud835\udc4f\ud835\udc4e\ud835\udc59. The objective are updated as: L = Lsup(G; \ud835\udeaf1, \ud835\udeaf2) + \ud835\udefc(Lrec1(G; \ud835\udeaf1) + Lrec2(G; \ud835\udeaf2)), (14) where Lsup = \u22121 \ud835\udc41 \ud835\udc41 \u2211\ufe01 \ud835\udc58=1 \ud835\udc36 \u2211\ufe01 \ud835\udc57=1 \ud835\udc9a\ud835\udc58,\ud835\udc57\ud835\udc59\ud835\udc5c\ud835\udc54( \u02c6 \ud835\udc9a\ud835\udc58,\ud835\udc57), (15) and \ud835\udefcis an adjustable hyperparameter used to control the weight of the reconstructed loss. In Lsup, \ud835\udc9a\ud835\udc58,\ud835\udc57denotes ground-truth label that has been one-hot encoded. and \u02c6 \ud835\udc9a\ud835\udc58,\ud835\udc57denotes the predicted probability distribution of event index \ud835\udc58\u2208{1, 2..., \ud835\udc41} belongs to class \ud835\udc57\u2208{1, 2, ...\ud835\udc36}. During the testing phase, we do not perform any special processing on the input data. We simply input it into all encoders to obtain their representations like eqs. (10) to (13) to generate the classification predictions. 4.4 Uniformity Regularizer In order to enhance the model\u2019s ability to learn the distinct patterns of rumors and non-rumors, we introduce a uniformity regularizer to further improve the model\u2019s performance. Uniformity loss prefers the uniform distribution on the unit hypersphere by pulling away the distance between the representations of different events, so as to preserves maximal information and eliminates the feature collapse issue [54]. The uniformity loss is defined as the logarithm of the average pairwise Gaussian potential: Luni = log E (\ud835\udc8e\ud835\udc56,\ud835\udc8e\ud835\udc57)\u223c\ud835\udc5ddata \ud835\udc52\u2212\ud835\udc61\u2225\ud835\udc8e\ud835\udc56\u2212\ud835\udc8e\ud835\udc57\u22252 , (16) where \ud835\udc5d\ud835\udc51\ud835\udc4e\ud835\udc61\ud835\udc4eis the distribution of data, \ud835\udc61is a hyperparameter for Gaussian potential kernel and \ud835\udc8e\ud835\udc58denotes the graph representations of event \ud835\udc58. Then, we introduce a uniformity loss into the objective of encoder \ud835\udc53\ud835\udc59\ud835\udc5c\ud835\udc50\ud835\udc4e\ud835\udc591, \ud835\udc53\ud835\udc59\ud835\udc5c\ud835\udc50\ud835\udc4e\ud835\udc592 and \ud835\udc53\ud835\udc54\ud835\udc59\ud835\udc5c\ud835\udc4f\ud835\udc4e\ud835\udc59. The objective defined by eq. (14) are finally updated as: L = Lsup(G; \ud835\udeaf1, \ud835\udeaf2) + \ud835\udefc1(Lrec1(G; \ud835\udeaf1) + Lrec2(G; \ud835\udeaf2)) + \ud835\udefc2Luni(G; \ud835\udeaf1, \ud835\udeaf2), (17) where \ud835\udefc1 and \ud835\udefc2 are adjustable hyperparameters used to control the weight of the reconstructed loss and uniformity loss. The parameters updating defined by eq. (5) and eq. (9) are updated as: \ud835\udeaf\u2605 1 , \ud835\udeaf\u2605 2 = arg min \u03981,\u03982 L(G; \ud835\udeaf1, \ud835\udeaf2), (18) 5 EXPERIMENTS In this section, we first conduct experiments to evaluate the effectiveness of the proposed GARD model by comparing it with other baseline models for rumor detection, and give some discussion and analysis. Secondly, we conducted ablation study to evaluate and analyze the effectiveness of each module in GARD. Thirdly, we perform a sensitivity analysis of the hyper-parameters in GARD, discussing the impact of each hyper-parameter on the experimental results. Finally, we evaluate the performance of GARD in the task of early rumor detection. 5.1 Evaluation Setups 5.1.1 Datasets. We conducted an evaluation of the GARD model using three publicly available real-world datasets: Twitter15 [23], Twitter16 [23], and PHEME [59]. These datasets were collected from Twitter, which is considered the most influential social media site in the US. The PHEME dataset consists of two versions based on five and nine breaking news events, and we selected the version with nine events for our work. Both Twitter15 and Twitter16 datasets have four tags: Non-rumor (N; Confirmed to be true), False Rumor (F; Confirmed to be a rumor), True Rumor (T; Initially thought to be a rumor but later confirmed to be true), and Unverified Rumor (U; The truthfulness is yet to be determined). The PHEME dataset only has two tags: Rumor (R) and Non-Rumor (N), used for binary classification of rumors and non-rumors. For detailed statistics, please refer to table 1. 5.1.2 Baselines. We compare GARD with state-of-the-art rumor detection models, including: \u2022 DTC [3]: A rumor detection method employs a Decision Tree classifier to detect rumors by analyzing a set of handcrafted features. \u2022 SVM-TS [22]: A method utilizes a linear SVM classifier and handcrafted features to build a time-series model. \u2022 BERT [6]: A popular pre-trained model that is used for rumor detection. \u2022 RvNN [24]: A rumor detection approach based on tree-structured recursive neural networks with GRU units that learn rumor representations via the propagation structure. \u2022 GCAN [20]: A GNN-based model that can describe the rumor propagation mode and use the dual co-attention mechanism to capture the relationship between source text, user characteristics and propagation path. \u2022 BiGCN [1]: A GNN-based rumor detection model utilizing the Bi-directional propagation structure. \u2022 RECL [47]: A rumor detection model perform self-supervision contrastive learning at both the relation level and event level to enrich the self-supervision signals for rumor detection. \u2022 GACL [34]: A GNN-based model using adversarial and contrastive learning, which can not only encode the global propagation structure, but also resist noise and adversarial samples, and captures the event invariant features by utilizing contrastive learning. \u2022 GARD (ours): A rumor detection model introduces self-supervised semantic evolvement learning to facilitate the acquisition of more transferable and robust representations. \fWWW \u201924, May 13\u201317, 2024, Singapore, Singapore Xiang Tao, Liang Wang, Qiang Liu, Shu Wu, & Liang Wang Table 1: Statistics of the datasets Statistics \ud835\udc47\ud835\udc64\ud835\udc56\ud835\udc61\ud835\udc61\ud835\udc52\ud835\udc5f15 \ud835\udc47\ud835\udc64\ud835\udc56\ud835\udc61\ud835\udc61\ud835\udc52\ud835\udc5f16 \ud835\udc43\ud835\udc3b\ud835\udc38\ud835\udc40\ud835\udc38 # source posts 1490 818 6425 # non-rumors 374 205 4023 # false rumors 370 205 2402 # unverified rumors 374 203 # true rumors 372 205 # users 276,663 173,487 48,843 # posts 331,612 204,820 197,852 5.1.3 Experimental Settings. We follow the evaluation protocol in BIGCN[1]. We randomly split the dataset into five parts and construct 5-fold cross-validation. The Accuracy (Acc.), Precision (Prec.), Recall (Rec.) and \ud835\udc391-measure (\ud835\udc391) are adopted as evaluation metrics in all three datasets. Same as GACL [34], graph topologies of posts are constructed based on users, sources and comments in the all three datasets, where the text content contained in each graph node is represented by BERT. Furthermore, the learning rate is set to 5\ud835\udc52\u22124 and the mask ratio in global semantic evolvement learning module is set to 0.25. We adopt 2-layer MLP as backbone of two encoders \ud835\udc53\ud835\udc59\ud835\udc5c\ud835\udc50\ud835\udc4e\ud835\udc59and tow decoders \ud835\udc54\ud835\udc59\ud835\udc5c\ud835\udc50\ud835\udc4e\ud835\udc59, while adopt 2-layer GCN as encoder \ud835\udc53\ud835\udc54\ud835\udc59\ud835\udc5c\ud835\udc4f\ud835\udc4e\ud835\udc59and 1-layer GCN as decoder \ud835\udc54\ud835\udc54\ud835\udc59\ud835\udc5c\ud835\udc4f\ud835\udc4e\ud835\udc59. We set \ud835\udefc1 = 0.05, \ud835\udefc2 = 0.5 for Twitter15 and Twitter16, and \ud835\udefc1 = 0.1, \ud835\udefc2 = 1 for PHEME. 5.2 Overall Performance table 2 and table 3 show the performance of the proposed GARD and all the compared methods on three public real-world datasets, where the bold part represents the best performance. The experimental results demonstrate that the proposed GARD performs exceptionally well among all baseline models, confirming the advantages of incorporating Graph Autoencoder to learn the semantic evolvement information of news propagation. Not surprisingly, the machine learning-based models, DTC and SVM-TS, obtained the worst results. On the other hand, the deep learning-based models, RvNN and BERT, achieved moderate performance in the tests. Both GCAN and BiGCN are models based on GNN. They relied on a powerful GNN encoder to capture global structural features of the rumor tree. RECL and GACL are both models based on GNN and contrastive learning, which improve the model\u2019s robustness through specific data augmentation strategies and contrastive learning methods. They serve as state-of-the-art benchmarks to validate the advantages of the proposed GARD model in this paper. The GARD model proposed in this paper achieved the best performance on all benchmarks, because with the progress of information propagation, particularly in the case of larger data volumes and higher data quality, there is a greater possibility of significant semantic changes in news\u2019 propagation. Therefore, learning semantic evolvement information becomes more important. Paying attention to it helps improve the performance of rumor detection tasks, and so our GARD model achieved the best performance without the need for complex data augmentation strategies. Table 2: Rumor detection results on Twitter15 and Twitter16 datasets (N: Non-Rumor; F: False Rumor; T: True Rumor; U: Unverified Rumor) \ud835\udc47\ud835\udc64\ud835\udc56\ud835\udc61\ud835\udc61\ud835\udc52\ud835\udc5f15 Model Acc. N F T U \ud835\udc391 \ud835\udc391 \ud835\udc391 \ud835\udc391 DTC 0.454 0.415 0.355 0.733 0.317 SVM-TS 0.642 0.811 0.434 0.639 0.600 RvNN 0.723 0.682 0.758 0.821 0.654 BERT 0.735 0.731 0.722 0.730 0.705 GCAN 0.842 0.844 0.846 0.889 0.800 BIGCN 0.886 0.891 0.860 0.930 0.864 RECL 0.902 0.856 0.910 0.947 0.894 GACL 0.901 0.958 0.851 0.903 0.876 GARD 0.911 0.889 0.923 0.905 0.901 \ud835\udc47\ud835\udc64\ud835\udc56\ud835\udc61\ud835\udc61\ud835\udc52\ud835\udc5f16 Model Acc. N F T U \ud835\udc391 \ud835\udc391 \ud835\udc391 \ud835\udc391 DTC 0.473 0.254 0.080 0.190 0.482 SVM-TS 0.691 0.763 0.483 0.722 0.690 RvNN 0.737 0.662 0.743 0.835 0.708 BERT 0.804 0.777 0.525 0.824 0.787 GCAN 0.871 0.857 0.688 0.929 0.901 BIGCN 0.880 0.847 0.869 0.937 0.865 RECL 0.921 0.875 0.933 0.949 0.901 GACL 0.920 0.934 0.869 0.959 0.907 GARD 0.932 0.936 0.935 0.950 0.908 Additionally, we found that the accuracy on the PHEME dataset is relatively lower compared to Twitter. This is because the PHEME dataset consists of data from only 9 event topics, leading to a significant overlap in the language descriptions and propagation structure. And our GARD achieve more improvement on the PHEME dataset than Twitter dataset because our model takes into account not only the structural information but also the crucial semantic evolvement information which exhibits greater distinctiveness on the PHEME dataset. 5.3 Ablation Study To evaluate the efficacy of the various modules of GARD, we conduct a comparative analysis by comparing it with the following variants: \u2022 GARD-SUP: This model removes the two semantic evolvement learning modules and the uniformity regularizer, and solely conducts supervised training by inputting a complete propagation graph into two encoders. \u2022 GARD-NGS: This model removes the global semantic learning module, which makes the model lose the ability of capturing broader significant semantic evolvement information. \u2022 GARD-NLS: This model removes the local semantic learning module, which makes the model lose the ability of capturing the \fSemantic Evolvement Enhanced Graph Autoencoder for Rumor Detection WWW \u201924, May 13\u201317, 2024, Singapore, Singapore Table 3: Rumor detection results on PHEME dataset \ud835\udc43\ud835\udc3b\ud835\udc38\ud835\udc40\ud835\udc38 Method Class Acc. Prec. Rec. \ud835\udc391 DTC R 0.254 0.080 0.190 0.482 N 0.483 0.722 0.690 SVM-TS R 0.685 0.553 0.539 0.539 N 0.758 0.762 0.757 RvNN R 0.763 0.689 0.587 0.631 N 0.796 0.858 0.825 BERT R 0.807 0.736 0.695 0.713 N 0.842 0.866 0.853 GCAN R 0.834 0.769 0.758 0.761 N 0.871 0.874 0.872 BIGCN R 0.824 0.753 0.734 0.741 N 0.861 0.872 0.865 RECL R 0.852 0.800 0.753 0.778 N 0.868 0.910 0.888 GACL R 0.850 0.801 0.750 0.772 N 0.871 0.901 0.885 GARD R 0.869 0.817 0.764 0.790 N 0.886 0.928 0.886 local semantic changes between tweets and their responses in both the top-down and bottom-up propagation directions. \u2022 GARD-NU: This model removes the uniformity regularizer, which makes the model lose the ability of eliminating the features collapse issue, allowing the model to learn more uniform representations. The results are summarized in table 4. We have the following observations from this table: 1) By comparing GARD and GARD-SUP (also can compare GARDNU and GARD-SUP), we can observe that the accuracy of GARDSUP on the Twitter15, Twitter16 and PHEME datasets is reduced by 4.9%, 5.7% and 4.7%, respectively. Obviously, the introduction of self-supervised semantic evolvement learning in our GARD leads to significant performance improvement compared to solely using a supervised learning objective to train the model. 2) Removing either the local semantic evolvement learning module or the global semantic evolvement learning module results in a decrease in the model\u2019s performance, but both perform better than GARD-SUP, which includes no semantic learning module. The best performance is achieved when both modules are present together, which demonstrates that both local and global semantic evolvement learning modules are beneficial and the combination of local semantic evolvement information and global semantic evolvement information provides a greater improvement. 3) By comparing GARD and GARD-NU, we can observe that the uniformity regularizer improves the performance of the model to a certain extent. In particular, it increased by 0.8% on the PHEME dataset. This is because the PHEME dataset has only 9 event topics, which results in a more similar event propagation Table 4: Results of ablation study on three datasets Model Acc. \ud835\udc47\ud835\udc64\ud835\udc56\ud835\udc61\ud835\udc61\ud835\udc52\ud835\udc5f15 \ud835\udc47\ud835\udc64\ud835\udc56\ud835\udc61\ud835\udc61\ud835\udc52\ud835\udc5f16 \ud835\udc43\ud835\udc3b\ud835\udc38\ud835\udc40\ud835\udc38 GARD 0.911 0.932 0.869 GARD-SUP 0.862 0.875 0.822 GARD-NGS 0.894 0.913 0.843 GARD-NLS 0.895 0.901 0.850 GARD-NU 0.905 0.926 0.861 Weight \u03b11 Accuracy Accuracy Weight \u03b12 Figure 3: Sensitivity analysis of hyperparameters \ud835\udefc1 and \ud835\udefc2, which represent the weight of reconstructed loss and uniformity loss. structure and language description compared to Twitter. The uniformity enhances the model\u2019s ability to learn distinguishing features, leading to a more significant improvement. 5.4 Sensitivity Analysis We conduct sensitivity analysis with hyper-parameters on the key designs of GARD. fig. 3 shows the effect of varied hyper-parameter values, from which we have the following observations. 5.4.1 Effect of weight of reconstruction loss \ud835\udefc1. This weight affects the result of rumor detection by affecting the weight of reconstruction loss in the total loss. As shown in the left picture of fig. 3, we conducted sensitivity analysis by selecting eight data points between 0 and 1. It can be observed that as the hyper-parameter \ud835\udefc1 gradually increases, the model\u2019s performance on three datasets starts to improve due to graph autoencoder self-supervised learning allows the model to learn semantic evolvement information, thereby improving the model\u2019s performance. For Twitter15 and Twitter16 datasets, the best performance is achieved when \ud835\udefc1 is set to 5\ud835\udc52\u22122, while for the PHEME dataset, \ud835\udefc1 of 1\ud835\udc52\u22121 yields the best performance. It is worth noting that when \ud835\udefc1 exceeds a certain threshold, the model\u2019s performance starts to decline noticeably. This is because of overfitting of the model to the self-supervised features reconstruction task during training. 5.4.2 Effect of weight of uniformity loss \ud835\udefc2. This weight affects the result of rumor detection by affecting the weight of uniformity loss in the total loss. As shown in the right picture of fig. 3, we conducted sensitivity analysis by selecting eight data points between 0 and 10. We can observe that initially, as \ud835\udefc2 increases, the model\u2019s performance on Twitter shows slow improvement. However, on the PHEME dataset, there is a more significant improvement in model performance as \ud835\udefc2 increases. This is due to the fact that, as mentioned earlier, the PHEME dataset has a smaller \fWWW \u201924, May 13\u201317, 2024, Singapore, Singapore Xiang Tao, Liang Wang, Qiang Liu, Shu Wu, & Liang Wang Figure 4: Results of rumor early detection task on three datasets number of event topics, making the value of \ud835\udefc2 have a larger impact on performance. Similarly, when \ud835\udefc2 exceeds a certain threshold, the model\u2019s performance starts to decline noticeably. This is because excessively pursuing the learning of feature differences can actually harm the quality of the learned representations, leading to a decrease in classification accuracy. 5.5 Early Rumor Detection Early rumor detection is also an important way for evaluating models. Its purpose is to detect rumors during the early stages of their spread, thereby preventing potentially greater harm. In our experiments in this paper, similar to the [34], we set up 8 different time points (i.e., 10, 20, ..., 120 minutes) to evaluate whether the model can correctly identify rumors based on the limited information available from earlier time points up to these specific moments. fig. 4 shows the performances of our GARD and baseline models at various deadlines for the Twitter15, Twitter16 and PHEME datasets in the early rumor detection task. We can observe that at time 0, all the models perform poorly. But at 10 minutes, our GARD model shows a more significant improvement compared to other models, and it maintains a high and stable accuracy rate throughout the subsequent time periods. This is because in the early stages of event propagation, there is less commenting and interaction, resulting in similar propagation structures for events. Therefore, relying solely on structural information to detect rumors has significant limitations. Our GARD model, on the other hand, not only considers structural information but also takes into account the semantic evolvement information. This comprehensive understanding allows the model to effectively detect rumors in the early stages. The performances demonstrates that semantic evolvement information are not only beneficial to long-term rumor detection, but also helpful to the early detection of rumors. 6"
19
+ }
abs_9K/validation_abstract_short_2404.16113v1.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.16113v1",
3
+ "title": "Joint operation of a fast-charging EV hub with a stand-alone independent battery storage system under fairness considerations",
4
+ "abstract": "The need for larger-scale fast-charging electric vehicle (EV) hubs is on the\nrise due to the growth in EV adoption. Another area of power infrastructure\ngrowth is the proliferation of independently operated stand-alone battery\nstorage systems (BSS), which is fueled by improvements and cost reductions in\nbattery technology. Many possible uses of the stand-alone BSS are being\nexplored including participation in the energy and ancillary markets, load\nbalancing for renewable generations, and supporting large-scale load-consuming\nentities like hospitals. In this paper, we study a novel usage of the\nstand-alone BSS whereby in addition to participating in the electricity reserve\nmarket, it allows an EV hub to use a part of its storage capacity, when\nprofitable. The hub uses the BSS storage capacity for arbitrage consequently\nreducing its operating cost. We formulate this joint operation as a\nbi-objective optimization model. We then reformulate it into a second-order\ncone Nash bargaining problem, the solution of which guarantees fairness to both\nthe hub and the BSS. A sample numerical case study is formulated using actual\nprices of electricity and simulated data for the reserve market and EV charging\ndemand. The Nash bargaining solution shows that both participants can benefit\nfrom the joint operation.",
5
+ "authors": "Diwas Paudel, Luke Wolf, Tapas K. Das",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-04-24",
8
+ "primary_cat": "eess.SY",
9
+ "cats": [
10
+ "eess.SY",
11
+ "cs.SY"
12
+ ],
13
+ "label": "Original Paper",
14
+ "paper_cat": "LLM Fairness",
15
+ "gt": "The need for larger-scale fast-charging electric vehicle (EV) hubs is on the\nrise due to the growth in EV adoption. Another area of power infrastructure\ngrowth is the proliferation of independently operated stand-alone battery\nstorage systems (BSS), which is fueled by improvements and cost reductions in\nbattery technology. Many possible uses of the stand-alone BSS are being\nexplored including participation in the energy and ancillary markets, load\nbalancing for renewable generations, and supporting large-scale load-consuming\nentities like hospitals. In this paper, we study a novel usage of the\nstand-alone BSS whereby in addition to participating in the electricity reserve\nmarket, it allows an EV hub to use a part of its storage capacity, when\nprofitable. The hub uses the BSS storage capacity for arbitrage consequently\nreducing its operating cost. We formulate this joint operation as a\nbi-objective optimization model. We then reformulate it into a second-order\ncone Nash bargaining problem, the solution of which guarantees fairness to both\nthe hub and the BSS. A sample numerical case study is formulated using actual\nprices of electricity and simulated data for the reserve market and EV charging\ndemand. The Nash bargaining solution shows that both participants can benefit\nfrom the joint operation.",
16
+ "main_content": "Introduction Rapid growth of electric vehicles (EVs) has prompted a critical need for an extensive infrastructure of EV charging facilities Conzade et al. [2021]. A substantial portion of these facilities is anticipated to be hubs housing several (often many) fast charging stations. The growth in EV charging infrastructure will play a pivotal role in minimizing range anxiety among EV owners further promoting EV adoption. The existing Tesla Supercharging stations are examples of fast-charging hubs Tesla. The charging hubs can source the needed power in multiple ways. A primary source of power is the day-ahead (DA) electricity market where hub operators can commit to buying a certain amount of the needed power for every hour of the following day. The real-time (RT) electricity market serves as one of the secondary sources to supply any additional power requirement beyond the day-ahead commitment. The other secondary source of power can be a battery storage system (BSS), which can be built-in or external to the hub. In addition to serving as a secondary source of power, BSS can allow the hub operators to use the storage capacity for arbitrage (i.e., to store power at cheaper prices and discharge when prices are high). With the advancement of battery technology, large-scale stand-alone battery storage systems are becoming commonplace. Such BSS can partake in supporting one or more of the entities including the electric grid (by supplying power for the reserve/ancillary markets for load balancing and frequency regulation), renewable electricity-generating farms, and a variety of large load-consuming entities like hospitals, factories, etc. As the cost of batteries continues to fall, large stand-alone BSS is becoming a more mainstream element of our newly built power infrastructure NREL [2023]. In the rest of the paper, we use the word hub to refer to the fast-charging EV hub and the word BSS to refer to the stand-alone battery storage system. EV charging hubs with numerous stations will soon join the ranks of significant load-consuming centers and thus will benefit from working with independently operated stand-alone BSS. In this paper, we consider a joint operation between a fast-charging EV hub and a stand-alone BSS. The hub uses BSS capacity to arbitrage by storing power from the DA and RT markets and discharging power to either charge EVs and/or sell power back to the RT market. The BSS is considered to participate in the reserve market, by submitting reserve up and reserve down bids, and also to allow the hub operator to use a part of its storage capacity. It is considered that the objective of the hub operator is to reduce its cost of power in meeting the EV charging demand for the day by optimally sourcing DA and RT power and deciding on the arbitrage strategy. The BSS, on the other hand, aims to maximize its gross profit by optimally using the storage capacity among its two participating activities. To our knowledge, a study examining joint operation between a fast-charging hub and a stand-alone multipurpose BSS, as explained above, has not been presented in the literature. We undertake such a study by developing a bi-objective optimization model. We then reformulate the model to obtain a Nash bargaining solution that is fair to both participants. The model is implemented on a sample case study problem built with real-world electric power market data and simulated data for EV charging demand and reserve market operations. The results demonstrate the value of cooperation and thus will help to establish new ventures in cooperative operation between hubs and BSS. 2 \fThe rest of this paper is organized as follows. A brief review of the related literature is provided in Section 2. We describe the problem in Sections 3 and provide the mathematical formulation in Section 4. The details of our solution approach are provided in Section 5 followed by a numerical case study in Section 6. Finally, the concluding remarks are provided in Section 7. 2 Related literature In this section, we present a discussion of the relevant literature that explores the following aspects of our problem: power management of EV charging hubs and the operation of the stand-alone BSS. Based on the review, we highlight the gap in the literature that our paper aims to address. The power management of EV charging hubs is a widely studied topic in the open literature. These studies primarily consider using electricity from DA and RT markets, while some also consider the use of in-house BSS, to meet the EV charging demands. The study presented in Zheng et al. [2020] approaches hub power management via a profitmaximizing day-ahead power procurement strategy accounting for RT market volatility and no BSS availability. The strategy is derived using a scenario-based stochastic optimization approach. A distributionally robust DA commitment strategy for hub power management is presented in Paudel et al. [2023], which in addition to the DA and RT power considers the in-house BSS availability. A system state-dependent real-time power management strategy is obtained in Paudel and Das [2023] via a deep-reinforcement learning model that considers both DA and RT markets as well as in-house BSS. There exists a significant collection of literature that considers EV charging hubs which are also parking garages where EVs remain parked for a significant length of time while also receiving charge. These papers consider effectively scheduling the charging time of each EV depending on their arrival and departure schedules and market price variations to reduce the cost of charging while also supporting network load balancing Subramanian and Das [2019]. Some of these papers also consider arbitrage using available power in the parked EVs by participating in a variety of power markets including the ancillary market DeForest et al. [2018] Sarker et al. [2015]. To our knowledge, there are no hub power management studies that consider working jointly with independently operated stand-alone battery storage systems, which are becoming commonplace in modern-day power infrastructure. In the following paragraph, we review some of the papers that explore some of the potential services that stand-alone BSS can provide to the power grid. The literature on the operation of stand-alone BSS primarily focuses on their participation in the reserve/frequency markets. A robust formulation for the operation of a BSS participating in spinning and reserve markets is presented in Kazemi et al. [2017]. The BSS generates revenue through accepted bids, received as capacity payments, and also through the deployment of accepted bids at the prevailing real-time market prices. A similar study considering the reserve market participation by stand-alone BSS is also provided in Padmanabhan et al. [2019] and Xu et al. [2017]. A bidding strategy for battery storage systems in the secondary control reserve market is examined in Merten et al. [2020]. The study indicates that the feasibility of revenue generation through reserve market participation by the BSS in stand-alone mode is limited. However, it becomes viable when operating jointly with a virtual power plant that includes 3 \fwind, photovoltaic, and thermal power sources. An economic study conducted in Germany explored bidding on both day-ahead and automatic frequency restoration reserve markets by a stand-alone BSS Nitsch et al. [2021]. The study shows an improved economic potential for stand-alone BSS in 2030 than it was in 2019. In a similar economic study of BSS Hu et al. [2022], the authors indicate that present BSS cost and lifetime make it not suitable for the energy market participation but has significant economic potential in the reserve markets. Based on the reviewed papers, contemporary Battery Storage Systems (BSS) demonstrate the ability to offer costeffective services to electricity markets, especially in the reserve market. However, there\u2019s a noticeable gap in studies assessing the synergy between a stand-alone BSS participating in the reserve market and fast-charging EV hubs. Therefore, our study aims to address this gap by investigating the joint operation of BSS with a fast-charging hub. Furthermore, our research introduces a novel pathway for expanding the range of services a BSS can provide through its collaboration with a fast-charging EV hub. 3 Problem Description Figure 1: A schematic for joint operation of fast charging EV hub and battery storage system We consider a hub with a large number of identical DC-fast charging stations where EVs arrive only for charging and leave promptly after charging. The hub draws power from the day-ahead and real-time markets of the electricity grid to meet EV charging needs. The primary function of the stand-alone independent BSS is considered to be supporting the reserve market by offering the network operator the use of its storage capacity via reserve up and down services bids. The reserve up capacity represents the amount of stored power that the BSS is willing to supply in real-time in case of an unexpected shortfall in the network. The reserve down capacity, on the other hand, represents the amount of storage capacity that the BSS is willing to offer for storing any excess power in the network. The acceptance of up 4 \fand/or down bid offers does not imply the actual deployment, i.e., supply or storage of power to/from the grid by the BSS. The deployment occurs sparingly, the probability of which can be accessed from the historical market data. The focus of this paper is to study the joint operation of a hub with a BSS that is connected to the same bus of power network for their mutual benefit. In the joint operation mode, the hub uses part of the BSS storage capacity to support its charging needs through arbitrage, i.e. by storing power at a low cost and discharging it when cost-economic, thereby reducing the cost of its operation The BSS benefits from the additional revenue generated by allowing the hubs to utilize part of its capacity when not deployed for the reserve purposes. The total storage capacity is comprised of multiple compartments each of which can be operated independently by the BSS operator. The key problem addressed in this paper is to determine the optimal joint operational strategies for the hub and the BSS that yield a fair distribution of the added benefits generated from cooperation. 4 Mathematical model In this section, we first present two separate models for the independent operation of the hub and the battery storage system. The model P1 is focused on minimizing the hub operator\u2019s cost of meeting the charging demand by procuring an optimal amount of power from the day-ahead market for each time interval depending on the expected price volatilities of the real-time market. The model P2 maximizes the profit of the BSS operator by optimally selecting up and down bid quantities in the reserve market for each time interval. Thereafter, we present a joint operation model P3 where in addition to participating in the reserve market, for each time period, the BSS operator also leases to the hub operator a part of the storage capacity. The hub operator uses the leased capacity for arbitrage and makes a payment for each unit of the stored/discharged quantities. The bi-objective model P3 allows both the hub and the BSS operators to improve their objectives through cooperation. 4.1 P1: Fast-charging EV hub power management model In this model, it is assumed that the hub operator acts independently of BSS and aims to minimize its cost of charging by optimally choosing to use power from the DA and RT markets based on their expected prices. The model determines the optimal hourly quantities for the hub operator to commit in the DA market. dacom t = daev t + dart t , \u2200t \u2208T . (1a) dacom t \u2264U com t , \u2200t \u2208T . (1b) evl t = daev t + rtev t , \u2200t \u2208T . (1c) min f a p1 = min X t\u2208T \" \u03bbda t daev t + (\u03bbda t \u2212\u03bbrt t )dart t + \u03bbrt t rtev t # (1d) 5 \fAmong the constraints of P1, (1a) ensures that the DA commitment (dacom t ) by the hub operator is fully consumed by charging the EVs in the hub (daev t ) and selling in real-time market (dart t ). The upper bound for the day-ahead commitment quantities is provided by (1b). Similarly, (1c) ensures that the EV charging demand in the hub (evl t) is fulfilled by using the power from the DA commitment and RT market (rtev t ). Note that we consider aggregated EV charging demand for each hub. The goal of the hub operator is to satisfy the total charging demand in the hub in the most cost-effective way as represented by the objective function in (1d), where \u03bbda t and \u03bbrt t are the prices of DA and RT power, respectively. The first term in (1d) represents the total cost of using DA power to charge the EVs. The cost of selling DA power in the RT market is captured by the second term. The last term represents the cost of charging the EVs with RT power. Problem P1 is represented in a compact form as follows. min x f a p1(x), x \u2208Xf, (2) where, x and Xf represent the decision variables and the decision space, respectively, of P1. This compact notation is used in the description of the model solution approach in Section 5. 4.2 P2: BSS model for reserve market participation This model assists an independent BSS operator, participating only in the reserve market, in determining the hourly bids for reserve-up and reserve-down capacities to maximize profit. The reserve-up capacity denotes the power quantity that the BSS is ready to deliver in real-time to address an unforeseen surge in network demand. Conversely, the reserve-down capacity signifies the power amount that the BSS is prepared to absorb (store) in instances of surplus supply within the network. It is considered that the BSS comprises multiple compartments and within each compartment, there is an independent battery unit. These battery units are capable of independent operation, allowing for greater flexibility and control. Each compartment can either charge, discharge, or idle at any time. The total reserve-up and down bids made by the BSS operator are aggregations of compartment bids, which are bounded by the maximum discharge/charge rates of the respective compartments. The up and down bids are assumed to be accepted and deployed with given probabilities, as is considered in Sarker et al. [2015] DeForest et al. [2018]. xk t + yk t \u22641, \u2200k \u2208K, \u2200t \u2208T . (3a) b pup,k t <= M d,kyk t , \u2200k \u2208K, t \u2208T . (3b) b pdn,k t <= M c,kxk t , \u2200k \u2208K, t \u2208T . (3c) X k\u2208K pup,k t = \u03c0d,up t X k\u2208K b pup,k t , \u2200t \u2208T . (3d) X k\u2208K pdn,k t = \u03c0d,dn t X k\u2208K b pdn,k t , \u2200t \u2208T . (3e) 6 \fpdn,k t + rtb,k t \u2264M c,kxk t , \u2200k \u2208K, \u2200t \u2208T . (3f) pup,k t \u2264M d,kyk t , \u2200k \u2208K, \u2200t \u2208T . (3g) \u03d5b,k t \u2264M k, \u2200k \u2208K, \u2200t \u2208T . (3h) \u03d5b,k t = \u03d5b,k t\u22121 + pdn,k t + rtb,k t \u2212pup,k t , \u2200k \u2208K, \u2200t \u2208T . (3i) max f b p2 = max \u0014 rcap + rdep \u2212c\u03d5 \u2212cdeg \u0015 (3j) Let, xk t and yk t be the binary variables, where in each time period t \u2208T , a battery compartment k \u2208K can operate in one of the three modes: charging (xk t = 1 & yk t = 0), discharging (xk t = 0 & yk t = 1), and idling (xk t = 0 & yk t = 0) as shown in (3a). Let, b pup,k t and b pdn,k t be the reserve-up and reserve-down bid quantities with corresponding bid prices \u03bbup t and \u03bbdn t , respectively. The upper limits for the quantity bids are the maximum allowable charging M c,k and discharging M d,k rates, respectively (see (3b) and (3c)). It is assumed that the up and down bids are accepted, as offered, with probabilities (\u03c0a,up t ) and (\u03c0a,dn t ), respectively. The BSS receives a capacity payment for the offered quantity on standby and receives an additional payment if called upon to deploy. The probabilities for up and down deployment are (\u03c0d,up t ) and (\u03c0d,dn t ), respectively. The estimates of the actual dispatch of the up (pup,k t ) and down (pdn,k t ) capacities are given in (3d) and (3e). Each compartment can be charged from the actual deployment of the reserve-down capacity and/or with the purchase of power from the RT market (rtb,k t ) as given in (3f). The BSS is considered to discharge only to deploy the reserve-up capacities, as in (3g). The maximum amount of power that can be stored in a compartment is controlled by (3h). The balance of the stored power is provided in (3i), which ensures that the power in compartment k in time t, (\u03d5b,k t ), is equal to the power added to (pdn,k t + rtb,k t ) and substracted from (pup,k t ) its power level in the previous time period (\u03d5b,k t\u22121). As stated earlier, the BSS participates in the reserve market with the aim to maximize its profit as provided in the objective function (3j). The first term in f b p2 represents the revenue from providing the reserve capacities (rcap) in the day-ahead market, of which the components are shown in (4). rcap = X t\u2208T \" \u03bbup t \u03c0a,up t X k\u2208K b pup,k t + \u03bbdn t \u03c0a,dn t X k\u2208K b pdn,k t # , (4) where the first and second terms represent the revenue from accepted reserve up and down bids, respectively, with corresponding prices \u03bbup t and \u03bbdn t . The second term in f b p2 represents the revenue from the actual deployment of the reserve capacities (rdep), the components of which are shown in (5). rdepl = X t\u2208T \" \u03bbrt t \u03c0d,up t X k\u2208K pup,k t + \u03bbrt t \u03c0d,dn t X k\u2208K pdn,k t # , (5) where \u03bbrt t is the real-time price of electricity at time t. The cost of purchasing RT power to charge the BSS (c\u03d5) and the battery degradation cost (cdeg) in f b p2 are shown in (6) and (7), respectively. The method of calculating the degradation 7 \fcost is adopted from Ortega-Vazquez [2014]. c\u03d5 = X t\u2208T \u03bbrt t X k\u2208K rtb,k t . (6) cdeg = X t\u2208T X k\u2208K CK\f \f \f mk 100 \f \f \f \"P t\u2208T \u0000pup,k t + pdn,k t \u0001 BCk # , (7) where mk is the slope of the linear approximation of the battery life as a function of the cycles, BCk is the capacity, and Ck is the cost of compartment k \u2208K. We represent P2 in a compact form as (8) with y being the its decision variables and Yf being its decision space. max y f b p2(y) y \u2208Yf (8) 4.3 P3: Model for joint operation of fast-charging EV hub and BSS We formulate the joint operation of the charging hub and BSS as a bi-objective cooperative optimization model. The joint operation results from the hub\u2019s use of a portion of the BSS capacity. The hub operator minimizes the cost of meeting the charging demand by optimally choosing the hourly DA commitment levels and arbitrage strategy for the leased BSS capacity. Whereas, the BSS operator maximizes profit by optimally biding in the DA reserve market and leasing a portion of BSS capacity to the hub operator. xk t + yk t \u22641, \u2200k \u2208K, \u2200t \u2208T . (9a) b pup,k t <= M d,kyk t , \u2200t \u2208T . (9b) b pdn,k t <= M c,kxk t , \u2200t \u2208T . (9c) X k\u2208K pup,k t = \u03c0d,up t X k\u2208K b pup,k t , \u2200t \u2208T . (9d) X k\u2208K pdn,k t = \u03c0d,dn t X k\u2208K b pdn,k t , \u2200t \u2208T . (9e) \u03d5a,k t + \u03d5b,k t \u2264M k, \u2200k \u2208K, \u2200t \u2208T . (9f) \u03d5a,k t = \u03d5a,k t\u22121 + daa,k t + rta,k t \u2212aev,k t \u2212art,k t , \u2200k \u2208K, \u2200t \u2208T . (9g) \u03d5b,k t = \u03d5b,k t\u22121 + pdn,k t + rtb,k t \u2212pup,k t , \u2200k \u2208K, \u2200t \u2208T . (9h) daa,k t + rta,k t + pdn,k t + rtb,k t \u2264M c,kxk t , \u2200k \u2208K, \u2200t \u2208T . (9i) aev,k t + art,k t + pup,k t \u2264M d,kyk t , \u2200k \u2208K, \u2200t \u2208T . (9j) 8 \fdacom t = X k\u2208K daa,k t + daev t + dart t , \u2200t \u2208T . (9k) evl t = daev t + X k\u2208K aev,k t + rtev t , \u2200t \u2208T . (9l) min f a p3 = min X t\u2208T \"( \u03bbda t daev t + (\u03bbda t \u2212\u03bbrt t )dart t + \u03bbrt t rtev t ) + \u03bbda t X k\u2208K daa,k t + \u03bbrt t X k\u2208K rta,k t \u2212\u03bbrt t X k\u2208K art,k t + cdeg \u0012 (1 + \u03b1) X k\u2208K \u0010 aev,k t + art,k t \u0011\u0013# . (9m) max f b p3 = max X t\u2208T X k\u2208K \"( \u03c0a,up t \u03bbu t b pup,k t + \u03c0a,dn t \u03bbd t b pdn,k t + \u03c0d,up t \u03bbrt t pup,k t + \u03c0d,dn t \u03bbrt t pdn,k t \u2212\u03bbrt t rtb,k t \u2212cdegpup,k t ) + cdeg\u03b1 \u0010 aev,k t + art,k t \u0011# . (9n) The constraints in (9a), (9b), (9c), (9d), and (9e) are same as in P2. The total power stored in compartment k by the hub (\u03d5a,k t ) and the BSS (\u03d5b,k t ) must be less than or equal to the total storage capacity of the compartment, see (9f). The balance of power stored by the hub in compartment k is maintained using (9g). This ensures that the power stored by the hub (\u03d5a,k t ) at time t is equal to the power in the previous time (\u03d5a,k t\u22121) plus the power added from DA commitment (daa,k t ) and/or the RT market (rta,k t ) minus the power discharged to meet EV charging demand (aev,k t ) and/or the power sold back to the grid (art,k t ). Similarly, the balance of power stored by the BSS in a compartment is maintained by (9h). The upper limits of the power added to and discharged from a compartment by the hub and BSS are maintained by (9i) and (9j), respectively. The balance of hourly usage of DA commitment and fulfillment of EV charging demand are ensured in (9k) and (9l), respectively. The objective functions for the hub and the BSS operators in joint operation mode are provided by (9m) and (9n), respectively. The objective function for the hub in (9m), in addition to the terms of the objective function of P1 shown within braces, has four other terms: cost of storing DA power, cost of storing RT power, cost of selling BSS power to RT grid, and the cost of leasing battery compartments. The objective function for BSS in (9n) contains all the terms, within braces, from the objective function of P2. The only additional term accounts for the profit from leasing BSS capacity to the hub. Equation (10) below represents the compact form of P3, where z denotes the vector of decision variables and Zf denotes the decision space. min z f a p3, max z f b p3 z \u2208Zf. (10) 5 Solution approach The formulation P1 is a linear program and P2 is a mixed integer linear (MILP) program, both of which can be solved using any commercial solver. Let d1 be the solution of problem P1, i.e., d1 = {minx f a p1 : x \u2208Xf}, and d2 be the solution of problem P2, i.e., d2 = {maxy f b p2 : y \u2208Yf}. The problem P3 is a bi-objective mixed integer linear program and can be solved using algorithms such as \u03f5-constraint method Mavrotas [2009], the outcome of which would 9 \fbe a Pareto frontier where each point on the frontier is a vector comprising objective function values for both the players i.e., the hub and the BSS. The Pareto frontier with multiple solutions does not provide a rule to select a solution that is convenient to both the players. A Nash bargaining solution (NBS) of P3 can identify a single solution from the frontier that is fair to both participants Nash Jr [1950] Charkhgard et al. [2022]. This solution satisfies a set of axioms to obtain a fair bargain for all the players. The axioms, as proposed by Nash Nash Jr [1950] include individual rationality, Pareto optimality, symmetry, linear invariance, and independence of irrelevant alternatives. This is the advantage of NBS compared to any other method (e.g., Khanal and Charkhgard) that provides a single Pareto optimal solution. The Nash bargaining problem for P3 can be formulated as follows, where d1 and d2 are the disagreement points that represent the payoff of each player under no cooperation. max (d1 \u2212f a p3)(f b p3 \u2212d2) z \u2208Zf, f a p3 \u2264d1, f b p3 \u2265d2. (11) The terms (d1 \u2212f a p3) and (f b p3 \u2212d2), in the objective function above, capture the added benefits from cooperation for the cost-minimizing hub operator and the profit-maximizing BSS operator with respect to their disagreement points. The above formulation (11) is a maximum multiplicative program and is not solvable as it is. Hence we present a second-order cone program (SOCP) reformulation as follows. max \u03b3 0 \u2264\u03b3 \u2264 q \u03c4 0 1 \u03c4 0 2 0 \u2264\u03c4 0 1 = d1 \u2212f a p3 0 \u2264\u03c4 0 2 = f b p3 \u2212d2 z \u2208Zf (12) The above formulation is a SOCP since any constraint of the form {u, v, w \u22650 : u \u2264\u221avw} is equivalent to n u, v, w \u22650 : q u2 + ( (v\u2212w)2 2 \u2264v+w 2 o . The formulation in (12) can be solved to optimality using most commercial solvers. Interested readers are referred to Ben-Tal and Nemirovski [2001] for more details on SOCP reformulation. 6 Numerical Case Study We build a representative case study to demonstrate the effectiveness of our proposed model. The hub and the BSS are assumed to be connected to the same bus of the power network and hence are subjected to the same electricity prices. 10 \fFigure 2: Hub and BSS location near a major street intersection in Tampa, Florida, USA, as considered in the numerical case study The BSS specification considered is similar to one of the battery storage systems operated by an electric power provider in the Tampa Bay area, Florida, USA. It is comprised of six compartments, each with a maximum storage capacity of 4000 kW. Each compartment maintains a minimum power of 500 kW and has a maximum charge/discharge rate of 3000 kW/hr. The charging hub is considered to be located near a busy roadway intersection in the Tampa Bay area (see figure 2) and is assumed to house 150 fast charging stations capable of charging the EVs at the maximum rate of 100kW/hr. It is assumed that, to limit arbitrage by the hub, maximum DA commitment is capped at two times the hourly expected EV charging demand. The number of EVs seeking to charge in the hub at any hour is determined as follows. The hourly average traffic flow data through the intersection (Nt), as depicted in Figure 2, is obtained from the Florida Department of Transportation FDOT [2023]. We adopted traffic data for the month of September 2023. It is assumed that the \u03b1% of the traffic are EVs and \u03b2% of those EVs use public charging facilities. Then the average number of the EVs passing through the intersection in each hour t that might seek to charge at the hub is \u03b1\u03b2Nt. These average values are used as the rate parameters for Poisson distributions to generate the hourly numbers of EVs that are potential candidates to charge in the hub ( \u02c6 Nt). The actual hourly number of EVs that charge in the hub (nt) is found by using a binomial distribution with parameters ( \u02c6 Nt, pt), where pt is the probability of an EV with potential to charge actually receiving charge. The values of pt are adopted from the EV charging behavior study by Idaho National Lab Deng et al. [2018]. We consider \u03b1 = 0.25 Conzade et al. [2021] and \u03b2 = 0.42 Narayan et al. [2022]. EVs arriving at the hub are assumed to have three different battery sizes, 50 kW, 75 kW, and 100 kW with probabilities of 0.3, 0.4, and 0.3, respectively. As per the study conducted by Idaho National Laboratory in the U.S. Idaho National Laboratory [2015], the amount of charge that an EV seeks to receive varies between 5% to 95% of its battery size. The hourly values of the total demand for charge in the hub for all 30 days are shown in Figure 3a. The blue lines in the figure represent the 10th, 50th, and 90th percentiles. 11 \fSince the Tampa Bay area electricity supply is regulated and does not have DA and RT markets, the hourly DA and RT prices are adopted from the electricity market (ERCOT) in the State of Texas, U.S. ERCOT. The DA and RT price profiles are given in Figures 3b and 3c, respectively, with the 10th, 50th, and 90th percentiles marked in blue. (a) (b) (c) Figure 3: (a) Total EV charging demands, (b) Day-ahead prices, and (c) Real-time prices The battery storage system operator estimates the probability of acceptance of the reserve up and down bids, as well as the probability of deployment of the accepted bids via simulation of the market clearing mechanism. The simulation uses published historical data from the ERCOT market for the price/quantity bids for all market participants, total accepted quantities in the DA reserve market, and the total deployed up and down quantities. The simulation yields the market clearing prices and the accepted bids. The number of accepted bids divided by the total number of bids yields the probability of acceptance of a reserve bid. Similarly, the total quantity of reserve power deployed divided by the total quantity of accepted bids yields the probability of deployment. The simulation results are summarized in Figure 4. Figures 4a and 4b depict the probability of acceptance of reserve up and reserve down bids, respectively. The price of accepted up and down bids are shown in figure 4c and 4d, respectively. The deployment probability for the accepted reserve up and down bids are shown in figures 4e and 4f, respectively. The mathematical models are solved using Gurobi 9.5.2 in Python 3.8 using a computer with an Intel i911900H@2.50GHz processor supported by 32 GB RAM. All the models are solved to an optimality gap of 0.05% or less. In what follows, we describe the scenarios for which the optimization models (P1, P2, and P3, described earlier) are solved and then present the corresponding results. 6.1 Results We first solve our models P1, P2, and P3 with all the input parameters set at their median values as shown in Figures 3 and 4. We solve P3 using a Nash bargaining approach (as presented in (12)). We also solve P3 using a total cost minimization (TCM) approach (13) to demonstrate the benefit of the NBS in terms of objective function value fairness for both the hub and the BSS in the joint operation mode. In the TCM approach, we minimize the combined cost of the 12 \f(a) Up bid acceptance probability (b) Down bid acceptance probability (c) Accepted price of up bids (d) Accepted price of down bids (e) Deployment probability of up bids (f) Deployment probability of down bids Figure 4: Results of reserve market clearing simulation using ERCOT data hub and the BSS (negative of its profit) given as min z f a p3 \u2212f b p3 z \u2208Zf, (13) which is a MILP and can be solved using any commercial solver. The results are shown in Table 1. When the hub and the BSS act independently (as in P1 and P2, respectively), both the hub cost and BSS profit are inferior to those obtained from the joint operation (TCM and NBS). In the TCM solution, the hub being a larger entity influences the solution and receives the most benefit from cooperation with 11.02% cost reduction while the BSS increases its profit only by 0.43% compared to the solutions from independent operations. Whereas, the NBS offers a fair distribution of the benefits of cooperation with a 7.32% cost reduction for the hub and a 5.23% profit increase for the BSS. Independent Operation Joint Operation per TCM (P3) Joint Operation per NBS (P3) Hub cost ($) 30,262.87 (from P1) 26,929.22 (-11.02%) 28,048.70 (-7.32%) BSS profit ($) 7,073.65 (from P2) 7,103.95 (0.43%) 7,443.91 (5.23 %) Table 1: Hub costs and BSS profits Since DA commitment is a primary source to procure power by the hub to control cost in meeting the charging demand, we examined the DA commitment behavior and DA power usage in independent as well as joint operation modes. Figure 5 shows the hourly DA commitments and DA usage when all the model parameters (prices, charging demand, and reserve market probabilities) are at their median values. The outer boundary line of each graph is obtained by joining the hourly DA commitment values. The shaded areas under the line represent the amounts of DA power used for charging EVs, storing in the BSS, and selling back to the RT market. We note that since the median RT prices are 13 \fgenerally higher than DA prices, the hub\u2019s choices for DA commitment in all operation modes are similar, except for hour 18. It can be observed that the hub generally commits to more than the EV charging requirement and sells the excess mostly to the RT market and only sparingly stores DA power in the BSS. Figure 6 also shows that when all parameters are at their median values, most of the EV charging power is sourced from the DA market except for a few hours when charging is supplemented by power from RT and BSS. Figure 7 depicts the DA commitment pattern for various RT prices when DA price and other parameters are their median values. As expected, when the RT price is lower than DA (RT at the 10th percentile and DA at the median), the hub chooses to minimize its DA commitment. In both of the other cases, RT prices are higher than DA and hence the DA commitments are similar. Figure 5: DA commitment and utilization at the median values of model parameters Since the BSS aims to maximize its profit by cooperating with the hub while also participating in the reserve market, we examined BSS\u2019 reserve market bidding behavior in independent and joint operation modes (see Figure 8). It can be seen that when BSS cooperates with the hub (P3), it offers less bid to the reserve market compared to its independent operation (P2), which allows for the use of BSS storage capacity by the hub. It can also be noted that in the TCM approach, the hub, being the larger entity, skews the solution in its favor by using a larger share of the storage capacity, thus reducing the bid offers by the BSS. In the more equitable approach (NBS), the BSS is allowed to use more of its capacity, when appropriate, to increase its profit, and hence we see more bid offers compared to TCM. We also note that BSS makes more down bids in the early hours of the day to store power, and submits more up bids in later hours to discharge when prices are higher. Figure 9 depicts the BSS capacity usage under independent and joint operation modes. Similar to that noted from Figure 8, the NBS solution in Figure 9 allows for more fair usage of storage capacity by the BSS as opposed to being dominated by the hub, as in the TCM solution. 14 \fFigure 6: EV charging demand and sources for meeting the demand at median values of model parameters Figure 7: DA commitment with different RT prices with DA price at the median 6.2 Sensitivity Analysis The hub and the BSS while operating jointly guided by the NBS must consider a multitude of parameters (including electricity and reserve market prices, EV charging demand, and down/up acceptance and deployment probabilities) in making respective cost-minimizing and profit-maximizing decisions. Even if we consider only three values for each of the parameters (low (10th percentile), median, and high (90th percentile)), there are 39 possible combinations to examine. Hence, we group the parameters into two subsets, each having a more direct influence on a decision-maker. 15 \fFigure 8: Reserve bid patterns by BSS Figure 9: BSS power We examine the sensitivity of DA and RT prices and EV charging demand on the hub\u2019s cost by considering three possible values (low, median, and high) of the parameters, which resulted in 33 different combinations. For each of these combinations, all other model parameters that are concerned with the reserve market and hence primarily affecting the BSS\u2019 profit are kept at their median values. The sensitivity is measured by the percentage reduction in the hub\u2019s NBS cost compared to its cost when operating independently (P1). This is calculated as {(NBS cost P1 cost)/(P1 cost)}\u00d7 100 and are presented in Table 2. Since the NBS differs from the P1 solution due to its ability to arbitrage using BSS\u2019 16 \fEV charging demand Low Median High RT price RT price RT price Low Median High Low Median High Low Median High Low 4.17 42.54 170.87 2.50 25.32 110.45 1.75 17.93 76.90 Median 5.16 11.92 52.96 4.35 7.32 31.97 3.76 5.14 22.33 DA price High 12.02 11.33 23.04 11.67 7.58 14.01 10.63 5.76 9.78 Table 2: Sensitivity of DA and RT prices and EV charging demand on hub\u2019s cost reduction (in percentage) from NBS compared to its individual solution (P1) storage capacity, all the numbers in the table reflect the incremental cost reduction benefits by the increase in revenue from arbitrage. Clearly, for some DA/RT prices and EV charging demand combinations, the arbitrage potentials for the hub are either very high or very low. The results show that the very high potentials are generally for the combinations when the DA prices are low and RT prices are high. The arbitrage potential is low when both the DA and RT prices are low. It may also be noted that the hub\u2019s arbitrage potential decreases, irrespective of DA and RT price combinations, with an increase in EV charging demand. Figure 10: BSS usage by the hub under different DA prices, RT prices, and EV charging demand Among the combinations studied in Table 2, the highest cost reduction potential (170.87 %) occurs when the DA price is low, the RT price is high, and the EV charging demand is low. To further examine this case, we looked at the BSS usage by the hub across all hours of the day. This is depicted in the leftmost part of Figure 10, where the line graphs show RT prices to be significantly higher than the DA prices, and the bar graphs show multiple charge/discharge activities by the hub. We note that the significant price differential between DA and RT prices encourages the hub operator to increase its level of arbitrage via high usage of BSS storage capacity and thus reduce its cost. We also examine two other cases: low DA and RT prices and high EV charging demand (cost reduction of 1.75%); and high DA prices, low RT prices, and low EV charging demand (cost reduction of 12.02%). The BSS usage by the hub for these two cases is 17 \fdepicted in the middle and the rightmost segment of Figure 10, respectively. For the case with a price reduction of 1.75%, the low differential between DA and RT prices prompts a limited hub engagement with the BSS (i.e. lower level of charge/discharge activity) yielding a lower potential for cost reduction. Whereas in the case of a 12.02 % cost reduction, we note that the RT prices are significantly lower than the DA prices and also do not vary widely across the hours. This yields a moderate amount of arbitrage by the hub using the BSS capacity. Parameters F-statistic F-critical P-value Decision Up bid market clearing price (\u03bbup) 11.92 4.279 0.002 Significant Down bid market clearing price (\u03bbdn) 1.82 4.279 0.18 Not Significant Probability of acceptance of up bid (\u03c0a,up) 8.82 4.279 0.006 Significant Probability of acceptance of down bid (\u03c0a,dn) 0.96 4.279 0.33 Not Significant Probability of deployment of up bid (\u03c0d,up) 83.79 4.279 3.94 \u00d7 10\u22129 Significant Probability of deployment of down bid (\u03c0d,dn) 32.10 4.279 9.07 \u00d7 10\u22126 Significant Up bid market clearing price (\u03bbup) \u00d7 probability of deployment of up bid (\u03c0d,up) 6.210 4.279 0.020 Significant Probability of deployment of up bid (\u03c0d,up) \u00d7 probability of deployment of down bid (\u03c0d,dn) 6.36 4.279 0.019 Significant Table 3: Analysis of variance (ANOVA) to examine the sensitivity of reserve market parameters on BSS\u2019s profit increase (in percentage) from NBS compared to its individual solution (P2) Hereafter, we study the sensitivity of six reserve market parameters on the BSS\u2019s ability to increase profit by allowing the hub to use its storage capacity. This profit increase potential (in percentage) is calculated as {(NBS profit P2 profit)/ P2 profit} \u00d7 100 %. The parameters studied are up and down bid market clearing prices, probabilities of acceptance of up and down bids, and probabilities of deployment of up and down bids. We used a 26\u22121 fractional factorial design-based analysis of variance (ANOVA) study, see chapter 8 of Montgomery [2017] for the details of 2k factorial design. The 10th and 90th percentile values are considered as the two levels of the parameters and the highest interaction term is used as the fractional factorial design generator. In the thirty-two experiments for the 26\u22121 fractional factorial design, the percentage profit varied between 1.52% and 45%. The ANOVA results are presented in Table 3. Of the six reserve market parameters, the down-bid market clearing price and its probability of acceptance are found not significant with a type-I error level of 5%. We also found two of the two-parameter interactions to be significant, although with a small margin. Of the four statistically significant parameters, the probabilities of deployment of up and down bids are the most significant ones with very high F-statistic values of 83.79 and 32.10, respectively. This is expected as the actual up-and-down deployments are the major contributor to BSS revenue from the reserve market. Examination of the BSS behavior from NBS reveals that for high values of up and down deployment probabilities, the BSS uses a higher proportion of its storage capacity for the reserve market, leaving a lower capacity for the hub. 7 Concluding remarks In this paper, we develop a bi-objective joint operation model between a cost-minimizing fast-charging EV hub and a profit-maximizing grid-connected stand-alone battery storage system. The BSS primarily uses its capacity to participate in the reserve market. It also cooperates with the hub by allowing the hub to use its storage capacity for arbitrage. 18 \fThe bi-objective problem is reframed as a Nash bargaining problem, which is then reformulated into a second-order cone program. We develop a sample case study problem adopting DA and RT electricity prices from the ERCOT market and generating simulated values for the reserve market prices and their probabilities as well as the EV charging demand. We demonstrate the benefits/fairness of our proposed Nash bargaining solution with the solution from a total cost minimization approach as well as the independent solutions without cooperation. A detailed study of parameter sensitivity reveals operational guidance for both the hub and the BSS under various parameter value combinations. Our work demonstrates that the EV charging hubs can significantly benefit financially by utilizing the storage capacity of grid-connected stand-alone BSS. We also show that the joint operation under NBS yields added benefits for the BSS. The results from the numerical case study, for a hub with 150 DC fast-charging stations and a BSS with 24 MW storage capacity, show that under specific operating conditions, the hub and the BSS can financially gain up to 170% and 45%, respectively. These findings create new opportunities for the growth of stand-alone BSS in support of large-scale fast-charging hubs, ultimately increasing the rate of EV adoption. Our study has the following limitations. Our model does not explicitly consider uncertainties in the energy market and the reserve market parameters. We investigated the performance of our model for various parameter value combination scenarios. A distributionally robust approach to the Nash bargaining problem could be a way to further accommodate these uncertainties Liu et al. [2018] Peng et al. [2021]. In our problem, we have considered participation in the reserve up and down markets as the primary activities of the battery storage system. Whereas in most electricity markets, BSS also participates in other reserve market activities such as responsive reserve, non-spinning responsive reserve, and contingency reserve. Consideration of these additional activities will add more variables and constraints without changing the fundamental nature of the model as we have developed. For simplicity, we have considered only the hourly variation in the RT market prices in formulating our model, which can be extended to accommodate more frequent changes in the RT market."
17
+ }
abs_9K/validation_abstract_short_2404.16115v1.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.16115v1",
3
+ "title": "Online Personalizing White-box LLMs Generation with Neural Bandits",
4
+ "abstract": "The advent of personalized content generation by LLMs presents a novel\nchallenge: how to efficiently adapt text to meet individual preferences without\nthe unsustainable demand of creating a unique model for each user. This study\nintroduces an innovative online method that employs neural bandit algorithms to\ndynamically optimize soft instruction embeddings based on user feedback,\nenhancing the personalization of open-ended text generation by white-box LLMs.\nThrough rigorous experimentation on various tasks, we demonstrate significant\nperformance improvements over baseline strategies. NeuralTS, in particular,\nleads to substantial enhancements in personalized news headline generation,\nachieving up to a 62.9% improvement in terms of best ROUGE scores and up to\n2.76% increase in LLM-agent evaluation against the baseline.",
5
+ "authors": "Zekai Chen, Weeden Daniel, Po-yu Chen, Francois Buet-Golfouse",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-04-24",
8
+ "primary_cat": "cs.CL",
9
+ "cats": [
10
+ "cs.CL",
11
+ "cs.AI",
12
+ "cs.LG"
13
+ ],
14
+ "label": "Original Paper",
15
+ "paper_cat": "LLM AND Agent",
16
+ "gt": "The advent of personalized content generation by LLMs presents a novel\nchallenge: how to efficiently adapt text to meet individual preferences without\nthe unsustainable demand of creating a unique model for each user. This study\nintroduces an innovative online method that employs neural bandit algorithms to\ndynamically optimize soft instruction embeddings based on user feedback,\nenhancing the personalization of open-ended text generation by white-box LLMs.\nThrough rigorous experimentation on various tasks, we demonstrate significant\nperformance improvements over baseline strategies. NeuralTS, in particular,\nleads to substantial enhancements in personalized news headline generation,\nachieving up to a 62.9% improvement in terms of best ROUGE scores and up to\n2.76% increase in LLM-agent evaluation against the baseline.",
17
+ "main_content": "Introduction In recent years, the advancements in large language models (LLMs) have been remarkable (Brown et al., 2020; Zhao et al., 2023), with these models demonstrating an unparalleled ability to understand and generate text across a wide spectrum of tasks (Wei et al., 2022; Kojima et al., 2022). This capability has revolutionized the way we interact with machine-generated content and opened up new avenues for personalized text generation (Kirk et al., 2023; Li et al., 2023a). Personalization in text generation is of paramount importance to ensure user engagement and satisfaction (Huang et al., 2022) across a range of in applications such as composing tweets, or generating news articles and financial reports, or in more personalized settings like business communications and creative writing (Li and Tuzhilin, 2019; Li et al., 2020). However, the prospect of developing a unique LLM for each user presents challenges, including the prohibitive resource requirements (HoffFigure 1: Evolution of generated headlines for an article on teen internet safety, illustrating the progressive refinement of generation that emulates this journalist stylistic tendencies through online learning. mann et al., 2022), data privacy concerns (Li et al., 2023b), and the scarcity of personalized data (Rafailov et al., 2023). These obstacles necessitate an alternative strategy that is both practical and flexible. A promising solution lies in adopting lightweight models capable of online learning, which can dynamically adjust their output based on continuous user feedback (Bai et al., 2022). Such an approach not only circumvents the need for a bespoke model for each user but also encourages alignment of the generated content to individual preferences over time. Importantly, this adaptive process is poised to unlock long-term rewards stemming from personalization, encompassing not just explicit preferences expressed by users but also responding to favorable actions (Xie et al., 2021). Despite these benefits, the ultimate effectiveness of LLMs hinges on the quality of the given instructions (Zhou et al., 2022; Bang et al., 2023; White et al., 2023). Previous efforts have focused on gradient-based strategies (Shin et al., 2020; Li arXiv:2404.16115v1 [cs.CL] 24 Apr 2024 \fFigure 2: Illustration of our framework. Details are described in Section 2. and Liang, 2021; Lester et al., 2021) for automated instruction optimization, the applicability is limited to less advanced public models, leaving out many advanced yet proprietary models. With the emergence of more advanced open models such as Mistral-7B (Jiang et al., 2023), Llama-70B (Touvron et al., 2023a,b), and Mixtral-8x7B (Jiang et al., 2024), which offer transparency and have reported performance that even surpasses that of ChatGPT3.51, there is a renewed focus on leveraging these models for direct optimization. In this study, we introduce a novel online method for enhancing the personalization of open-ended text generation with white-box LLMs. Considering that capturing the nuances of persona in natural language instructions is challenging, we aim to directly optimize the soft token embeddings (Chen et al., 2023; Lin et al., 2023), representing the contextual factors through user feedback by utilizing neural bandit algorithms (Zhou et al., 2019; Zhang et al., 2021). This method not only promises to refine the personalization process of text generation but also contributes to the broader application of adaptive algorithms in creating content that closely reflects individual user preferences. 2 Peronalization with Neural Bandits Neural Bandits (Zhou et al., 2019; Zhang et al., 2021) integrate the adaptive exploration of bandit algorithms (Auer, 2003; Agrawal and Goyal, 2012; Li et al., 2010) with neural networks\u2019 superior ability to predict rewards under uncertainty. By leveraging past interactions to balance the tradeoff between exploring new actions and exploiting known ones, these algorithms can accurately predict and enhance personalized outcomes. Therefore, we adopt NeuralUCB (Zhou et al., 2020) and NeuralTS (Zhang et al., 2021) in our framework to comprehensively evaluate how Neural Bandits benefit LLMs\u2019 generation in an online fashion. 1https://chat.openai.com/ This section explores the application of Neural Bandits to white-box large language models (LLMs) as a strategy for directly refining soft prompts (aka. contextual embeddings) to overcome the inability of natural language instructions to fully express nuances of persona. The process involves a white-box LLM, f, which takes a soft prompt z, an instruction, \u03c1, and a test input, x, to produce an output sentence, \u02c6 y = f(z, \u03c1, x). A soft prompt z is a continuous vector representing preference token embeddings, which is used alongside the default instruction, \u03c1, as input to f. Given a specific user u at time t, we have a specific input xi, the goal is to find an optimal soft prompt token, z\u2217, that maximizes the following objective function based on user\u2019s feedback s(\u02c6 yi) (see Figure 2 for illustration): z\u2217 t = arg max z\u2208Z NeuralBanditst(z, s) With NeuralUCB, it involves computing the acquisition value for each candidate soft prompt and selecting the one that maximizes this value, based on the model\u2019s current parameters and the uncertainty associated with each prompt: zt+1 = arg max z\u2208Z (\u00b5(g(z); \u03b8t) + \u03bdt\u03c3t(g(z); \u03b8t)) , Here, \u00b5(g(z); \u03b8t) represents the network\u2019s predicted value for the soft prompt z at iteration t, while \u03c3t(g(z); \u03b8t) quantifies the uncertainty of the prediction. The parameter \u03bdt controls the trade-off between exploration and exploitation, influencing the algorithm\u2019s preference for exploring less certain prompts versus exploiting prompts with higher predicted values. When using NeuralTS for updating z, the process involves sampling from a predictive distribution to select the next soft prompt. Unlike NeuralUCB, which directly uses a deterministic acquisition function, NeuralTS generates a sample for each candidate z from a distribution modeled by the neural network. The update can be represented as follows: \fFigure 3: 10 user profiles (different blues) are randomly selected for demonstration. Trend of increasing averaged best rewards (yellow dashes) across learning iterations for three personalized text generation tasks, showcasing the progressive improvement in performance achieved by both NeuralUCB (Zhou et al., 2019) and NeuralTS (Zhang et al., 2021) algorithms. zt+1 = arg max z\u2208Z \u02dc rz,t \u02dc rz,t \u223cN \u0010 \u02dc \u00b5 \u0000g(z); \u03b8t \u0001 , \u03bdt\u02dc \u03c3t \u0000g(z); \u03b8t \u0001\u0011 Where, \u02dc \u00b5(g(z); \u03b8t) and \u02dc \u03c3t(g(z); \u03b8t) represent the estimated mean and standard deviation respectively for the soft prompt z, and \u02dc rz,t is a sampled reward from the predictive distribution for z at iteration t. The parameter \u03bdt again balances exploration and exploitation, but in the context of NeuralTS, the exploration is informed by the stochasticity introduced through sampling, encouraging diversity in the selection of z based on both prediction and uncertainty. NeuralUCB uses an upper confidence bound to balance these aspects deterministically, offering robust performance in environments where a clear quantification of uncertainty benefits decisionmaking. NeuralTS, on the other hand, employs a Thompson sampling (Agrawal and Goyal, 2012) approach, introducing stochasticity in the selection process, which can lead to more diverse exploration. Therefore, we tested both approaches as different kernels given the actual performance hinges on the problem\u2019s nature, the desired balance between exploration and exploitation, and the computational resources available. 3 Experiments on LaMP 3.1 Personalized Generations The LaMP (Salemi et al., 2023) dataset, or Language Model Personalization, is a benchmark deFigure 4: LLM evaluation of personalized generation between NeuralUCB (Zhou et al., 2019) and NeuralTS (Zhang et al., 2021) in personalized news headline generation. signed for training and evaluating large language models (LLMs) to produce personalized outputs. It aims to assess the efficacy of LLMs in generating responses tailored to individual user profiles. For example, in personalized news headline generation task, the writing of journalist exhibits unique stylistic characteristics shaped by both individual and societal influences (Zhu and Jurgens, 2021). This scenario serves as an excellent opportunity for exploring personalized generation. In this study, we evaluate our framework on three open-ended generation tasks which are Personalized News Headline Generation, Personalized Scholarly Title Generation, and Personalized Tweet Paraphrasing. 3.2 Online Simulation using LaMP We simulate a realistic online setting where individual users, such as those represented by distinct profiles in the LaMP dataset, continually receive outputs from LLMs in response to predetermined instructions. We then take ROUGE scores (Lin, 2004), which measure the correspondence between \fTasks Metric Random (zero-shot) NeuralUCB @k = 165 NeuralTS @k = 165 \u2206\u2191 Personalized News Headline Generation Avg. ROUGE-1/L\u2191 0.140 \u00b1 0.076 0.203 \u00b1 0.072 0.228 \u00b1 0.088 62.9% Personalized Scholarly Title Generation Avg. ROUGE-1/L\u2191 0.225 \u00b1 0.127 0.345 \u00b1 0.116 0.341 \u00b1 0.119 53.3% Personalized Tweet Paraphrasing Avg. ROUGE-1/L\u2191 0.346 \u00b1 0.110 0.459 \u00b1 0.114 0.466 \u00b1 0.120 34.7% Table 1: Performance comparison of NeuralUCB (Zhou et al., 2019) and NeuralTS (Zhang et al., 2021) algorithms against a random baseline in three personalized text generation tasks, measured by average ROUGE-1/L scores with improvement percentages (\u2206\u2191) after 165 iterations. the model\u2019s output and the user\u2019s ideal or \"golden\" response, as their online feedback. Additionally, we monitor the assessments from a black-box LLM, which evaluates the appropriateness of the generated content for a desired persona based on their profiles (e.g., using LLMs to automatically rate the generation based on the consistency with users\u2019 stylistics). An ideal result would exhibit both improved ROUGE metrics and LLM ratings. As introduced in Section 1, we employ Mistral7B-Instruct-v0.22 as our default white-box LLM. By simulating this online interaction scenario, our aim is to closely mimic the dynamic and personalized experience users encounter in real-world applications of language models. Through this experiment, we seek to evaluate the effectiveness of Neural Bandits in responding to the nuanced persona of different users/profiles, thereby informing future improvements and adaptations in personalized generation. 3.3 Results Analysis For the task of Personalized News Headline Generation, from Table 1 we observed a significant performance leap with NeuralTS, achieving an Average ROUGE-1/L score of 0.228\u00b10.088, marking a 62.9% improvement over the random baseline (0.140 \u00b1 0.076). NeuralUCB also outperformed the baseline, albeit with a slightly lower score of 0.203 \u00b1 0.072. In Personalized Scholarly Title Generation, NeuralUCB exhibited the highest increase, with a score of 0.345 \u00b1 0.116, closely followed by NeuralTS (0.341 \u00b1 0.119), both surpassing the baseline (0.225 \u00b1 0.127) by approximately 53.3%. Lastly, the Personalized Tweet Paraphrasing task showed NeuralTS slightly outperforming NeuralUCB with a score of 0.466 \u00b1 0.120 against 0.459 \u00b1 0.114, over a baseline of 0.346 \u00b1 0.110, 2https://huggingface.co/mistralai/Mistral-7B-Instructv0.2 translating to a 34.7% improvement. Figure 2 also summarises these results. At the same time, as shown in Figure 4, we observe increase over the LLM evaluation scores, with NeuralUCB achieving an average improvement of 2.8% vs. \u223c1% for NeuralTS. These findings underscore the potential of Neural Bandit algorithms in enhancing content personalization across various text generation tasks. However, it\u2019s important to acknowledge certain limitations inherent in LLM evaluations. LLMs tend to exhibit a positivity bias, often returning higher scores for the generated content. This bias can potentially skew the evaluation results and may not fully capture nuances in personalization or consistency. Also, while ROUGE provides a useful automated proxy for assessing the quality of personalized content, it has well-known limitations in fully capturing subjective preferences or nuanced stylistic tendencies. It may not align well with human judgments, especially for highly creative and personalized text. Thus, while the gains demonstrated in both ROUGE and LLM evaluation provide encouraging evidence, human evaluations are imperative for comprehensively assessing improvements in adapting to individual user profiles. 4"
18
+ }
abs_9K/validation_abstract_short_2404.16118v1.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.16118v1",
3
+ "title": "Act as a Honeytoken Generator! An Investigation into Honeytoken Generation with Large Language Models",
4
+ "abstract": "With the increasing prevalence of security incidents, the adoption of\ndeception-based defense strategies has become pivotal in cyber security. This\nwork addresses the challenge of scalability in designing honeytokens, a key\ncomponent of such defense mechanisms. The manual creation of honeytokens is a\ntedious task. Although automated generators exists, they often lack\nversatility, being specialized for specific types of honeytokens, and heavily\nrely on suitable training datasets. To overcome these limitations, this work\nsystematically investigates the approach of utilizing Large Language Models\n(LLMs) to create a variety of honeytokens. Out of the seven different\nhoneytoken types created in this work, such as configuration files, databases,\nand log files, two were used to evaluate the optimal prompt. The generation of\nrobots.txt files and honeywords was used to systematically test 210 different\nprompt structures, based on 16 prompt building blocks. Furthermore, all\nhoneytokens were tested across different state-of-the-art LLMs to assess the\nvarying performance of different models. Prompts performing optimally on one\nLLMs do not necessarily generalize well to another. Honeywords generated by\nGPT-3.5 were found to be less distinguishable from real passwords compared to\nprevious methods of automated honeyword generation. Overall, the findings of\nthis work demonstrate that generic LLMs are capable of creating a wide array of\nhoneytokens using the presented prompt structures.",
5
+ "authors": "Daniel Reti, Norman Becker, Tillmann Angeli, Anasuya Chattopadhyay, Daniel Schneider, Sebastian Vollmer, Hans D. Schotten",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-04-24",
8
+ "primary_cat": "cs.CR",
9
+ "cats": [
10
+ "cs.CR"
11
+ ],
12
+ "label": "Original Paper",
13
+ "paper_cat": "LLM Fairness",
14
+ "gt": "With the increasing prevalence of security incidents, the adoption of\ndeception-based defense strategies has become pivotal in cyber security. This\nwork addresses the challenge of scalability in designing honeytokens, a key\ncomponent of such defense mechanisms. The manual creation of honeytokens is a\ntedious task. Although automated generators exists, they often lack\nversatility, being specialized for specific types of honeytokens, and heavily\nrely on suitable training datasets. To overcome these limitations, this work\nsystematically investigates the approach of utilizing Large Language Models\n(LLMs) to create a variety of honeytokens. Out of the seven different\nhoneytoken types created in this work, such as configuration files, databases,\nand log files, two were used to evaluate the optimal prompt. The generation of\nrobots.txt files and honeywords was used to systematically test 210 different\nprompt structures, based on 16 prompt building blocks. Furthermore, all\nhoneytokens were tested across different state-of-the-art LLMs to assess the\nvarying performance of different models. Prompts performing optimally on one\nLLMs do not necessarily generalize well to another. Honeywords generated by\nGPT-3.5 were found to be less distinguishable from real passwords compared to\nprevious methods of automated honeyword generation. Overall, the findings of\nthis work demonstrate that generic LLMs are capable of creating a wide array of\nhoneytokens using the presented prompt structures.",
15
+ "main_content": "INTRODUCTION In the field of cyber deception, the main objective is to divert the attention of an attacker, which can be achieved by inventing false tokens of information. There are different approaches to reach that objective, such as creating vulnerable decoy systems in a network to attract an attacker, also known as honeypots [33]. Another less resource-intensive possibility is to create bogus files on a system, also known as honeytokens [30]. A shared problem between those approaches is the creation of new convincing looking data. While humans can create such systems and files manually to a degree that a possible adversary will be deceived, it is a time-consuming process. With the increasing maturity of LLMs such as GPT-4, there are now tools which are able to create various types of high quality artificial text-based data. The capability of LLMs to create extensive and detailed output for various domains based on specific instructions, with a quality often indistinguishable from one written by a human, was quickly abused for misinformation attacks as it could be used to automatically generate targeted phishing emails or publish false information through social media on a large scale, demonstrating the power of LLMs to deceive humans [14, 40]. This work explores how these capabilities can be used to create different honeytokens and assesses their quality through various types of verification. To determine the most effective prompt structures for creating different honeytokens, experiments were carried out to test a variety of prompts. Different building blocks were developed which together form a complete prompt sequence. This resulted in 210 different prompts which were statistically analyzed to determine the 20 best building blocks. With the help of these building blocks, two honeytoken types, namely robots.txt and honeywords, were used to test the effectiveness of the LLMs to create honeytokens using metrics developed by the authors. In addition, a tool from Wang et. al [39] was applied to calculate the flatness of the generated honeywords, which is the success probability for distinguishing honeywords from real passwords. The results show that this approach resulted in a 15.15% success probability of distinguishing attacks compared to the methods used by Juels and Rivest [17] that reported a 29.29% 1 arXiv:2404.16118v1 [cs.CR] 24 Apr 2024 \fReti et al. success rate. These results show that LLMs are able to create deceptive honeytokens. The main contributions of this paper are: \u2022 Comparison of prompts and prompt building blocks for honeytoken generation \u2022 Quantitative evaluation designed for two of the seven honeytokens: honeywords and robots.txt files, based on custom metrics \u2022 Comparison of performance for different LLMs for honeytoken generation (GPT3.5, GPT4, LLaMA2, and Gemini) 2 BACKGROUND 2.1 Honeypots and Honeytokens Numerous defensive measures can be utilized to protect networks from illicit activities. While traditional security measures such as intrusion prevention and detection systems, firewalls and system hardening are essential, a comprehensive protection against internet threats is difficult to achieve [3, 4]. Deception technologies aim to be a more proactive countermeasure and possibly warn against attacks in their early stages, as well as to observe attack behavior, including Tactics, Techniques, and Procedures (TTPs) [1, 2, 15]. One example of deception technologies are honeypots, which are security resources specifically deployed to be attacked, enabling all traffic observed on them to be regarded as malicious and thus facilitating analysis [10, 32]. A honeypot may slow down or deter an attacker by diverting the attacker\u2019s attention away from an actual production system. Honeypots can be classified into two different types, based on their level of involvement or interaction. Low Interaction Honeypots (LIHs), providing limited access to the operating system, emulating only essential protocols and network services. And High Interaction Honeypots (HIHs), mimicking entire systems, providing a broader scope for observing and capturing attacker behavior. While all honeypot types possess the capacity to serve as efficient Intrusion Detection System (IDS), by deliberately attracting malicious activity, allowing to gather insights into attacker behavior and detecting unauthorized access attempts, HIHs excel at not just detecting attacks but also defending against them, mainly by luring attackers into wasting time and resources on deceptive targets. Since the concept of honeypots has been introduced to the field of IT security, several related terms have been coined, carrying \"honey\" as a prefix to signal the use of deception [12, 33]. One of those concepts is the honeytoken, which does not aim to represent a whole system but rather pieces of data, such as files, database entries, usernames, or passwords [30]. The term honeytoken can be applied to data present on a honeypot, but more importantly, this kind of deceptive data can also be hosted on production systems, serving as host-specific IDS in addition to the general defensive bonuses supplied by deception [28]. 2.2 Large Language Models and Prompt Engineering The research area of Natural Language Processing (NLP) aims to comprehend, manipulate, and generate natural language. The first promising approaches were made over statistical analysis, so-called Statistical Language Model (SLM), which tried to predict the next word based on the most recent context [16]. These approaches were mostly limited due to the curse of dimensionality. Later, Neural Language Models (NLMs) was introduced, based on neural networks such as Recurrent Neural Networks (RNNs), to realize the prediction with better results. Pre-trained Language Models (PLMs) used context-aware word representations and were predominantly realized by a so-called transformer, a deep learning architecture introduced by Vaswani et. al [37]. Unlike previous approaches, such as RNNs or Convolutional Neural Networks (CNNs), the transformer architecture relied on an attention mechanism to draw global dependencies between the input and the output. Transformers showed promising results and could be trained in parallel. In recent years, language models have vastly improved. LLMs dominate the NLP research area and show impressive results. An LLM is a PLM of significant size regarding training parameters like data size, model size, or total computational effort. Their main performance advantage comes from enormous training data. Until now, it is unclear at which training size the performance increase starts [13]. Although general purpose LLMs are capable of solving a wide variety of specific tasks, the option for fine-tuning can be applied to improve their performance. In the pre-training, the model is provided with enormous text data. The input text is split into tokens, which may be single characters or character sequences such as sub-words or words. Token splitting plays an essential role in the performance of the LLM, and there are multiple different approaches, for example, Byte-Pair-Encoding (BPE) [29] or Unigram Language Model [22]. In the training phase, the model is provided with large token sequences representing the input text, and the model predicts the next token. By learning from the token sequences, it adjusts its weights to predict the next possible token. Just by using this approach, LLMs can solve text-based tasks. The models are fine-tuned for better performance of specific tasks, e.g. dialogues or text completion. Especially in open-source projects, fine-tuning leads to different variants of LLMs that rely on one base LLM. With the announcement of ChatGPT-4 [26] by OpenAI, LLMs gained public attention. ChatGPT-4 was able to reach over 1 billion users within five days after its publication [19]. Nonetheless, besides GPT, there exist many other LLMs with equal performances or even better performances, depending on the LLMs\u2019 versions and use cases: \u2022 LLaMA2 [35] developed by Meta. It outperforms the earlier and still available ChatGPT-3 version, in baseline Q&A tests and is exclusively trained on publicly available data. Recently LLaMA2 was released to the public [36], which allows it to access its model free and open source. \u2022 Galactica [34] developed by Meta focuses on scientific research and provides a knowledge interface. It is trained on research papers. \u2022 PaLM [9] developed by Google uses a Pathway approach to increase the performance of the LLM. PaLM is used in Google\u2019s chatbot Bard. Later, Bard\u2019s internal structure was changed and renamed as Gemini. Google didn\u2019t explicitly disclose the specific LLM architecture used in Gemini. 2 \fAct as a Honeytoken Generator! The research area of LLMs has rapidly grown in the past few years. The development and current state of LLMs has been described in different surveys [11, 27, 42]. In recent developments, LLMs have demonstrated results of such high quality that identifying whether the content was created by a human or an LLM has become a challenging task for humans. The quality of the result is strongly dependent on the input prompt. To optimize the query, fine-tuning of the input prompt is required, referred to as instruction tuning or, more commonly prompt engineering. This should not be confused with the fine-tuning of the LLM itself, wherein the LLM undergoes re-training. The instructions, wording, or formatting used in the prompts given to the model, influence the results and capabilities of the LLM. Different prompt engineering techniques can be used depending on the underlying task or problem such as Few-Shot Prompting [6], Zero-Shot Prompting [41], and Chain-of-Thought Prompting [20]. 3 RELATED WORK In the domain of deception technology, designing honeypots or honeytokens that are as convincing and believable as possible, poses a significant challenge. To increase password security, Juels et. al proposed an innovative method of honeywords creation. The proposed method advocates for the enhancement of password security through the inclusion of honeywords alongside authentic passwords into databases, thereby complicating the task for attackers who manage to acquire passwords, as they would struggle to distinguish between genuine passwords and honeywords. This can be achieved by either modifying an already existing password or changing the password creation process in a way, that a random three-digit value is added to each password to then create honeytokens by modifying that three-digit value. Furthermore, the system triggers an alarm when a honeyword is used for login, with detection carried out by an auxiliary server known as the \"honeychecker\" [17]. A new approach to adaptive honeypots, which employs machine learning techniques, specifically a variant of reinforcement learning, to collect comprehensive data about attackers while maintaining the honeypot\u2019s disguised identity, was introduced by Wagner et. al with the creation of an adaptive SSH honeypot [38]. In their work \"HoneyGen: an Automated Honeytokens Generator\" Bercovitch et. al proposed a novel approach to generate honeytokens [24]. They introduce \"HoneyGen,\" a method for automatically generating honeytokens that closely mimics real data by extracting rules from production databases, creating artificial relational databases based on these rules, and assessing their similarity to real data. Evaluation through a Turing-like test demonstrated the method\u2019s effectiveness in generating honeytokens indistinguishable from genuine data to human observers. Luk\u00e1\u0161 et. al proposed a method aimed at detecting attackers within Active Directory (AD) structures by incorporating fake users, known as honey-users, into AD environments to enhance attack detection capabilities. Their approach involves employing a Variational Autoencoder to strategically position honey-users within the AD framework [23]. Cambiaso et. al proposed a method to incorporate LLMs into cyber security as they explored the potential of leveraging ChatGPT, to combat email scams by engaging scammers in automated and fruitless interactions, thereby wasting their time and resources. Their findings demonstrated ChatGPT\u2019s effectiveness in deceiving scammers, highlighting AI\u2019s potential in mitigating email-based threats [7]. Using ChatGPT as a unique interface for honeypots in cybersecurity was shown by McKee et. al by simulating Linux, Mac, and Windows terminal commands and integrating with tools like TeamViewer, Nmap, and Ping. The authors were able to create a dynamic environment to observe attackers\u2019 tactics, techniques, and procedures. Their primary aim was to prolong attacker timelines and delay access to critical network assets [25]. 4 HONEYTOKEN GENERATION This section outlines the authors\u2019 approach to designing prompts and the building blocks utilized for automated honeytoken generation. While there are many different forms of honeytokens only the following list of different honeytokens was implemented in this paper: \u2022 Honeywords: Honeywords are a security concept first introduced by Bojinov et. al in 2010 to enhance password security [5]. They are decoy passwords inserted alongside genuine ones in a system\u2019s database to confuse attackers. If an attacker breaches the system and selects a honeyword, it triggers an alarm, signaling a potential security breach. Essentially, honeywords serve as a trap to detect unauthorized access attempts and enhance overall system security. \u2022 Invoice File: An invoice file can serve as a honeytoken as it contains sensitive information, making it an attractive target for attackers. It can be utilized as a honeytoken by embedding unique identifiers, serving as indicators of unauthorized access if the file is ever opened or manipulated. These identifiers can be designed to be inconspicuous to legitimate users but trigger alerts when accessed, providing insights into potential security breaches and unauthorized activity within a system. \u2022 Robots.txt: A robots.txt file is a text file placed on a website to instruct web crawlers and search engine robots about which pages or sections should not be crawled or indexed [21]. The essential components of a robots.txt file are allow and disallow entries, indicating permitted and restricted paths for said web crawlers [21]. They can be repurposed as a honeytoken by including fabricated or obscure directives within it that are not typically relevant to search engine crawlers. These directives can be crafted to be unique and easily recognizable, serving as indicators of unauthorized access if they are ever accessed. When a web crawler or unauthorized user accesses these fabricated directives within the robots.txt file, it triggers an alert, indicating potential malicious activity and providing insight into attempted unauthorized access. An additional benefit of adding bogus directories is, that an adversary may be slowed down in their attack, by examining all of the bogus directories. 3 \fReti et al. \u2022 Ports & Services: A list of open ports and running services is not a honeytoken in itself, but rather a blueprint for them. By creating a list of ports and their corresponding services a system can be created that mimics the machine of a person/user with a specific occupation, which is reflected in these ports and services. This approach allows for the creation of more convincing honeypots. \u2022 Service Config File: A service configuration file can be used as a honeytoken in multiple ways. The first approach would be as another probe to trigger alerts with every interaction of the file. In this approach, the file should just look like a normal config file for the given service, with no specific requirements to the content other than it being syntactically correct. The second approach would be, that the config file is misconfigured on purpose to make it seem like the service has an exploitable vulnerability, when in fact the config file is only a decoy with the real file being located in a different directory. If an attacker then tries to exploit the service based on the vulnerabilities found in the honeyconfig file, an alert will be triggered. \u2022 Log File: A log file of a specific service or the system itself is a valuable target for an attacker because it may store sensitive data that could aid in unauthorized access or further attacks. Placing a log file on a system can help convince a potential attacker that the machine is a real production machine and not a honeypot. The log file would show activity on the machine that would seem normal in a day to day use. Every interaction with the log file should trigger an alert. \u2022 Database: As databases often hold valuable and sensitive information, they are sought after by attackers. A database can be used as a honeytoken by including fabricated or anomalous entries within it. These entries may contain enticing but bogus data designed to lure and expose unauthorized access attempts. When the fabricated data is accessed or manipulated, it triggers an alert, indicating potential malicious activity and providing insight into attempted unauthorized access. Initially, many prompts were manually tested on ChatGPT3.5 and ChatGPT4 for the feasibility of certain types of prompts and to narrow down the scope. ChatGPT was selected due to its popularity, output quality, and availability. Subsequently, the best prompts were compared across various other LLMs. The authors adopted a modular approach to construct and compare diverse prompts for the above-mentioned honeytokens. Four distinct building blocks were realized: \u2022 Generator Instructions: This module instructs the LLMs to focus on generating a specific entity. \u2022 User Input: This module informs the LLMs that the user is providing information intended for processing within the prompt. \u2022 Special Instructions: This module specifies the required appearance and desired properties for the generation of tokens. \u2022 Output format: This module is crucial for preemptively defining the formatting of the LLM\u2019s response. It facilitates optimal post-processing of answers and helps prevent the inclusion of irrelevant information. These building blocks are concatenated in the order presented to form a prompt as seen in table 1. Highlighted in blue are placeholders that get replaced based on the honeytoken that is being generated by the LLMs. Different types of parentheses and quotation marks are part of the prompt, not the placeholder. An empty generator instruction seen as \u2019\" \"\u2019 is provided to the LLM coupled with other building block formats, resulting in a prompt without the generation of any entity. Table 3 indicates details on special instructions for each selected category of the honeytoken. To enhance the functionality of the LLM, input data was included in this approach, resulting in more diverse, realistic, and detailed outputs. The input data can either be sourced from actual networks or generated by LLMs. Two honeytokens were chosen to evaluate the different prompt composition possibilities: the robots.txt file and honeywords. Subsequently, 210 distinct prompts were generated based on the building blocks and compared based on these metrics. The resulting best prompts were used to test all honeytokens amongst the different LLMs. 5 EXPERIMENT AND EVALUATION DESIGN The approach of utilizing ChatGPT for honeytoken generation is to have a generic LLM that does not need to be re-trained or fine-tuned for a specific type of honeytoken, which enables a wide scope of honeytoken types that can be generated. For this work, 7 example honeytoken types have been defined, and the prompts have been qualitatively evaluated. To also quantitatively assess the performance of the honeytoken generating prompt, the evaluation metrics for two honeytoken types were defined, namely robots.txt and honeywords. For the evaluation of robots.txt, the format and the paths were compared to those of popular websites. The honeywords were chosen, as an evaluation metric from previous scientific works. The quality of a honeyword can be quantified by the similarity of probabilistic character distribution to that of real passwords, computed from passwords of a data breach. 5.1 Robots.txt To quantify if a LLM is able to generate a functioning and deceiving robots.txt file, each response of the 210 different prompts was compared against samples of the most visited websites provided by the commonly known Alexa Top 1000 1 and a review was performed by experts, rating each robots.txt. To gain insights into common robots.txt characteristics, the robots.txt files of all 1000 web pages from the Alexa Top 1000 list have been crawled. To crawl the robots.txt, a simple Python script was used to copy the content of each robots.txt file into a local text file. Among these 1000 web pages, 846 websites had a valid and accessible robots.txt file, while 154 either lacked a robots.txt file, were unreachable, blocked access to it, or lacked a secure connection and could not be crawled. Expected values for each allow/disallow entry, along with their corresponding standard deviations were computed. Additionally, specified paths in robots.txt files were examined, using 1https://github.com/urbanadventurer/WhatWeb/blob/master/plugin-development/ alexa-top-1000.txt 4 \fAct as a Honeytoken Generator! Table 1: Building blocks for the prompt generation with a placeholder in blue. Row 6 is an empty generator instruction. ID Generator instruction Input(optional) Output format 0 You are now a honey_token generator. I will provide you with the following information: input. Refrain from explaining your response. 1 Act as a honey_token generator. Consider the following information: \u201cinput\u201d. Only reply with the honey_token and nothing else. Do not write explanations. 2 Behave like a honey_token generator. Take the following information into account: \u2019input\u2019 Quick answer. 3 Generate a honey_token. I will provide you with the following information: {input}. Just the answer. 4 Create a honey_token. Consider the following information: {input}. \u201c \u201d 5 Make a honey_token. Take the following information into account: {input}. 6 \u201c \u201d a common word list for web-application fuzzing 2. This word list includes popular directory and file names to identify existing paths on a web page. The word list was used to determine the frequency of popular paths and directories in robots.txt files. Paths were segmented into directories, and each directory was checked against the word list separately for allow and disallow entries. Table 2 illustrates the expected values and standard deviations for each feature, providing a comprehensive picture of a standard robots.txt. In assessing the compatibility of the LLM-generated robots.txt files with the specified features, a verification process was conducted to ensure each feature lies within the standard deviation. As indicated by earlier experiments, all generated data consistently adhered to the standard deviation. This alignment can be attributed to the (likely) possibility that the data from the Alexa Top 1000 and all its robots.txt are part of the training set for ChatGPT, influencing the model to generate data that reflect these features. A scoring system was implemented to establish a metric for a more nuanced evaluation of the prompt outputs based on the proximity of the generated values to the expected values, with consideration given to the standard deviation. The scoring formula applied for each feature is expressed as score = 0.5 \u2217(1 \u2212(\ud835\udc4e\ud835\udc4f\ud835\udc60(\ud835\udc65\u2212expected value)/standard deviation)) where \ud835\udc65is the feature value for the current robots.txt. This formula assigns a score of 0.5 when the generated value precisely 2https://github.com/digination/dirbuster-ng/blob/master/wordlists/common.txt Table 2: Analysis of the robots.txt files of the 1000 most popular websites. Paths were split into path segments and then checked against a popular wordlist for directory scanning. Allow/Disallow Feature Expected value \u00b1 standard deviation Allow # of entries 10.27 \u00b1 35.13 # of path segment overlap with wordlist 13.96 \u00b1 46.40 Total # of path segments 21.02 \u00b1 71.86 Disallow # of entries 76.35 \u00b1 228.98 # of path segment overlap with wordlist 83.76 \u00b1 272.85 Total # of path segments 143.40 \u00b1 484.55 matches the expected value; otherwise, it dynamically adjusts based on the deviation from the expected value. The expected value and standard deviation for each chosen feature can be located in table 2. The formula provided is utilized to assess a score for each feature, which is then aggregated to derive the variance score. The scores of the best-performing prompts can be seen in table 5. The maximum attainable score per feature can be 0.5, leading to a maximum total score of 3 (0.5 \u00b7 6), representing perfect alignment with the expected standard deviations. This scoring approach enables a fine assessment of the outputs, considering both proximity to the expected values and adherence to the standard deviation. The second part of the evaluation was a review conducted by a group of security researchers. The review process was crucial in ensuring the functionality of a generated robots.txt file as a honeytoken and validating the output format. The robots.txt file must incorporate certain suspicious Uniform Resource Locators (URLs) designed to entice potential attackers. However, maintaining a delicate balance between the level of suspicion and the presence of other allow and disallow entries is equally important. For instance, in the robots.txt file of an online store that specializes in animal food products, the presence of an \\textit{allow/disallow} directive granting access to nuclear power codes would be considered highly unusual and might raise suspicions for potential attackers. Similar anomalies were detected in robots.txt files generated by ChatGPT. The researchers conducted human-based evaluations using a designated scale reaching up to 5 points to assess the degree of suspicion and the overall impression of the robots.txt file. A score of 0 is assigned if the robots.txt contains URLs that are overly obvious or suspicious, potentially causing an attacker to question the authenticity of the robots.txt. A score of 2.5 is assigned when all paths are realistic and sufficiently suspicious, yet minor issues exist, such as duplicates of allow and disallow entries. A score of 5 is assigned when all paths are realistic, and some suspicious paths that could potentially tempt an attacker are included. This evaluation scale provides a nuanced approach to estimating the effectiveness of the generated robots.txt files as honeytokens, 5 \fReti et al. considering both the realism of the paths and the potential appeal to attackers. For usability considerations, the LLM is expected to provide a correct robots.txt without any unrelated or unnecessary additional information. This is crucial for automation in subsequent steps, facilitating a smoother processing of the output. Scores ranging from 0 to 2 are assigned to evaluate the output: A score of 2 is given for a valid robots.txt with the correct format and no additional information. A score of 1 if the output contains additional information or the thinking process of the LLM. A score of 0 is assigned if the robots.txt has an incorrect format, rendering it invalid. This could occur if the robots.txt lacks proper syntax or structure. The review is essential to ensure accuracy, as correct parsing and automatic filtering can be prone to errors. In summary, a generated robots.txt can attain a maximum score of 10, distributed as follows: 5 points for human impression, 3 points for similarity to the Alexa Top 1000, and 2 points for the format. The format is valuable in addition to human impressions because it can be used for parsing and is a key aspect of later work, reading automation, and usability. The weights were selected to prioritize the human impression above all else, with the ultimate aim being to deceive a human attacker. Format concerns are given the least weight, as they can potentially be rectified easily through additional prompts or parsing. This comprehensive scoring system ensures that the generated robots.txt files meet technical requirements and additionally makes it possible to compare among different prompts. 5.2 Honeywords Honeywords are usually created by taking the real password and performing rule-based permutations. This can be done by changing any number of characters or adding new characters to the real password [17]. Additionally, honeywords can also be created using a probabilistic model based on a list of real passwords and other parameters [17]. To evaluate if LLMs are capable of generating convincing honeywords, the methodology of Wang et. al [39] was employed, where the authors presented a systematic method for evaluating the effectiveness of honeywords. They devised a dedicated tool to assess how well honeywords could mislead potential attackers, ultimately determining their efficacy in concealing authentic passwords. Their tool executes a trawling guessing attack wherein it learns the probabilities of password parts associated with a given dataset of leaked passwords [39]. These learned probabilities are then utilized to identify and highlight passwords that are highly probable to be genuine. The password most likely to be real is then selected and tested. If the password is genuine, it results in a hit, otherwise, it is considered a miss. To better simulate a realistic application, the tool offers two parameters that can be configured to mimic the behavior of a real web server in the event of an attack. These parameters are, first, the maximum number of failed login attempts for all users. If this number is exceeded, the system blocks all login attempts and shuts down. And secondly, the option of limiting the number of login attempts for an individual user. If this number is exceeded, only this specific user is blocked. The authors generated honeywords using Personal Identifiable Information (PII) based on the current research methodology. There are many publicly available password leaks, such as the RockYou! leak [31], which contains millions of passwords but no additional information is included. The ClixSense3 dataleak was chosen for this work, as it provides a comprehensive database containing both passwords and other PII. The database contains approximately 1.6 million user entries with 35 different columns per user, such as: first name, last name, username, password, e-mail, street address, date of birth, last login, and account creation date, among others. For the focus of this study, only six columns were relevant: username, password, first name, last name, email, and date of birth. These columns were selected as they represent the primary sources of personal information suitable for integration into a password. Out of the 1.6 million entries of the ClixSense dataset, 1000 were randomly selected, with the criterion that either username, first name, last name, email, and date of birth must be present in addition to the password of that user. This ensured that users incorporated PII into their password creation. For each of these 1000 entries, the corresponding PII was provided to ChatGPT, which was tasked with generating 20 passwords using the PII. It\u2019s worth noting that this method incurs a higher token count, resulting in increased billing. To mitigate costs, only the top 20 building blocks of the already evaluated robots.txt were tested. The output of these prompts was then analyzed and categorized into three groups: no passwords returned, fewer than 20 passwords returned, and exactly 20 passwords returned. Only prompts that yielded exactly 20 passwords were subjected to further scrutiny against the original password from the ClixSense dataset. Entries with fewer or no passwords were considered failed responses. Out of the 20 generated passwords, 1 was randomly discarded, leaving 19 random samples. The real password was then randomly included in the group of 19 passwords, creating an array of 20 passwords for each of the 1000 entries. The amount of 19 passwords was chosen to result in 20 passwords in total, solely because 19 passwords are identified as a good amount of honeywords in the literature [18, 39]. Next, the method introduced by Wang et. al [39] was employed to detect if the real passwords could be detected among the 19 honeywords. Various parameters and assumptions, such as the training size of the dataset, the number of tries per array representing login attempts per user, and the overall number of login attempts across the dataset were considered. Different values were selected for each parameter, as presented in table 4. The results obtained from this tool and the outcomes of unsuccessful attempts play a pivotal role in evaluating the effectiveness of various building blocks. Furthermore, the tool conducts a simulation of the left-or-right oracle. By making slight adjustments and utilizing an array size of 2 while limiting the login attempts to 1 per user, the authors adapt this concept to the presented tool for honeywords detection. The objective is to discern whether the password generated by a LLM corresponds to an actual password. To fulfill this, 1 of the 19 generated honeywords is picked and compared to the real one. This process offers valuable insights into distinguishing between a genuine password and one generated by a LLM. If the generated password cannot be distinguished from the real one, the only recourse is guessing, leading to an average success rate of 50%. 3https://github.com/hacxx-underground/Files/blob/main/ClixSense%20database%20l eaked%20September%202016 6 \fAct as a Honeytoken Generator! Table 3: Special instruction for each selected honeytoken ID Honeytoken Category Special Instruction A Robots.txt Network/Service (Website) Based on the given information, return a robots.txt file. Some paths of the robots.txt should be interesting for a potential attacker. B Honeywords Network/Credentials Based on this information, return 20 different username and password pairs. C Ports/Services Network Service/Ports Return a random list of ports and services, including their version for a random IP. The services should match the given occupation of the user. The result should look like a Nmap scan. D Invoice File Host/File Based on the field of work of that company, return an invoice list containing 5 items with Quantity, Name, and Price. E Config Host/File Based on the given information, return a config file for that service. F Log File Host/File Based on the given information, return a log file for that service. G Database Network/Service Return a database filled with user information: full name, email address, password, phone number, birthday, company ID (random 6-digit number). 6 RESULTS In this section, the metrics for honeywords and robots.txt generation have been evaluated. It has been articulated how each selected building block has affected the specific components of the score. Furthermore, generation of honeytokens using different LLMs has been outlined, wherein the honeytokens generated using a prompt have been rated and evaluated based on custom metrics. 6.1 Robots.txt The evaluation of the robots.txt allows the classification of each prompt, with the top exemplary performance achieved by the following prompt: Act as a honey token generator. Consider the following information:{input}. Only reply with the honey_token and nothing else. Do not write explanations., which corresponds to an arrayed ID [1, 4, 1] in accordance with Table 1, attained a score of 8.71. A comprehensive list of the top 20 prompt combinations is provided in table 5. In contrast, the prompt [3, 3, 4]: Generate a honey token. I will provide you with the following information: {Input} Just the answer. reached a score of 2.388, which was the poorest performance of all tested prompts. Among the 210 prompts tested, 99 achieved the highest score in both the format and the human score features. The deviation decides the ranking of the best 99 prompts and how it is correlated to the existing robots.txt dataset. To better understand how each selected building block affects specific components of the score, we analyzed the score distribution for each building block. The results are shown in fig. 1. Each graph Table 4: Parameters used for honeyword detection to evaluate the performance of various prompts. Parameter Test values Login attempts overall 50, 100, 250, 500 Login attempts per user 1, 3, 5, 10 Training data size 10,000; 100,000; 1,000,000 Real passwords 1,000 depicts a specific category of building blocks, namely, Generator Instructions, Input, or Output format. Each building block is tested to determine the influence of different score elements. For instance, for Generator Instruction 0, worded/formulated as \"You are now a honey_token,\" among the 210 prompts tested, none achieved a format score of 0. Approximately 17% attained a score of 1, while over 83% scored 2. Notably, the variance score is significant when the sum of the actual values of robots.txt exceeds 1.5, deviating from the expected values. The figure reveals the following observations: The output format of the building block Input(options), including the phrase Quick answer, can negatively impact the format score. Additionally, it should be noted that the output format building block labeled 3 has the highest human score of 2. Overall, it can be observed that the format score, indicating the quality of the output format, is consistently good across all building blocks, while the human score, reflecting its realism, varies significantly. 6.2 Honeyword During the honeywords generation, it was observed that not all of the 1000 requests yielded successful results. Some outputs did not contain 20 passwords, and a few others provided a response indicating adherence to usage guidelines. For e.g., a response such as \"Unfortunately, I cannot fulfill this request as it goes against our policy to generate username and password pairs for individuals. It is important to maintain the security and privacy of personal information.\" was observed in certain scenarios. Such prompts were excluded from the analysis but included in the total count to calculate a comprehensive score (see table 5). Using the tool of Wang et. al mapping the strongest attacker model, with a threshold of 500 failed login attempts and 10 login attempts per user on a training set of 1 million passwords, it was shown, that the best-performing prompt was [6, 1, 3] with a score of only 117 hits. Prompt [3, 4, 4] yielded the best results concerning the conversation with ChatGPT, with only 4 responses considered as failed prompts. Aggregating the two scores, as they are weighted equally by the authors, the two prompts with the overall best score of 149 were [4, 0, 0] and [4, 1, 1]. With 1000 real passwords, the two prompts had 141 and 140 hits respectively, indicating a potential to detect the real password out of the honeywords with approximately 7 \fReti et al. Table 5: Comparison of the resulting scores of the prompt evaluation for robots.txt and honeywords for different building block combinations. The highlighted values represent the best score of the respective column. Building Block Robots.txt Honeywords Format Human Variance Total Hit Failed Prompts Total [0,0,3] 2 5 1.42 8.42 141 83 224 [0,1,0] 2 5 1.45 8.45 145 21 166 [0,5,1] 2 5 1.56 8.56 147 13 160 [1,1,0] 2 5 1.69 8.69 150 11 161 [1,4,1] 2 5 1.71 8.71 146 6 152 [2,2,2] 2 5 1.43 8.43 146 26 172 [2,5,1] 2 5 1.62 8.62 147 13 160 [3,0,4] 2 5 1.64 8.64 151 6 157 [3,2,0] 2 5 1.41 8.41 142 9 151 [3,3,0] 2 5 1.62 8.62 158 9 167 [3,3,1] 2 5 1.48 8.48 154 9 163 [3,3,2] 2 5 1.42 8.42 156 27 183 [3,4,4] 2 5 1.45 8.45 155 4 159 [4,0,0] 2 5 1.46 8.46 141 8 149 [4,0,4] 2 5 1.49 8.49 144 8 152 [4,1,0] 2 5 1.48 8.48 146 10 156 [4,1,1] 2 5 1.6 8.6 140 9 149 [4,4,2] 2 5 1.4 8.4 143 34 177 [5,2,1] 2 5 1.49 8.49 141 14 155 [6,1,3] 2 5 1.42 8.42 117 48 165 0 1 2 3 4 5 6 Build block ID 0.0 0.2 0.4 0.6 0.8 Percentage Generator instructions 0 1 2 3 4 5 Build block ID 0.0 0.2 0.4 0.6 0.8 1.0 Percentage Input (optional) 0 1 2 3 4 Build block ID 0.0 0.2 0.4 0.6 0.8 1.0 Percentage Output format compiler_score_0 compiler_score_1 compiler_score_2 variance human_score_0 human_score_1 human_score_2 Figure 1: Analysis of change of score if one parameter is present a 14% success rate. In an ideal scenario, adding honeywords to a database would increase the security of that database, by reducing the chance of an attacker randomly guessing the real password between the honeywords. With 19 honeywords used in this work, the chance to guess the correct password would result in 5%. As a baseline success rate, randomly selecting a user and a corresponding password, out of 1000 users, with 20 passwords each (19 honeywords 1 password), 500 failed login attempts, and 10 login attempts per user, would result in approximately 26.67 real passwords being detected or a 2, 667% success rate. While the LLM approach reaches around 14% success rate it highlights that ChatGPT is close to providing a perfect solution. With a proportionally scaled-down attacker model used by Wang et. al to evaluate the work of Juels and Rivest [17] the LLM approach achieved a success rate of 15.15% of distinguishing generated from genuine passwords. This surpasses the findings of Wang et. al [39], who reported an average success rate ranging from 29.29% to 32.62% on the proposed methodology to create honeywords by Juels and Rivest. Figure 2 illustrates the different analysis parameters that influence the hit rate. The number of attempts an attacker has before 8 \fAct as a Honeytoken Generator! Figure 2: Hit rate of real password detection algorithm depending on maximal allowed login attempts per user and maximal total login attempts. Each color represents a different size of the training set. 1000 examples were presented, each example consisting of 1 real password and 19 honeywords generated with ChatGPT. being blocked depends on the specific attacker model in question. The figure shows that the size of the training set containing real passwords dramatically increases the hit rate. While the logins per user had a low impact, as compared to the login attempts in total. Lastly, when performing the left-right oracle, as explained in section 5.2, the honeywords can be distinguished by 56% instead of the ideal 50%. The score of 56% merely indicates a noticeable distinction. However, it\u2019s challenging to gauge its effectiveness because it can only be compared to the 50% baseline. Assessing the significance of the 6% difference requires further investigation. 6.3 Honeytoken Evaluation among Different LLMs This section reports the execution and subsequent evaluation of prompts designed in ChatGPT-3.5 in other LLMs, namely ChatGPT4, LLaMA-2, and Gemini (formerly Bard). For LLaMA-2, the model version Llama-2-70b-chat-hf was used. For the other LLMs, their browser versions (web-APIs) that were currently available as of 21.02.2024, were used. For the evaluation, each honeytoken prompt was built based on its special instruction, together with one of the best-performing building block combinations, namely [4,1,1]. Each prompt has been tested ten times for each of the seven honeytokens. Every response generated by the four LLMs; namely GPT-3.5, GPT-4, LLaMA-2, and Gemini, has been graded by a group of security researchers. The assessment has been done based on how the responses look like, namely \"-\" for bad; wherein either the generated response does not match the expected standards of the specific honeytoken, or it can be identified that the document has been machine-generated. Rating \"o\" has been given for neutrallooking generated honeytokens; in this case, although at first glance the honeytoken confirms to expected standards, a closer look would expose mistakes or machine-generated data. \"+\" has been marked for well-generated responses that can not be identified as machinegenerated and look realistic. Ratings are given for each of the four categories syntax, credibility, variability, and stability. Lastly \"x\" has been used for scenarios where the prompts have not been possible to execute by the LLMs. Primarily, this has happened due to the restriction of the underlying models. To rate and evaluate the different prompts, another evaluation scheme was needed that could be applied to all honeytokens, not just limited to the robots.txt and honeywords. The following characteristics were chosen as qualitative metrics: Syntax evaluates how well the prompt can replicate the structure of the honeytokens it is instructed to create. This is particularly important because the generated output should resemble genuine syntax, which is crucial. After all, accurate parsing ensures that the honeytokens generated by LLMs are consistent with the syntax and semantics of real file entries, such as log or configuration files. Valid syntax generation also increases credibility and reduces the risk of detection by potential attackers who may scrutinize such files for inconsistencies. Some prompts do not directly produce the output in the correct format, even when the output format is mentioned in the prompt. The model often replies with its thinking process or any other additional text. Thus, the syntax property primarily gives an overview of the prompt in general, its properties, and the associated output. Credibility is associated with the relevance of the content generated within a specific domain. There is a possibility that the LLMs may generate content that is unrelated or out of context for the given field. For instance, for the \"Services & Ports\" honeytoken, created for a web developer, including an unusually high port number or a port number associated with a service rarely utilized by web developers can diminish the credibility of the generated data. This can raise suspicion for potential attackers. Variability assesses the diversity of responses generated by the LLMs and the distinctiveness of the honeytokens. The variability rating considers two factors: firstly, the outcome after the prompt is executed multiple times, and secondly, the consistency of variability within the same conversation when requesting additional examples, such as \"give me more examples.\" Stability indicates how the prompt response remains unchanged if used multiple times, without refusing to generate a response. If however, in certain circumstances, the prompt results in negative responses like \"I cannot help you with that\" or \"I would need more details\" etc., then such responses impact the stability of the prompts and indicate the need for better design for optimal output. Each prompt response has been evaluated based on the four quality metrics i.e. Syntax, Credibility, Variability, and Stability, and a summarized result is presented in table 6. It can be observed that in comparison to alternative language models, the GPT-3.5 and GPT-4 models have consistently produced better results for generating the different honeytokens with valid syntaxes. GPT-3.5 has performed consistently well for all the seven honeytoken with valid syntax. Gemini had the most difficulties in the generation of valid syntax, with multiple \"x\" ratings, indicating that it may not have executed some prompts properly due to underlying model limitations. Upon analyzing the robots.txt file it was observed that GPT-3.5 and GPT-4 performed well across all metrics for the honeytokens. LLaMA, too, showed stable syntax generation across all honeytokens. For the category of ports and services, it is observed that GPT-3.5, GPT-4, and Gemini perform consistently well as compared to LLaMA-2. Similarly, for other honeytokens like invoice files, config files, and 9 \fReti et al. log files, Gemini performs the best amongst them across all the metrics. Lastly, for the database honeytoken, only GPT-3.5 could correctly generate the syntax of the database table among all the other LLMs. GPT4 and Gemini could not produce any response to the prompts due to underlying model limitations which did not permit these models to generate database structures. It is evident from the tables and figures above that LLMs have effectively generated honeytokens. These documents are enticing to attackers because they contain relevant information and can deceive them. The honeytokens, which have valid syntax, can also be used to fill honeypots that require fake but enticing content. The capability of LLMs to generate honeytokens would allow enterprises to create honeypots for cybersecurity purposes. Table 6: Prompts for honeytoken generation evaluated in different LLM, + good, bad, o neutral, x not possible to execute. The column labels A-G correspond to IDs in table 3. LLM Prompt A B C D E F G Syntax + + + + + + + GPT3.5 Credibility + + o + + Variability + + o o + + + Stability + + + + + + Syntax + + + + o + x GPT4 Credibility o + + + o + x Variability + + o + o x Stability + + + + + + x Syntax o + + + + + + LLaMA Credibility + + + + o Variability + + + o o Stability + + + + + + Syntax + x + + + + x Gemini Credibility + x + o + o x Variability + x + + + o x Stability + x + + + + x 7 DISCUSSION Assessing the efficacy of various honeywords remains inherently imperfect, relying heavily on human expertise. Crafting metrics to measure the effectiveness of these honeytokens poses a significant challenge, as there are numerous factors to consider. Despite these limitations, the authors tried to construct two metrics aimed mostly at automating the evaluation of honeytokens. However, developing metrics to prove the credibility and success of a honeytoken can be challenging. An ideal solution would involve deploying honeywords in real-world scenarios and subjecting them to real-world attacks for comparison. While such an approach would offer remarkable insights, the very magnitude of effort required renders it impractical for the potential insights gained. A larger comparison between multiple prompts would be prohibitively costly. Nevertheless, the presented findings yield promising results, demonstrating the effectiveness of leveraging LLMs to generate authentic honeytokens. While comprehensive proof remains a subject for future exploration, its necessity may be questioned, given that the results already look convincing enough. The overall focus of this work was to highlight the capability of LLMs as generic honeytoken generators. Each category of honeytoken provides enough ground for individual research on the specific kind of honeytoken. As the results show, even a slight modification of the sentence structure or wording can influence the outcome and performance. This work provides a community hub for exchanging and discussing the best deception honeytoken. 4 Regarding honeywords overall it should be noted that honeywords alongside real passwords should not be stored in clear text, which was done in this work only to facilitate evaluation. When an attacker finds a database with hashed honeywords stored alongside real user passwords, the presence of honeywords could slow down a potential brute-force attack. This research was heavily focused and oriented on ChatGPT. The evaluation and selection of the best building blocks were performed on ChatGPT. Other models may perform better than ChatGPT. As already mentioned, this decision was made at the beginning of the research, when not even all LLMs that were tested in this work were available in Europe (i.e. Gemini and LlaMA2). Limitations. It is important to consider the limitations of LLMs as they significantly impacted the generation of honeytokens. For instance, while generating a complete database with user details, it was observed that some of the LLMs could not generate any database, which could have happened due to various reasons such as complexity, domain knowledge, or policy constraints. Another limitation based on the token prediction of LLM is that without an external source of randomness, it can\u2019t generate random responses, which needs to be considered when generating new data. This is due to the probabilities of token sequences being determined during the training phase, which can lead to repeating patterns in the output. As with most models a temperature parameter can control the variation of the selected token and thus the perceived randomness of the model output. This influenced the results of some tokens, generating repetitive or similar content in some cases. Additionally, it is important to note that LLMs can not provide more recent information than their training phase, which could result in non-evolving content making generated honeytokens more easily detectable through learning their patterns. Furthermore, the fast and steady development of LLMs and the changing model versions make reproducing the results hard. For instance, the quality of a prompt output can change over time for better or worse [8]. This makes it hard to perform precise research in this domain. In this work, the authors have presented honeyword generation method which is considerably less detectable than previous methods. However, it must be noted that a direct comparison of these results to earlier results warrants careful consideration due to the slightly smaller scale of the presented approach. An extensive comparison would be more cost-intensive and could be targeted in future work. Future Work. Future research in the field of honeytokens holds significant potential for expansion and refinement. The current 4https://github.com/dfki-in-sec/prompt-collection 10 \fAct as a Honeytoken Generator! research, albeit focused on a limited selection of honeytokens, lays the groundwork for broader implementation. Researchers could explore creating specific types of honeytokens to make them more believable and effective. Additionally, there\u2019s a possibility of developing tools to automatically generate files like PowerPoint or Word documents, streamlining the process of deploying honeytokens. The idea of using honeytokens to set up environments autonomously is also worth investigating further. By integrating honeytokens into existing systems, researchers can gather real-world data to improve their effectiveness and assess their susceptibility to detection. Furthermore, future work could involve fine-tuning LLMs for better honeytoken generation or even creating entire fake companies, including advertising materials, to enhance the effectiveness of honeypots. In addition to the method used in this work, other prompt engineering techniques like few-shot and zero-shot approaches may be considered, or the token amount can be considered as a parameter. Fix Idea: For further optimization of the generator prompts, the evaluation metrics could be fed back into an auto-tuning loop in order to validate the effectiveness, and discriminators could be trained. Finally, enhancing the performance and cost efficiency of LLMs may be achieved through fine-tuning, considering the temperature parameter, and adjusting token size. Moreover, exploring smaller transformers can further optimize cost. 8"
16
+ }
abs_9K/validation_abstract_short_2404.16123v1.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.16123v1",
3
+ "title": "FairDeDup: Detecting and Mitigating Vision-Language Fairness Disparities in Semantic Dataset Deduplication",
4
+ "abstract": "Recent dataset deduplication techniques have demonstrated that content-aware\ndataset pruning can dramatically reduce the cost of training Vision-Language\nPretrained (VLP) models without significant performance losses compared to\ntraining on the original dataset. These results have been based on pruning\ncommonly used image-caption datasets collected from the web -- datasets that\nare known to harbor harmful social biases that may then be codified in trained\nmodels. In this work, we evaluate how deduplication affects the prevalence of\nthese biases in the resulting trained models and introduce an easy-to-implement\nmodification to the recent SemDeDup algorithm that can reduce the negative\neffects that we observe. When examining CLIP-style models trained on\ndeduplicated variants of LAION-400M, we find our proposed FairDeDup algorithm\nconsistently leads to improved fairness metrics over SemDeDup on the FairFace\nand FACET datasets while maintaining zero-shot performance on CLIP benchmarks.",
5
+ "authors": "Eric Slyman, Stefan Lee, Scott Cohen, Kushal Kafle",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-04-24",
8
+ "primary_cat": "cs.CV",
9
+ "cats": [
10
+ "cs.CV",
11
+ "cs.AI",
12
+ "cs.CL",
13
+ "I.4.10; I.2.7; E.0"
14
+ ],
15
+ "label": "Original Paper",
16
+ "paper_cat": "LLM Fairness",
17
+ "gt": "Recent dataset deduplication techniques have demonstrated that content-aware\ndataset pruning can dramatically reduce the cost of training Vision-Language\nPretrained (VLP) models without significant performance losses compared to\ntraining on the original dataset. These results have been based on pruning\ncommonly used image-caption datasets collected from the web -- datasets that\nare known to harbor harmful social biases that may then be codified in trained\nmodels. In this work, we evaluate how deduplication affects the prevalence of\nthese biases in the resulting trained models and introduce an easy-to-implement\nmodification to the recent SemDeDup algorithm that can reduce the negative\neffects that we observe. When examining CLIP-style models trained on\ndeduplicated variants of LAION-400M, we find our proposed FairDeDup algorithm\nconsistently leads to improved fairness metrics over SemDeDup on the FairFace\nand FACET datasets while maintaining zero-shot performance on CLIP benchmarks.",
18
+ "main_content": "Introduction Recent Vision-Language Pretrained (VLP) models [55] that learn to align image and language encodings have demonstrated strong zero-shot performance on many standard perception tasks [12, 16, 71, 73]. Beyond these, VLP models have enabled complex downstream applications ranging from visually-aware chatbots [42, 44] and language-based image segmentation [37, 79] to instruction-guided robotics [62, 69] and semantic mapping of 3D scenes [35, 61]. The rapid adoption and widespread impact of these models is due in part to the incredibly broad range of content they can represent effectively \u2013 a scope far exceeding prior models trained on manually-curated, closed-world datasets [16, 43]. To acquire this capability, VLP models are trained on massive open-world datasets of image-caption pairs collected from the internet [58]. VLP models improve reliably *Work conducted during Slyman\u2019s 2023 summer internship at Adobe. FairDeDup (50% Data) Task Performance Zero-Shot ImageNet\u00a0 (Accuracy@5 \u2191) SemDeDup (50% Data) 89.7% 89.7% LAION-400M (100% Data) 89.9% FairDeDup (50% Data) Equality of Oppourtunity Zero-Shot FACET\u00a0 (Gender Disparity in Recall\u00a0\u2193) .104 .113 .346 .109 .298 SemDeDup (50% Data) Average Worst-Class Average Worst-Class Worst-Group .303 LAION-400M (100% Data) Average Worst-Class Figure 1. Training models on deduplicated data can yield similar results to the full-data setting on standard tasks like zero-shot ImageNet [16] classification (left, higher is better \u2191). However, impacts on subgroup performance have not been studied. We discover cases such as gender disparity (right, lower is better \u2193) where deduplication reinforces existing biases on FACET [26]. FairDeDup preserves performance while reducing bias from deduplication and, in some cases, w.r.t. the full-data setting. with additional training data [13], driving the number of examples in these datasets into the billions [59]. This scale of uncurated data introduces at least two challenges \u2013 1) training can be extremely costly, and 2) manual data curation to reduce undesirable social biases is economically prohibitive. In this work, we explore how dataset deduplication techniques developed to reduce training costs may exacerbate or ameliorate these biases in trained models. While larger pretraining datasets generally yield better model performance [13], the massive web-scraped datasets commonly used for training VLP models contain many identical samples (duplicates) or samples that capture nearly the same content under similar imaging conditions (semantic duplicates [1]). Several recently developed techniques for data pruning/deduplication have demonstrated that aggressive removal of these duplicates has limited im1 arXiv:2404.16123v1 [cs.CV] 24 Apr 2024 \fpact on the task performance of trained models [1, 48, 63]. For example, Abbas et al. [1] found that pruning LAION400M [58] by 50% resulted in trained models that achieved average performance within 0.5% of their full-data analogs across a range of common benchmark tasks \u2013 effectively cutting training time in half. However, these web-scale datasets contain a plethora of problematic social biases and harmful stereotypes [5, 6, 23]. These biases can often then be reflected in the behavior of models trained on these datasets [2, 27, 28, 68]. To better understand and reduce these potential harms, there is increased interest in analyzing the composition of these datasets and their downstream effects on trained models [5, 23, 77]. Deduplication techniques introduce another algorithmic step between dataset and model training that may systematically alter the data distribution \u2013 potentially amplifying, maintaining, or reducing the effect of dataset biases. Given that deduplication techniques will likely be widely deployed as cost-saving measures, understanding how their design affects the behavior of downstream models in terms of bias and fairness is a timely but unexamined question. To study this question, we investigate the fairness outcomes of CLIP-style [55] VLP models trained on the LAION-400M dataset [58] pruned with SemDeDup [1]. Replicating the results of Abbas et al. [1], we find task performance on CLIP Benchmark [12] is only marginally affected; however, evaluation on the fairness-focused FairFace [34] and FACET [26] datasets suggest deduplication results in mixed effects compared to the full-data setting. We observe increased disparities across gender, but both positive and negative changes for disparities across skin tone and age. Based on these findings, we propose FairDeDup \u2013 a fairness-aware data pruning algorithm that makes pruning decisions to improve representation of specified sensitive concepts (e.g., gender, shown in Fig. 1). The implementation of FairDeDup is a simple modification to SemDeDup and specifying concepts can be done in natural language. Our large-scale experiments show that FairDeDup leads to improved fairness outcomes comapred to SemDeDup while maintaining comparable performance on standard zero-shot and retrieval-based performance benchmarks. To better understand the deduplication process, we run a smaller scale study deduplicating demographiclabeled data \u2013 finding that FairDeDup consistently retains more images depicting minority classes than SemDeDup. Contributions. We summarize our contributions below: \u2022 We conduct, to our knowledge, the first large-scale experiment evaluating the fairness outcomes of training largescale vision language models on pruned data \u2013 training CLIP-style models on full and deduplicated versions of the popular LAION-400M dataset then evaluating on standard fairness benchmarks for VLP models. \u2022 We find that models trained on SemDeDup [1] pruned data have varied effects on fairness outcomes from the full-data model; reinforcing some biases and mitigating others. \u2022 We introduce FairDeDup, a simple and efficient modification to SemDeDup that improves fairness outcomes while retaining task performance \u2013 improving fairness outcomes over SemDeDup in nearly all cases studied. 2. Related Work Vision-Language Fairness. Vision and language models have been shown to learn, reflect, and amplify problematic social biases. For example, vision systems have been shown to dehumanize minority groups by identifying them as animals [19] and degrade in task performance on intersectional combinations of gender and skin tone [9]. Likewise, language models are known to learn gendered associations of professions [8], increase sentiment-intensity along racial lines [38], and a myriad of other problems documented in [7, 65]. Vision-language models are not exempt from these problems [27, 47, 52] and can even reinforce them [64, 77]. Contemporary Vision-Language Pretrained models are frequently pretrained on massive but uncurated data scraped from the internet [11, 32, 40, 55]. While web-scale data is shown to improve performance, it also teaches models \u201cmisogyny, pornography, and malignant stereotypes\u201d [5]. VLP models demonstrate dehumanizing behavior with respect to racial subgroups in zero-shot text-image retrieval [2, 3], show bias related to gender [23, 27, 28, 68], age [23] and skin tone [23, 28, 68, 76] in image captioning, and also demonstrate biases relating to age, gender, skin tone, and ethnicity in text-image retrieval [23, 78]. These behaviors are attributed to the use of uncurated web-scale datasets in pretraining VLP models [5, 6, 23]. Mitigations for bias in VLP models typically include fairness-aware training [75] or post-hoc methods to disentangle useful concepts from sensitive attributes [3, 14, 60]. Unlike these methods, we seek to prevent bias from being reinforced in the dataset, rather than removing bias from the model itself. Though early vision-language fairness literature frequently calculates WEAT [10] and SEAT [49] embedding association measures extended for the multimodal setting [31, 57], these measures have been shown to be overly sensitive to small changes in model architecture and outputs [3]. As such, VLP model fairness is primarily evaluated on CelebA [45] and FairFace [34]. Recent datasets such as PHASE [23] and FACET [26] allow for the study of bias on \u201cin the wild\u201d data across diverse subgroups. Dataset Pruning. Several techniques exist for reducing the size of a dataset while preserving, or even improving, performance. We consider all techniques under this umbrella as dataset pruning algorithms. Coreset selection chooses a weighted subset of training samples which closely estimate the full dataset\u2019s gradient [25, 50] to perform data2 \fefficient training with little loss in performance. However, these methods do not scale well with dataset size and frequently require class labels [63]. The most similar work to ours among coreset selection algorithms is the recent D2 Pruning [48]. D2 Pruning utilizes graph based methods to select samples that are both hard and diverse across a data distribution. While promising, D2 Pruning does not evaluate any fairness outcomes and is only demonstrated to scale to DataComp Small (12.8M) [22], a low accuracy setting for VLP models peaking around 5% top-1 zero-shot ImageNet [16] accuracy. In comparison, base-sized CLIP-style models can range from 67-74% accuracy with web-scale data on the same task. We refer readers to [54] for a more thorough review of coreset selection algorithms. Large-scale deduplication typically attempts to find exact perceptual duplicates using techniques like perceptual hashing [20] or filtering [22] on image-text CLIP scores and target classes (e.g., filtering to images close to ImageNet classes). Abbas et al. [1] introduces the concept of semantic duplicates, images with similar semantic meaning that are not perceptually the same image, alongside SemDeDup, a formalized version of the unsupervised deduplication algorithm from [63]. SemDeDup has been shown to be capable of significantly reducing dataset size with only marginal impact on performance. We choose to study SemDeDup due to the ubiquity of its underlying selection method among contemporary deduplication algorithms cosine similarity between samples and scalable nature. To our knowledge, we are the first to study the effect of data pruning on the fairness outcomes of VLP models and study the effects of fairness-aware pruning on their behavior. 3. FairDeDup: Fair Semantic Deduplication There frequently exists sensitive attributes in data for which it is desirable to obtain some notation of fairness [21]. For example, we may seek demographic parity for gender so that individuals do not receive differing treatment based on their gender identity. Such outcomes are usually based on social norms, organizational ethics, or even codified into discrimination law [4, 15, 29, 53]. Our goal is to improve post-deduplication fairness outcomes concerning these sensitive groups. To achieve this, we propose boosting the representation of underrepresented sensitive subgroups on the internet (e.g., women of color) in the post-pruning dataset distribution. We allow for user-defined natural language sensitive concepts, which captures these subgroups for consideration in the deduplication process, and leverage them to bias the selection of preserved samples towards those concepts which are currently underrepresented. 3.1. Preliminaries: SemDeDup We implement FairDeDup as a lightweight modification to the SemDeDup algorithm, which we describe here for com1 Embed & Cluster Dataset SemDeDup FairDeDup (ours) K-Means Clustering Feature Extraction Web-Scale Data 2 Prune Semantic Duplicates Within Clusters Maximize distance to cluster centroids Maximize similarity to underrepresented concepts CLIP Figure 2. The semantic deduplication pipeline following three clusters (8,8,8) with two subgroups (g,a). Connected shapes are duplicates. We (1) embed all images from the dataset with a pretrained model then partition with k-means to enable efficient search during (2) deduplication. We make a simple modification to the maximum distance selection heuristic used by Abbas et al. [1] (left) to improve subgroup diversity by preserving samples which maximize similarity to poorly represented sensitive concepts according to user-specified concept prototypes (right). pleteness. Abbas et al. [1] identify that pruning both exact perceptual duplicates (e.g., copies of the same image) and those that carry redundant semantic information (e.g., many photos of the same object from differing angles), denoted semantic duplicates, is helpful for improving the data efficiency of training large models. To achieve this, they propose SemDeDup [1], an extension of the unsupervised pruning metric from Sorscher et al. [63] to web-scale data. To identify duplicates, SemDeDup first leverages pretrained foundation models (e.g. CLIP [55]) to embed all images in the dataset into a semantically meaningful feature space. Na\u00a8 \u0131vely thresholding embedding similarity between all points to detect duplicates requires O(n2) pairwise comparisons and is intractable for web-scale data like LAION-400M, which requires computing \u22481.5\u00d71017 cosine similarities. To mitigate this, the dataset is partitioned using an efficient K-means algorithm under the assumption that pairwise similarity need only be calculated for approximately similar samples. SemDeDup then considers the resulting O(n2/k) pairwise similarities on an independent per 3 \fcluster basis. Within each cluster, they determine sets of samples within a 1\u2212\u03f5 similarity threshold as duplicates and keep only the sample most distant from the cluster centroid. While this selection heuristic is motivated by the hardness hypothesis of Sorscher et al. [63], ablations show that the algorithm is robust to choosing even a random sample. 3.2. FairDeDup Due to the robustness of SemDeDup to the choice of selection heuristic on performance, we seek instead to replace the heuristic with one that can support our fairness motivation. We provide an overview following shared and unique steps of SemDeDup and FairDeDup in Fig. 2. Sensitive Concept Prototypes. Given a list of user-defined sensitive concepts C that are desired to be represented in the pruned dataset, we denote the concept prototype Pi for a sensitive concept Ci\u2208C as the average text embedding of the set of captions generated from template strings (e.g., \u201cA photo of a {Ci}\u201d) capturing that concept. As is common for VLP models, we assume the embedding model supporting image clustering can also produce image-text alignment scores [32, 41, 55, 72, 74] and consider the case where alignment is determined as the cosine similarity between the representations produced by a vision \u03a6I : I \u2192Rd and text \u03a6T : T \u2192Rd encoder: sim(I, T) = \u03a6I(I)T \u03a6T (T) / \u2225\u03a6I(I)\u2225\u2225\u03a6T (T)\u2225. (1) We measure how well an image aligns with a sensitive concept by measuring the image-text similarity between that image and the concept prototype sim(I, Pi). We choose concepts that both relate to commonly protected demographic subgroups of people and are annotated in common fairness datasets, such as ones based in race and gender. Additional details on the selection of sensitive concepts (Sec. 10) and a list of all concepts used (Sec. 12) are given in the appendix. While this work focuses on text-based prototypes, we note that our methodology trivially extends to image-based ones and beyond, as described in Sec. 6. Sample Preservation Heuristic. To determine which samples to prune, we consider duplicate neighborhoods: the set of images within 1\u2212\u03f5 similarity of a given point, and preserve only one sample from each neighborhood. For each cluster produced by k-means, we track the running average similarity between preserved samples in that cluster and the sensitive concept prototypes. Until all samples are visited, we randomly select an unvisited sample, calculate the similarity between all samples in its neighborhood and the prototypes, and keep only the sample that maximizes similarity to the least similar running average prototype, marking all points in the neighborhood as visited. We preserve the sample with the highest average similarity across concept prototypes for the first neighborhood visited in a cluster. 1 # Input: prototypes, embeddings, eps 2 # Get similarity with concept prototypes 3 proto = embeddings @ prototypes.T 4 5 balance = AverageMeter(prototype.shape[0]) 6 tovisit = torch.ones(embeddings.shape[0]) 7 while tovist.any(): 8 # Find an unvisited neighborhood 9 node = torch.where(tovisit)[0][0] 10 sims = embeddings[node] @ embeddings.T 11 neighbors = torch.where(sims > 1 eps)[0] 12 13 # Maximize least represented concept 14 c = balance.get_min_concept() 15 point = proto[neigbors][:, c].argmax() 16 balance.update(point) 17 18 log_and_keep(point) 19 tovisit[neighbors] = 0 Figure 3. PyTorch-style pseudo-code for FairDeDup selection given concept prototypes, within cluster embeddings, and an eps similarity threshold for determining neighborhoods. We omit the base case where the first sample selected within a cluster is the one with the highest average concept prototype similarity. We track running average similarity on a per cluster basis for two reasons: 1) to avoid a synchronous update step between workers processing clusters in parallel and 2) to prevent algorithmic \u201cgaming\u201d of the selection criteria by balancing concept representation on clusters which highly represent a concept due to some stereotyped notion. Given two clusters primarily composed of doctors and nurses, for example, per cluster processing prevents balancing underselection of feminine presenting doctors by overselecting feminine presenting nurses. We provide pseudo-code for the FairDeDup selection heuristic in Fig. 3. We visualize random samples after pruning a cluster manually identified to be primarily composed of people with FairDeDup and the SemDeDup maximum distance selection heuristic in Fig. 4, and show additional examples in the appendix (Sec. 11). 4. Experiments To assess the effect of deduplication on learned VLP models, we train CLIP-style models on variants of LAION400M [58] and evaluate their performance on both standard and fairness-oriented benchmarks for zero-shot classification and text-image retrieval. 4.1. Models and Training We train all models on LAION-400M [58] as a web-scale dataset representative of those typically used for largescale vision-language pretraining. LAION-400M contains image-text pairs extracted from Common Crawl1 filtered to 1https://commoncrawl.org/ 4 \f(a) Maximum Distance Selection (b) FairDeDup Selection Figure 4. A random sampling of preserved samples from a cluster primarily composed of medical professionals after deduplication. FairDeDup improves selection diversity featuring increased variability in age, skin tone, and gender presentation. have image-text CLIP similarity \u22650.3 without significant further curating. This makes LAION-400M an ideal test case for our setting as it is sufficiently large to train VLP models, captures bias from the internet, and is expected to contain semantically redundant samples. At the time of our data collection, only 375M image-text pairs from LAION400M were still available for download. We train CLIP-ViT-Base/16 [55] models from the OpenClip [30] implementation with vision transformer [18] base (ViT-B-16) as the image encoder and text transformer [67] as the text encoder. We perform distributed training over 80-120 A100 GPUs depending on the model with a global batch size of 33,820 image-caption pairs for 16 epochs regardless of dataset size. We use the AdamW [46] optimizer with linear warm up and cosine annealed learning rate schedule peaking at 5\u00d710\u22124. Additional hyperparameter details are provided in the appendix (Sec. 9). We evaluate CLIP training on three LAION-400M data settings for performance and fairness: Baseline: LAION-400M. We train a CLIP model on the full LAION-400M dataset for a total of 183k steps as a control by which to evaluate baseline performance and fairness. A good model in the deduplicated setting should perform similarly to this model on common benchmarks without negatively impacting subgroup disparity and skew. SemDeDup LAION-400M. For SemDeDup, we use a CLIP-ViT-Base/16 trained on WebImageText (WIT) [55] to produce image embedding which are partitioned into 50, 000 clusters using the FAISS [33] implementation of k-means and set the \u03f5 threshold for identifying duplicates within each cluster such that 50% of samples are pruned. FairDeDup LAION-400M. We leverage the same WIT trained CLIP model for FairDeDup as SemDeDup. We consider 110 sensitive concepts capturing intersectional combinations of age, gender, skin tone, race and ethnicity and represent them using embeddings of 330 corresponding captions (three each with minor syntactic variation). We use the average across captions of the same concept as our prototypes. We enumerate all sensitive concepts and templates used to generate the text prototypes in the appendix (Sec. 12). The selection step can be parallelized across CPUs up to the number of clusters produced by k-means. We find that selection in this setting on a 32 CPU machine takes one hour on average and that the overall time is dominated by the shared GPU parallelizable embedding and clustering steps. 4.2. Datasets and Metrics We evaluate across three benchmarks to validate if models trained on deduplicated data are both performant and fair. Zero-Shot Classification and Retrieval. We evaluate the performance of each model across 41 common zeroshot classification and retrieval datasets from Clip Benchmark [12] such as ImageNet [16], Flickr30k [71], and VTAB [73]. A model trained on deduplicated data should perform at least as well as a model trained in the full-data setting on these benchmarks. Fair Zero-Shot Classification. The FACET [26] dataset contains expert reviewer annotations for 52 person related classes, gender presentation, skin tone, age, and other attributes, on a 32k image subset of Segement Anything 1 Billion (SA-1B) [36]. We perform zero-shot classification over the 52 person-classes by constructing a text prompt (e.g., \u201cA photo of a {class}\u201d) for each class and predicting the class used to construct the prompt with highest similarity to the image. Given a model f, sensitive attribute label l, person5 \fclass C, and set of of images IC l which captures class C featuring a person with label l, we measure the average and worst-class disparity in recall between subgroups of sensitive attributes where disparity is defined as: disparity = recall(f(l1, IC l1 , C)) \u2212recall(f(l2, IC l2 , C)). (2) Conceptually, a large magnitude disparity indicates that a model better predicts positive instances of person-class C for one of the two subgroups, while a disparity of zero indicates equality of opportunity between subgroups. We evaluate subgroup disparity for average perceived gender expression by masculine vs. feminine presentation, lighter (1-4MST2) vs. darker (6-10MST) skin tone, and middle vs. younger and middle vs. older age for all personclasses which have at least 25 samples in both subgroups. Gustafson et al. [26] consider only the 21k images capturing a single person in their disparity analysis for simplicity and alignment between tasks (e.g., classification and visual grounding). To increase the sample size of our analysis, we consider each person in the dataset as a unique sample. We expand the bounding box for each person by 20% to capture context before extracting a square-padded image crop centered on the box, yielding 49,551 images. Fair Image Retrieval. FairFace [34] annotates a balanced dataset of 108k cropped faces from YFCC-100M [66] by seven racial groups with additional annotations for perceived gender and age. Similar to [3, 14, 60], we measure the degree to which the top-k results of an image-text query differ over values of sensitive attributes in the 11k image validation set with respect to the desired proportion of those values with MaxSkew@1000 [24]. Given the top-k images \u03c4 k r returned by image-text query r, let the actual proportion of images returned by the query for a particular value ai\u2208A of sensitive attribute A be P\u03c4 k r ,r,ai\u2208[0, 1] and the desired proportion be Pq,r,ai\u2208[0, 1], then the skew of value ai is: Skewai@k(\u03c4r) = ln \u0012P\u03c4 k r ,r,ai Pq,r,ai \u0013 (3) One limitation of Skew@k is that it is defined only for a single value of a sensitive attribute. To give a more holistic view across all values that a sensitive attribute may take on, we report the most skewed ai with MaxSkew@k: MaxSkew@k(\u03c4r) = max ai\u2208A Skewai@k(\u03c4r) (4) Conceptually, MaxSkew indicates the \u201clargest unfair advantage\u201d [24] provided to images with a particular value of the sensitive attribute for appearing in the the top-k results of the query. We choose the desired proportion of images to be the same as the true distribution of those images 2Monk Skin Tone scale [51] Full Data (100%) SemDeDup (50%) FairDeDup (50%) IN1Kacc@5 .899 .897 (\u2013.002) .897 (\u2013.002) INV2acc@5 .845 .841 (\u2013.004) .837 (\u2013.008) C10acc@5 .999 .998 (\u2013.001) .999 (\u2013.000) C100acc@5 .934 .934 (\u2013.000) .939 (+.005) FlickrR@5 .873 .874 (+.001) .871 (\u2013.002) COCOR@5 .633 .632 (\u2013.001) .626 (\u2013.007) Table 1. Common zero-shot and text-image retrieval benchmarks for CLIP models on ImageNet1K [16], ImageNetV2 [56], CIFAR [39] (C10/C100), Flicker30k [71], and COCO Captions [43]. Higher (\u2191) is better in all cases. The difference in performance from the full-data setting is shown in green (red) when improved (reduced). Both deduplication strategies yield models that preserve the performance of models trained on the full data. in the dataset. Under this condition, if the proportion of of ai in the top-k results is the same as its distribution in the dataset, MaxSkew obtains an optimal result of 0 and achieves demographic parity. Following [3], we report average MaxSkew@1000 across 240 (un)favorable captions orthogonal to images in the dataset (e.g., \u201cA photo of a {smart} person\u201d), matching test attributes and prompts for race (|A|=7), gender (|A|=2), and age (|A|=3). Similar to Seth et al. [60], we bin age into larger groups: younger (0-19), middle (20-49), and older (50-70+) to reduce noise. We additionally report MinSkew@k, which captures the \u201cworst disadvantage in representation\u201d for a subgroup, and the normalized discounted cumulative KL-divergence (NDKL), which captures the weighted average of Skew@k over all attribute values at varying settings of k. Intuitively, MinSkew captures the severity of the most negatively biased subgroup juxtaposed against the most positively biased captured by MaxSkew, and NDKL is a summary statistic over configurations of Skew@k. We refer readers to Geyik et al. [24] for the formulation of MinSkew and NDKL. 5. Results Deduplication Preserves Aggregate Performance. In Tab. 1, we report Accuracy@5 for four common zeroshot image classification datasets: ImageNet1K [16], ImageNetV2 [56], CIFAR-10 and CIFAR-100 [39], and Recall@5 for two common image-text retrieval datasets: Flicker30k [71] and COCO Captions [43]. As expected, the performance drop from the full-data setting to deduplicated is marginal (\u22640.8%), indicating that performance is preserved after pruning 50% of the training data. The performance gap between the two deduplicated-data models is even smaller (\u22640.6%), and neither consistently performs more favorably across tasks. We refer readers to Sec. 13 in the appendix for results on additional datasets and metrics. 6 \fFull (100%) SemDeDup (50%) FairDeDup (50%) Diff. (FDD-SDD) Gender Masc / Femm Mean .104 .113 (+ 9%) .109 (+ 5%) \u2013.004 Max .303 .346 (+14%) .298 (\u2013 2%) \u2013.048 Gap .199 .233 (+17%) .189 (\u2013 5%) \u2013.053 Skin Tone Light / Dark Mean .100 .112 (+12%) .105 (+ 5%) \u2013.007 Max .354 .342 (\u2013 3%) .320 (\u201310%) \u2013.022 Gap .254 .230 (\u2013 9%) .215 (\u201315%) \u2013.015 Age Mid / Yng Mean .063 .059 (\u2013 6%) .075 (+19%) +.016 Max .268 .230 (\u201314%) .225 (\u201316%) \u2013.005 Gap .205 .171 (\u201317%) .150 (\u201327%) \u2013.022 Age Mid / Old Mean .098 .096 (\u2013 2%) .087 (\u201311%) \u2013.009 Max .252 .248 (\u2013 2%) .153 (\u201339%) \u2013.095 Gap .154 .152 (\u2013 1%) .066 (\u201357%) \u2013.008 Table 2. Absolute disparity (Eq. 2) in zero-shot classification performance on FACET [26] averaged across 52 person classes. Larger values indicate a greater performance gap between subgroups when predicting true positive samples of the same occupation. Lower (\u2193) is better for all metrics. Best deduplicated model in bold. The percent change in fairness outcomes from the fulldata setting is shown in green (red) when improved (reduced). SemDeDup Has Mixed Effects on Fairness. We show the result of our zero-shot image classification evaluation on FACET [26] in Tab. 2, studying subgroups across gender, skin tone, and age-based sensitive attributes. We find that SemDeDup yields mixed impacts. SemDeDup reinforces average and worst-class disparity across gender subgroups, exacerbates average disparity in skin tone while mitigating the worst-class, and surprisingly aids in reducing average and worst-class disparity across age groups. In Tab. 3, we present the results of our text-image retrieval evaluation on FairFace [34], focusing on subgroups related to gender, race, and age. We again find that SemDeDup demonstrates mixed effects. SemDeDup reinforces gender skew across all metrics but mitigates skew towards the largest unfairly advantaged group (MaxSkew) while magnifying skew away from the worst disadvantaged group. FairDeDup Improves Fairness Over SemDeDup. FairDeDup improves fairness outcomes over SemDeDup on FACET by mitigating, rather than exasperating, worst-class gender disparity while improving disparity outcomes in all cases except for age between middle-aged and young subgroups. With respect to SemDeDup, FairDeDup reduces the average over groups for mean disparity by .0001 (.0067 excluding Age Mid/Yng), worst-class by .0425 and gap by .0245. This result demonstrates that FairDeDup more closely achieves equality of opportunity than SemDeDup. FairFace also shows evidence that FairDeDup improves fairness outcomes. While both methods increase gender Full (100%) SemDeDup (50%) FairDeDup (50%) Diff. (FDD-SDD) Gender MinSkew .159 .223 (+40%) .182 (+14%) \u2013.041 MaxSkew .123 .153 (+24%) .125 (+ 2%) \u2013.028 NDKL .010 .015 (+50%) .012 (+20%) \u2013.003 Race MinSkew .545 .583 (+ 7%) .513 (\u2013 6%) \u2013.070 MaxSkew .432 .401 (\u2013 7%) .372 (\u201314%) \u2013.029 NDKL .035 .034 (\u2013 3%) .030 (\u201314%) \u2013.004 Age MinSkew .618 .702 (+14%) .647 (+ 5%) \u2013.055 MaxSkew .241 .224 (\u2013 7%) .296 (+23%) +.072 NDKL .023 .022 (\u2013 4%) .028 (+22%) +.006 Table 3. Skew evaluation on FairFace [34] averaged over 240 textimage query templates. As MinSkew is a negative metric optimal at its upper bound of zero, we report its absolute value for readability so that lower (\u2193) is better for all metrics. Best deduplicated model in bold. The percent change in fairness outcomes from the full-data setting is shown in green (red) when improved (reduced). skew, FairDeDup exhibits a milder skew across all summary metrics. For race, both methods mitigate the effects of the largest unfairly advantaged group (MaxSkew) compared to the baseline, while FairDeDup mitigates the magnitude of MaxSkew and reduces the skew against the worst disadvantaged class (MinSkew) compared to the baseline. Determining the best-performing method for age-based subgroups is inconclusive. Across gender and race groups, FairDeDup reduces MinSkew by .0555, MaxSkew by .0285 and NDKL by .0035. This results demonstrates that FairDeDup better achieves demographic parity than SemDeDup w.r.t. gender and race, even outperforming the full-data setting on race. 6. Discussion Below we discuss observations when pruning smaller-scale annotated data, potential FairDeDup variants for varied concept prototypes, and limitations of our approach. Evaluation on Demographically Annotated Data. In this paper, we have shown on large-scale real model training that FairDeDup achieves results on-par with SemDeDup on standard benchmarks, while demonstrating improved fairness outcomes. We believe that is the clearest signal about the applicability of FairDeDup in real-world usage. However, we would also like to directly demonstrate that FairDeDup does indeed select more diverse data representations compared to SemDeDup. To do so, we consider deduplicating the FACET [26] images described in Sec. 4. We perform k-means clustering (k=50) on the images with ten different random seeds and apply both deduplication methods to each. In Tab. 4, we report the percent of the postpruning dataset labeled as non-majority classes for gender (feminine, non-binary, other), skin tone (MST>4, other), and age (younger, older, other), averaged across the ten 7 \fFull Data (100%) SemDeDup (50%) FairDeDup (50%) Gender 32.92% 31.91% 32.29% Skin Tone 51.28% 50.46% 51.06% Age 44.74% 43.62% 44.06% Table 4. Data mass allocated to minority classes in FACET [26] after deduplication averaged over ten random seeds. We consider minority classes by gender, skin tone, and age. The difference between means of SemDeDup and FairDeDup across trials is significant at >99.9% confidence (n=10) for all groups according to a paired t-test. In all cases, we observe that FairDeDup helps recover mass reallocated to the majority class by SemDeDup. trials. This analysis indicates that 1) SemDeDup does indeed reduce the frequency of the least well represented subgroups and 2) that FairDeDup mitigates this effect. The difference between means across trials of SemDeDup and FairDeDup is statistically significant at \u226599.9% confidence (n=10) across all groups according to a paired t-test. Variants and Applications of the FairDedup Algorithm. In our experiments, we use text-based prototypes to guide FairDeDup towards balancing representation of sensitive concepts. However, the exact specification of these prototypes is flexible to other subjects (e.g., non-person related) and modalities (e.g., image-based concepts). FairDeDup can be trivially modified to consider any prototype for which the embedding model can output similarity to individual images, such as sets of semantically aligned images (e.g., based on image type, photographs, illustrations, infographics, etc), or a combination of image and text prototypes. Similarly, FairDedup can be used to boost underrepresented samples from arbitrary sets such as object entities [70], or other forms of semantic organization. 6.1. Limitations Clustering Restrictions on Selection. While clustering allows deduplication algorithms to scale to hundreds of millions of samples, it also limits the availability of lowerrepresented samples for balancing sensitive concept representation. Take, for example, a data subset capturing photos of dancers. If the clustering algorithm creates two \u201cdancer\u201d clusters, bifurcating across binary gender presentation, then FairDeDup will be unable to perform significant gender balancing due to the independent processing of each cluster. We note that the resulting balance will be based on a combination of the underlying number of \u201cdancer\u201d photos in the dataset and the rate of duplication within both groups. If the two clusters are approximately equal sized with equal frequency of semantic duplicates, the independent deduplication of both clusters is equivalent in representation to a joint deduplication with respect to the bifurcated attribute. We display demonstrative clusters in the appendix (Sec. 8). Bias Transfer From the Embedding Model. By deduplicating based on model embeddings, we subject the selection of samples to the biases of the embedding model. The majority of sensitive concepts we select are social constructs based in gender and race, and are not identifiable by anyone other than the photographed individual. We therefore expect sensitive concept representation to be based upon the predominate social norms they capture, rather than necessarily true identities of individuals. Nonetheless, we assert that a deduplication method which maintains the bias of the full-data setting is a favorable start to one that magnifies it. Demographic Representation in Fairness Datasets. Most contemporary fairness datasets lack annotations from the individuals they represent. Consequently, for nonstationary socially constructed attributes such as gender, race, and perceived young/oldness, the captured data relies solely on annotators\u2019 subjective understanding. Additionally, these datasets often limit gender representation to a binary perspective (occasionally including a small \u201cother\u201d category) [17], a necessary operationalization for scale that is not inclusive of bias characterization for diverse gender identities. We also note that fairness datasets cover a limited number of directions under which a model may express bias, excluding disability, national origin, and other sensitive attributes. Our analysis, therefore, only examines fairness outcomes with respect to contemporary and subjective evaluation of these limited available demographic attributes. 7."
19
+ }
abs_9K/validation_abstract_short_2404.16130v1.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.16130v1",
3
+ "title": "From Local to Global: A Graph RAG Approach to Query-Focused Summarization",
4
+ "abstract": "The use of retrieval-augmented generation (RAG) to retrieve relevant\ninformation from an external knowledge source enables large language models\n(LLMs) to answer questions over private and/or previously unseen document\ncollections. However, RAG fails on global questions directed at an entire text\ncorpus, such as \"What are the main themes in the dataset?\", since this is\ninherently a query-focused summarization (QFS) task, rather than an explicit\nretrieval task. Prior QFS methods, meanwhile, fail to scale to the quantities\nof text indexed by typical RAG systems. To combine the strengths of these\ncontrasting methods, we propose a Graph RAG approach to question answering over\nprivate text corpora that scales with both the generality of user questions and\nthe quantity of source text to be indexed. Our approach uses an LLM to build a\ngraph-based text index in two stages: first to derive an entity knowledge graph\nfrom the source documents, then to pregenerate community summaries for all\ngroups of closely-related entities. Given a question, each community summary is\nused to generate a partial response, before all partial responses are again\nsummarized in a final response to the user. For a class of global sensemaking\nquestions over datasets in the 1 million token range, we show that Graph RAG\nleads to substantial improvements over a na\\\"ive RAG baseline for both the\ncomprehensiveness and diversity of generated answers. An open-source,\nPython-based implementation of both global and local Graph RAG approaches is\nforthcoming at https://aka.ms/graphrag.",
5
+ "authors": "Darren Edge, Ha Trinh, Newman Cheng, Joshua Bradley, Alex Chao, Apurva Mody, Steven Truitt, Jonathan Larson",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-04-24",
8
+ "primary_cat": "cs.CL",
9
+ "cats": [
10
+ "cs.CL",
11
+ "cs.AI",
12
+ "cs.IR",
13
+ "H.3.3; I.2.7"
14
+ ],
15
+ "label": "Original Paper",
16
+ "paper_cat": "Knowledge AND Graph",
17
+ "gt": "The use of retrieval-augmented generation (RAG) to retrieve relevant\ninformation from an external knowledge source enables large language models\n(LLMs) to answer questions over private and/or previously unseen document\ncollections. However, RAG fails on global questions directed at an entire text\ncorpus, such as \"What are the main themes in the dataset?\", since this is\ninherently a query-focused summarization (QFS) task, rather than an explicit\nretrieval task. Prior QFS methods, meanwhile, fail to scale to the quantities\nof text indexed by typical RAG systems. To combine the strengths of these\ncontrasting methods, we propose a Graph RAG approach to question answering over\nprivate text corpora that scales with both the generality of user questions and\nthe quantity of source text to be indexed. Our approach uses an LLM to build a\ngraph-based text index in two stages: first to derive an entity knowledge graph\nfrom the source documents, then to pregenerate community summaries for all\ngroups of closely-related entities. Given a question, each community summary is\nused to generate a partial response, before all partial responses are again\nsummarized in a final response to the user. For a class of global sensemaking\nquestions over datasets in the 1 million token range, we show that Graph RAG\nleads to substantial improvements over a na\\\"ive RAG baseline for both the\ncomprehensiveness and diversity of generated answers. An open-source,\nPython-based implementation of both global and local Graph RAG approaches is\nforthcoming at https://aka.ms/graphrag.",
18
+ "main_content": "Introduction Human endeavors across a range of domains rely on our ability to read and reason about large collections of documents, often reaching conclusions that go beyond anything stated in the source texts themselves. With the emergence of large language models (LLMs), we are already witnessing attempts to automate human-like sensemaking in complex domains like scientific discovery (Microsoft, 2023) and intelligence analysis (Ranade and Joshi, 2023), where sensemaking is defined as Preprint. Under review. arXiv:2404.16130v1 [cs.CL] 24 Apr 2024 \fSource Documents Text Chunks text extraction and chunking Element Instances domain-tailored summarization Element Summaries domain-tailored summarization Graph Communities community detection Community Summaries domain-tailored summarization Community Answers query-focused summarization Global Answer query-focused summarization Indexing Time Query Time Pipeline Stage Figure 1: Graph RAG pipeline using an LLM-derived graph index of source document text. This index spans nodes (e.g., entities), edges (e.g., relationships), and covariates (e.g., claims) that have been detected, extracted, and summarized by LLM prompts tailored to the domain of the dataset. Community detection (e.g., Leiden, Traag et al., 2019) is used to partition the graph index into groups of elements (nodes, edges, covariates) that the LLM can summarize in parallel at both indexing time and query time. The \u201cglobal answer\u201d to a given query is produced using a final round of query-focused summarization over all community summaries reporting relevance to that query. \u201ca motivated, continuous effort to understand connections (which can be among people, places, and events) in order to anticipate their trajectories and act effectively\u201d (Klein et al., 2006a). Supporting human-led sensemaking over entire text corpora, however, needs a way for people to both apply and refine their mental model of the data (Klein et al., 2006b) by asking questions of a global nature. Retrieval-augmented generation (RAG, Lewis et al., 2020) is an established approach to answering user questions over entire datasets, but it is designed for situations where these answers are contained locally within regions of text whose retrieval provides sufficient grounding for the generation task. Instead, a more appropriate task framing is query-focused summarization (QFS, Dang, 2006), and in particular, query-focused abstractive summarization that generates natural language summaries and not just concatenated excerpts (Baumel et al., 2018; Laskar et al., 2020; Yao et al., 2017) . In recent years, however, such distinctions between summarization tasks that are abstractive versus extractive, generic versus query-focused, and single-document versus multi-document, have become less relevant. While early applications of the transformer architecture showed substantial improvements on the state-of-the-art for all such summarization tasks (Goodwin et al., 2020; Laskar et al., 2022; Liu and Lapata, 2019), these tasks are now trivialized by modern LLMs, including the GPT (Achiam et al., 2023; Brown et al., 2020), Llama (Touvron et al., 2023), and Gemini (Anil et al., 2023) series, all of which can use in-context learning to summarize any content provided in their context window. The challenge remains, however, for query-focused abstractive summarization over an entire corpus. Such volumes of text can greatly exceed the limits of LLM context windows, and the expansion of such windows may not be enough given that information can be \u201clost in the middle\u201d of longer contexts (Kuratov et al., 2024; Liu et al., 2023). In addition, although the direct retrieval of text chunks in na\u00a8 \u0131ve RAG is likely inadequate for QFS tasks, it is possible that an alternative form of pre-indexing could support a new RAG approach specifically targeting global summarization. In this paper, we present a Graph RAG approach based on global summarization of an LLM-derived knowledge graph (Figure 1). In contrast with related work that exploits the structured retrieval and traversal affordances of graph indexes (subsection 4.2), we focus on a previously unexplored quality of graphs in this context: their inherent modularity (Newman, 2006) and the ability of community detection algorithms to partition graphs into modular communities of closely-related nodes (e.g., Louvain, Blondel et al., 2008; Leiden, Traag et al., 2019). LLM-generated summaries of these 2 \f0 1 2 3 0 10000 20000 30000 Number of gleanings performed Entity references detected 600 chunk size 1200 chunk size 2400 chunk size Figure 2: How the entity references detected in the HotPotQA dataset (Yang et al., 2018) varies with chunk size and gleanings for our generic entity extraction prompt with gpt-4-turbo. community descriptions provide complete coverage of the underlying graph index and the input documents it represents. Query-focused summarization of an entire corpus is then made possible using a map-reduce approach: first using each community summary to answer the query independently and in parallel, then summarizing all relevant partial answers into a final global answer. To evaluate this approach, we used an LLM to generate a diverse set of activity-centered sensemaking questions from short descriptions of two representative real-world datasets, containing podcast transcripts and news articles respectively. For the target qualities of comprehensiveness, diversity, and empowerment (defined in subsection 3.4) that develop understanding of broad issues and themes, we both explore the impact of varying the the hierarchical level of community summaries used to answer queries, as well as compare to na\u00a8 \u0131ve RAG and global map-reduce summarization of source texts. We show that all global approaches outperform na\u00a8 \u0131ve RAG on comprehensiveness and diversity, and that Graph RAG with intermediateand low-level community summaries shows favorable performance over source text summarization on these same metrics, at lower token costs. 2 Graph RAG Approach & Pipeline We now unpack the high-level data flow of the Graph RAG approach (Figure 1) and pipeline, describing key design parameters, techniques, and implementation details for each step. 2.1 Source Documents \u2192Text Chunks A fundamental design decision is the granularity with which input texts extracted from source documents should be split into text chunks for processing. In the following step, each of these chunks will be passed to a set of LLM prompts designed to extract the various elements of a graph index. Longer text chunks require fewer LLM calls for such extraction, but suffer from the recall degradation of longer LLM context windows (Kuratov et al., 2024; Liu et al., 2023). This behavior can be observed in Figure 2 in the case of a single extraction round (i.e., with zero gleanings): on a sample dataset (HotPotQA, Yang et al., 2018), using a chunk size of 600 token extracted almost twice as many entity references as when using a chunk size of 2400. While more references are generally better, any extraction process needs to balance recall and precision for the target activity. 2.2 Text Chunks \u2192Element Instances The baseline requirement for this step is to identify and extract instances of graph nodes and edges from each chunk of source text. We do this using a multipart LLM prompt that first identifies all entities in the text, including their name, type, and description, before identifying all relationships between clearly-related entities, including the source and target entities and a description of their relationship. Both kinds of element instance are output in a single list of delimited tuples. The primary opportunity to tailor this prompt to the domain of the document corpus lies in the choice of few-shot examples provided to the LLM for in-context learning (Brown et al., 2020). 3 \fFor example, while our default prompt extracting the broad class of \u201cnamed entities\u201d like people, places, and organizations is generally applicable, domains with specialized knowledge (e.g., science, medicine, law) will benefit from few-shot examples specialized to those domains. We also support a secondary extraction prompt for any additional covariates we would like to associate with the extracted node instances. Our default covariate prompt aims to extract claims linked to detected entities, including the subject, object, type, description, source text span, and start and end dates. To balance the needs of efficiency and quality, we use multiple rounds of \u201cgleanings\u201d, up to a specified maximum, to encourage the LLM to detect any additional entities it may have missed on prior extraction rounds. This is a multi-stage process in which we first ask the LLM to assess whether all entities were extracted, using a logit bias of 100 to force a yes/no decision. If the LLM responds that entities were missed, then a continuation indicating that \u201cMANY entities were missed in the last extraction\u201d encourages the LLM to glean these missing entities. This approach allows us to use larger chunk sizes without a drop in quality (Figure 2) or the forced introduction of noise. 2.3 Element Instances \u2192Element Summaries The use of an LLM to \u201cextract\u201d descriptions of entities, relationships, and claims represented in source texts is already a form of abstractive summarization, relying on the LLM to create independently meaningful summaries of concepts that may be implied but not stated by the text itself (e.g., the presence of implied relationships). To convert all such instance-level summaries into single blocks of descriptive text for each graph element (i.e., entity node, relationship edge, and claim covariate) requires a further round of LLM summarization over matching groups of instances. A potential concern at this stage is that the LLM may not consistently extract references to the same entity in the same text format, resulting in duplicate entity elements and thus duplicate nodes in the entity graph. However, since all closely-related \u201ccommunities\u201d of entities will be detected and summarized in the following step, and given that LLMs can understand the common entity behind multiple name variations, our overall approach is resilient to such variations provided there is sufficient connectivity from all variations to a shared set of closely-related entities. Overall, our use of rich descriptive text for homogeneous nodes in a potentially noisy graph structure is aligned with both the capabilities of LLMs and the needs of global, query-focused summarization. These qualities also differentiate our graph index from typical knowledge graphs, which rely on concise and consistent knowledge triples (subject, predicate, object) for downstream reasoning tasks. 2.4 Element Summaries \u2192Graph Communities The index created in the previous step can be modelled as an homogeneous undirected weighted graph in which entity nodes are connected by relationship edges, with edge weights representing the normalized counts of detected relationship instances. Given such a graph, a variety of community detection algorithms may be used to partition the graph into communities of nodes with stronger connections to one another than to the other nodes in the graph (e.g., see the surveys by Fortunato, 2010 and Jin et al., 2021). In our pipeline, we use Leiden (Traag et al., 2019) on account of its ability to recover hierarchical community structure of large-scale graphs efficiently (Figure 3). Each level of this hierarchy provides a community partition that covers the nodes of the graph in a mutually-exclusive, collective-exhaustive way, enabling divide-and-conquer global summarization. 2.5 Graph Communities \u2192Community Summaries The next step is to create report-like summaries of each community in the Leiden hierarchy, using a method designed to scale to very large datasets. These summaries are independently useful in their own right as a way to understand the global structure and semantics of the dataset, and may themselves be used to make sense of a corpus in the absence of a question. For example, a user may scan through community summaries at one level looking for general themes of interest, then follow links to the reports at the lower level that provide more details for each of the subtopics. Here, however, we focus on their utility as part of a graph-based index used for answering global queries. Community summaries are generated in the following way: 4 \f(a) Root communities at level 0 (b) Sub-communities at level 1 Figure 3: Graph communities detected using the Leiden algorithm (Traag et al., 2019) over the MultiHop-RAG (Tang and Yang, 2024) dataset as indexed. Circles represent entity nodes with size proportional to their degree. Node layout was performed via OpenORD (Martin et al., 2011) and Force Atlas 2 (Jacomy et al., 2014). Node colors represent entity communities, shown at two levels of hierarchical clustering: (a) Level 0, corresponding to the hierarchical partition with maximum modularity, and (b) Level 1, which reveals internal structure within these root-level communities. \u2022 Leaf-level communities. The element summaries of a leaf-level community (nodes, edges, covariates) are prioritized and then iteratively added to the LLM context window until the token limit is reached. The prioritization is as follows: for each community edge in decreasing order of combined source and target node degree (i.e., overall prominance), add descriptions of the source node, target node, linked covariates, and the edge itself. \u2022 Higher-level communities. If all element summaries fit within the token limit of the context window, proceed as for leaf-level communities and summarize all element summaries within the community. Otherwise, rank sub-communities in decreasing order of element summary tokens and iteratively substitute sub-community summaries (shorter) for their associated element summaries (longer) until fit within the context window is achieved. 2.6 Community Summaries \u2192Community Answers \u2192Global Answer Given a user query, the community summaries generated in the previous step can be used to generate a final answer in a multi-stage process. The hierarchical nature of the community structure also means that questions can be answered using the community summaries from different levels, raising the question of whether a particular level in the hierarchical community structure offers the best balance of summary detail and scope for general sensemaking questions (evaluated in section 3). For a given community level, the global answer to any user query is generated as follows: \u2022 Prepare community summaries. Community summaries are randomly shuffled and divided into chunks of pre-specified token size. This ensures relevant information is distributed across chunks, rather than concentrated (and potentially lost) in a single context window. \u2022 Map community answers. Generate intermediate answers in parallel, one for each chunk. The LLM is also asked to generate a score between 0-100 indicating how helpful the generated answer is in answering the target question. Answers with score 0 are filtered out. \u2022 Reduce to global answer. Intermediate community answers are sorted in descending order of helpfulness score and iteratively added into a new context window until the token limit is reached. This final context is used to generate the global answer returned to the user. 5 \fDataset Example activity framing and generation of global sensemaking questions Podcast transcripts User: A tech journalist looking for insights and trends in the tech industry Task: Understanding how tech leaders view the role of policy and regulation Questions: 1. Which episodes deal primarily with tech policy and government regulation? 2. How do guests perceive the impact of privacy laws on technology development? 3. Do any guests discuss the balance between innovation and ethical considerations? 4. What are the suggested changes to current policies mentioned by the guests? 5. Are collaborations between tech companies and governments discussed and how? News articles User: Educator incorporating current affairs into curricula Task: Teaching about health and wellness Questions: 1. What current topics in health can be integrated into health education curricula? 2. How do news articles address the concepts of preventive medicine and wellness? 3. Are there examples of health articles that contradict each other, and if so, why? 4. What insights can be gleaned about public health priorities based on news coverage? 5. How can educators use the dataset to highlight the importance of health literacy? Table 1: Examples of potential users, tasks, and questions generated by the LLM based on short descriptions of the target datasets. Questions target global understanding rather than specific details. 3 Evaluation 3.1 Datasets We selected two datasets in the one million token range, each equivalent to about 10 novels of text and representative of the kind of corpora that users may encounter in their real world activities: \u2022 Podcast transcripts. Compiled transcripts of podcast conversations between Kevin Scott, Microsoft CTO, and other technology leaders (Behind the Tech, Scott, 2024). Size: 1669 \u00d7 600-token text chunks, with 100-token overlaps between chunks (\u223c1 million tokens). \u2022 News articles. Benchmark dataset comprising news articles published from September 2013 to December 2023 in a range of categories, including entertainment, business, sports, technology, health, and science (MultiHop-RAG; Tang and Yang, 2024). Size: 3197 \u00d7 600-token text chunks, with 100-token overlaps between chunks (\u223c1.7 million tokens). 3.2 Queries Many benchmark datasets for open-domain question answering exist, including HotPotQA (Yang et al., 2018), MultiHop-RAG (Tang and Yang, 2024), and MT-Bench (Zheng et al., 2024). However, the associated question sets target explicit fact retrieval rather than summarization for the purpose of data sensemaking, i.e., the process though which people inspect, engage with, and contextualize data within the broader scope of real-world activities (Koesten et al., 2021). Similarly, methods for extracting latent summarization queries from source texts also exist (Xu and Lapata, 2021), but such extracted questions can target details that betray prior knowledge of the texts. To evaluate the effectiveness of RAG systems for more global sensemaking tasks, we need questions that convey only a high-level understanding of dataset contents, and not the details of specific texts. We used an activity-centered approach to automate the generation of such questions: given a short description of a dataset, we asked the LLM to identify N potential users and N tasks per user, then for each (user, task) combination, we asked the LLM to generate N questions that require understanding of the entire corpus. For our evaluation, a value of N = 5 resulted in 125 test questions per dataset. Table 1 shows example questions for each of the two evaluation datasets. 6 \f3.3 Conditions We compare six different conditions in our analysis, including Graph RAG using four levels of graph communities (C0, C1, C2, C3), a text summarization method applying our map-reduce approach directly to source texts (TS), and a na\u00a8 \u0131ve \u201csemantic search\u201d RAG approach (SS): \u2022 CO. Uses root-level community summaries (fewest in number) to answer user queries. \u2022 C1. Uses high-level community summaries to answer queries. These are sub-communities of C0, if present, otherwise C0 communities projected down. \u2022 C2. Uses intermediate-level community summaries to answer queries. These are subcommunities of C1, if present, otherwise C1 communities projected down. \u2022 C3. Uses low-level community summaries (greatest in number) to answer queries. These are sub-communities of C2, if present, otherwise C2 communities projected down. \u2022 TS. The same method as in subsection 2.6, except source texts (rather than community summaries) are shuffled and chunked for the map-reduce summarization stages. \u2022 SS. An implementation of na\u00a8 \u0131ve RAG in which text chunks are retrieved and added to the available context window until the specified token limit is reached. The size of the context window and the prompts used for answer generation are the same across all six conditions (except for minor modifications to reference styles to match the types of context information used). Conditions only differ in how the contents of the context window are created. The graph index supporting conditions C0-C3 was created using our generic prompts for entity and relationship extraction only, with entity types and few-shot examples tailored to the domain of the data. The graph indexing process used a context window size of 600 tokens with 1 gleaning for the Podcast dataset and 0 gleanings for the News dataset. 3.4 Metrics LLMs have been shown to be good evaluators of natural language generation, achieving state-ofthe-art or competitive results compared against human judgements (Wang et al., 2023a; Zheng et al., 2024). While this approach can generate reference-based metrics when gold standard answers are known, it is also capable of measuring the qualities of generated texts (e.g., fluency) in a referencefree style (Wang et al., 2023a) as well as in head-to-head comparison of competing outputs (LLMas-a-judge, Zheng et al., 2024). LLMs have also shown promise at evaluating the performance of conventional RAG systems, automatically evaluating qualities like context relevance, faithfulness, and answer relevance (RAGAS, Es et al., 2023). Given the multi-stage nature of our Graph RAG mechanism, the multiple conditions we wanted to compare, and the lack of gold standard answers to our activity-based sensemaking questions, we decided to adopt a head-to-head comparison approach using an LLM evaluator. We selected three target metrics capturing qualities that are desirable for sensemaking activities, as well as a control metric (directness) used as a indicator of validity. Since directness is effectively in opposition to comprehensiveness and diversity, we would not expect any method to win across all four metrics. Our head-to-head measures computed using an LLM evaluator are as follows: \u2022 Comprehensiveness. How much detail does the answer provide to cover all aspects and details of the question? \u2022 Diversity. How varied and rich is the answer in providing different perspectives and insights on the question? \u2022 Empowerment. How well does the answer help the reader understand and make informed judgements about the topic? \u2022 Directness. How specifically and clearly does the answer address the question? For our evaluation, the LLM is provided with the question, target metric, and a pair of answers, and asked to assess which answer is better according to the metric, as well as why. It returns the winner if one exists, otherwise a tie if they are fundamentally similar and the differences are negligible. To account for the stochasticity of LLMs, we run each comparison five times and use mean scores. Table 2 shows an example of LLM-generated assessment. 7 \fQuestion Which public figures are repeatedly mentioned across various entertainment articles? Graph RAG Overview of Prominent Public Figures in Entertainment The entertainment industry is vast and diverse, encompassing film, television, music, sports, and digital media. Certain public figures stand out due to their significant contributions and influence across these sectors. The following summary highlights key individuals who are repeatedly mentioned in various entertainment articles, reflecting their impact and presence within the industry. Actors and Directors [...] Public Figures in Controversy [...] Musicians and Executives [...] Athletes and Coaches [...] Influencers and Entrepreneurs [...] The repeated mention of these figures in entertainment articles signifies their ongoing relevance and the public\u2019s interest in their work. Their influence spans across various aspects of entertainment, from shaping cultural narratives in film and television to driving trends in music and digital media. These individuals not only contribute to their respective fields but also influence the broader cultural landscape, often becoming central figures in social discussions and public discourse. Na\u00a8 \u0131ve RAG Public figures who are repeatedly mentioned across various entertainment articles include Taylor Swift, Travis Kelce, Britney Spears, and Justin Timberlake. These individuals have been highlighted for various reasons, ranging from their professional achievements to their personal lives. Taylor Swift [...] Travis Kelce [...] Britney Spears [...] Justin Timberlake [...] These figures are frequently covered due to their high-profile status and the public\u2019s interest in their careers and personal lives. Their activities, whether in music, sports, or personal relationships, have significant cultural and economic impacts, as evidenced by the media coverage and public reactions. LLM Decision Comprehensiveness: Winner=1 (Graph RAG) Answer 1 is better because it provides a more comprehensive and detailed list of public figures from a wider range of entertainment sectors, including film, television, music, sports, gaming, and digital media. It also includes specific examples of their contributions and the impact they have on their respective fields, as well as mentions of controversies and their implications. Answer 2, while detailed in its coverage of a few individuals, is limited to a smaller number of public figures and focuses primarily on their personal lives and relationships rather than a broad spectrum of their professional influence across the entertainment industry. Diversity: Winner=1 (Graph RAG) Answer 1 is better because it provides a more varied and rich response by covering a wide range of public figures from different sectors of the entertainment industry, including film, television, music, sports, gaming, and digital media. It offers insights into the contributions and influence of these figures, as well as controversies and their impact on public discourse. The answer also cites specific data sources for each mentioned figure, indicating a diverse range of evidence to support the claims. In contrast, Answer 2 focuses on a smaller group of public figures, primarily from the music industry and sports, and relies heavily on a single source for data, which makes it less diverse in perspectives and insights. Empowerment: Winner=1 (Graph RAG) Answer 1 is better because it provides a comprehensive and structured overview of public figures across various sectors of the entertainment industry, including film, television, music, sports, and digital media. It lists multiple individuals, providing specific examples of their contributions and the context in which they are mentioned in entertainment articles, along with references to data reports for each claim. This approach helps the reader understand the breadth of the topic and make informed judgments without being misled. In contrast, Answer 2 focuses on a smaller group of public figures and primarily discusses their personal lives and relationships, which may not provide as broad an understanding of the topic. While Answer 2 also cites sources, it does not match the depth and variety of Answer 1. Directness: Winner=2 (Na\u00a8 \u0131ve RAG) Answer 2 is better because it directly lists specific public figures who are repeatedly mentioned across various entertainment articles, such as Taylor Swift, Travis Kelce, Britney Spears, and Justin Timberlake, and provides concise explanations for their frequent mentions. Answer 1, while comprehensive, includes a lot of detailed information about various figures in different sectors of entertainment, which, while informative, does not directly answer the question with the same level of conciseness and specificity as Answer 2. Table 2: Example question for the News article dataset, with generated answers from Graph RAG (C2) and Na\u00a8 \u0131ve RAG, as well as LLM-generated assessments. 8 \fPodcast transcripts 50 17 28 25 22 21 83 50 50 48 43 44 72 50 50 53 50 49 75 52 47 50 52 50 78 57 50 48 50 52 79 56 51 50 48 50 SS TS C0 C1 C2 C3 SS TS C0 C1 C2 C3 Comprehensiveness 50 18 23 25 19 19 82 50 50 50 43 46 77 50 50 50 46 44 75 50 50 50 44 45 81 57 54 56 50 48 81 54 56 55 52 50 SS TS C0 C1 C2 C3 SS TS C0 C1 C2 C3 Diversity 50 42 57 52 49 51 58 50 59 55 52 51 43 41 50 49 47 48 48 45 51 50 49 50 51 48 53 51 50 51 49 49 52 50 49 50 SS TS C0 C1 C2 C3 SS TS C0 C1 C2 C3 Empowerment 50 56 65 60 60 60 44 50 55 52 51 52 35 45 50 47 48 48 40 48 53 50 50 50 40 49 52 50 50 50 40 48 52 50 50 50 SS TS C0 C1 C2 C3 SS TS C0 C1 C2 C3 Directness News articles 50 20 28 25 21 21 80 50 44 41 38 36 72 56 50 52 54 52 75 59 48 50 58 55 79 62 46 42 50 59 79 64 48 45 41 50 SS TS C0 C1 C2 C3 SS TS C0 C1 C2 C3 Comprehensiveness 50 33 38 35 29 31 67 50 53 45 44 40 62 47 50 40 41 41 65 55 60 50 50 50 71 56 59 50 50 51 69 60 59 50 49 50 SS TS C0 C1 C2 C3 SS TS C0 C1 C2 C3 Diversity 50 47 57 49 50 50 53 50 58 50 50 48 43 42 50 42 45 44 51 50 58 50 52 51 50 50 55 48 50 50 50 52 56 49 50 50 SS TS C0 C1 C2 C3 SS TS C0 C1 C2 C3 Empowerment 50 54 59 55 55 54 46 50 55 53 52 52 41 45 50 48 48 47 45 47 52 50 49 49 45 48 52 51 50 49 46 48 53 51 51 50 SS TS C0 C1 C2 C3 SS TS C0 C1 C2 C3 Directness Figure 4: Head-to-head win rate percentages of (row condition) over (column condition) across two datasets, four metrics, and 125 questions per comparison (each repeated five times and averaged). The overall winner per dataset and metric is shown in bold. Self-win rates were not computed but are shown as the expected 50% for reference. All Graph RAG conditions outperformed na\u00a8 \u0131ve RAG on comprehensiveness and diversity. Conditions C1-C3 also showed slight improvements in answer comprehensiveness and diversity over TS (global text summarization without a graph index). 3.5 Configuration The effect of context window size on any particular task is unclear, especially for models like gpt-4-turbo with a large context size of 128k tokens. Given the potential for information to be \u201clost in the middle\u201d of longer contexts (Kuratov et al., 2024; Liu et al., 2023), we wanted to explore the effects of varying the context window size for our combinations of datasets, questions, and metrics. In particular, our goal was to determine the optimum context size for our baseline condition (SS) and then use this uniformly for all query-time LLM use. To that end, we tested four context window sizes: 8k, 16k, 32k and 64k. Surprisingly, the smallest context window size tested (8k) was universally better for all comparisons on comprehensiveness (average win rate of 58.1%), while performing comparably with larger context sizes on diversity (average win rate = 52.4%), and empowerment (average win rate = 51.3%). Given our preference for more comprehensive and diverse answers, we therefore used a fixed context window size of 8k tokens for the final evaluation. 3.6 Results The indexing process resulted in a graph consisting of 8564 nodes and 20691 edges for the Podcast dataset, and a larger graph of 15754 nodes and 19520 edges for the News dataset. Table 3 shows the number of community summaries at different levels of each graph community hierarchy. Global approaches vs. na\u00a8 \u0131ve RAG. As shown in Figure 4, global approaches consistently outperformed the na\u00a8 \u0131ve RAG (SS) approach in both comprehensiveness and diversity metrics across datasets. Specifically, global approaches achieved comprehensiveness win rates between 72-83% for Podcast transcripts and 72-80% for News articles, while diversity win rates ranged from 75-82% and 62-71% respectively. Our use of directness as a validity test also achieved the expected results, i.e., that na\u00a8 \u0131ve RAG produces the most direct responses across all comparisons. 9 \fPodcast Transcripts News Articles C0 C1 C2 C3 TS C0 C1 C2 C3 TS Units 34 367 969 1310 1669 55 555 1797 2142 3197 Tokens 26657 225756 565720 746100 1014611 39770 352641 980898 1140266 1707694 % Max 2.6 22.2 55.8 73.5 100 2.3 20.7 57.4 66.8 100 Table 3: Number of context units (community summaries for C0-C3 and text chunks for TS), corresponding token counts, and percentage of the maximum token count. Map-reduce summarization of source texts is the most resource-intensive approach requiring the highest number of context tokens. Root-level community summaries (C0) require dramatically fewer tokens per query (9x-43x). Community summaries vs. source texts. When comparing community summaries to source texts using Graph RAG, community summaries generally provided a small but consistent improvement in answer comprehensiveness and diversity, except for root-level summaries. Intermediate-level summaries in the Podcast dataset and low-level community summaries in the News dataset achieved comprehensiveness win rates of 57% and 64%, respectively. Diversity win rates were 57% for Podcast intermediate-level summaries and 60% for News low-level community summaries. Table 3 also illustrates the scalability advantages of Graph RAG compared to source text summarization: for low-level community summaries (C3), Graph RAG required 26-33% fewer context tokens, while for root-level community summaries (C0), it required over 97% fewer tokens. For a modest drop in performance compared with other global methods, root-level Graph RAG offers a highly efficient method for the iterative question answering that characterizes sensemaking activity, while retaining advantages in comprehensiveness (72% win rate) and diversity (62% win rate) over na\u00a8 \u0131ve RAG. Empowerment. Empowerment comparisons showed mixed results for both global approaches versus na\u00a8 \u0131ve RAG (SS) and Graph RAG approaches versus source text summarization (TS). Ad-hoc LLM use to analyze LLM reasoning for this measure indicated that the ability to provide specific examples, quotes, and citations was judged to be key to helping users reach an informed understanding. Tuning element extraction prompts may help to retain more of these details in the Graph RAG index. 4 Related Work 4.1 RAG Approaches and Systems When using LLMs, RAG involves first retrieving relevant information from external data sources, then adding this information to the context window of the LLM along with the original query (Ram et al., 2023). Na\u00a8 \u0131ve RAG approaches (Gao et al., 2023) do this by converting documents to text, splitting text into chunks, and embedding these chunks into a vector space in which similar positions represent similar semantics. Queries are then embedded into the same vector space, with the text chunks of the nearest k vectors used as context. More advanced variations exist, but all solve the problem of what to do when an external dataset of interest exceeds the LLM\u2019s context window. Advanced RAG systems include pre-retrieval, retrieval, post-retrieval strategies designed to overcome the drawbacks of Na\u00a8 \u0131ve RAG, while Modular RAG systems include patterns for iterative and dynamic cycles of interleaved retrieval and generation (Gao et al., 2023). Our implementation of Graph RAG incorporates multiple concepts related to other systems. For example, our community summaries are a kind of self-memory (Selfmem, Cheng et al., 2024) for generation-augmented retrieval (GAR, Mao et al., 2020) that facilitates future generation cycles, while our parallel generation of community answers from these summaries is a kind of iterative (Iter-RetGen, Shao et al., 2023) or federated (FeB4RAG, Wang et al., 2024) retrieval-generation strategy. Other systems have also combined these concepts for multi-document summarization (CAiRE-COVID, Su et al., 2020) and multi-hop question answering (ITRG, Feng et al., 2023; IR-CoT, Trivedi et al., 2022; DSP, Khattab et al., 2022). Our use of a hierarchical index and summarization also bears resemblance to further approaches, such as generating a hierarchical index of text chunks by clustering the vectors of text embeddings (RAPTOR, Sarthi et al., 2024) or generating a \u201ctree of clarifications\u201d to answer multiple interpretations of ambiguous questions (Kim et al., 2023). However, none of these iterative or hierarchical approaches use the kind of self-generated graph index that enables Graph RAG. 10 \f4.2 Graphs and LLMs Use of graphs in connection with LLMs and RAG is a developing research area, with multiple directions already established. These include using LLMs for knowledge graph creation (Trajanoska et al., 2023) and completion (Yao et al., 2023), as well as for the extraction of causal graphs (Ban et al., 2023; Zhang et al., 2024) from source texts. They also include forms of advanced RAG (Gao et al., 2023) where the index is a knowledge graph (KAPING, Baek et al., 2023), where subsets of the graph structure (G-Retriever, He et al., 2024) or derived graph metrics (GraphToolFormer, Zhang, 2023) are the objects of enquiry, where narrative outputs are strongly grounded in the facts of retrieved subgraphs (SURGE, Kang et al., 2023), where retrieved event-plot subgraphs are serialized using narrative templates (FABULA, Ranade and Joshi, 2023), and where the system supports both creation and traversal of text-relationship graphs for multi-hop question answering (Wang et al., 2023b). In terms of open-source software, a variety a graph databases are supported by both the LangChain (LangChain, 2024) and LlamaIndex (LlamaIndex, 2024) libraries, while a more general class of graph-based RAG applications is also emerging, including systems that can create and reason over knowledge graphs in both Neo4J (NaLLM, Neo4J, 2024) and NebulaGraph (GraphRAG, NebulaGraph, 2024) formats. Unlike our Graph RAG approach, however, none of these systems use the natural modularity of graphs to partition data for global summarization. 5 Discussion Limitations of evaluation approach. Our evaluation to date has only examined a certain class of sensemaking questions for two corpora in the region of 1 million tokens. More work is needed to understand how performance varies across different ranges of question types, data types, and dataset sizes, as well as to validate our sensemaking questions and target metrics with end users. Comparison of fabrication rates, e.g., using approaches like SelfCheckGPT (Manakul et al., 2023), would also improve on the current analysis. Trade-offs of building a graph index. We consistently observed Graph RAG achieve the best headto-head results against other methods, but in many cases the graph-free approach to global summarization of source texts performed competitively. The real-world decision about whether to invest in building a graph index depends on multiple factors, including the compute budget, expected number of lifetime queries per dataset, and value obtained from other aspects of the graph index (including the generic community summaries and the use of other graph-related RAG approaches). Future work. The graph index, rich text annotations, and hierarchical community structure supporting the current Graph RAG approach offer many possibilities for refinement and adaptation. This includes RAG approaches that operate in a more local manner, via embedding-based matching of user queries and graph annotations, as well as the possibility of hybrid RAG schemes that combine embedding-based matching against community reports before employing our map-reduce summarization mechanisms. This \u201croll-up\u201d operation could also be extended across more levels of the community hierarchy, as well as implemented as a more exploratory \u201cdrill down\u201d mechanism that follows the information scent contained in higher-level community summaries. 6"
19
+ }
abs_9K/validation_abstract_short_2404.16131v1.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.16131v1",
3
+ "title": "Combinatorial Approximations for Cluster Deletion: Simpler, Faster, and Better",
4
+ "abstract": "Cluster deletion is an NP-hard graph clustering objective with applications\nin computational biology and social network analysis, where the goal is to\ndelete a minimum number of edges to partition a graph into cliques. We first\nprovide a tighter analysis of two previous approximation algorithms, improving\ntheir approximation guarantees from 4 to 3. Moreover, we show that both\nalgorithms can be derandomized in a surprisingly simple way, by greedily taking\na vertex of maximum degree in an auxiliary graph and forming a cluster around\nit. One of these algorithms relies on solving a linear program. Our final\ncontribution is to design a new and purely combinatorial approach for doing so\nthat is far more scalable in theory and practice.",
5
+ "authors": "Vicente Balmaseda, Ying Xu, Yixin Cao, Nate Veldt",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-04-24",
8
+ "primary_cat": "cs.DS",
9
+ "cats": [
10
+ "cs.DS",
11
+ "cs.LG",
12
+ "cs.SI"
13
+ ],
14
+ "label": "Original Paper",
15
+ "paper_cat": "Graph AND Structure AND Learning",
16
+ "gt": "Cluster deletion is an NP-hard graph clustering objective with applications\nin computational biology and social network analysis, where the goal is to\ndelete a minimum number of edges to partition a graph into cliques. We first\nprovide a tighter analysis of two previous approximation algorithms, improving\ntheir approximation guarantees from 4 to 3. Moreover, we show that both\nalgorithms can be derandomized in a surprisingly simple way, by greedily taking\na vertex of maximum degree in an auxiliary graph and forming a cluster around\nit. One of these algorithms relies on solving a linear program. Our final\ncontribution is to design a new and purely combinatorial approach for doing so\nthat is far more scalable in theory and practice.",
17
+ "main_content": "Introduction Graph clustering is a fundamental task in graph mining where the goal is to partition nodes of a graph into disjoint clusters that have dense internal connections but are only sparsely connected to the rest of the graph. This has a wide variety of applications which include detecting communities in social networks [Fortunato, 2010], identifying related genes in biological networks based on gene expression profiles [Ben-Dor et al., 1999], and finding groups of pixels in an image that belong to the same object [Shi and Malik, 2000]. An idealized notion of a cluster in a graph is a set of nodes that is completely connected internally (i.e., a clique) while being completely disconnected from the rest of the graph. Cluster graph modification problems [Shamir et al., 2004] are a class of graph clustering objectives that seek to edit the edges in a graph as little as possible in order to achieve this idealized structure. One widely studied problem is correlation clustering [Bansal et al., 2004], which can be cast as adding or deleting a minimum number of edges to convert a graph into a disjoint union of cliques. This problem is also known as cluster editing. Designing approximation algorithms for different variants of correlation clustering has a long history, and has also seen extensive interest in the past few years in the machine learning community [Jafarov et al., 2020, 2021, Bun et al., 2021, Cohen-Addad et al., 2021, Veldt, 2022, Stein et al., 2023, Davies et al., 2023, Assadi et al., 2023]. This paper focuses on a variant of correlation clustering called Cluster Deletion, which seeks a minimum number of edges to delete so that the graph becomes a disjoint set of cliques. Cluster Deletion was first motivated by applications in clustering gene networks [Ben-Dor et al., 1999] and arises as an interesting special case of other more general frameworks for clustering [Charikar et al., 2005, Puleo and Milenkovic, 2015, Veldt et al., 2018]. The problem is NP-hard, but has been 1 arXiv:2404.16131v1 [cs.DS] 24 Apr 2024 \fstudied extensively from the perspective of parameterized algorithms [Gramm et al., 2005, Damaschke, 2009, Gao et al., 2013, B\u00a8 ocker and Damaschke, 2011, Bathie et al., 2022] and approximation algorithms [Charikar et al., 2005, Dessmark et al., 2007, Puleo and Milenkovic, 2015, Veldt et al., 2018, Veldt, 2022]. We provide several improved theoretical results and practical implementations for combinatorial algorithms for this task. Previous work. The first approximation algorithm for Cluster Deletion was based on rounding a linear programming (LP) relaxation and came with a factor 4-approximation guarantee [Charikar et al., 2005]. Other approximation algorithms based on the same canonical LP were subsequently developed [van Zuylen and Williamson, 2009, Puleo and Milenkovic, 2015], culminating in the current-best approximation factor of 2 [Veldt et al., 2018]. One limitation of all of these algorithms is that the underlying LP relaxation has O(n3) constraints for a graph with n nodes, and is prohibitively expensive to solve in practice on large instances. Recently, Veldt [2022] provided faster approximation algorithms by rounding different and less expensive lower bounds for Cluster Deletion. The first was a 4-approximation algorithm based on rounding an LP relaxation for a related problem called Strong Triadic Cluster (STC) labeling [Sintos and Tsaparas, 2014]. The STC LP relaxation has fewer constraints than the canonical Cluster Deletion LP relaxation, but still provides a lower bound on Cluster Deletion. Veldt also developed the first combinatorial approximation algorithm, called MatchFlipPivot, which applies a fast algorithm for STC labeling and then rounds the resulting edge labels into a 4-approximate Cluster Deletion solution. In numerical experiments, solving and rounding the STC LP relaxation using black-box LP software was shown to be roughly twice as fast solving and rounding the canonical LP, while MatchFlipPivot was shown to be orders of magnitude faster. Motivating questions. While these recent results lead to more practical algorithms, there is still a gap between theory and practice for Cluster Deletion algorithms, and several open questions remain. Although the STC-based algorithms are faster and more practical, their 4-approximation guarantee is still noticeably worse than the 2-approximation based on the canonical LP relaxation. In practice, the STC-based algorithms tend to produce solutions that are much better than just a 4-approximation [Veldt, 2022]. A natural direction is to try to improve approximation factors and bridge the gap between theoretical and practical performance of STC-based methods. Another direction is to address the performance gap between MatchFlipPivot and the STC LP rounding algorithm. MatchFlipPivot is far faster in practice while satisfying the same worst-case approximation guarantee. At the same time, the STC LP relaxation is guaranteed to return a tighter lower bound for Cluster Deletion, and was shown to produce higher quality results in practice. Furthermore, solving the STC LP relaxation was observed to often return the optimal solution for the canonical LP relaxation in practice. In these cases, the LP rounding technique is guaranteed to return a 2-approximate solution. These observations motivate the study of better approximation guarantees and faster techniques for solving the STC LP relaxation. Finally, existing implementations of the STC-based algorithms are randomized, and their approximation guarantees hold only in expectation. In theory these algorithms can be made deterministic by leveraging existing derandomization techniques [van Zuylen and Williamson, 2009]. However, the deterministic versions are more complicated and slower, and as such have not been implemented in practice. Our contributions. We significantly bridge the theory-practice gap by presenting algorithms that are simpler, faster, and have better approximation guarantees. 2 \f\u2022 We provide a simplified presentation and a tight analysis of the MatchFlipPivot algorithm, proving an improved 3-approximation guarantee for the method and providing instances on which the ratio is asymptotically 3. \u2022 We show a similar tighter analysis for an STC LP rounding algorithm, improving its approximation guarantee to 3. \u2022 We improve the runtime of MatchFlipPivot by designing a faster algorithm for a key step: computing a maximal edge-disjoint set of open wedges in a graph. \u2022 We prove that the STC LP relaxation can be reduced to a minimum s-t cut problem, leading to a faster, purely combinatorial version of our LP-based algorithm. \u2022 We prove a simpler and faster new approach for deterministically rounding a Cluster Deletion lower bound into an approximate solution. To put the last contribution into context, we note that previous approximations for Cluster Deletion rely on (1) computing a lower bound on a graph G, (2) rounding the lower bound into a new graph \u02c6 G, and (3) forming clusters by pivoting in \u02c6 G (repeatedly select a node and cluster it with its neighbors). We prove that selecting pivot nodes based simply on degrees in \u02c6 G provides the same approximation guarantee as other (more complicated and computationally expensive) deterministic pivoting strategies. We accompany our theoretical results with practical implementations and numerical experiments. They include the first implemented deterministic algorithms for Cluster Deletion, which in practice produce solutions that are typically much less than 3 times the optimal solution. We also implement our combinatorial algorithm for solving the STC LP relaxation and demonstrate in practice that it is significantly faster than using black-box LP software and scales to instances that are orders of magnitude larger. 2 Preliminaries and Related Work Let G = (V, E) be an unweighted undirected graph with n = |V | and m = |E|. We use the \u02dc O(\u00b7) notation to suppress logarithmic factors in runtimes, e.g., O(log n) = \u02dc O(1). The problems we consider rely on the concept of open wedges. An open wedge centered at k is a node triplet (i, j, k) such that (i, k) \u2208E, (j, k) \u2208E and (i, j) / \u2208E. The third node indicates the center of the wedge. The order of the first two nodes in an open wedge is irrelevant, hence (i, j, k) \u2261(j, i, k). Let W(G) be the set of open wedges in G, and Wk(G) \u2286W(G) be the set of open wedges centered at k. When G is clear from context we simply write W and Wk. 2.1 Cluster Deletion Given graph G, Cluster Deletion seeks a set of edges ED \u2286E that minimizes |ED| such that G\u2032 = (V, E \u2212ED) is a disjoint set of cliques. This is equivalent to forming clusters in a way that minimizes the number of edges between clusters (known as \u201cmistakes\u201d) while ensuring all clusters are cliques. This can be formulated as a binary linear program (BLP) as follows: min X (i,j)\u2208E xij s.t. xik + xjk \u2265xij \u2200i, j, k xij = 1 if (i, j) / \u2208E xij \u2208{0, 1} \u2200(i, j) \u2208E. (1) 3 \fThis BLP has one variable for each pair of nodes, and xij = 0 if and only if nodes i and j are in the same cluster. The canonical LP relaxation for Cluster Deletion is obtained by replacing xij \u2208{0, 1} with nonnegativity constraints xij \u22650. Charikar et al. [2005] presented a 4-approximation based on this LP relaxation. The results of van Zuylen and Williamson [2009] for constrained variants of correlation clustering imply a 3-approximation algorithm for Cluster Deletion by rounding the same LP. The current best approximation factor for Cluster Deletion, also obtained by rounding this LP, is 2 [Veldt et al., 2018]. 2.2 Strong Triadic Closure Labeling Cluster Deletion has a well-documented connection to another NP-hard graph optimization problem [Sintos and Tsaparas, 2014]. The latter problem is derived from the Strong Triadic Closure (STC) principle from social network analysis [Granovetter, 1973, Easley and Kleinberg, 2010], which states that if two individuals both have a strong connection to a mutual friend, they are likely to share at least a weak connection with each other. Following this principle, we can label the edges in G as either weak or strong such that the STC principle is satisfied, i.e., each open wedge has at least one weak edge. This is called an STC labeling, and is encoded by a set of weak edges EW \u2286E. The minimum weakness strong triadic closure (MinSTC) problem [Sintos and Tsaparas, 2014] is then the problem of finding a strong triadic closure labeling of G that minimizes the number of weak edges. Formally this is cast as the following BLP: min X (i,j)\u2208E xij s.t. xik + xjk \u22651 \u2200(i, j, k) \u2208W xij \u2208{0, 1} \u2200(i, j) \u2208E. (2) The variable xij is equal to 1 if and only if edge (i, j) is a weak edge. The constraints in this BLP are in fact a subset of the constraints in the Cluster Deletion BLP in (1). This implies that every feasible solution ED for Cluster Deletion defines a valid STC labeling EW = ED, and hence MinSTC lower bounds Cluster Deletion. However, deleting edges in an arbitrary STC labeling EW does not necessarily produce a disjoint union of cliques. The relationship between MinSTC and Cluster Deletion has been noted in several different contexts [Konstantinidis et al., 2018, Veldt, 2022, Bengali and Veldt, 2023], and there are known graphs where their optimal solutions differ by up to a factor of 8/7 [Gr\u00a8 uttemeier and Komusiewicz, 2020]. Approximations based on vertex cover. Solving MinSTC over a graph G = (V, E) is equivalent to finding a minimum vertex cover in the Gallai graph of G, obtained by associating each edge (i, j) \u2208E with a vertex vij and introducing an edge (vik, vjk) in the Gallai graph if (i, j, k) defines an open wedge in G [Le, 1996]. Every algorithm for vertex cover instantly implies an algorithm for MinSTC with the same approximation factor. One simple 2-approximation for MinSTC is to find a maximal edge-disjoint set of open wedges in G, then label an edge (i, j) \u2208E as weak if it is in one of the open wedges in this set. This is equivalent to applying a standard maximal matching 2-approximation for vertex cover in the Gallai graph. Another simple 2-approximation is to solve the LP relaxation of the BLP in (2) and label (i, j) \u2208E as weak if xij \u22651/2, analogous to a standard LP rounding algorithm for vertex cover. Nemhauser and Trotter [1975] showed that the LP relaxation for vertex cover is half integral, meaning that every basic feasible solution has LP variables satisfying xij \u2208{0, 1/2, 1}. This property therefore also holds for the STC LP relaxation, obtained by replacing binary constraints in (2) with nonnegativity constraints xij \u22650. 4 \fAlgorithm 1 Pivot( \u02c6 G = (V, \u02c6 E)) 1: V \u2032 \u2190V ; E\u2032 \u2190\u02c6 E; C \u2190\u2205 2: while V \u2032 not empty do 3: Select pivot k \u2208V \u2032 4: Ck = k \u222a{i \u2208V \u2032 : (i, k) \u2208E\u2032} // get neighbors 5: C = C \u222a{Ck} // new cluster 6: V \u2032 \u2190V \u2032 \u2212Ck; E\u2032 \u2190\u02c6 E \u2229(V \u2032 \u00d7 V \u2032) // update graph 7: end while 8: Return clustering C 2.3 STC + Pivot Framework The Pivot algorithm repeatedly selects an unclustered node (the pivot) in a graph and then clusters it with all of its unclustered neighbors. This was first designed as a way to approximate correlation clustering. When pivots are chosen uniformly at random and the procedure is applied directly to a graph G, this is a randomized 3-approximation algorithm for correlation clustering [Ailon et al., 2008]. Many algorithms for different variants of correlation clustering and Cluster Deletion use Pivot as one step in a broader algorithmic pipeline [van Zuylen and Williamson, 2009, Chawla et al., 2015, Jafarov et al., 2020, Veldt, 2022]. Choosing random pivots leads to approximation guarantees that hold only in expectation, but van Zuylen and Williamson [2009] also showed techniques for carefully selecting pivot nodes in order to obtain deterministic approximation guarantees for different problems variants. Veldt [2022] recently provided a general framework for approximating Cluster Deletion by combining STC labelings with pivoting procedures. The framework first (1) obtains an approximately optimal STC labeling EW for a graph G = (V, E), and then (2) runs Pivot on graph \u02c6 G = (V, E \u2212EW ) to form clusters. If pivoting on a node k places two other nodes i and j inside a cluster, then both (i, k) and (j, k) are strong edges, which guarantees (i, j) \u2208E. This leads to a useful observation. Observation 2.1. If EW \u2286E is an STC labeling for G = (V, E), running Pivot on \u02c6 G = (V, E \u2212 EW ) with any pivot selection strategy produces clusters that are cliques in G. Veldt [2022] used this framework to design two 4-approximation algorithms for Cluster Deletion: one based on rounding the STC LP relaxation, and a faster purely combinatorial algorithm called MatchFlipPivot based on finding a maximal edge-disjoint set of open wedges. The approximation guarantees hold in expectation when pivot nodes are chosen uniformly at random. The derandomized pivoting techniques of van Zuylen and Williamson [2009] can be used to obtain deterministic approximation guarantees, though this is more involved conceptually and far slower computationally. 3 Improved Approximation Analysis We prove tighter approximations and new deterministic rounding schemes for combining STC labelings with Pivot. 5 \f3.1 Pivoting Lemma Algorithm 1 shows the generic Pivot algorithm applied to a graph \u02c6 G. The resulting clusters are typically not cliques in \u02c6 G, but we will combine these strategies with STC labeling techniques and Observation 2.1 in order to design Cluster Deletion approximation algorithms. Consider what happens if we have an induced subgraph G\u2032 = (V \u2032, E\u2032) of \u02c6 G at some intermediate step of the Pivot algorithm and we pivot on a node k \u2208V \u2032 to form a new cluster Ck \u2286V \u2032. Let degk(G\u2032) = |Ck| \u22121 be the degree of node k in G\u2032 (the number of neighbors of k in V \u2032), and define two sets of node pairs: Bk(G\u2032) = {(i, j) \u2208E\u2032 : (i, k) \u2208E\u2032, (j, k) / \u2208E\u2032}, Nk(G\u2032) = {(i, j) / \u2208E\u2032 : (i, k) \u2208E\u2032, (j, k) \u2208E\u2032}. The set Bk(G\u2032) represents edges on the boundary of cluster Ck and Nk(G\u2032) is the set of non-edges inside the cluster. We define three strategies for selecting pivots. \u2022 Pivot Strategy 1. Select a pivot k with the maximum degree in G\u2032. \u2022 Pivot Strategy 2. Select a pivot k that minimizes |Bk(G\u2032)|/|Nk(G\u2032)|. \u2022 Pivot Strategy 3. Select a pivot k uniformly at random. Lemma 3.1. Let B be the set of edges between clusters and N be the set of non-edges inside clusters that result from running Algorithm 1. If Pivot Strategy 1 or 2 is used, then |B| \u22642|N|. If Pivot Strategy 3 is used, this holds in expectation: E[|B|] = 2E[|N|]. Proof. Consider the graph G\u2032 = (V \u2032, E\u2032) at a fixed intermediate step of the algorithm. For an arbitrary node v \u2208V \u2032 we write Nv = Nv(G\u2032), Bv = Bv(G\u2032) and degv = degv(G\u2032) Strategy 1 analysis. Assume that node k is chosen as the pivot when applying Pivot Strategy 1. For an arbitrary node u \u2208Ck \\ {k}, let bu be the number of edges in G\u2032 that are incident to u but not contained in Ck, and let nu be the number of non-edges involving u that are in Ck. Note that bu + (|Ck| \u22121) \u2212nu = degu \u2264degk = |Ck| \u22121, which implies that bu \u2264nu. Each non-edge in Ck involves two nodes from Ck \\ {k}, so |Bk| = X u\u2208Ck\\{k} bu \u2264 X u\u2208Ck\\{k} nu = 2|Nk|. Thus, the number of new boundary edges in each iteration is bounded by twice the number of non-edges in the new cluster. Summing across all iterations gives |B| \u22642|N|. Strategy 2 and 3 analysis. Let W\u2032 be the set of open wedges in G\u2032. The following four statements are equivalent: (1) (i, j, k) is an open wedge; (2) (i, k) \u2208Bj, (3) (j, k) \u2208Bi, and (4) (i, j) \u2208Nk. Thus, P k\u2208V \u2032 |Nk| = |W\u2032| and P k\u2208V \u2032 |Bk| = 2|W\u2032|. In other words, X k\u2208V \u2032 (|Bk| \u22122|Nk|) = X k\u2208V \u2032 |Bk| \u22122 X k\u2208V \u2032 |Nk| = 0. (3) Therefore, there is at least one node satisfying |Bk| \u22122|Nk| \u22640, and applying Pivot Strategy 2 guarantees that |Bk| \u22642|Nk|, so summing across iterations again gives |B| \u22642|N|. Regarding Pivot Strategy 3, Eq. (3) implies that for a uniform random pivot, Ek\u2208V \u2032[|Bk| \u22122|Nk|] = 0. Thus, at every iteration, the expected number of new boundary edges is twice the expected number of non-edges inside the cluster. By linearity of expectation, E[|B|] = 2E[|N|]. 6 \fAlgorithm 2 MatchFlipPivot(G = (V, E)) 1: W \u2190maximal edge-disjoint set of open wedges in G. 2: EW \u2190edges contained in some open wedge of W. 3: Form \u02c6 G = (V, E \u2212EW ) 4: Run Pivot( \u02c6 G) // for some choice of pivot strategy 3.2 Rounding a Disjoint Open Wedge Set One way to approximate MinSTC over a graph G = (V, E) is a straightforward adaptation of the matching-based approximation algorithm for vertex cover. We find a maximal edge-disjoint set of open wedges W \u2286W, and then for each (i, j, k) \u2208W, place edges (i, k) and (j, k) into the weak edge set EW . Note that |W| is a lower bound for MinSTC (and also Cluster Deletion) since each open wedge in W must contain at least one weak edge (or in the case of Cluster Deletion, one deleted edge) and no two wedges in W share an edge. The edge set EW is therefore a 2-approximation for MinSTC since |EW | = 2|W|. The randomized MatchFlipPivot (MFP) algorithm of Veldt [2022] runs Pivot on \u02c6 G = (V, E \u2212EW ) with uniform random pivot nodes. The algorithm has an expected approximation ratio 4, and can be derandomized using the techniques of van Zuylen and Williamson [2009] as a black box. We note here that this corresponds to running Algorithm 2 using Pivot Strategy 2. Our next result improves on this prior work by providing a tighter analysis of MFP to show an improved approximation guarantee of 3. Furthermore, we prove that our simple new degree-based pivoting strategy also provides a deterministic 3-approximation. This is significant given that the bottleneck of the previous deterministic MFP algorithm was computing and updating Nk and Bk values. Theorem 3.2. When using Pivot Strategy 1 or 2 on \u02c6 G, Algorithm 2 is a deterministic 3-approximation for Cluster Deletion. When selecting pivots uniformly at random, it is a randomized 3approximation algorithm. Proof. Let mW denote the number of weak edges between clusters, and mS the number of other edges between clusters. The three nodes in any open wedge W \u2208W must be separated into at least two clusters. Thus, at least one of the two edges of every wedge in W is between clusters. This means that mW \u2265|EW |/2. Note that mS = |B| and |N| = |EW | \u2212mW because non-edges of \u02c6 G inside clusters are all weak edges. By Lemma 3.1, using Pivoting Strategy 1 or 2 on \u02c6 G guarantees that mS = |B| \u22642|N| = 2(|EW | \u2212mW ). The total number of edges between clusters is thus: mW + mS \u2264mW + 2(|EW | \u2212mW ) = 2|EW | \u2212mW \u22643 2|EW | = 3|W| \u22643OPTCD. If we select pivot nodes uniformly at random, mW and mS become random variables, but coupling Lemma 3.1 with the fact that mW \u2265|EW |/2 for every choice of pivot nodes provides the same guarantee in expectation. 7 \fu1 u2 u3 u4 u5 u6 v1 v2 v3 v4 v5 v6 (a) G v6 v1 u1 v2 u2 v3 u3 v4 u4 v5 u5 v6 u6 (b) \u02c6 G Figure 1: The example for Theorem 3.3. Algorithm 3 STC-LP-round(G = (V, E)) 1: {xij}ij\u2208E \u2190(half-integral) solution to STC LP 2: Set EW \u2190{(i, j) \u2208E : xij \u2208{1/2, 1}} 3: Form \u02c6 G = (V, E \u2212EW ) 4: Run Pivot( \u02c6 G) // for some choice of pivot strategy The following theorem proves that independent of the pivot strategy used, Algorithm 2 cannot have a ratio better than 3. Theorem 3.3. The asymptotic ratio of Algorithm 2 is at least three. Proof. For any even integer n \u22658, we can construct a graph of n vertices {v1, v2, . . . , vn/2, u1, u2, . . . , un/2}. The vertex set {v1, v2, . . . , vn/2} is a clique, and for each i = 1, . . . , n/2, the vertex ui is adjacent to only vi. See Figure 1 for the example when n = 12. The only optimal solution is ED = {(v1, u1), (v2, u2), . . . , (vn/2, un/2)} and it has cost n/2. On the other hand, it is easy to see that W = {(v1, u2, v2), (v2, u3, v3), . . . , (vn/2, u1, v1)} is a maximal edge-disjoint set of open wedges in G. The set EW is accordingly {(u1, v1), (u2, v2), . . . , (un/2, vn/2), (v1, v2), (v2, v3), . . . , (vn/2, v1)}. In \u02c6 G = (V, E \u2212EW ), for all i = 1, . . . , n/2, the vertex ui is isolated, and the vertex vi has n/2 \u22123 neighbors. When applying Algorithm 2, whatever the pivot strategy is, the first pivot in {v1, v2, . . . , vn/2} decides the solution. The solution has cost n/2 + 2(n/2 \u22122) = 3n/2 \u22124. Thus, the ratio is asymptotically three. 3.3 Rounding the STC LP Relaxation Recall that the LP relaxation of the BLP in (2) provides a natural lower bound for both MinSTC and Cluster Deletion. Since every basic feasible solution of (2) is half integral, we 8 \fcan obtain a set of variables {xij} in polynomial time with xij \u2208{0, 1/2, 1} for every (i, j) \u2208E, that minimizes (2). Given this solution, define E1 = {(i, j) \u2208E : xij = 1} and Eh = {(i, j) \u2208E : xij = 1/2}, and note that EW = E1\u222aEh defines an STC-labeling that is a 2-approximation for MinSTC. We also refer to edges in Eh as \u201chalf-edges.\u201d Define ES = {(i, j) \u2208E : xij = 0} = E \u2212EW to be strong edges. Veldt [2022] showed that with randomized pivot nodes, Algorithm 3 has an expected approximation ratio 4, and can be derandomized using the techniques of van Zuylen and Williamson [2009].1 Mirroring Theorem 3.2, we provide an improved approximation analysis and show that our (simpler and faster) degree-based pivoting also gives a deterministic 3-approximation. Theorem 3.4. When using Pivot Strategy 1 or 2 on \u02c6 G, Algorithm 3 is a deterministic 3-approximation for Cluster Deletion. When selecting pivots uniformly at random, it is a randomized 3approximation algorithm. Proof. We begin by proving that for every choice of pivot nodes in \u02c6 G, at most half of the edges in Eh will end up inside the clusters formed by Algorithm 3. Consider an arbitrary choice of pivots. Let Bh be the set of half-edges between clusters, and Nh the set of half-edges inside clusters. We claim that the following set of variables is still feasible for the STC LP: \u02c6 xij = \uf8f1 \uf8f4 \uf8f2 \uf8f4 \uf8f3 xij if xij \u2208{0, 1}, 1 if xij \u2208Bh, 0 if xij \u2208N h. Consider an arbitrary open wedge (i, j, k) \u2208W. Assume without loss of generality that xik \u2265xjk. If xik = 1, then \u02c6 xik = 1 and \u02c6 xik + \u02c6 xjk \u22651. Otherwise, xik = xjk = 1/2. The three nodes in W must be separated into at least two clusters. Thus, at least one of xik and xjk is in Bh, and hence \u02c6 xik + \u02c6 xjk \u22651. From the optimality of {xij} and the feasibility of {\u02c6 xij} it follows that X (i,j)\u2208E xij \u2264 X (i,j)\u2208E \u02c6 xij = X (i,j)\u2208E xij + |Bh| 2 \u2212|Nh| 2 . Thus, |Bh| \u2265|Nh| and |Nh| \u2264(|Bh| + |Nh|)/2 = |Eh|/2. Let m1 and mS be the numbers of edges between clusters that are from the sets E1 and ES, respectively. Note that |B| = mS and |N| = |E1| \u2212m1 + |Nh|. Using Pivot Strategy 1 or 2, Lemma 3.1 implies that mS \u22642(|E1| \u2212m1 + |Nh|). We can then bound the total number of edges between clusters in G: m1+|Bh| + mS \u2264m1 + |Bh| + 2(|E1| \u2212m1 + |Nh|) = 2|E1| \u2212m1 + |Bh| + 2|Nh| \u22642|E1| + 3 2|Eh| = X (i,j)\u2208E1 2xij + X (i,j)\u2208Eh 3xij \u22643 X (i,j)\u2208E xij \u22643OPTCD. 1The deterministic STC-LP algorithm of Veldt [2022] incorporates LP values {xij} more directly in choosing pivot nodes and is different from running Algorithm 3 with Pivot Strategy 2. The latter provides a simplified and unified approach for rounding both types of Cluster Deletion lower bounds we consider. 9 \fLemma 3.1 can similarly be used to show the same result in expectation for random pivot nodes. 4 Faster Algorithms for Lower Bounds In addition to our improved approximation analysis, we provide faster algorithms for computing a maximal edge-disjoint sets of open wedges and for solving the STC LP. 4.1 Maximal Edge-Disjoint Open Wedge Set A simple existing approach for finding a maximal edge-disjoint open wedge set is to iterate through each node k \u2208V , and then iterate through pairs {i, j} of neighbors of v. If (i, j, k) is an open wedge and edge-disjoint from previously explored open wedges, we can add it to a growing set W of open wedges. We maintain a list EW of edges that come from wedges in W. This can be implemented in O(P k\u2208V d2 k)-time, which is always larger than |W| and can be as large as O(nm). While this is already fast in practice, we can further improve the theoretical runtime. Lemma 4.1. A maximal edge-disjoint set of open wedges can be found in O(m1.5) time and O(m) space. The appendix provides pseudocode and a full analysis for an algorithm satisfying these bounds. Similar to the previous approach, our procedure starts by iterating through nodes k \u2208V and then iterates through pairs of neighbors of k. The key observation is that as soon as we encounter an open wedge (i, j, k) and add its two edges (i, k) and (j, k) to EW , we can effectively \u201cdelete\u201d these edges and avoid exploring triplets involving them in future iterations. Since |W| is always at most m/2, the total amount of work for adding edges to EW and then deleting them is bounded by O(m). Now, when visiting two neighbors {i, j} of k we may find that {i, j, k} is a triangle rather than an open wedge. We therefore have nothing to add to W and no edges to delete. However, the amount of work that goes into finding these unwanted triangles is bounded in terms of the number of triangles in the graph, which is known to be at most O(m1.5). The result is inspired by the recent work of Cao et al. [2024], who provided the same type of bound for finding a maximal set of disjoint open triangles in a complete signed graph. See the appendix for further details on the similarities and differences between these problems and approaches. 4.2 Combinatorial Solver for the STC LP Although the STC LP rounding algorithm produces the same 3-approximation guarantee as MFP, the LP relaxation produces a tighter lower bound for Cluster Deletion and tends to produce better solutions in practice. However, previous implementations rely on simply applying black-box LP solvers, which become a bottleneck both in terms of runtime and memory requirements [Veldt, 2022]. In this section we present a faster and purely combinatorial approach for solving the LP by reducing it to a minimum s-t cut problem. This can be accomplished by first proving that the halfintegral STC LP can be cast as a so-called monotone IP2 problem\u2014an integer program with two variables per constraint with opposite signed coefficients. This can in turn be cast as a maximum closure problem [Picard, 1976] and then reduced to a maximum s-t flow problem following the approach of Hochbaum [2021]. The reduction we present in this section merges several of these steps in order to provide a simplified and more direct reduction for the STC LP. 10 \fConverting to BLP The STC LP relaxation is obtained by replacing constraint xij \u2208{0, 1} in (2) with xij \u22650. Since every basic feasible solution of the LP is half-integral, we can equivalently optimize over variables xij \u2208{0, 1/2, 1}. We will show that this is equivalent to the following BLP: min X (i,j)\u2208E 1 2yij + 1 2(1 \u2212zij) s.t. zik \u2264yjk zjk \u2264yik ) \u2200(i, j, k) \u2208Wk zij, yij \u2208{0, 1} \u2200(i, j) \u2208E. (4) We prove the following result. Lemma 4.2. If {yij, zij}ij\u2208E is feasible for (4), then xij = 1 2(yij \u2212zij + 1) \u2200(i, j) \u2208E (5) defines a feasible half-integral solution for the STC LP with the same objective value. Conversely, if {xij}ij\u2208E is a feasible half-integral solution to the STC LP, the variables (yij, zij) = \uf8f1 \uf8f4 \uf8f2 \uf8f4 \uf8f3 (0, 1) if xij = 0 (1, 1) if xij = 1/2 (1, 0) if xij = 1 \u2200(i, j) \u2208E (6) are feasible for (4) and have the same objective value. Proof. First, suppose that {yij, zij}ij\u2208E is feasible for (4). Then xik + xjk = 1 2(yik \u2212zik + 1) + 1 2(yjk \u2212zjk + 1) = 1 2(yjk \u2212zik) + 1 2(yik \u2212zjk) + 1 \u22651. Thus, {xij}ij\u2208E is feasible for the STC LP. It is obviously half-integral and the objective value is the same. Now suppose that {xij}ij\u2208E is a feasible half-integral solution to the STC LP. Consider an open wedge (i, j, k). Assume without loss of generality that xik \u2265xjk. \u2022 If xik = 1/2, then xjk = 1/2. By (6), we have yik = zjk = 1 and yjk = zik = 1. \u2022 If xik = 1, then by (6), we have yik = 1 \u2265zjk and yjk \u2265zik = 0. Thus, {yij, zij}ij\u2208E, which is integral, is feasible for (4). Since 1 2(yij + 1 \u2212zij) = xij for all the possible values of xij, the objective value is the same. We can therefore turn our attention to solving (4), and use Eq. (5) to convert back to a solution to the STC LP. 11 \fCasting as a minimum s-t cut problem The BLP in (4) is equivalent to a minimum s-t cut problem on a graph Gst. To construct the graph, we introduce a source node s and a sink node t. Then for each (i, j) \u2208E, we introduce a node Yij and a node Zij, then construct two directed edges (s, Zij) and (Yij, t) each with weight 1/2. Finally, for every (i, j, k) \u2208Wk, we introduce two infinite-weight directed edges: (Zik, Yjk) and (Zjk, Yik). Every s-t cut in Gst corresponds to a feasible solution to (4), where the weight of cut edges in Gst equals the resulting objective score for (4). In more detail, nodes Yij and Zij correspond to binary variables yij and zij in (4). Setting a binary variable to 1 corresponds to placing its node on the s-side of the cut. For example, setting yij = 1 means placing Yij on the s-side, which cuts the edge (Yij, t). This contributes a 1/2 to the cut penalty of Gst, just as setting yij = 1 contributes 1/2 to the objective of (4). A similar penalty arises from setting zij = 0, which is equivalent to placing Zij on the t-side of an s-t cut in Gst. The infinite weight edges in Gst encode the constraints of (4). The edge (Zik, Yjk) has infinite weight to ensure that if Zik is on the s-side of the cut, then Yjk is as well, just as zik = 1 forces yjk = 1, required by the constraint zik \u2264yjk. To understand how this relates to MinSTC, note that an edge (s, Zij) encourages zij to be 1 and edge (Yij, t) encourages yij to be zero. If both these preferences are satisfied, then xij = 0 meaning that xij is a strong edge. If neither preference is satisfied, then xij = 1 and the edge is weak, whereas satisfying one preference but not the other leads to xij = 1/2. The reason these preferences typically cannot all be satisfied is because an edge (Zjk, Yik) indicates that if zjk = 1, this forces yik = 1. 4.3 Runtime and Space Analysis We briefly summarize several improvements in runtime and space requirements that are obtained using our new techniques. More details for proving these bounds are included in the appendix. Lemma 4.1 improves the runtime for computing the MFP lower bound to O(m1.5). This is always at least as fast as the previous O(mn) runtime and is strictly faster for sparse graphs. The previous deterministic pivoting scheme (Pivot Strategy 2) has space and runtime requirements that are \u2126(m + |W|), which can be O(n3) in the worst case, whereas degree-based pivoting can be implemented in O(m) time and space. The most expensive step of Algorithm 3 is solving the STC LP. Hence, the runtime for our combinatorial STC LP solver is also the asymptotic runtime for Algorithm 3. Using our reduction to minimum s-t cut, we can can get a randomized solver that runs in (m + |W|)1+o(1) time by applying recent nearly linear time algorithms for maximum s-t flows [Chen et al., 2022]. Using the algorithm of Goldberg and Rao [1998] we can get a deterministic algorithm with runtime \u02dc O(min{(m + |W|)1.5, (m + |W|) \u00b7 m2/3). For comparison, even the best recent theoretical solvers for general LPs would lead to runtimes that are \u2126((m + |W|)2) [van den Brand, 2020, Jiang et al., 2021, Cohen et al., 2021]. 5 Experimental Results Veldt [2022] previously showed experimental results for the randomized variants of Algorithms 2 and 3 on a large collection of real-world graphs. For these experiments, the STC LP was solved using Gurobi optimization software. For our work we implement both deterministic schemes (Pivot Strategies 1 and 2) and compare them against each other and the randomized variant. We also show that our combinatorial approach for solving the STC LP is much faster and scales to much larger graphs than using a black-box LP solver. Our algorithms are implemented in Julia. Our experiments were run on a laptop with 16 GB of RAM. For the most direct comparison with 12 \fFigure 2: Approximation ratios (|ED|/|W|) for MFP. previous work [Veldt, 2022], we consider the same collection of large graphs from the SNAP Repository [Leskovec and Krevl, 2014], the largest of which (soc-Livejournal1) has 4.2 million nodes and 4.7 billion edges. We also run experiments on one even larger graph (com-Orkut) with 117.2 billion edges. The appendix includes additional details about datasets, implementations, and experimental results. Comparing pivot strategies. Our degree-based pivoting strategy is fast and practical. In addition to enjoying a deterministic approximation guarantee, it is comparable in speed to choosing random pivot nodes, while achieving much better approximations. Figure 2 shows approximation ratios and Figure 3 shows runtimes achieved by MFP with degree-based pivots (DegMFP), pivots that minimize the ratio |Bu|/|Nu| (RatMFP), and two different approaches to using random pivots. RanMFP-100 runs the random pivot strategy 100 times and takes the best solution found. This is a natural strategy to use since running randomized pivot once is very fast. RanMFP-Avg represents the average performance of the algorithm over these 100 trials. DegMFP is almost identical to RatMFP in terms of approximation ratio, but is faster by an order of magnitude or more. DegMFP finds better solutions that RanMFP-100 and RanMFP-Avg, and is faster than RanMFP-100. Choosing random pivots once is faster (see runtimes for RanMFPAvg), but especially for larger graphs DegMFP has comparable runtimes. A benefit of DegMFP is that by choosing high-degree nodes, it terminates in fewer pivot steps. Most approximation ratios achieved by MFP are very close to 2. This can be explained by noting that the method labels a large percentage of edges as weak\u2014between 63.4% and 99.7% for graphs in Figure 2. As a result, MFP deletes nearly all edges for some graphs, which is roughly a 2-approximation since |E| \u22482|W|. It is especially interesting to observe the behavior of different pivoting strategies when fewer edges are labeled weak and approximations factors deviate more from 2 (leftand right-most graphs in Figure 2). In these cases, RanMFP tends to have approximations that are worse than 2, while the deterministic schemes perform the best in these cases and detect more meaningful clusters. This highlights the utility of having a very fast deterministic rounding scheme for Cluster Deletion algorithms. Cluster merging heuristic. Figure 4 shows results for DegMFP on graphs from the Facebook100 dataset [Traud et al., 2012] with up to 351k edges. For these graphs, finding an edge13 \fFigure 3: Runtimes of the MFP algorithms using different pivoting strategies. Each point represents one graph. Figure 4: Improved approximation ratios when incorporating a cluster merging step after DegMFP. disjoint open wedge set labels between 99.6% and 99.95% of edges as weak. MFP essentially achieves a 2-approximation by deleting nearly all edges. We also implement a heuristic for checking when clusters output by MFP can be merged into larger cliques (see appendix for details). Our current implementation is a proof of concept and not optimized for runtime. Nevertheless, this leads to noticeably better approximation ratios for these graphs, as well as others where a smaller percentage of edges are labeled weak (see appendix). Developing more scalable techniques for improving MFP is a promising direction for future research. STC LP solvers. Our combinatorial solver for the STC LP enables us to run Algorithm 3 more quickly and on a much larger scale than was previously possible. Figure 5 shows runtimes for solving this LP using our combinatorial min-cut approach (Comb-LP) versus using general-purpose Gurobi optimization software (Gurobi-LP). The resulting objective score is the same for both since they are both finding an optimal solution for the LP. The main bottleneck of both algorithms is memory. For smaller graphs where both algorithms terminate without memory overflow, our combinatorial approach is roughly twice as fast. Overall, Gurobi-LP can only solve the STC LP on 6 of 34 graphs, while Comb-LP can solve it for 21 of 34. The largest graph for which Gurobi 14 \fFigure 5: Runtimes of two different solvers for the STC LP. Each point represents a graph. Points above the black dashed line indicate graphs for which the given STC LP solver did not find a solution. The two vertical dashed lines indicate the size of the largest graph (in terms of edges) for which each method was able to successfully solve the LP. finds a solution has 34,546 nodes and 420,877 edges, while our combinatorial approach was able to find solutions for many of the larger graphs, the largest of which has 1,971,281 nodes and 2,766,607 edges. Thus, in addition to being faster, this approach allows us to tackle problems that are an order of magnitude larger. 6"
18
+ }
abs_9K/validation_abstract_short_2404.16160v1.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.16160v1",
3
+ "title": "Domain-Specific Improvement on Psychotherapy Chatbot Using Assistant",
4
+ "abstract": "Large language models (LLMs) have demonstrated impressive generalization\ncapabilities on specific tasks with human-written instruction data. However,\nthe limited quantity, diversity, and professional expertise of such instruction\ndata raise concerns about the performance of LLMs in psychotherapy tasks when\nprovided with domain-specific instructions. To address this, we firstly propose\nDomain-Specific Assistant Instructions based on AlexanderStreet therapy, and\nsecondly, we use an adaption fine-tuning method and retrieval augmented\ngeneration method to improve pre-trained LLMs. Through quantitative evaluation\nof linguistic quality using automatic and human evaluation, we observe that\npre-trained LLMs on Psychotherapy Assistant Instructions outperform\nstate-of-the-art LLMs response baselines. Our Assistant-Instruction approach\noffers a half-annotation method to align pre-trained LLMs with instructions and\nprovide pre-trained LLMs with more psychotherapy knowledge.",
5
+ "authors": "Cheng Kang, Daniel Novak, Katerina Urbanova, Yuqing Cheng, Yong Hu",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-04-24",
8
+ "primary_cat": "cs.CL",
9
+ "cats": [
10
+ "cs.CL",
11
+ "cs.AI"
12
+ ],
13
+ "label": "Original Paper",
14
+ "paper_cat": "LLM Fairness",
15
+ "gt": "Large language models (LLMs) have demonstrated impressive generalization\ncapabilities on specific tasks with human-written instruction data. However,\nthe limited quantity, diversity, and professional expertise of such instruction\ndata raise concerns about the performance of LLMs in psychotherapy tasks when\nprovided with domain-specific instructions. To address this, we firstly propose\nDomain-Specific Assistant Instructions based on AlexanderStreet therapy, and\nsecondly, we use an adaption fine-tuning method and retrieval augmented\ngeneration method to improve pre-trained LLMs. Through quantitative evaluation\nof linguistic quality using automatic and human evaluation, we observe that\npre-trained LLMs on Psychotherapy Assistant Instructions outperform\nstate-of-the-art LLMs response baselines. Our Assistant-Instruction approach\noffers a half-annotation method to align pre-trained LLMs with instructions and\nprovide pre-trained LLMs with more psychotherapy knowledge.",
16
+ "main_content": "INTRODUCTION Large Language Models (LLMs) have demonstrated impressive generalization capabilities, such as in-context learning [1], chain-of-thoughts reasoning [2], and biomedical diagnosing [3]. Instruction-tuning of LLMs has enabled them to follow natural language instructions and perform realworld tasks [4]. Two main methods have been developed for instruction-tuning LLMs: (1) fine-tuning the model on a wide range of tasks using human-annotated prompts and \u2217Corresponding Author. \u2020Thanks to Research Center Informatics (No. CZ.02.1.01/0.0/0.0/16 019/0000765), Brain Dynamics (No. CZ.02.01.01/00/22 008/0004643) and Student Grant in Czech Technical University in Prague (NO.SGS22/165/OHK3/3T/13) for funding. Katerina Urbanova is also with the National Institute of Mental Health in Prague, Czech Republic \u2021The work also was supported during the author\u2019s internship at The University of Hong Kong. Yuqing Cheng is also with the Shenzhen Mental Health Centre, China. Question: What is DSM-5 and ICD-10 Coding? Output: The depressive disorders grouping in the fifth edition of the Diagnostic and Statistical Manual of mental disorders or DSM-5 contains a number of distinct disorders, each given it's own unique diagnostic code. Domain: Depressive Disorders. Concept Explanation Question Answering Dialogue Generation Depressive Disorders Addictive Disorders Anxiety Disorders ... Psychotherapy Instructions Template Instruction: Input: Output: Task: Domain: Readability Professional Match Psychotherapy Data on Alexander Street Natural Task Identification Domain Knowledge Reward on Specific Tasks Mental Status Assessment Psychological Counseling Information Extraction ... Step one Step three Step four Step two Fig. 1. Schematic representation of Assistant-Instructional prompts in psychotherapy domains. Step one: Task identification; Step two: Knowledge expansion; Step three: Evaluation. feedback [5], and (2) supervised fine-tuning using public benchmarks and datasets augmented with manually or automatically generated instructions [6]. Reinforcement Learning on Human Feedback (RLHF) has proven to be an effective way to improve LLMs in various domains, such as medicine [7], knowledge graphs [8], multimodal data fusion [9] and biomedical applications [10], but it comes with a high cost. Self-Instruct tuning [11, 12] and Guess-Instruction tuning methods have shown better performance in aligning LLMs with human intent by learning from instruction-following data generated by state-of-the-art instruction-tuned teacher LLMs (e.g., GPT-3, GPT-3.5, and even GPT-4). These lines of instruction-tuning research have proven effective in improving the zero and few-shot generalization abilities of LLMs. To improve the professional knowledge of LLMs on psychotherapy domains, our paper presents the psychotherapy Assistant-Instruction approach, which aims to (1) achieve generalization over different psychological consulting tasks and (2) incorporate psychological knowledge into natural common LLMs. Figure 1 provides an overview of our proposed approach, in which a single model can perform various NLP tasks in specific psychotherapy domains. To achieve human-level professional responses in instrucarXiv:2404.16160v1 [cs.CL] 24 Apr 2024 \fPretrained LLMs Psychotherapy Training Transcripts Assistant AssistantInstructions on Psychotherapy Data Generated Response Inhibited LoRA Or RAG Embedding Inputs The Server: identify tasks, generate instructions and score relevance. Bot Evaluation Expert 1. Identification 2. Generation 3. Relevance Assistant Fig. 2. The schematic of our system. tion tuning for psychotherapy, we propose a novel approach using GPT-4 as an assistant for Assistant-Instruct tuning (a half self-instruct tuning method) on psychotherapy consulting tasks (Seen in Figure 1). Our method makes the following contributions: (a) it covers a wide range of psychological topics and incorporating feedback knowledge generated by GPT4. (b) it absorbs psychotherapy knowledge from professional data and enables them to generate content close to GPT-4. (c) it demonstrates the effectiveness of using assistant LLMsrevised instruction data to tune LLMs in psychotherapy domains, providing practical insights to build a general-purpose LLM-following agent powered by assistant LLMs (e.g., GPT4). 2. METHOD 2.1. Assistant on Annotation and Task Identification To arrange psychotherapy data to correct tasks, such as (1) concept explanation, (2) question answering, (3) mental status assessment, (4) psychological counseling and (5) information extraction, (6) dialogue generation, (7) sentiment analysis, (8) event ordering, we use an assistant LLM \u2013 GPT-4 to identify which task the human-constructed instruction should be. We directly prompt the LLM in a few-shot way to determine this, using 8 classification instructions from the seed tasks. The prompting template is shown in Table 1. Can the following task be regarded as a question answering task with finite output on [***] domain? Input: \u201dJEFFREY MISHLOVE Yeah! Well we\u2019re running out of time. . . time. I supposed the point is that you\u2019ve been successful in... in developing these devices and. . . and using them in the laboratory? Output: \u201dSTEPHEN LABERGE Yes! That\u2019s right! Well, not just in the laboratory, but we developed devices that... that do have sensors built under the mass that could be used at home, so that... that of course was one of our major goals which used to have make lucid dreaming available in general to people so that they could make better lucid dream.\u201d Result: Yes Table 1. Prompt used for identifying the type of tasks. 2.2. Assistant on Generation, and Evaluation Our approach involves two main steps. Firstly, we optimize formulations that retain the content of the original instructions. We prompt a language model to reformulate the tasks in the core data for each generated task. In some instruction formulations, we embed the input into or add it behind the \u201cINPUT\u201d template \u2013 \u201dWe are talking about [***].\u201d \u2013 to emphasize the topic. This manually constructed \u201cINPUT\u201d also captures the content discussed by members of the audience in Alexander Street Video, merging the discussed topic with the point of interest for the audience or visitors. Secondly, following [13], we use GPT-4 as an assistant to evaluate the retrieved passage\u2019s relevance.The prompting template is shown in Table 2. Prompt for Generation: \u201dMake a more professional instruction and output based on given context of conversation in [***] domain. Remove people\u2019s names and UNKNOWN. Then, improve them all based on your knowledge. If you cannot do that, output nothing.\u201d Prompt for Evaluation: \u201dGiven an instruction and an output in [***] domain, rate whether the response appears to be a helpful and informative answer to the query, from 1 (lowest) 5 (highest). The detailed criterion is as follows: 5: The response provides a complete, highly detailed, and informative response to the query, fully satisfying the information needs. 4: The response mostly fulfills the need in the query, while there can be some minor improvements such as discussing more detailed information, having better structure of the response, or improving coherence. 3: The response is acceptable, but some major additions or improvements are needed to satisfy users\u2019 needs. 2: The response still addresses the main request, but it is not complete or not relevant to the query. 1: The response is barely on-topic or completely irrelevant..\u201d Table 2. Prompt used for generation and evaluation. 3. EXPERIMENTS 3.1. Data Collection Alexander Street Press is a website known for its vast collection of video transcripts and recordings from therapy and counseling sessions, covering topics such as depression, abuse, trauma, and mental disorders. The video transcript dataset was specifically collected from the Counseling and Therapy channel on the website. We curated the dataset to include only English-language sessions recorded between 1980 and 2023, resulting in a set of 1,333 videos and accompanying transcripts. After filtering out short-length and non-informative videos, the final dataset comprises 1,179 video transcripts, containing a total of 188,421 dialogue turns. To ensure data quality, we performed a cleaning process to remove Unicode characters, pauses, and other unnecessary elements, resulting in a dataset with 3,141,520 words and a vocabulary size of 30,438.1 On the Alexander Street Press website, most video transcripts and recordings consist of knowledge presentations and counseling talks. For knowledge presentations, there are no instruction questions or instance inputs, and the output is the content presented by the speaker. In the first step, we manually set instructions and instance inputs based on the discussed topics (e.g., Depressive disorders, Addiction, etc.). In 1https://alexanderstreet.com/ \fthe second step, we used the GPT-4 API to revise and generate instructions and instance inputs based on the contents. 3.2. Models We conducted an evaluation of the language models mentioned above for the task of response generation in the psychotherapy domain, specifically focusing on therapeutic counseling. For generating the assistant instructions based on new psychotherapy data, we utilized the GPT-4 API as the Assistant-LLM. To fine-tune the generated instruction data effectively, we employed the inhibition adaption finetuning method [14] and self-RAG [13] on Llama2-7B [15], as well as ChatGLM2-6B [16]. The fine-tuned LLMs were then evaluated by two psychologists on psychotherapy data. The fine-tuning process required two weeks for ChatGLM26B/Llama2-7B when using eight NVIDIA Tesla A100 GPUs with 40GB graphic memory cards.2 3.3. Metrics As shown in Table 5, our fine-tuned LLMs are evaluated under two main methods: Automatic evaluation and Human evaluation. For the automatic evaluation, we submit 200 generated answers and use Rouge-L [17] and Fluency [18] to compare the generated output with a reference text and calculate a score for the similarity evaluation. For the human evaluation, we also submit 60 generated outputs (20 examples for each tasks, as we have 3 main tasks) without model and domain information to two professional psychologists, and based on their professional psychotherapy knowledge, they will measure the quality of the generated content according to the questions and answers. There are six grades that they will use to mark the quality of generated content: Extremely Bad (1), Bad (2), Neutral (3), Acceptable (4), Good (5) and Very Good (6). They should consider the readability, professional and match score (that measures the match with the domain knowledge). 3.4. Analytic Experiments 3.4.1. Performance on Revision Due to numerous vocabulary and grammar errors in the original psychotherapy data, manual processing and revision of these errors were not feasible. In Table 1, we presented the one command that requires generated instructions from GPT4. The right panel of Table 3 contains additional information contributed by GPT-4, such as common knowledge about depressive disorders, including psychotherapy, cognitivebehavioral therapy, medication, and a combination of treatment approaches. These recommendations from GPT-4 are 2https://github.com/ChengKang520/ psychotherapy-assistant_instruction Instruction: Instruction: What suggestions or comments you can provide to address or alleviate the following topics? Kindly provide professional suggestions or comments on effectively addressing and alleviating [Depressive Disorders]. Input: Input: We are talking about [Depressive Disorders]. We are discussing [Depressive Disorders]. Output: Output: A major depressive episode has a number of characteristic features, which take place most of the day, nearly every day, where relevant. The two main characteristics are a depressed mood, and a noticeably decreased interest in most activities. Other characteristics include trouble sleeping, diminished hunger or pronounced weight loss, trouble concentrating or making decisions, fatigue or loss of energy, recurring suicidal thoughts with or without intent to act on these thoughts, feelings of worthlessness or excessive or inappropriate guilt, psychomotor agitation or retardation, and feelings of low self-worth or pronounced guilt. These symptoms must cause marked distress in the patient\u2019s work or social life. For all of these episodes the clinician should ensure that the symptoms are not better explained by another medical condition or by the affects of a substance. A major depressive episode is characterized by a range of distinct features that persist for most of the day, nearly every day. The primary indicators include a persistent low mood and a significant decrease in interest or pleasure in most activities. Other symptoms may involve sleep disturbances, changes in appetite or weight, difficulty concentrating or making decisions, fatigue, recurring thoughts of suicide with or without intent to act on them, feelings of worthlessness or excessive guilt, psychomotor agitation or retardation, and feelings of low self-worth. These symptoms should cause marked distress in the individual\u2019s work, social life, or daily functioning. When addressing Depressive Disorders, clinicians should ensure that the symptoms are not better explained by another medical condition or the effects of substance use. As professionals, let\u2019s explore effective treatment options, such as psychotherapy, cognitivebehavioral therapy, medication, or a combination of these approaches. Encouraging patients to engage in regular physical activity, maintain a healthy diet, and establish a supportive social network can also be beneficial. Furthermore, it is crucial to foster a compassionate and understanding environment to help individuals with Depressive Disorders seek appropriate help and support. Perplexity: 6.71 Perplexity: 2.15 Table 3. The manually constructed Instruction and GPT-4 revised Assistant-Instruction on the Depressive Disorder domain. considered common-sense by psychologists, but the original psychotherapy data lacked sufficient common knowledge (because it always merely has professional knowledge). The instructions and instance inputs were also refined by GPT-4 based on the given command. Perplexity is a metric that gauges the language model\u2019s ability to predict a sequence of words. The perplexity of the right panel is lower than that of the left panel. This revision process makes the content more LLM-friendly, transforming \u201dprofessional knowledge format\u201d into a more accessible \u201dcommon knowledge format\u201d (or open-domain knowledge format). 3.4.2. Generation on Psychotherapy Domain When comparing to the content generated by pre-trained ChatGLM2-6B, we observed that the RAG method contains additional professional knowledge (can be seen from Table 4). While this extra knowledge provides more professional information, pre-trained LLMs could not offer further professional insights into autism. When comparing the generated content of ChatGLM2-6B fine-tuned on inhibited LoRA to that of ChatGLM2-6B, we found that the former provides more refinedly revised information (However, this difference is not obvious). For example, it offers insights on professional \fInstruction: Please provide professional suggestions or comments to effectively address and alleviate [Autism]. Input: We are discussing [Autism]. Output from Zero-Shot: Autism is a developmental disorder that can cause significant social, communication and behavioral challenges. There is no known single cause for autism, but increased awareness and funding support research into possible causes and better ways to treat the disorder. Output from Inhibited LoRA: Autism is a developmental disorder that can cause significant social, communication and behavioral challenges. It is a spectrum disorder, which means that symptoms and severity vary widely among individuals. Output from Inhibited LoRA + RAG: Autism is a developmental disorder that can cause significant social, communication and behavioral challenges. It is a spectrum disorder, which means that symptoms can range from mild to severe. Some people with autism may also have other conditions, such as attention deficit hyperactivity disorder (ADHD), anxiety disorders, or epilepsy. Applied Behavior Analysis (ABA) a widely recognized and evidence-based therapy for Autism. ABA techniques focus on promoting positive behaviors and reducing challenging behaviors. Speech and language therapy can help improve communication skills, such as speech articulation, expressive language, and social communication. Table 4. Based on Llama2-7B, we illustrate the performance of Zero-Shot, inhibited LoRA Tuned and RAG methods on Psychotherapy data. explanation, such as \u201d It is a spectrum disorder, which means that symptoms and severity vary widely among individuals.\u201d. 3.4.3. Evaluation We present a performance summary of different instructiontuning methods applied to two pre-trained LLMs in Table 5. While the Rouge and Fluency evaluation results show improvement with the use of Assistant-Instruction. To validate the performance, we use a selected portion of psychotherapy data as a validation set. Through content revising and leveraging additional common knowledge from GPT-4, both of these two LLMs show significant enhancement in matching the revised answers. Pre-trained LLMs can provide clients with comments to address psychological problems, but the quality of generated content may not always be fully accepted by psychologists. From Table 5, we observe that psychologists tend to prefer models that have been fine-tuned on psychotherapy data. As most LLMs lack specialization in a specific domain, they often require more domain-specific knowledge to improve their performance in professional domains. Because LLMs have been pre-trained on a vast corpus, giving them an inherent advantage in readability, and the size of tokens used does not seem to affect their performance significantly. Regarding the professionalism of the generated content, the psychologists gave higher scores to models that had been fine-tuned on psychotherapy instruction data compared to the corresponding original LLMs. Inhibited LoRA Finetuning (without / with Asisstant-Instruction) Pretrained LLM Automatic Human Evaluation Rouge-L \u2191 Fluency \u2193 Read Prof Match ChatGLM2-7B 24.3/27.1 49.4/48.7 4.8/4.9 2.9/3.3 2.1/2.5 Llama2-7B 15.1/16.9 20.9/20.5 5.0/5.2 3.0/3.2 1.9/2.3 Retravel Augmented Generation (without / with Asisstant-Instruction) Pretrained LLM Automatic Human Evaluation Rouge-L \u2191 Fluency \u2193 Read Prof Match ChatGLM2-7B 25.1/32.8 56.4/46.7 4.6/5.3 3.9/4.2 2.9/3.3 Llama2-7B 15.4/22.4 30.3/20.7 4.8/5.2 3.7/4.1 3.0/3.4 Table 5. For evaluating the performance of LLMs on psychotherapy domain, two methods inhibited LoRA and RAG were used on two pre-trained LLMs have been tuned on Assistant-Instruction using . 3.4.4. Human Evaluation Agreement To assess the reliability of our human evaluation, we conducted an inner-rater agreement analysis [6] between our two evaluators. We used Cohen\u2019s \u03ba to measure inter-rater agreement for categorical items. The 6-level rating scale (ranging from 0 to 5) was treated as a categorical variable for each aspect under consideration. The resulting \u03ba value was 0.63, indicating a moderate level of agreement according to common practice. Furthermore, we computed the Spearman correlation coefficient \u03c1 between the ratings of our two evaluators, treating the ratings as ordinal variables (ranging from 0 to 5). The obtained coefficient was \u03c1 = 0.81, demonstrating a high correlation between the two evaluators. These results indicate a reasonably reliable human evaluation process for our study. 4."
17
+ }
abs_9K/validation_abstract_short_2404.16164v1.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.16164v1",
3
+ "title": "Towards a Holistic Evaluation of LLMs on Factual Knowledge Recall",
4
+ "abstract": "Large language models (LLMs) have shown remarkable performance on a variety\nof NLP tasks, and are being rapidly adopted in a wide range of use cases. It is\ntherefore of vital importance to holistically evaluate the factuality of their\ngenerated outputs, as hallucinations remain a challenging issue.\n In this work, we focus on assessing LLMs' ability to recall factual knowledge\nlearned from pretraining, and the factors that affect this ability. To that\nend, we construct FACT-BENCH, a representative benchmark covering 20 domains,\n134 property types, 3 answer types, and different knowledge popularity levels.\nWe benchmark 31 models from 10 model families and provide a holistic assessment\nof their strengths and weaknesses. We observe that instruction-tuning hurts\nknowledge recall, as pretraining-only models consistently outperform their\ninstruction-tuned counterparts, and positive effects of model scaling, as\nlarger models outperform smaller ones for all model families. However, the best\nperformance from GPT-4 still represents a large gap with the upper-bound. We\nadditionally study the role of in-context exemplars using counterfactual\ndemonstrations, which lead to significant degradation of factual knowledge\nrecall for large models. By further decoupling model known and unknown\nknowledge, we find the degradation is attributed to exemplars that contradict a\nmodel's known knowledge, as well as the number of such exemplars. Lastly, we\nfine-tune LLaMA-7B in different settings of known and unknown knowledge. In\nparticular, fine-tuning on a model's known knowledge is beneficial, and\nconsistently outperforms fine-tuning on unknown and mixed knowledge. We will\nmake our benchmark publicly available.",
5
+ "authors": "Jiaqing Yuan, Lin Pan, Chung-Wei Hang, Jiang Guo, Jiarong Jiang, Bonan Min, Patrick Ng, Zhiguo Wang",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-04-24",
8
+ "primary_cat": "cs.CL",
9
+ "cats": [
10
+ "cs.CL",
11
+ "cs.AI",
12
+ "cs.LG"
13
+ ],
14
+ "label": "Original Paper",
15
+ "paper_cat": "LLM Fairness",
16
+ "gt": "Large language models (LLMs) have shown remarkable performance on a variety\nof NLP tasks, and are being rapidly adopted in a wide range of use cases. It is\ntherefore of vital importance to holistically evaluate the factuality of their\ngenerated outputs, as hallucinations remain a challenging issue.\n In this work, we focus on assessing LLMs' ability to recall factual knowledge\nlearned from pretraining, and the factors that affect this ability. To that\nend, we construct FACT-BENCH, a representative benchmark covering 20 domains,\n134 property types, 3 answer types, and different knowledge popularity levels.\nWe benchmark 31 models from 10 model families and provide a holistic assessment\nof their strengths and weaknesses. We observe that instruction-tuning hurts\nknowledge recall, as pretraining-only models consistently outperform their\ninstruction-tuned counterparts, and positive effects of model scaling, as\nlarger models outperform smaller ones for all model families. However, the best\nperformance from GPT-4 still represents a large gap with the upper-bound. We\nadditionally study the role of in-context exemplars using counterfactual\ndemonstrations, which lead to significant degradation of factual knowledge\nrecall for large models. By further decoupling model known and unknown\nknowledge, we find the degradation is attributed to exemplars that contradict a\nmodel's known knowledge, as well as the number of such exemplars. Lastly, we\nfine-tune LLaMA-7B in different settings of known and unknown knowledge. In\nparticular, fine-tuning on a model's known knowledge is beneficial, and\nconsistently outperforms fine-tuning on unknown and mixed knowledge. We will\nmake our benchmark publicly available.",
17
+ "main_content": "Introduction Recent advancements of large language models (LLMs), exemplified by ChatGPT1, GPT-4 (OpenAI, 2023), are leading to their widespread adoption in various domains. Despite their remarkable performance on NLP tasks, they are still plagued by the issue of hallucinations (Ji et al., 2023). Therefore, it is important to conduct holistic assessments to learn how well LLMs capture factual knowledge and what are the factors that affect their ability to recall knowledge learned from pretraining. Previous factuality benchmarks created from knowledge bases (Mallen et al., 2023; Yu et al., 2023) focus on a few domains and property types, and questions are created from templates with limited patterns (Sun et al., 2023). Evaluation of LLMs on these benchmarks reveal a large gap from mastery of factual knowledge. However, it is unclear whether such gap is caused by design challenges, such as ambiguity of the questions and presence of multiple plausible answers, which could lead to biased results. In this work, we introduce FACT-BENCH, a comprehensive factuality benchmark consisting of 20K question-answer (QA) pairs and featuring four characteristics: (1) Simplicity: we create simple questions from Wikidata triplets (subject, property, object) using Claude 2, to elicit knowledge from LLMs. (2) Validity: To make sure the answers are grounded, we select triplets whose subject has a Wikipedia article and whose object also appears in the same article. (3) Diversity: FACT-BENCH covers 20 domains, 134 property types, and 3 answer types (entities, dates and numbers). (4) Specificity: we manually select property types that are highly likely to yield unique answers and perform prompt engineering to generate specific questions. 1https://platform.openai.com/docs/models 2https://www.anthropic.com/index/ introducing-claude. Specifically, we use claude-v1.3-100k to generate questions. arXiv:2404.16164v1 [cs.CL] 24 Apr 2024 \fWe benchmark 31 models across 10 model families on FACT-BENCH. Our results reveal that instruction-tuning hurts knowledge recall, as pretraining-only models consistently outperform their instruction-tuned counterparts. We observe positive effects of model scaling \u2014 for all model families, larger models outperform smaller ones across all metrics. However, the best performance from GPT-4 still represents a large gap with the upper-bound. To identify where the gap lies, we conduct evaluation from multiple perspectives and find that LLMs struggle with long-tail entities and certain property types, consistent with the findings in (Mallen et al., 2023) and (Sun et al., 2023). In addition, we perform counterfactual incontext learning (ICL) experiments to examine the role of in-context exemplars. Our results indicate that counterfactual exemplars lead to significant degradation of factual knowledge recall for large models. By further decoupling model known and unknown knowledge, we find the degradation is attributed to exemplars that contradict a model\u2019s known knowledge, as well as the number of such exemplars. Lastly, we fine-tune LLaMA-7B in different settings of known and unknown knowledge. In particular, fine-tuning on knowledge that is known to the model is beneficial, and consistently outperforms fine-tuning on knowledge that is unknown, which empirically verifies the hypothesis in Schulman (2023) that fine-tuning on unknown knowledge teaches the model to hallucinate. Our contributions include: (1) A comprehensive benchmark to evaluate LLMs\u2019 ability to recall factual knowledge learned from pretraining. (2) Holistic assessment of the strengths and weaknesses of 31 LLMs, and the factors that affect their recall of factual knowledge. (3) Counterfactual ICL experiments to study the role of in-context exemplars, where we find contradicting a model\u2019s known knowledge leads to significant degradation of knowledge recall, as well as the number of such exemplars. (4) Fine-tuning experiments that show the advantage of using known knowledge over mixed and unknown knowledge. 2 FACT-Bench 2.1 Dataset Construction We formulate the factuality evaluation task as closed-book question answering (Roberts et al., 2020), where a question is fed to the model without any context, and the model needs to leverage its parametric knowledge to answer the question. As simple as the setup is, we identify four challenges: (1) How to make the questions simple enough so that it solely requires knowledge recall rather than complex reasoning or multi-source information? (2) What types of questions are fair to ask? It is unfair to query knowledge that does not exist in the pretraining data of all LLMs. (3) How to make the questions diverse and representative? (4) How to make the question specific enough so that the answer is unique and grounded in some knowledge source? We address these challenges from the following four aspects. Simplicity. Although LLMs have shown remarkable performance for solving composite questions (Wei et al., 2022); (Zhou et al., 2023b), we aim to decouple the ability to reason and to recall factual knowledge. Therefore, we focus on a simple QA setting to elicit knowledge from LLMs and build up the questions based on sampled Wikidata triplets3. The knowledge in Wikidata is in the format of (subject, property, object) triplets, where a simple question can be asked for the property of the subject, and the answer would be the object. Validity. To benchmark performance across various models, we take steps to make sure questions in FACT-BENCH are answerable from their pretraining corpora. Although the exact pretraining corpora are not disclosed for some LLMs, it is reasonable to assume that they have all been pretrained on Wikipedia articles. Therefore, we normalize the main content of the Wikipedia page4 for the subjects, and only select triplets whose objects also appear in the same Wikipedia page. Diversity. We diversify FACT-BENCH from five aspects: (1) Multi-domain. We leverage the knowledge domain categories from Freebase (Bollacker et al., 2008) and select triplets whose subject has a Wikipedia article page, as well as a Freebase ID. We manually aggregate the 99 top-level domains from Freebase into 20 general domains, such as finance, travel, and literature. (2) Multianswer-type. Unlike previous work, we not only include questions with textual answers, but also dates and numbers. (3) Multi-property-type. We manually select a total of 134 diverse properties, which is much more comprehensive than previous benchmarks. The full list of property types 3We use the dump from https://dumps.wikimedia. org/wikidatawiki/20230601/. 4We use the 20220301.en subset from the Hugging Face datasets library: https://huggingface.co/ datasets/wikipedia. \fby answer type can be found in Appendix C. (4) Multi-knowledge-popularity. Following previous work (Mallen et al., 2023), we use the view count of subject Wikipedia article from the whole year of 2021 to approximate the popularity of knowledge and sample triplets from the top-25% and bottom25% most popular triplets sets within each domain. (5) Diverse questions. Previous benchmarks typically use templates to construct questions from triplets, whereas we leverage a LLM to generate syntactically rich questions. Specificity. A challenging issue for the opendomain QA task is that multiple plausible answers may exist for certain questions. We tackle this challenge from two levels. First, select proper triplets. For example, the triplet [\u00d6rjan Sandred, student of, Sven-David Sandstr\u00f6m] may not be a good triplet since there could be multiple teachers for everyone, whereas the triplet [Jacob Viner, doctoral advisor, F. W. Taussig] is more restricted. We manually select property types that are highly likely to yield unique answers. Second, ask specific questions. Given a proper triplet, there could be multiple ways to ask questions. For example, given [Dan Wickline, place of birth, \u201cNorwalk, California\u201d], the question \u201cwhere was Dan Wickline born?\u201d has multiple valid answers such as Norwalk, and California, even though the place of birth is unique for everyone. The question \u201cWhat city and state was Dan Wickline born in?\u201d is more specific. We test multiple prompts for question generation and select one that works best for us (prompt shown in Table 5). Additionally, we filter out triplets whose subjects contain \u201c()\u201d in their Wikipedia titles as \u201c()\u201d is used for disambiguation5. We also remove triplets that share the same subject and property. Lastly, for specific numerical answers, we check the number together with the unit. For example, for length, we check for 500 kilometers or 500 km instead of just 500, and for temperature, we check for 98 \u00b0C instead of just 98. 2.2 Dataset Statistics and Evaluation Metrics We manually select 90 properties with textual answers, 22 properties with date answers, and 22 properties with numerical answers. We randomly sample 1000 triplets from each of the 20 domains, where 500 are from the top-25% most popular triplets, and 500 from the bottom-25%. The re5https://en.wikipedia.org/wiki/Wikipedia: Article_titles#Disambiguation sulting 20k QA pairs are split into training and evaluation set, with a size of 5K and 15K, respectively. The 5K training set is released to facilitate exemplar sampling for ICL and small-scale finetuning. We keep the distribution consistent for any subset, i.e., there is an equal number of examples from each domain, out of which half comes from the top-25% and the other half from the bottom25%. For evaluation, we use standard metrics for QA tasks, such as SQuAD (Rajpurkar et al., 2016): Exact Match (EM) and F1 score. For answers that are entities, we collect their aliases from Wikidata as additional ground-truth answers. Dates are normalized in the format of month, day, year. In zeroshot experiments, we observe models that have not been instruction-tuned tend to generate verbose answers, which leads to low EM and F1 scores but does not necessarily mean that the prediction is wrong. Therefore, we introduce an additional metric Contains, which simply checks if any of the ground-truth answers appear in the prediction. 2.3 Dataset Validation We provide a solid estimation of the upper-bound through human validation to validate that FACTBENCH is of high quality from the triplet sampling and question generation efforts. Concretely, we sample a 2k subset from the 15k evaluation set while keeping the distribution of questions consistent, and manually check the validity and specificity of the questions by examining supporting evidence from Wikipedia articles. We identify 201 questions from the 2k subset that are either ambiguous or not supported by Wikipedia, and replace them with valid ones. Empirically, the upper-bound is 90% for the 15k set and 100% for the 2k subset, which we denote as PREMIUM2K. 3 Benchmarking LLMs 3.1 Experimental Setup We consider LLMs with different model architectures, sizes, pretraining-only/instruction-tuning, and conduct zero-shot and few-shot ICL experiments. Specifically, we benchmark GPT-4, GPT3.5-turbo6, BLOOM/BLOOMZ (7B) (Scao et al., 2023), LLaMA (7B, 13B, 33B, 65B) (Touvron et al., 2023), Vicuna (7B, 13B, 33B) (Chiang et al., 2023), OpenLLaMA (7B, 13B) (Geng & Liu, 2023), FLAN-T5-XXL (11B) (Chung et al., 6We access the APIs of OpenAI models from the week of July 3rd to that of July 17th, 2023 \fGPT-4 ChatGPT BLOOM-7.1B BLOOMZ-7.1B LLaMA-7B LLaMA-13B LLaMA-33B LLaMA-65B Vicuna-7B-v1.3 Vicuna-13B-v1.3 Vicuna-33B-v1.3 OpenLLaMA-7B OpenLLaMA-13B FLAN-T5-XXL T0++ UL2-20B FLAN-UL2-20B Falcon-7B Falcon-7B-instruct Falcon-40B Falcon-40B-instruct Falcon-180B Falcon-180B-chat MPT-7B MPT-7B-instruct MPT-30B MPT-30B-instruct Pythia-6.9B Pythia-12B 0 20 40 60 80 Exact Match Top-25% Bottom-25% Figure 1: 10-shot EM by knowledge popularity. Knowledge popularity is a strong predictor of knowledge recall. LLMs struggle with long-tail entities (Bottom-25%) as shown by the large gap with popular entities (Top-25%). all country located in admin territorial entity place of birth inception country of citizenship date of birth occupation place of death sport manufacturer taxon rank educated at date of death country of origin headquarters location part of parent taxon 0 20 40 60 80 100 Exact Match GPT-4 ChatGPT LLaMA-7B LLaMA-13B LLaMA-33B LLaMA-65B Figure 2: 10-shot EM by property type. LLMs do well on certain property types, such as country-related properties, while struggle on other property types, such as date-related properties. Due to space, we show results for GPT and LLaMA models, and the most common property types from the full set of 134 property types. Models zero-shot 1-shot 6-shot 10-shot EM Contains EM Contains EM Contains EM Contains GPT-4 58.60 64.65 59.85 63.20 63.35 66.45 65.90 69.15 GPT-3.5-turbo 49.75 52.60 51.25 53.70 52.65 55.80 53.55 56.40 BLOOM-7.1B 03.20 20.30 18.95 19.95 17.85 19.90 18.15 19.75 BLOOMZ-7.1B 18.00 19.45 14.05 15.35 14.40 17.05 15.20 17.70 LLaMA-7B 14.65 35.20 33.25 34.15 35.55 37.15 35.05 36.75 LLaMA-13B 21.35 39.95 36.45 37.30 41.15 42.75 41.20 42.95 LLaMA-33B 27.25 46.55 45.25 46.70 48.30 50.30 48.90 51.10 LLaMA-65B 35.25 49.20 47.15 48.45 52.15 53.80 52.45 54.10 Vicuna-7B-v1.3 24.65 33.25 31.15 33.80 30.10 35.05 31.00 34.65 Vicuna-13B-v1.3 32.95 35.15 36.45 37.60 38.00 41.20 38.40 41.15 Vicuna-33B-v1.3 34.30 44.15 41.39 44.75 44.10 48.10 44.00 48.05 OpenLLaMA-7B 14.05 32.30 31.75 32.80 32.55 34.70 33.80 35.95 OpenLLaMA-13B 25.70 37.35 37.05 38.40 38.75 40.70 39.70 41.55 FLAN-T5-XXL (11B) 20.60 21.60 20.45 21.45 21.05 22.15 20.95 22.00 T0++ (11B) 16.05 21.25 16.75 19.95 16.80 20.00 17.05 19.85 UL2 (20B) 03.40 23.55 23.50 24.40 24.15 25.75 23.50 25.00 FLAN-UL2 (20B) 24.05 25.20 24.10 25.25 24.10 25.30 23.90 24.95 Falcon-7B 23.60 30.05 30.25 31.90 30.70 32.60 30.45 32.25 Falcon-7B-instruct 10.85 25.10 21.75 24.60 22.45 25.45 22.45 25.20 Falcon-40B 26.55 30.90 39.10 40.50 42.05 43.60 42.25 43.80 Falcon-40B-instruct 21.95 40.25 38.85 40.75 40.40 42.20 40.00 41.85 Falcon-180B 44.90 47.45 49.25 50.60 53.55 55.05 53.45 55.00 Falcon-180B-chat 39.95 47.10 47.00 49.30 49.05 51.50 49.30 51.60 MPT-7B 03.45 30.35 28.85 29.85 29.75 31.15 30.45 31.55 MPT-7B-instruct 03.55 30.40 21.55 29.25 26.35 29.30 27.85 29.60 MPT-30B 25.30 35.00 34.35 35.55 35.80 37.55 36.05 37.75 MPT-30B-instruct 19.05 33.50 28.80 31.20 31.00 33.50 31.50 33.85 Pythia-6.9B 11.00 13.15 21.20 22.45 21.85 23.05 21.70 23.25 Pythia-12B 15.25 22.00 22.75 23.70 22.95 24.35 23.20 24.65 Mistral-7B 28.45 29.25 38.90 39.80 40.45 41.85 40.75 42.60 Mistral-7B-instruct 26.00 29.30 26.80 30.05 26.80 30.35 27.20 30.75 Table 1: Benchmarking results on PREMIUM2K. 2022), T0++ (11B) (Sanh et al., 2021), UL2/FLANUL2 (20B) (Tay et al., 2023), Falcon/Falconinstruct (7B, 40B, 180B) (Almazrouei et al., 2023), MPT/MPT-instruct (7B, 30B) (MosaicML NLP Team, 2023), Pythia (6.9B, 12B) (Biderman et al., 2023), and Mistral/Mistral-instruct (7B) (Jiang et al., 2023). For all LLMs, we use the same prompts shown in Table 6 and 7. The exemplars in the few-shot experiments are shared across models and are randomly sampled from the training set, considering coverage for all 3 answer types (entities, dates and numbers). All our experiments are conducted on the PREMIUM2K subset to reduce the cost of running LLMs7. 3.2 Results Benchmarking results are presented in Table 18. Large gap with upper-bound. GPT-4 outperforms all the other models we consider on our benchmark. However, its performance of 65.9% EM in the 10-shot setting still represents a large gap with the estimated upper-bound, which shows the challenge of mastering factuality, as well as the potential risks of using LLMs in certain tasks. Positive effect of model scaling. Overall, we observe positive effects of model scaling. For all model families (i.e., LLaMA, Falcon, and MPT), larger model sizes translate to better performances across settings. Closed-source GPT models significantly outperform open-source models with the 7For the full 15k evaluation set, we provide zero-shot and 10-shot results in Appendix B.4 for reference. 8Full results including F1 scores can be found in Appendix B.3. \fall automotive-fashion food law religion travel visual-art device transportation education media architecture science finance literature event sports organization entertainment location people 0 20 40 60 80 100 Exact Match GPT-4 ChatGPT LLaMA-7B LLaMA-13B LLaMA-33B LLaMA-65B Figure 3: 10-shot EM by domain. Compared to knowledge popularity and property type, domain is less predictive of knowledge recall as model performances across different domains are more flat. Due to space, we show results for GPT and LLaMA models. all entity date number 0 20 40 60 80 Exact Match GPT-4 ChatGPT LLaMA-7B LLaMA-13B LLaMA-33B LLaMA-65B Figure 4: 10-shot EM by answer type. LLMs are less capable on date and numerical knowledge. Due to space, we show results for GPT and LLaMA models. notable exception of LLaMA-65B, which is competitive with GPT-3.5-turbo in the 10-shot setting. Negative impact of instruction-tuning. Comparing models in their pretraining-only form and their instruction-tuned counterparts, such as LLaMA/Vicuna, Falcon/Falcon-instruct, and MPT/MPT-instruct in the few-shot setting, all instruction-tuned models display inferior performance for all metrics. In the zero-shot setting, pretraining-only models tend to generate verbose answers, which leads to low EM and F1 scores, but the Contains metric reveals that they outperform their instruction-tuned counterparts. This result empirically verifies the hypothesis in Zhou et al. (2023a) that most knowledge of LLMs is learned during pretraining and alignment only helps with output style and format. We hypothesize that the alignment tax (Ouyang et al., 2022) from instruction-tuning leads to the performance drop. Overall, the best performance for each model family is achieved by few-shot ICL with the pretraining-only version of the model. Diminishing returns from adding more exemplars. Going from zero-shot to 1-shot, all opensource models benefit greatly learning from the answer format of the in-context exemplar, which is reflected in their improved EM scores. This is especially the case for pretraining-only models. By the Contains metric, results are mixed. As k increases to 6, all models, with the exception of BLOOM and T0++, show improvements over zero-shot and 1-shot. However, going from 6-shot to 10-shot, model performances mostly stay flat, except for GPT-4, improving by 2.7%. To further validate this, we run zero, 1\u201310 shots with LLaMA models, and results are shown in Figure 5, where the curves flatten after providing 3\u20135 exemplars. 0 1 2 3 4 5 6 7 8 9 10 20 40 60 Number of Exemplars EM 7B 13B 33B 65B Figure 5: LLaMA zero-to-10-shot results by EM. 3.3 Fine-grained Evaluation To gain a better understanding of where the gap with the upper-bound lies, we examine model performances from multiple perspectives. Knowledge popularity and property type are predictive of knowledge recall. Figure 1 shows 10-shot performance by knowledge popularity and Figure 2 by property type. We observe similar findings in Mallen et al. (2023) that knowledge popularity and property type are strong predictors of knowledge recall. LLMs struggle with long-tail entities (Bottom-25%) as shown by the large gap with popular entities (Top-25%). This result suggests that knowledge distribution of the pretraining data (if known to the model user) can potentially be leveraged as a predictor for factual knowledge recall. LLMs do well on certain property types, \fsuch as country-related properties, while struggle on other property types, such as date-related properties. Further results by answer type (Figure 4) show that LLMs are less capable on date and numerical knowledge. Domain is less predictive of knowledge recall. On the other hand, domain is not a strong predictor of model performance as shown in Figure 3, where model performances across different domains are more flat compared to knowledge popularity levels and property types. 4 The Role of In-context Exemplars Previous work (Min et al., 2022) suggests that ground-truth labels play an insignificant role for ICL, such that replacing ground-truth labels with random labels on classification and multi-choice tasks only results in marginal loss of accuracy. Compared to classification and multi-choice tasks, the label space of our task is much larger. We design a set of experiments to investigate how counterfactual in-context exemplars affect a model\u2019s ability to recall factual knowledge. 4.1 Counterfactual ICL Experimental setup. In this set of experiments, we replace the ground-truth answers of our regular 10-shot exemplars with random answers chosen from the 5k training set. We impose an additional constraint that the random answer is chosen within the same property type, denoted as shuffle. For example, we change the ground-truth answer for \u201cIn which military branch did Henry Curtis serve?\u201d from \u201cRoyal Navy\u201d to the counterfactual answer \u201cUnited States Marine Corps\u201d. Without prior knowledge required to answer the question, the new input-label pair looks reasonable but is actually not factual. Results. Figure 6 shows the results. Notably, LLaMA-65B experiences a major drop from 52.45% EM (regular 10-shot) to 29.45%, followed by Falcon-180B from 53.45% to 37.05%, and LLaMA-33B from 48.9% to 43.2%, while the performance of smaller models remains flat and unaffected. In addition, we observe that instructiontuned models are less affected by counterfactual exemplars than their pretraining-only counterparts. For example, compared to LLaMA, Falcon and MPT, the drop is less significant for Vicuna, Falconchat, and MPT-instruct models, respectively. 4.2 Counterfactual ICL with known and unknown knowledge Results in the previous section show that counterfactual exemplars lead to significant degradation of factual knowledge recall for large models. However, it is not clear what factors lead to this behavior besides model scale. LLaMA-65B, Falcon-180B and LLaMA-33B are the three most capable opensource models on our benchmark (Table 1). Since the 10 in-context exemplars are randomly sampled, it is expected that these three models have more knowledge about the exemplars than the other models. Therefore, we further decouple known and unknown knowledge of the exemplars to study their role. Experimental setup. We conduct controlled experiments on LLaMA models and text-davinci-0029. To approximate model known and unknown knowledge, we sample k = 32 questions that are correctly answered by each model as known knowledge, and k = 32 incorrectly answered as unknown knowledge. We corrupt the exemplars with the same shuffling method as the previous experiment. Contradicting LLMs\u2019 known knowledge teaches them to lie. Results are shown in Figure 7. Comparing known-shuffle with unknownshuffle in the 10-shot setting, LLaMA-65B drops from 52.45% EM (regular 10-shot) to 26.60% with known-shuffle while the drop with unknownshuffle is much less significant from 52.45% EM to 42.90%. For LLaMA-33B, performance drops from 48.30% to 42.20% with known-shuffle, and from 48.30% to 46.25% with unknown-shuffle. For the larger text-davinci-002 model, performances are near identical with known-shuffle and unknownshuffle (41.60% vs 41.30%). However, as we increase k, the gap between knownand unknownshuffle becomes increasingly deep (i.e., 34.10% vs 42.80% in 20-shot, and 29.95% vs 40.55% in 32-shot). Similar effect from increasing k is observed on LLaMA-33B and LLaMA-65B. Notably, as k increases, the smaller LLaMA-13B also starts experiencing sharp drops with known-shuffle. In the 32-shot setting, its performance drops from 41.29% (regular 10-shot) to 24.45%, while remains flat with unknown-shuffle at 40.80%. For the smallest LLaMA-7B, its performances stay flat across 9In Wei et al. (2023), experiments using in-context exemplars with flipped labels show that text-davinci-002 experiences the largest drop on binary classification tasks. We further include this model in this set of experiments. \fGPT-4 ChatGPT BLOOM-7.1B BLOOMZ-7.1B LLaMA-7B LLaMA-13B LLaMA-33B LLaMA-65B Vicuna-7B-v1.3 Vicuna-13B-v1.3 Vicuna-33B-v1.3 OpenLLaMA-7B OpenLLaMA-13B FLAN-T5-XXL T0++ UL2-20B FLAN-UL2-20B Falcon-7B Falcon-7B-instruct Falcon-40B Falcon-40B-instruct Falcon-180B Falcon-180B-chat MPT-7B MPT-7B-instruct MPT-30B MPT-30B-instruct Pythia-6.9B Pythia-12B 0 20 40 60 Exact Match Regular 10-Shot Counterfactual 10-Shot Figure 6: Comparison of regular 10-shot and counterfactual 10-shot by Exact Match. LLaMA-65B experiences a major drop with counterfactual exemplars, followed by Falcon-180B and LLaMA-33B, while the performance of smaller models remains flat and unaffected. 10 15 20 32 0 20 40 60 Shot Exact Match text-davinci-002 known-unshuffle known-shuffle unknown-unshuffle unknown-shuffle 10 15 20 32 0 20 40 60 Shot LLaMa-7B 10 15 20 32 0 20 40 60 Shot LLaMa-13B 10 15 20 32 0 20 40 60 Shot LLaMa-33B 10 15 20 32 0 20 40 60 Shot LLaMa-65B Figure 7: Counterfactual few-shot with known and unknown knowledge, evaluated by Exact Match. Result shows that the degradation in factual knowledge recall is primarily due to exemplars that contradict models\u2019 known knowledge, and the number of such exemplars. different settings. The results suggest that the degradation in factual knowledge recall is primarily due to exemplars that contradict models\u2019 known knowledge, i.e., counterfactual ICL with known knowledge is essentially teaching LLMs to lie, leading to unexpected results. Additionally, the number of counterfactual exemplars also plays a prominent role. As k increases, models experience sharper drops and even smaller models (LLaMA-13B in our experiments) can suffer from significant performance drops. In practical applications, it is therefore important to pair in-context exemplars with the correct answers if known to the model, in order to maximally elicit their parametric knowledge. Finally, we observe comparable performances for knownunshuffle and unknown-unshuffle across different models. 5 Fine-tuning In this section, we examine how fine-tuning affects a model\u2019s ability to recall factual knowledge and use LLaMA-7B to conduct experiments. 5.1 Regular fine-tuning Experimental setup. We fine-tune LLaMA-7B on the 5k training set and sample 4k additional examples using the same procedure described in Section 2 as the validation set. We train for 40 steps where training stabilizes based on validation loss and report results on the PREMIUM2K subset. For model input and output, we use the same inputlabel format as in the prompting experiments (i.e., input consists of an instruction and a question, and output is the answer to the question). Results. In the zero-shot setting, we compare models using the contains metric instead of EM since the predictions of pretraining-only LLaMA are verbose. Table 2 shows that our fine-tuned LLaMA underperforms Vicuna, and both models underperform the pretraining-only LLaMA. Results of this experiment further verify the hypothesis in Zhou et al. (2023a) that a model\u2019s knowledge is mostly learned from pretraining, and instructiontuning only helps align the answer format. Models zero-shot EM F1 Contains LLaMA-7B 14.65 27.66 35.20 Vicuna-7B 24.65 33.33 33.25 LLaMA-7B (fine-tuned) 28.75 35.22 29.85 Table 2: Comparison of LLaMA, Vicuna and our finetuned LLaMA. \f5.2 Counterfactual fine-tuning Experimental setup. In the counterfactual ICL experiments (Section 4), our experiment results indicate that LLaMA-7B is mostly unaffected by counterfactual exemplars. We set up similar experiments in the fine-tuning setting, where we corrupt the training data with inner-property-shuffle. Results. Table 3 shows the results. Factuality of in-context exemplars plays a critical role for finetuning. The model can recover part of its capability as training goes on. However, its performance is still significantly worse than that from regular finetuning (11.25% EM vs 29.1%). Setup for fine-tuning zero-shot EM F1 Contains Regular fine-tuning 28.75 35.22 29.85 Counterfactual fine-tuning 10.75 15.61 12.45 Table 3: Fine-tuning LLaMA-7B with counterfactual knowledge. 5.3 Fine-tuning with known, unknown and mixed knowledge Experimental setup. We fine-tune LLaMA-7B with three types of factual knowledge separately: (1) known. (2) unknown. (3) mixed. To approximate known and unknown knowledge, we use the same method described in Section 4.2. We use our evaluation set (not including PREMIUM2K) as the candidate pool to select training data since we need to distinguish between known and unknown knowledge, and 5k is insufficient. We then randomly choose 2.5k training examples for known and unknown knowledge, respectively. Results. Table 4 shows the results. Training with known knowledge consistently outperforms training with mixed knowledge, and training with unknown knowledge leads to the worst performance. The results verify the claim in Schulman (2023) that fine-tuning on knowledge unknown to the model teaches the model to hallucinate. Setup for fine-tuning zero-shot EM F1 Contains Known knowledge 33.00 39.54 33.85 Unknown knowledge 27.55 34.10 28.75 Mixed knowledge 29.30 36.36 30.25 Table 4: Fine-tuning LLaMA-7B with known, unknown and mixed knowledge. 6 Related Work Factuality Benchmarks Question answering datasets, such as Natural Questions (Kwiatkowski et al., 2019), TriviaQA (Joshi et al., 2017), WebQuestions (Berant et al., 2013), TruthfulQA (Lin et al., 2022) have been used to evaluate factuality of language models. LAMA (Petroni et al., 2019, 2020) leverages 4 knowledge sources and converts fact triplets into cloze-style questions. More recent works, such as POPQA (Mallen et al., 2023) and KoLA (Yu et al., 2023), construct benchmarks from Wikidata using templates and cover a limited set of property types and domains. Head-to-Tail (Sun et al., 2023) creates their benchmark from DBpedia (Auer et al., 2007) with a focus on evaluating LLMs on knowledge at different popularity levels. Compared to previous benchmarks, FACT-BENCH is more diverse and representative, covering 134 property types, 20 general domains and 3 answer types. We strictly filter Wikidata triplets and generate valid and specific questions whose answers are grounded in Wikipedia. The role of in-context exemplars Min et al. (2022) studies the role of in-context exemplars and shows that ground-truth labels are not required for ICL. Yoo et al. (2022) revisits the findings and proposes additional metrics to reveal the importance of ground-truth labels. Wei et al. (2023) conducts similar experiments and finds that overriding semantic priors is an emergent ability of large models. Our counterfactual ICL experiments corroborate this finding, where large models suffer from significant degradation of knowledge recall. We additionally find that contradicting a model\u2019s known knowledge is the primary factor leading to this behavior, along with the number of such exemplars. Pan et al. (2023) separates task recognition from task learning in studying how ICL leverages demonstrations, and find that task recognition does not drastically improve with model scaling and more exemplars, while task learning does. 7"
18
+ }
abs_9K/validation_abstract_short_2404.16189v1.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.16189v1",
3
+ "title": "Structure Preserving PINN for Solving Time Dependent PDEs with Periodic Boundary",
4
+ "abstract": "We present a structure preserving PINN for solving a series of time dependent\nPDEs with periodic boundary. Our method can incorporate the periodic boundary\ncondition as the natural output of any deep neural net, hence significantly\nimproving the training accuracy of baseline PINN. Together with mini-batching\nand other PINN variants (SA-PINN, RBA-PINN, etc.), our structure preserving\nPINN can even handle stiff PDEs for modeling a wide range of\nconvection-diffusion and reaction-diffusion processes. We demonstrate the\neffectiveness of our PINNs on various PDEs from Allen Cahn, Gray Scott to\nnonlinear Schrodinger.",
5
+ "authors": "Baoli Hao, Ulisses Braga-Neto, Chun Liu, Lifan Wang, Ming Zhong",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-04-24",
8
+ "primary_cat": "math.NA",
9
+ "cats": [
10
+ "math.NA",
11
+ "cs.NA"
12
+ ],
13
+ "label": "Original Paper",
14
+ "paper_cat": "Diffusion AND Model",
15
+ "gt": "We present a structure preserving PINN for solving a series of time dependent\nPDEs with periodic boundary. Our method can incorporate the periodic boundary\ncondition as the natural output of any deep neural net, hence significantly\nimproving the training accuracy of baseline PINN. Together with mini-batching\nand other PINN variants (SA-PINN, RBA-PINN, etc.), our structure preserving\nPINN can even handle stiff PDEs for modeling a wide range of\nconvection-diffusion and reaction-diffusion processes. We demonstrate the\neffectiveness of our PINNs on various PDEs from Allen Cahn, Gray Scott to\nnonlinear Schrodinger.",
16
+ "main_content": "Introduction Time-dependent partial differential equations (PDEs) hold a ubiquitous presence across numerous scientific and engineering models, underpinning various physical phenomena (Allen & Cahn, 1979; Bazant, 2017; Burgers, 1948; Cahn & Hilliard, 1958; Cassani, Monteverde, & Piumetti, 2021; De Kepper, Castets, Dulos, & Boissonade, 1991; Fibich, 2015; Horstmann, Danner, & Bessler, 2013; Hyman, Weber, & J\u00a8 ulicher, 2014; Kato, 1987; Kevrekidis, Rasmussen, & Bishop, 2001; Kim et al., 2016; Kudryashov, 1990; Lee et al., 2014; Michelson, 1986; Miranville, 2017; Nishiura & Ueyama, 1999; Shen & Yang, 2010; Takatori & Brady, 2015; Tian, Mao, Brown, Rutledge, & Hatton, 2015; Whitham, 2011; Zhabotinsky, 2007). Particularly, when coupled with periodic boundary conditions, these PDEs become instrumental in modeling phenomena on infinite physical domains. However, the task of solving such PDEs often poses significant challenges. In response to these challenges, we propose an innovative series of machine learning-based solvers tailored for handling time-dependent PDEs, with a specific emphasis on forward evolution of the data. The utilization of machine learning methodologies has demonstrated notable success in various scientific endeavors, ranging from the intricate process of protein folding Jumper et al. (2021), new drug discoveries Carracedo-Reboredo et al. (2021), to expediting matrix multiplication Fawzi et al. (2022). Traditional data-driven machine learning approaches rely heavily on vast amounts of training data, sometimes yielding models that lack interpretability due to their detachment from the physical understanding of the problem domain. Moreover, in numerous scientific domains, acquiring high-fidelity data proves to be both expensive and time-consuming. The emerging field of physics-informed machine learning presents a promising avenue to address these challenges. By integrating constraints derived from physical laws, physics-informed machine learning enables the prediction of complex system behaviors using sparse data Cai, Wang, Lu, Zaki, and Karniadakis (2021); X. Chen et al. (2022); Y. Chen, Hosseini, Owhadi, and Stuart (2021); Jin, Cai, Li, and Karniadakis (2021); Liu and Wang (2019, 2021); Rad, Viardin, Schmitz, and Apel (2020); Raissi and Karniadakis (2018); Raissi, Perdikaris, and Karniadakis (2019); R. Wang, Zhong, Xu, S\u00b4 anchez-Cort\u00b4 es, and de Cominges Guerra (2023); Yang, Barajas-Solano, Tartakovsky, and Tartakovsky (2019); Zhu, Liu, and Yan (2021). However, the successful training of physics-informed machine learning models remains a formidable task Coutinho et al. (2023); McClenny and Braga-Neto (2020); S. Wang, Teng, and Perdikaris (2020); S. Wang, Yu, and Perdikaris (2020). Fundamental challenges include the difficulty in propagating information away from data, particularly in scenarios involving stiff PDEs. In this paper, we introduce a novel algorithm designed to preserve the structural integrity of physics-informed neural networks (PINNs). Our approach involves embedding information regarding initial and boundary conditions directly into the neural network architecture, thereby reducing the reliance on spectral bases in training 1 arXiv:2404.16189v1 [math.NA] 24 Apr 2024 \fvarious types of losses S. Wang, Yu, and Perdikaris (2020). This architectural modification not only accelerates the training process but also enhances the accuracy of solutions derived from PINNs. Our key insight lies in recognizing that collocation-based machine learning solvers, utilized for training PINNs, can be viewed as a specialized form of regularized regression. In this framework, the initial and boundary conditions, along with observed data points, serve as the basis for training, while collocation points act as regularization data. However, the multi-objective nature of the training loss often poses challenges in finding global minimizers. Furthermore, the solution manifolds of most time-dependent PDEs exhibit sensitivity to initial and boundary conditions, where slight variations may yield vastly different outcomes. By integrating initial and boundary condition data into the neural network structure\u2014thus preserving the underlying problem structure\u2014we simplify the PINN training process, particularly for stiff time-dependent PDEs. Moreover, our approach can be augmented with existing training enhancement techniques, such as self-adaptive weights McClenny and Braga-Neto (2020), causal PINNs S. Wang, Yu, and Perdikaris (2020), and time-marching PINNs Wight and Zhao (2020), Residual-based Attention PINN Anagnostopoulos, Toscano, Stergiopulos, and Karniadakis (2024), co-training PINN Zhong, Liu, Arroyave, and Braga-Neto (2024), further refining prediction accuracy. 1.0.1 Related Work The foundational PINN algorithm, while demonstrating remarkable efficacy across numerous applications, occasionally exhibits shortcomings in accurately approximating solutions or achieving convergence, particularly when applied to \u201cstiff\u201d PDEs, where a small time scale is required in order for traditional numerical algorithms to stay stable. Extensive research indicates that such challenges stem from an imbalance within the PINN loss function between its data-fitting and residual components (Shin, Darbon, & Karniadakis, 2020; S. Wang, Teng, & Perdikaris, 2020; S. Wang, Yu, & Perdikaris, 2020; Wight & Zhao, 2020). Notably, gradient descent tends to prioritize minimizing the residual loss over the data-fitting component, impeding convergence to the correct solution. This issue is particularly pronounced in forward problems, where all available data are confined to initial and boundary conditions, with scant information within the PDE domain. For instance, in time-evolution scenarios, neural network training struggles to propagate information from initial conditions to subsequent time steps, as corroborated by several researchers Haitsiukevich and Ilin (2022); Krishnapriyan, Gholami, Zhe, Kirby, and Mahoney (2021); McClenny and Braga-Neto (2020); S. Wang, Sankaran, and Perdikaris (2022); Wight and Zhao (2020). In addressing these challenges, Wight and Zhao (2020) proposed a method to propagate information forward in time by segmenting the time axis into smaller intervals, sequentially training PINNs on each segment, starting from the interval closest to the initial condition. However, this approach is time-intensive due to the necessity of training multiple PINNs. Furthermore, both Wight and Zhao (2020) and McClenny and Braga-Neto (2020) emphasized the importance of weighting initial condition data and residual points near t = 0 to effectively propagate information forward, as evidenced in nonlinear Allen-Cahn PDE benchmarks. Notably, McClenny and Braga-Neto (2020) demonstrated that their self-adaptive PINNs autonomously learn this weighting during training, a phenomenon observed in benchmarks featuring complex initial conditions, such as the Wave equation. Similarly, Krishnapriyan et al. (2021) proposed a \u201csequence-to-sequence\u201d approach, wherein the PINN sequentially learns each time step in a time-marching scheme, further addressing the propagation challenge. S. Wang et al. (2022) identified a lack of \u201ccausality\u201d in standard PINN training and proposed a corrective weighting scheme that gradually prioritizes data from early to later times, leveraging information from the PDE residue itself, akin to the self-adaptive weighting mechanism proposed by McClenny and Braga-Neto (2020). Moreover, recent developments, such as the pseudo-label approach introduced in Haitsiukevich and Ilin (2022), bear resemblance to self-training methodologies in PINNs, further diversifying the arsenal of techniques available for enhancing convergence and accuracy in PINN-based solutions. Finally, a characteristic-informed neural networks (CINNs) framework was introduced in Braga-Neto (2023) for training PINNs for solving transport equations, where the PDE information is built-in to the structure of the neural networks. Similar approach was proposed in Lagaris, Likas, and Fotiadis (1998) for a Dirichlet BC, our method is essential similar to that approach but with a more careful design of stability in mind. 1.0.2 Contributions of this Work In this paper, we proposed a structure-preserving PINN algorithm by building the IC/BC information into the structure of neural networks, in order to reduce the training difficulties for PINNs for solving various stiff timedependent PDEs. \u2022 We develop structure preserving PINN algorithms, and investigate their stability, training speed, and prediction accuracy. The structure preserving PINN is similar to the method proposed recently in Braga-Neto (2023). However in that paper, PDE is built into the structure; whereas ours build the IC/BC into the PINNs. \u2022 We investigate how structure preserving ameliorates the issue of propagating information forward in time, which is a common failure mode of PINNs. \u2022 We propose the first structure preserving PINNs which incorporate both IC and BC data in a neural networks. 2 \f2 Methodology We consider the following setup for a family of time dependent PDEs. Let u be an unknown scalar function defined on [0, T] \u00d7 \u2126with \u2126\u2282Rd. Here the physical domain \u2126comes with a Lipschitz boundary \u2202\u2126. Let P be a spatial partial differential operator, i.e. for the heat equation ut \u2212\u03bbuxx = 0, P = \u03bb \u22022 \u2202x2 . Moreover P can be nonlinear. Let B be another partial differential operator on the boundary, i.e. for Dirichlet boundary condition u(t, x) = g(t, x) for (t, x) \u2208[0, T] \u00d7 \u2202\u2126, B = I (the identity). Then we say that u is a solution of an PDE, if u satisfies the following \uf8f1 \uf8f4 \uf8f2 \uf8f4 \uf8f3 ut \u2212P(u)(t, x) = 0, (t, x) \u2208(0, T] \u00d7 \u2126, u(0, x) = u0(x), x \u2208\u00af \u2126= \u2126\u222a\u2202\u2126, B(u)(t, x) = g(t, x), (t, x) \u2208[0, T] \u00d7 \u2202\u2126, (1) Here the two functions u0, g are user-input and are assumed to satisfy desired regularity so that the existence and uniqueness of solutions for such a PDE is guaranteed. We also assume that the compactibility condition, i.e., g(0, x) = u0(x) for x \u2208\u2202\u2126, is satisfied in order to prevent any ill-conditioning of the PDE problem. Types of Boundary Conditions: one can consider many kinds of boundary conditions as follows B(u)(t, x) = u(t, x), Dirichlet type, B(u)(t, x) = \u2202u \u2202n(t, x), Neumann type, n is the outward normal vector to \u2202\u2126, B(u)(t, x; a, b) = au(t, x) + b \u2202u \u2202n(t, x), Robin type. The periodic boundary condition gives d different equations, and they are given as follows, B(u)(t, x) = u(t, x) \u2212u(t, x + Pei) = 0, i = 1, \u00b7 \u00b7 \u00b7 , d. Here P is the period and ei is the ith standard basis vector in Rd, i.e. ei = \u0002 0 \u00b7 \u00b7 \u00b7 0 1 0 \u00b7 \u00b7 \u00b7 0 \u0003\u22a4 | {z } 1 is the in the ith position. . One can even consider a mixture of two or all of the above BC conditions, i.e. where \u2126= \u03931 \u222a\u00b7 \u00b7 \u00b7 \u222a\u0393K and each \u0393i defines a different kind of BC. In this paper, we will mainly focus on the periodic type of boundary conditions. Classical numerical techniques such as the Finite Difference Method (which approximates derivatives on a point mesh), Finite Element Method (utilizing basis approximation on a triangular mesh with weak formulation), and Spectral Method (employing Fourier basis with FFT on a point mesh) are widely utilized in scientific computations. However, recent advancements in scientific machine learning integrate the principles of physics, particularly the understanding of PDEs, into the training process of machine learning models. This integration enables the development of PINNs to solve for u as follows: one tries to find an approximate solution from a set of deep neural networks (of the same depth, same number of neurons on each hidden layer, and same activation functions on each layer) HNN, which is a minimizer of the following loss functional Loss(unn) = 1 NCL NCL X i=1 |(\u2202u \u2202t \u2212P(unn))(tCL i , xCL i )|2 + 1 NIC NIC X i=1 |unn(0, xIC i ) \u2212u0(xIC i )|2 + d X i=1 1 NBC NBC X j=1 |unn(tBC j , xBC j ) \u2212unn(tBC j , xBC j + Pei)|2 , \u2200unn \u2208HNN Here {(tCL, xCL)i}NCL i=1 \u2208(0, T]\u00d7\u2126are called collocation points, {(0, xIC)i}NIC i=1 \u2208{0}\u00d7 \u00af \u2126are the initial condition points, and {(tBC, xBC)i}NBC i=1 \u2208[0, T] \u00d7 \u2202\u2126are the boundary condition points. The minimizer, denoted as uNN, will an be approximate solution to (1). 2.1 Hard Constrains The major motivation for us to consider hard constrains transformation for PINNs is the possible ill-conditioning of the PDE solution map\u2019s dependence on IC and BC. Traditional numerical methods do not need to encounter this kind of difficulty, as the IC data is exactly satisfied in their solutions. PINNs, on the other hand, use L2-loss to fit the IC/BC and PDE residual data, causing the solutions to be highly sensitive to the goodness of fit of the IC in the training (as pointed out in McClenny and Braga-Neto (2020)). By moving the IC/BC data into the structure of PINNs, it reduces the ill-conditioning of the solutions. Therefore, We consider the following transformation \u02dc u(t, x) = \u03c8(t, x) + \u03d5(t, x)unn(t, x). Here the two functions \u03c8 and \u03d5 are both smooth function with the following properties \u03d5(0, x) = 0 for x \u2208\u00af \u2126 and \u03d5(t, x) = 0, for x \u2208\u2202\u2126; 3 \fand \u03c8(0, x) = u0(x) for x \u2208\u00af \u2126 and \u03c8(t, x) = 0, for x \u2208\u2202\u2126. For the Neumann and Robin type, a more complicated \u03c8 and \u03d5 have to be designed. For the periodic BC, we simply require \u03c8 and \u03d5 to be P-periodic. If we use such transformation, then the training for unn is changed, due to the fact that IC/BC can be built into the PDE loss, i.e. Loss(unn) = 1 NCL NCL X i=1 |(\u02dc ut \u2212P(\u02dc u))(tCL i , xCL i )|2, for \u02dc u = \u03c8 + \u03d5unn. We have reduced the kinds of losses in the training; however the information about IC and BC has then moved into the PDE residual loss through \u03c8 and \u03d5. The difficulty in reducing the new PDE residual loss has been increased. Hence, other training enhancement techniques can be used to greatly improve training. Periodic Neural Networks: even though we require \u03c8 and \u03d5 to be periodic, we still need to build the information of periodicity into unn, hence we consider the following composition unn(t, x) = fnn(v(t, x)), fnn is a neural network, and x \u2208R, and v(t, x) = \u0002 t 1 cos( 2\u03c0 P x) sin( 2\u03c0 P x) cos( 2\u03c0 P 2x) sin( 2\u03c0 P 2x) \u00b7 \u00b7 \u00b7 cos( 2\u03c0 P mx) sin( 2\u03c0 P mx) \u0003\u22a4, where m > 0 is a positive integer (another hyper-parameter). With this composition, unn will be automatically P-periodic (Dong & Ni, 2021). For higher dimensional physical x, similar transformation can be used. (write the 2D here). 2.2 Mini-batching and Other Techniques As we have mentioned in the previous section, although we have reduced the kinds of losses to one PDE residual loss, the information about IC and BC have been transferred into the new PDE residual loss. So we consider mini-batching in the training for decreasing the PDE residual loss. As pointed out in Wight and Zhao (2020), the mini-batching technique is similar to time-marching resampling. But with mini-batching, one do not consider an explicit time-grid. Similar training enhancement can be added, such as SA PINN McClenny and Braga-Neto (2020), RBA PINN Anagnostopoulos et al. (2024), xPINN Jagtap and Karniadakis (2020). 3 Numerical Experiments In this section, We will evaluate our proposed PINN scheme in the previous section on multiple prototypical time dependent PDEs with periodic boundary. First of all, we use a Latin hypercube sampling (LHS) strategy to sample the collocation points in the whole domain including the boundary. We next take a simple transformation as follows \u02dc u(t, x) = u0(x) \u2217exp(\u2212t) + t \u2217unn(t, x), (t, x) \u2208[0, T] \u00d7 \u00af \u2126, where \u03c8(t, x) = u0(x) and \u03d5(t, x) = t. Through the construction of the transformed u-network and the specification of appropriate loss function, we train our neural network using the generated points. Next, we utilize the trained model to approximate the solution to the partial differential equations (PDEs). To ascertain the accuracy of our results, we use Chebfun, a spectral-style system implemented in MATLAB for handling functions in an object-oriented manner. This allows us to obtain solutions with high accuracy against which we can rigorously compare the performance of our scheme. Given the data points {xi, ti}N i=1 with N the total number of points, we take relative L2 norm of the \u201dexact\u201d value u(xi, ti) at those points and the network output U(xi, ti) at those points to evaluate the accuracy of our trained model: E = qPN i=1 |U(xi, ti) \u2212u(xi, ti)|2 qPN i=1 |u(xi, ti)|2 . 3.1 Solving the Viscous Burger\u2019s Equation The viscous Burger\u2019s Equation is a fundamental partial differential equation and convection-diffusion equation used in fluid dynamics and nonlinear waves (Burgers, 1948; Whitham, 2011). For a given field u(x, t), and viscosity \u03bd, the general form of viscous Burgers\u2019 equation is: ut + uux = \u03bduxx , (x, t) \u2208[\u22121, 1] \u00d7 [0, \u221e) , u(x, 0) = u0(x) , \u22121 < x < 1 , u(1, t) = u(\u22121, t) = 0 , t > 0 . 4 \fThe parameters we used to train are in Table 1: # Co. Points # Layers # Neurons 16, 384 7 32 Table 1: PINN Params It trains with 50k Adam steps with learning rate at 5 \u00d7 10\u22123 first, and then uses the L-BFGS-B optimizer to fine-tune the neural network. The results are shown in Figure 1 and Figure 2: Figure 1: Exact solution of the 1D Viscous Burger\u2019s Equation with the corresponding network prediction and the absolute error difference. Figure 2: Solutions of 1D Viscous Burger\u2019s Equation. 3.2 Solving the Allen-Cahn Equation Allen-Cahn type PDE is a classical phase-field model, has been widely used to investigate the phenomena of phase separation (Bazant, 2017). The Allen-Cahn equation has numerous practical applications across various fields, such as material science (Allen & Cahn, 1979; Shen & Yang, 2010), biological systems (Hyman et al., 2014; Takatori & Brady, 2015), electro-chemical systems (Horstmann et al., 2013; Tian et al., 2015) etc. We first tested the one-dimensional Allen-Cahn Equation with periodic boundary conditions, as follows: ut \u2212\u03b31uxx + \u03b32u3 \u2212\u03b32u = 0, (t, x) \u2208(0, T) \u00d7 (a, b), u(0, x) = u0(x), x \u2208[a, b], u(t, a) = u(t, b), t \u2208[0, T], ux(t, a) = ux(t, b), t \u2208[0, T], (2) where \u03b31, \u03b32 > 0, T > 0, a < b are prescribed constants. As \u03b32 increases, the transition interface of the solutions is sharper, which makes it harder to solve the AC equation numerically. 5 \f3.2.1 Case I Therefore, we demonstrate the effectiveness of our scheme by testing on AC PDE with a large \u03b32: u0(x) = x2 cos(\u03c0x), T = 1, a = \u22121, b = 1, \u03b31 = 0.001, \u03b32 = 5. We train a PINN solution using the same parameters in Table 1. Figure 3 and ?? show the results: Figure 3: Case I: Exact solution of the 1D AC with the corresponding network prediction and the absolute error difference. Figure 4: Case I: Solutions of the AC equation \u03b32 = 5. Allen-Cahn Baseline PINN Re-sampling (Wight & Zhao, 2020) Our Approach Relative L2 9.90e-1 2.33e-2 9.16e-4 Relative L1 9.90e-1 6.20e-3 4.84e-4 L\u221enorm 9.96e-1 2.64e-1 1.43e-1 Table 2: Comparison of errors in the learned solutions of the Allen-Cahn equation using various PINN approaches Table 2 compares the errors among the three approaches: baseline PINN, re-sampling technique proposed by Wight and Zhao (2020) and our approach. Unfortunately, using the standard PINN approach alone, we were not able to learn the accurate solution for the Allen-Cahn equation, and capture the dynamics of equation. The relative error is almost equal to 1. Compared with the technique proposed by Wight and Zhao (2020), the error is much less and the accuracy is improved. 3.2.2 Case II Next, we explore how our enhanced PINN approach performs in handling scenarios with sharper moving interfaces. Specifically, we modify the initial conditions of the Allen-Cahn equation to introduce more oscillations, and vary 6 \fthe parameters to observe the method\u2019s effectiveness across different problem settings. Instead of Equation 2 in case I, we use the following equations: ut \u2212\u03b31uxx + \u03b32u3 \u2212\u03b32u = 0, (t, x) \u2208(0, 1) \u00d7 (\u22121, 1), u(0, x) = x2 sin(2\u03c0x), x \u2208[\u22121, 1], u(t, \u22121) = u(t, 1), t \u2208[0, 1], ux(t, \u22121) = ux(t, 1), t \u2208[0, 1], (3) where \u03b31 = 0.001, \u03b32 = 4. Figure 5 and 6 show the results: Figure 5: Case II: Exact solution of the 1D AC with the corresponding network prediction and the absolute error difference. Figure 6: Case II: Solutions of the AC equation \u03b32 = 4. 3.3 Solving the Cahn-Hilliard Equation Related to Allen-Cahn Equation, Cahn-Hilliard Equation also describes the process of phase separation, by which the two components of a binary fluid spontaneously separate and form domains pure in each component (Cahn & Hilliard, 1958; Kim et al., 2016; Lee et al., 2014; Miranville, 2017). It is defined as the following equation: ut = \u03f51(\u2212uxx \u2212\u03f52uxxxx + (u3)xx), (t, x) \u2208(0, T] \u00d7 (\u2212L, L), u(0, x) = u0(x), x \u2208[\u2212L, L], u(t, \u2212L) = u(t, L), t \u2208[0, T], (4) where \u03f51 = 10\u22122, \u03f52 = 10\u22124, T = 1, L = 1. We specify the initial condition as u0(x) = \u2212cos(2\u03c0x). This PDE has higher order derivatives and is known to be harder to solve than the Allen-Cahn equation. We train the neural network by using 7 layers, 128 neurons and 16,384 collection points with 50k steps. The results are shown in the following Figures 7 and Figure 8: 7 \fFigure 7: Exact solution of the 1D CH with the corresponding network prediction and the absolute error difference. Figure 8: Solutions of the CH equation. 3.4 Solving the Kuramoto-Sivashinsky equation Kuramoto\u2013Sivashinsky equation is a fourth-order nonlinear partial differential equation, known for its chaotic behavior (Kudryashov, 1990; Michelson, 1986), as follows: ut = \u2212uxx \u2212uxxxx \u2212uux, (t, x) \u2208(0, T] \u00d7 (a, b), u(0, x) = u0(x), x \u2208[a, b], u(t, a) = u(t, b), t \u2208[0, T], (5) where T = 20, a = 0, b = 32\u03c0, and u0(x) = cos x 16(1 + sin x\u22121 16 ). The parameters are the same with Table 1. The results are shown in Figure 9 and 10: Figure 9: Exact solution of the 1D KS with the corresponding network prediction and the absolute error difference. 8 \fFigure 10: Solutions of the KS equation. 3.5 Solving the Gray-Scott Equation Reaction and diffusion of chemical species can produce a variety of patterns (De Kepper et al., 1991; Nishiura & Ueyama, 1999), reminiscent of those often seen in nature. The Gray-Scott type system is one of classical mathematical models for chemical reactions (Gray & Scott, 1983, 1984; Liang, Jiang, Liu, Wang, & Zhang, 2022). The general irreversible GS equations describe such reactions: U + 2V \u2212 \u21923V, V \u2212 \u2192P. (6) This system is defined by two equations that describe the dynamics of two reacting substances: ut = \u03f51uxx + b(1 \u2212u) \u2212uv2, (t, x) \u2208(0, T] \u00d7 (\u2212L, L), vt = \u03f52vxx \u2212(b + k)v + uv2, u(0, x) = u0(x), v(0, x) = v0(x), \u2200x \u2208[\u2212L, L], u(t, \u2212L) = u(t, L), v(t, \u2212L) = v(t, L), \u2200t \u2208[0, T], j (7) where T = 20, L = 50, \u03f51 = 1, \u03f52 = 0.01 are diffusion rates, b = 0.02 is the \u201dfeeding rate\u201d that adds U, k = 0.0562 is the \u201dkilling rate\u201d that removes V . We set our initial conditions as: u0(x) = 1 \u2212sin(\u03c0(x \u221250)/100)4 2 , v0(x) = sin(\u03c0(x \u221250)/100)4 4 . The parameters that we used are the same with before. Figures 12 and ?? show the results: Figure 11: Solutions of the GS-u equation. 9 \fFigure 12: Solutions of the GS-v equation. Figure 13 and Figure14 show the results of exact solutions of the 1D GS Equations that we obtain using Chebfun, with the corresponding network predictions and the absolute error differences: Figure 13: Exact solution of the 1D GS-u Equation with the corresponding network prediction and the absolute error difference. Figure 14: Exact solution of the 1D GS-v Equation with the corresponding network prediction and the absolute error difference. 3.6 Solving the Belousov-Zhabotinsky equation A Belousov\u2013Zhabotinsky reaction is one of a class of reactions that serve as a classical example of non-equilibrium thermodynamics. It typically involves the oxidation of organic compounds by bromine in an acidic medium 10 \f(Cassani et al., 2021; Zhabotinsky, 2007). The system is as follows: ut = \u03f51uxx + u + v \u2212uv \u2212u2, vt = \u03f52vxx + w \u2212v \u2212uv, wt = \u03f51wxx + u \u2212w, (t, x) \u2208(0, T] \u00d7 [\u2212L, L] u(0, x) = u0(x), v(0, x) = v0(x), w(0, x) = w0(x), \u2200x \u2208[\u2212L, L] u(t, \u2212L) = u(t, L), v(t, \u2212L) = v(t, L), w(t, \u2212L) = w(t, L), \u2200t \u2208[0, T], (8) where T = 3, L = 1, \u03f51 = 10\u22125, \u03f52 = 2 \u00d7 10\u22125 are diffusion rates. We let the initial conditions be: u0(x) = exp(\u2212100(x + 0.5)2), v0(x) = exp(\u2212100x2), w0(x) = exp(\u2212100(x \u22120.5)2). The results are: Figure 15: Solutions of the BZ-u equation. Figure 16: Solutions of the BZ-v equation. 11 \fFigure 17: Solutions of the BZ-w equation. The comparison between the exact solutions of (u, v, w) equations with corresponding neural network predictions by our approach on the whole (x, t) domain are shown in Figures 18, 16 and 17: Figure 18: Exact solution of the 1D BZ-u Equation with the corresponding network prediction and the absolute error difference. Figure 19: Exact solution of the 1D BZ-v Equation with the corresponding network prediction and the absolute error difference. 3.7 Solving the Nonlinear Schroedinger equation In theoretical physics, nonlinear schroedinger equation is a nonlinear PDE, applicable to classical and quantum mechanics (Fibich, 2015; Kato, 1987; Kevrekidis et al., 2001). The dimensionless equation of the classical field is ut = iuxx + i|u|2u, (t, x) \u2208[0, 2] \u00d7 [\u2212\u03c0, \u03c0], u(0, x) = u0(x), x \u2208[\u2212\u03c0, \u03c0], u(t, \u2212\u03c0) = u(t, \u03c0), t \u2208[0, 2], (9) 12 \fFigure 20: Exact solution of the 1D BZ-u Equation with the corresponding network prediction and the absolute error difference. where we let u0(x) = 2 2 \u2212 \u221a 2 cos(x) \u22121. Using the same parameters and training step with before, we obtain the following results: Figure 21: Exact solution of the real part of 1D NLS with the corresponding network prediction and the absolute error difference. Figure 22: Real-part Solutions of the NLS equation. 13 \fFigure 23: Exact solution of the imaginary part of 1D NLS with the corresponding network prediction and the absolute error difference. Figure 24: Imaginary-part Solutions of the NLS equation. 4"
17
+ }
abs_9K/validation_abstract_short_2404.16248v1.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.16248v1",
3
+ "title": "URL: Universal Referential Knowledge Linking via Task-instructed Representation Compression",
4
+ "abstract": "Linking a claim to grounded references is a critical ability to fulfill human\ndemands for authentic and reliable information. Current studies are limited to\nspecific tasks like information retrieval or semantic matching, where the\nclaim-reference relationships are unique and fixed, while the referential\nknowledge linking (RKL) in real-world can be much more diverse and complex. In\nthis paper, we propose universal referential knowledge linking (URL), which\naims to resolve diversified referential knowledge linking tasks by one unified\nmodel. To this end, we propose a LLM-driven task-instructed representation\ncompression, as well as a multi-view learning approach, in order to effectively\nadapt the instruction following and semantic understanding abilities of LLMs to\nreferential knowledge linking. Furthermore, we also construct a new benchmark\nto evaluate ability of models on referential knowledge linking tasks across\ndifferent scenarios. Experiments demonstrate that universal RKL is challenging\nfor existing approaches, while the proposed framework can effectively resolve\nthe task across various scenarios, and therefore outperforms previous\napproaches by a large margin.",
5
+ "authors": "Zhuoqun Li, Hongyu Lin, Tianshu Wang, Boxi Cao, Yaojie Lu, Weixiang Zhou, Hao Wang, Zhenyu Zeng, Le Sun, Xianpei Han",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-04-24",
8
+ "primary_cat": "cs.CL",
9
+ "cats": [
10
+ "cs.CL",
11
+ "cs.AI"
12
+ ],
13
+ "label": "Original Paper",
14
+ "paper_cat": "LLM Fairness",
15
+ "gt": "Linking a claim to grounded references is a critical ability to fulfill human\ndemands for authentic and reliable information. Current studies are limited to\nspecific tasks like information retrieval or semantic matching, where the\nclaim-reference relationships are unique and fixed, while the referential\nknowledge linking (RKL) in real-world can be much more diverse and complex. In\nthis paper, we propose universal referential knowledge linking (URL), which\naims to resolve diversified referential knowledge linking tasks by one unified\nmodel. To this end, we propose a LLM-driven task-instructed representation\ncompression, as well as a multi-view learning approach, in order to effectively\nadapt the instruction following and semantic understanding abilities of LLMs to\nreferential knowledge linking. Furthermore, we also construct a new benchmark\nto evaluate ability of models on referential knowledge linking tasks across\ndifferent scenarios. Experiments demonstrate that universal RKL is challenging\nfor existing approaches, while the proposed framework can effectively resolve\nthe task across various scenarios, and therefore outperforms previous\napproaches by a large margin.",
16
+ "main_content": "Introduction Access to reliable, authentic, and well-founded information is a fundamental human necessity (Clifford, 1877; Cole, 2011). In recent years, with the rise of AI-generated content (AIGC), there has been an increasing demand for the verification of information authenticity and the identification of corresponding references (Lewis et al., 2020; Cao et al., 2023; Zhao et al., 2023). Within this context, linking a claim to its grounded references, a task we refer to as referential knowledge linking (RKL), plays an indispensable role. Given a claim, the objective of referential knowledge linking is to associate it with relevant references within trustworthy information sources, thereby facilitating Query Why the car brake pads make a noise ? Information Retrieval Document Braking clattering is due to small stone in pads. Sentence 1 A man with a jersey is dunking the ball in game. Semantic Matching Sentence 2 The ball is being dunked by a man with a jersey. Government Policy The country will develop wind power generation. Company Profile Our company is engaged in coal mining and filter. Legal Case The two defendants have yet to repay a penny. Legal Provision The valid loan contract needs in written form. Patient Symptom I have some symptoms of sneezing and feel bad. Drug Description This product can treat allergic rhinitis. Training Objective Our goal is to cultivate computer engineers. Course Introduction This course introduces the matrix theory. (a) Conventional approaches mainly focus on a single task. (b) URL aims to universally address RKL tasks on versatile semantics. U R L Affecting Confirming Treating Supporting Figure 1: Compared to conventional approaches focus on a single task, URL aims to universally address RKL tasks on versatile semantics with deep knowledge. the verification of related information (Yue et al., 2023; Huang et al., 2023; Gao et al., 2023). RKL is crucial for affirming the accuracy and validity of information, ensuring the reliability and legality of AIGC-produced content, and the efficient organization and management of information. Currently, the work on referential knowledge linking is often confined to specific tasks and contexts. As illustrated in Figure 1, information retrieval (Hambarde and Proen\u00e7a, 2023; Muennighoff et al., 2023; Xiao et al., 2023) focuses on locating documents that contain answers to a query, primarily concentrating on the \u201ccontains-answer\u201d type of relationship. Semantic matching, on the other hand, aims to identify pairs of text segments that share the same semantics (Cer et al., 2017; Chandrasekaran and Mago, 2021), essentially looking for segments that are \u201csemantically equivalent\u201d. However, the scenarios for referential knowledge linking in reality are far more diverse. Depending on the particular claim and reference, the objectives of linking can vary significantly. For instance, arXiv:2404.16248v1 [cs.CL] 24 Apr 2024 \fTraining Corpus Construction Why car brake pads make noise? Compress the answer about car, use it to find relevant questions . Generally we press lock button. A small stone is in braking area. Negative Reference Positive Reference Claim Compress the answer about car, use it to find relevant questions . Compress the question about car, use it to link to relevant answers . U R L U R L QA Data Why car brake pads make noise? Claim Contrastive Learning Generative Reconstruction Multi-view URL Learning Task-aware Instruction Transformation A small stone is in braking area. Positive Reference Figure 2: Illustration of training corpus construction and multi-view URL learning. Based on QA data, we set the question as claim and answer as reference, then annotate instructions that describe the field of data and the purpose of representation. For learning, contrastive learning is on embeddings of claims and references, generative reconstruction is to force the model generating positive reference based on claim embedding and vice versa. given a legal case, one might aim to link it to corresponding legal provisions to find the basis of the verdict. Conversely, given a patient symptom, it could be linked to relevant drugs, treatment plans, or possible cause, depending on the specific need. Compared to the previous focus on specific contexts such as information retrieval or semantic matching, it is challenging to universally solve referential knowledge linking in diverse real-world scenarios. Firstly, although all under the paradigm of RKL, the target semantics of RKL vary across different contexts, i.e., whether a claim and a reference constitute a linking pair may differ under different RKL contexts. For example, given a legal case and a provision, the decision on whether they should be linked may vary drastically under different relational contexts like \u201capplying for adults\u201d or \u201capplying for minors\u201d. Secondly, unlike information retrieval and semantic matching, which often only require superficial semantic understanding (e.g., word matching features and shallow semantic representations), many RKL tasks necessitate deep semantic comprehension and reasoning. Therefore, RKL demands models with robust semantic understanding and, often potentially, reasoning capabilities. Finally, given the typically large size of reference databases, it is impractical to directly perform complex, deep semantic interactions and matching across all claim-reference pairs. Thus, constructing and implementing an efficient, highly adaptable, and semantically capable general RKL model poses a significant challenge. In this paper, we introduce unified referential linking (URL), a universal framework for linking claims to references on versatile semantics. Specifically, URL leverages the semantic comprehension and instruction-following capabilities of large language models (LLMs) to facilitate universal referential knowledge linking across diverse contexts. However, applying LLMs to RKL poses several challenges due to differences in training objectives and usage modalities. Firstly, the high computational cost of large language models makes direct pair-wise comparison for claim-reference decisionmaking highly inefficient. Secondly, since large language models are trained in a language model paradigm, directly employing them for universal referential knowledge linking may lead to mismatches in patterns, thereby significantly impacting the performance of LLMs in general RKL tasks. Addressing these key challenges is crucial for harnessing the capabilities of large language models for referential knowledge linking. To this end, URL introduces a LLM-driven taskinstructed representation compression mechanism, which adaptively integrates task-specific information with claim/reference and converts them into vector representations. This approach allows the representations of claims and references to be efficiently adapted across different task scenarios. Levering these vectorized representations, the linking between claims and references can be conducted by directly calculating the association between their task-aware representations, thereby significantly reducing the need for complex computations with large models and enhancing the efficiency of RKL. To facilitate this, we propose a parameter-efficient, multi-view learning algorithm that enables joint training of the large models in both generation and linking modes under the constraint of only observing compressed representations. As illustrated in Figure 2, this approach can \feffectively learn the compressed vector representation by shifting the mode of large language models from context-aware generation to compressed representation-aware generation and linking. Moreover, to train a generalizable and universal RKL representation model effectively, we start with existing question answering (QA) corpus. By transforming QA data from various domains into diverse claim-reference datasets under different linking relationships, we align the model from a language generation mode to a representation compression mode, thereby learning better task-aware RKL representation models. To validate the effectiveness of universal referential knowledge linking, we introduce a new benchmark\u2014URLBench. The primary objective of URLBench is to construct an evaluation set that covers multiple scenarios of referential knowledge linking, thereby assessing the ability of model in generalized referential knowledge linking. Specifically, URLBench encompasses four distinct domains: finance, law, medicine, and education. Within these domains, URLBench evaluates the model capability to link claims and references under various semantic conditions, which primarily includes linking government policy to company profile, legal case to legal provision, patient symptom to drug description, and training objective to course introduction. Experimental results on URLBench demonstrate that URL is an effective approach for achieving universal RKL. Its performance not only surpasses previous models trained on large-scale retrieval and semantic matching datasets, but also significantly outperforms proprietary large-modelbased embedding models like OpenAI Text Embedding. This validates the efficacy of the approach proposed in this paper for RKL tasks1. The main contributions of this paper are: \u2022 We define the task of universal referential knowledge linking, which extends beyond considering only a few specific relationships to achieve generalized RKL abilities across diverse scenarios. \u2022 We propose task-instructed representation compression, a novel framework adapting LLMs to RKL tasks. Meanwhile, we propose a new method based on multi-view RKL learning, which can effectively finetune LLMs by existing QA data. 1Our code and data are openly available at https:// github.com/Li-Z-Q/URL \u2022 We construct URLBench, a new benchmark across versatile knowledge-rich tasks in various fields, which can effectively evaluate the ability of models in universal referential knowledge linking. 2 Related Work 2.1 Semantic Matching Semantic matching is to measure the semantic similarity between two blocks of text (Chandrasekaran and Mago, 2021). This is a traditional and fundamental task in natural language processing, containing datasets across many domains and language (Agirre et al., 2012, 2013, 2014, 2015, 2016; Marelli et al., 2014; Cer et al., 2017). However, the relationship in this task is single and static, which is merely about shallow semantic of two sentences, judging whether that \u201chave similar meaning\u201d. 2.2 Information Retrieval Information retrieval (IR) is the process of searching and returning relevant documents for a query from a collection (Hambarde and Proen\u00e7a, 2023; Muennighoff et al., 2023). IR contains datasets in various fields and task formats such as questionanswer, title-passage, query-document (Thakur et al., 2021; Kwiatkowski et al., 2019; Cohan et al., 2020; Xiao et al., 2023; Thorne et al., 2018). However, the essence of all the IR tasks is identical, which is judging if the claim and reference \u201ccontain similar information\u201d. In other words, the relationship in IR is still lacked of universality. 2.3 Sentence Embedding Early embedding methods are based on BERT-style models (Reimers and Gurevych, 2019). Then some works use contrastive learning and get improvement (Gao et al., 2021; Izacard et al., 2021). Recent common methods are using two-stage contrastive learning by large scale corpus (Wang et al., 2022; Xiao et al., 2023; Li et al., 2023b), based on special trained RetroMAE (Xiao et al., 2022). And some works also use task instructions on BERTstyle models (Su et al., 2023). Recently, some works use LLMs to generate sentence embeddings by instruction (Jiang et al., 2023), and contrastive learning (Ma et al., 2023; Zhang et al., 2023). And embeddings generated by LLMs can be used to do retrieval (Wang et al., 2024; Li et al., 2023a), or compression (Gupta et al., 2023; Mu et al., 2023; Chevalier et al., 2023). \fThe important distinction between this work and previous LLM embeddings is that URL focus on addressing versatile RKL tasks from a unified perspective, which receives less attention before. Additionally, beyond contrastive learning, this work proposes a multi-view learning approach. 3 Universal RKL via Task-instructed Representation Compression Universally addressing RKL tasks poses significant challenges because of versatile linking relationships and deep semantic of claim-reference pairs. Firstly, the relationship between claims and references is flexible across different contexts, requiring varied semantic abilities for linking. Secondly, the relationship involves deep semantic correlations and even some reasoning, demanding deep knowledge and reasoning capabilities from the model. Moreover, handling large-scale reference datasets directly by complex semantic processing on each claim-reference pair causes large time costs. In this paper, we propose a novel framework for universal RKL tasks based on LLMs with powerful knowledge, semantic understanding and universality. But applying LLMs presents several challenges due to computational cost and original training objective. Firstly, direct pairwise comparison by LLMs is inefficient, exacerbating efficiency issues with large-scale reference databases. Secondly, since LLMs are trained as language models, directly applying to RKL encounters pattern mismatching. To tackle mentioned challenges, URL employs a task-instructed representation compression mechanism driven by LLMs. The method dynamically incorporates task-specific details with claim/reference data, generating vector representations. To facilitate LLMs for this, this paper introduces a multi-view learning algorithm to enable simultaneous training in both generation and linking modes, on only compressed representations. Specifically, by LLM-driven task-instructed representation compression, URL combines task information with claims/references and gets taskinstructed embeddings, achieving efficient adaptation across different scenarios. In finetuning, multi-view learning injects knowledge of LLMs into representations and aligns representations with claim-reference embedding-similarity paradigms. To construct training data, URL leverages existing question answering data, transforming QA data from different domains into claim-reference data. This data construction method is a convenient way to simulate real versatile RKL tasks. 3.1 Task-instructed Compression for RKL Applying LLMs to practical RKL tasks faces two major challenges: adaptability and efficiency. In adaptability, linking from claim to reference requires diverse semantic abilities depending on the context or application, necessitating a model capable of adapting to various contexts or tasks. In efficiency, there is large computation cost because of the low operating speed of LLMs and possible large scale of reference databases, requiring some efficient linking better than direct comparison. In this paper, URL addresses mentioned challenges by adding task-aware instructions to claims and references, enabling the model to generate taskinstructed representations. By computing vectorized representations similarity, URL achieves efficient and adaptive linking for versatile RKL tasks. Specifically, task-instructed compression compresses the claim/reference, as well as the instruction of target task to be performed into the same vectorized representation, thereby constructing a task oriented vectorized representation: H = LLM(xs, xins, xsuffix) es = Pooling(Hsuffix) where xs is the claim or reference, xins is the taskaware instruction adapted with the claim or reference, xsuffix means some suffix tokens, H is last-layer hidden states of all tokens and Hsuffix is that of suffix tokens, es is the output embedding. In summary, by calculating vector similarity of task-instructed representations of the claim and reference, URL gets the linking score of claimreference pairs, and address RKL tasks efficiently and universally without complex computation. 3.2 Multi-view URL Learning Under the aforementioned URL framework, a core issue is how to effectively learn task-instructed representation for versatile RKL tasks. Given that LLMs are primarily designed for language generation tasks, directly applying representations from LLMs to RKL tasks is challenging. And solely employing claim-reference pairs contrastive learning presents damaging the original knowledge and reasoning capabilities obtained during pre-training. In this paper, we propose a novel multi-view learning approach that facilitates simultaneous gener\fative reconstruction and contrastive learning processes, enabling large models to swiftly and costeffectively adapt to URL norms while preserving existing knowledge and reasoning abilities. Specifically, multi-view URL learning comprises two components: generative reconstruction and contrastive learning. The generative reconstruction employs claim embeddings to generate relevant references and reference embeddings to generate relevant claims, enabling the injection of model knowledge into compressed representations to better address reasoning-style linking tasks in RKL. The second component, contrastive learning, minimizes the distance between related claim and reference representations while maximizing the distance between unrelated ones, enabling model-generated representations to align with the embedding-similarity paradigm. Generative Reconstruction. By generative loss based on the claim representation with relevant reference, and reference representation with relevant claim, generative reconstruction injects knowledge of the LLM into the compressed representation: L1 = X D \u2212log p(xpos|ec, xp) where D means training data, ec is the claim embedding, xpos is the positive reference, xp is the prompt used to guide the LLM to generate the relevant reference. On another hand, reconstructing claim based on reference embedding has symmetric formula as above. Through generative reconstruction, the representation contains great knowledge and deep understanding of the input sentence because the LLM can generate relevant contents merely based on the compressed representation rather than original complete sentences. Contrastive Learning. By minimizing the distance between representations of the relevant claim and reference and maximizing that of the irrelevant claim and reference, contrastive learning directly train the LLM for suiting the claim-reference embedding-similarity pattern for URL: L2 = X D \u2212log e\u27e8ec,epos\u27e9/\u03c4 e\u27e8ec,epos\u27e9/\u03c4 + P eneg e\u27e8ec,eneg\u27e9/\u03c4 where epos is embedding of the positive reference, eneg is for the negative reference, and \u03c4 is the temperature parameter. Through contrastive learning, the LLM are trained to efficiently address RKL tasks by embedding-similarity method. Multi-view Learning. By composing the loss of generative reconstruction and contrastive learning, multi-view URL learning integrates the advantages of two training methods, the LLM can be well aligned for versatile knowledge-rich RKL tasks: Ltotal = \u03b1L1 + (1 \u2212\u03b1)L2 where \u03b1 is a parameter. In actual training, URL uses symmetric bi-direct loss as some recent works (Xiao et al., 2023). Respectively, for generative reconstruction, URL also calculates loss by generating the claim based on embedding of the correct reference, for contrastive learning, URL also calculates loss among embeddings of one reference, the relevant claim, and irrelevant claims. In summary, multi-view URL learning ensures task-instructed representations encompass knowledge of the LLM, and suit for the claim-reference embedding-similarity pattern. The total training process can effectively align the LLM for universally addressing versatile RKL tasks. 3.3 Constructing URL Training Data via QA Corpus Transformation In order to support the multi-view URL learning mentioned above, a core issue is to construct training data for versatile RKL tasks. This presents a crucial challenge as existing works primarily focus on information retrieval and semantic matching, both of which entail singular linking relationships, lacking diverse training data for versatile linking tasks. In this paper, we propose constructing a URL training corpus by transforming QA data. By annotating instructions for ordinary question-answer data according to the domain of data, this construction method utilizes versatile domain data to simulate versatile tasks in RKL. Specifically, for 1000 question-answer pairs selected from mMARCO (Bonifacio et al., 2021), we manually categorize data into 40 domains, annotate instructions for each domain, and set the question as claim and the answer as reference. As illustrated in Figure 2, each data includes a claim, a positive reference, some negative references by random sampling, and two simulating task-aware instructions. In addition, this training dataset has versions for both Chinese and English language. In summary, the method uses heterogeneous domains to simulate versatile relationships of RKL. This is an efficient alternative solution in the situation absenting real versatile training data for RKL. \fDomain Application Relationship Claim Reference Content Number Length Content Number Length Finance Stock Decision Affecting Government Policy 1000 157 252 Company Profile 709 1026 922 Law Legal Judgement Confirming Legal Case 1000 236 390 Legal Provision 3627 56 103 Medicine Medical Prescription Treating Patient Symptom 750 80 148 Drug Description 1000 36 70 Education Course Planning Supporting Training Objective 133 90 145 Course Introduction 787 115 153 Table 1: Detailed statistics of the benchmark. Length is the average token number of sentences by LLM tokenizers, the left value is for Chinese version and the right is for English version. 4 URLBench: Benchmarking Universal Referential Knowledge Linking Currently, RKL benchmarks primarily focus on two specific tasks: semantic matching and information retrieval. The former emphasizes \u201chaving similar semantics\u201d, while the latter focuses on \u201ccontaining similar information\u201d. However, RKL tasks are versatile and with challenging knowledge-rich relationships in real-world applications, there is a lack of a benchmark that covers versatile RKL tasks and reflects complex deep linking relationships, posing a significant obstacle to evaluating unified models. In this paper, we propose a new benchmark that encompasses various RKL tasks across multiple domains and real applications. The benchmark can greatly reflect the diversity and knowledge-rich challenge of RKL tasks. Specifically, by focusing on four real-world applications including stock decision, legal judgement, medical prescription and course planning, URLBench collects data from web or existing datasets to create four evaluation tasks: linking government policies and company profiles, legal cases and legal provisions, patient symptoms and drug descriptions, and training objectives and course introductions. Focusing on stock decision, URLBench contains linking from government policies to companies that can be affected, constructed by transforming an existing task (Wang et al., 2023) to policy-company linking format. Focusing on legal judgement, URLBench contains linking from legal cases to provisions that can confirm the case, constructed by transforming and extending an existing classification task (Xiao et al., 2021) referring to web2. Focusing on medical prescription, URLBench contains linking from patient symptoms to drugs that can treat the symptom, constructed by transforming and extending an existing classification task (He et al., 2022) referring to web3. Focusing on course planning, URLBench contains link2http://www.law-lib.com/ 3https://zyp.yilianmeiti.com ing from training objectives to courses that can support the objective. This task is constructed based on a university enrollment handbook4. Clear statistics are shown in Table 1, the scale of the benchmark can ensure experiments quick and effective, and the length of datas is suitable for most models. Note that these datasets are originally mainly in Chinese language, we do translation by gpt-3.5-turbo5 to get English version. We then do some filter and checking to ensure the quality. 5 Experiments 5.1 Experimental Settings We choose LLAMA-2-7B-Chat (Touvron et al., 2023) as the base model for English tasks, and Baichuan-2-7B-Chat (Yang et al., 2023) for Chinese tasks. We finetune LLMs by the 1000 training data by LoRA method (Hu et al., 2022) in multiview learning, setting lora_r as 8, lora_alpha as 16 and lora_dropout as 0.05. Respectively, we set lora_target as \u201cW_pack\u201d for Baichuan model and \u201cq_proj v_proj\u201d for LLAMA model. Thanks to these settings, we finetune 7B-size LLMs on one A-100 80G GPU. The total finetuning process has 62 training steps and needs about 20 minutes. We choose NDCG (Wang et al., 2013) and MAP (Carterette and Voorhees, 2011) as metrics in evaluating. And we utilize the Python interface of the official TREC evaluation tool (Gysel and de Rijke, 2018) to ensure the reliability of results. 5.2 Baselines Referring to MTEB leader board6, we select some top-ranking and common used models as baseline, including a traditional sparse retriever BM25 (Robertson et al., 2009), four powerful closed source API, text-embedding-ada002 and text-embedding-3-large7, baichuan-text4https://dean.pku.edu.cn/web/download.php 5https://platform.openai.com/docs/guides/text-generation 6https://huggingface.co/spaces/mteb/leaderboard 7https://platform.openai.com/docs/guides/embeddings \fMethod Policy-Company Case-Provision Symptom-Drug Objective-Course NDCG MAP NDCG MAP NDCG MAP NDCG MAP @10 @20 @10 @20 @10 @20 @10 @20 @10 @20 @10 @20 @10 @20 @10 @20 English Evaluation BM25 36.3 39.3 27.3 28.7 2.9 3.8 1.5 1.9 4.6 6.4 2.7 3.2 22.0 24.9 11.1 13.1 Voyage-lite-02-instruct 43.9 47.5 34.0 35.9 12.8 14.7 6.7 7.8 10.7 12.8 7.0 7.6 38.0 41.0 22.6 25.6 Text-embedding-ada-002 46.7 50.3 36.7 38.7 9.3 11.9 6.5 7.9 11.1 13.5 7.3 8.1 38.7 42.5 23.7 27.4 Text-embedding-3-large 49.3 53.0 39.3 41.3 20.1 21.0 14.2 14.4 10.2 12.7 6.1 6.8 44.3 48.0 28.0 32.2 E5-7B (Wang et al., 2024) 41.8 45.7 32.5 34.6 18.5 20.2 12.7 13.7 11.9 15.1 7.2 8.1 39.1 42.7 23.2 26.7 UAE (Li and Li, 2023) 46.6 50.2 36.4 38.3 5.9 7.5 3.1 4.0 8.4 11.0 5.2 6.0 42.1 46.2 26.8 30.6 BGE (Xiao et al., 2023) 43.6 47.7 33.8 35.8 9.5 11.2 5.8 6.6 8.2 10.0 5.1 5.6 39.3 43.2 24.2 27.7 GTE (Li et al., 2023b) 46.4 50.0 36.4 38.2 14.7 16.6 10.2 11.4 9.4 12.2 6.0 6.8 42.1 45.9 26.2 30.0 E5 (Wang et al., 2022) 38.8 42.6 29.6 31.4 7.4 8.5 5.2 5.9 6.4 8.7 4.0 4.5 34.7 38.9 21.0 24.3 INSTRUCTOR (Su et al., 2023) 45.5 49.6 35.6 37.8 17.5 19.1 12.2 12.6 10.0 13.0 6.1 7.0 37.3 42.2 22.2 26.2 URL (ours) 47.1 51.0 37.5 39.7 29.3 30.4 20.2 21.3 13.8 16.1 9.7 10.4 48.2 53.4 31.1 37.4 Chinese Evaluation BM25 23.7 26.3 17.4 18.4 10.2 11.1 8.0 8.3 5.5 7.1 3.4 3.9 18.7 20.9 10.4 11.7 Baichuan-text-embedding 26.6 30.5 18.8 20.4 25.0 26.9 16.9 17.5 10.3 12.6 6.7 7.3 16.0 17.5 7.2 8.2 Text-embedding-ada-002 47.3 51.3 37.2 39.4 17.5 19.9 10.5 11.2 7.0 9.1 4.3 4.8 34.7 38.4 20.7 23.8 Text-embedding-3-large 45.8 49.6 35.7 37.7 24.2 26.6 16.1 16.9 10.2 13.3 6.0 6.9 42.8 46.4 27.1 31.1 E5-7B (Wang et al., 2024) 37.1 41.2 27.3 29.3 16.7 18.6 10.3 10.7 10.6 13.8 6.8 7.7 40.3 43.6 25.0 28.3 GTE (Li et al., 2023b) 32.9 36.7 24.5 26.2 7.7 9.1 4.3 4.6 10.2 13.6 6.3 7.2 40.3 43.6 25.2 28.5 BGE (Xiao et al., 2023) 38.7 42.8 29.2 31.2 24.3 26.5 16.4 17.1 11.6 14.1 7.1 7.8 38.3 41.2 22.5 25.6 URL (ours) 49.4 53.0 39.3 41.5 31.0 33.1 21.1 21.9 14.7 17.2 9.8 10.5 50.5 55.1 32.9 38.9 Table 2: Main experiments in URLBench. Best/second-best performing score in each column is highlighted with bold/underline. It shows that URL is with better performance and universality than baselines. Method Policy-C. Case-P. Symptom-D. Objective-C. URL (ours) 47.1 29.3 13.8 48.2 Further Finetuning BERT-style Models BGE (Xiao et al., 2023) 36.7\u2193 7.8\u2193 7.8\u2193 40.9\u2191 GTE (Li et al., 2023b) 35.6\u2193 12.1\u2193 7.1\u2193 42.6\u2191 Using Task-aware Instructions on API Text-embedding-ada-002 36.9\u2193 7.8\u2193 10.1\u2193 35.6\u2193 Text-embedding-3-large 35.0\u2193 19.6\u2193 11.4\u2191 42.4\u2193 Table 3: NDCG@10 scores for further finetuning BERTstyle models by our training data and using task-aware instructions on powerful API. It shows some fluctuations, yet still significantly under-performs URL. embedding8, and voyage-lite-02-instruct9, some open source embedding models trained by large scale retrieval datas, uae-large-v1 (Li and Li, 2023), gte-large and gte-large-zh (Li et al., 2023b), bgelarge-en-v1.5 and bge-large-zh-v1.5 (Xiao et al., 2023), e5-large-v2 (Wang et al., 2022), instructorxl (Su et al., 2023). Additionally, we also evaluate e5-mistral-7b-instruct (Wang et al., 2024), which is a LLM embedder trained by contrastive learning and expensive high-quality multi-language datas. 5.3 Overall Results In order to validate the performance of URL on versatile RKL tasks and illustrate the necessity of URL, experiments are conducted based on URLBench from three perspectives, including compar8https://platform.baichuan-ai.com/docs/text-Embedding 9https://docs.voyageai.com/embeddings/ ing performance of URL and baselines, further finetuning BERT-style models by our 1000 training data, and using task-aware instructions on API. Experiments show that URL is universal and accurate, simple finetuning on BERT-style models and direct adding instructions on API are not good solutions. Firstly, by comparing the performance of open source embedding models, powerful closed-source API, and URL on the benchmark, as shown in Table 2, results demonstrate that although some baseline models achieve similar performance as URL on the certain dataset, none of them can consistently perform well across all the versatile tasks. The conclusion is that URL can perform high performance and great universality for RKL tasks. Secondly, by observing performance of original BERT-style models trained further on our training data, as shown in Table 3, it shows some performance fluctuations, but BERT-style models are surely not enough to address universal RKL as URL. Conclusion is that BERT-style models cannot achieve same level of universal high performance as URL with only 1000 training data samples. Finally, by observing the performance of API with task-aware instructions, as shown in Table 3, scores of both text-embedding-ada-002 and textembedding-3-large become worse in most tasks when directly using task-aware instructions on it. The conclusion is that directly using API cannot achieve good and universal performance. \fMethod Components Policy-Company Case-Provision Symptom-Drug Objective-Course Task-aware Instruction Generative Contrastive NDCG MAP NDCG MAP NDCG MAP NDCG MAP URL (ours) \u2713 \u2713 \u2713 \u2713 47.1 37.5 29.3 20.2 13.8 9.7 48.2 31.1 Ablating Task-aware Instruction w/o Instruction \u2717 \u2717 \u2713 \u2713 37.7 28.4 23.1 15.3 5.7 3.1 24.6 13.0 w/o Task-aware Instruction \u2717 \u2713 \u2713 \u2713 48.4 38.8 29.7 19.7 11.7 8.1 40.0 24.5 Ablating Multi-view Learning w/o Learning \u2713 \u2713 \u2717 \u2717 19.3 13.1 4.5 2.9 5.3 3.6 28.1 16.4 w/o Generative Reconstruction \u2713 \u2713 \u2717 \u2713 46.1 36.6 28.2 19.7 12.7 8.9 46.4 29.1 Table 4: NDCG@10 and MAP@10 results of ablations. It shows that task-aware instructions and multi-view learning are great helpful for addressing RKL tasks universally and effectively. In summary, through the aforementioned three perspectives of experimentation, the results show that URL is a reliable unified solution, and the framework is valuable and necessary for the development of RKL area because existing BERT-style models and powerful closed API cannot achieve performance close to URL through simple further training or task instructions. 5.4 Ablations for Task-aware Instruction and Multi-view Learning Note that task-aware instruction and multi-view learning are two important modules. To validate their impact for URL framework, we conduct two types of ablation experiments about instructions and learning, results are shown in Table 4. Firstly, by observing performance when no instructions are used and when task-aware instructions are not employed, with only a fixed instruction, it shows that using a single instruction is better than using none at all, but clearly not as universal as task-aware instructions. Conclusion is instructions significantly affect performance, and task-aware instruction is with important effect in URL. Secondly, by comparing performance of LLM without training and LLM trained only via contrastive learning, it shows that raw LLMs perform badly, and multi-view learning shows better performance beyond contrastive learning. The conclusion is that original LLMs need training to apply to RKL tasks, and multi-view learning is a more effective training approach than contrastive learning. In summary, task-aware instructions and multiview learning show significant effect in URL framework, these two components are helpful to align LLMs with better ability for versatile RKL tasks. 5.5 Comparing URL and Conventional Models on Some Cases To further investigate why URL performs better than conventional models, we analyze some claimClaim Knowledgeable Reference PolicyCompany Establish a number of Internet of Things technology laboratories ... Company mainly engaged in the research of MEMS sensors ... ObjectiveCourse This major focuses on systematic mastery of robot engineering ... This course is to introduce the feedback control systems ... Table 5: BERT-style models fail on these cases because linking is versatile and knowledgeable, rather than with fixed and simple semantic similarity. URL can handle correctly due to powerful knowledge and adaptability. reference pairs that URL deals right but BERT-style models do not. And we find that URL is better mainly because of greater ability for knowledgerich and versatile cases. As shown in Table 5, the course about \u201cfeedback control\u201d can support objective about \u201crobot engineering\u201d, the company about \u201cMEMS sensors\u201d is affected by policy about \u201cInternet of Things\u201d. These versatile cases are with deep knowledge rather than merely fixed superficial semantic correlation, thus BERT-style models are easy to fail. But URL can handle correctly due to powerful adaptability and knowledgeable semantic understanding ability, further improving multi-view learning is an effective method to align LLMs for RKL. 6"
17
+ }
abs_9K/validation_abstract_short_2404.16251v2.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.16251v2",
3
+ "title": "Investigating the prompt leakage effect and black-box defenses for multi-turn LLM interactions",
4
+ "abstract": "Prompt leakage in large language models (LLMs) poses a significant security\nand privacy threat, particularly in retrieval-augmented generation (RAG)\nsystems. However, leakage in multi-turn LLM interactions along with mitigation\nstrategies has not been studied in a standardized manner. This paper\ninvestigates LLM vulnerabilities against prompt leakage across 4 diverse\ndomains and 10 closed- and open-source LLMs. Our unique multi-turn threat model\nleverages the LLM's sycophancy effect and our analysis dissects task\ninstruction and knowledge leakage in the LLM response. In a multi-turn setting,\nour threat model elevates the average attack success rate (ASR) to 86.2%,\nincluding a 99% leakage with GPT-4 and claude-1.3. We find that some black-box\nLLMs like Gemini show variable susceptibility to leakage across domains - they\nare more likely to leak contextual knowledge in the news domain compared to the\nmedical domain. Our experiments measure specific effects of 6 black-box defense\nstrategies, including a query-rewriter in the RAG scenario. Our proposed\nmulti-tier combination of defenses still has an ASR of 5.3% for black-box LLMs,\nindicating room for enhancement and future direction for LLM security research.",
5
+ "authors": "Divyansh Agarwal, Alexander R. Fabbri, Philippe Laban, Ben Risher, Shafiq Joty, Caiming Xiong, Chien-Sheng Wu",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-04-26",
8
+ "primary_cat": "cs.CR",
9
+ "cats": [
10
+ "cs.CR",
11
+ "cs.AI",
12
+ "cs.CL"
13
+ ],
14
+ "label": "Original Paper",
15
+ "paper_cat": "Retrieval AND Augmented AND Generation AND RAG",
16
+ "gt": "Prompt leakage in large language models (LLMs) poses a significant security\nand privacy threat, particularly in retrieval-augmented generation (RAG)\nsystems. However, leakage in multi-turn LLM interactions along with mitigation\nstrategies has not been studied in a standardized manner. This paper\ninvestigates LLM vulnerabilities against prompt leakage across 4 diverse\ndomains and 10 closed- and open-source LLMs. Our unique multi-turn threat model\nleverages the LLM's sycophancy effect and our analysis dissects task\ninstruction and knowledge leakage in the LLM response. In a multi-turn setting,\nour threat model elevates the average attack success rate (ASR) to 86.2%,\nincluding a 99% leakage with GPT-4 and claude-1.3. We find that some black-box\nLLMs like Gemini show variable susceptibility to leakage across domains - they\nare more likely to leak contextual knowledge in the news domain compared to the\nmedical domain. Our experiments measure specific effects of 6 black-box defense\nstrategies, including a query-rewriter in the RAG scenario. Our proposed\nmulti-tier combination of defenses still has an ASR of 5.3% for black-box LLMs,\nindicating room for enhancement and future direction for LLM security research.",
17
+ "main_content": "Introduction Prompt leakage is an injection attack against LLMs with the objective of revealing sensitive information from the LLM prompt (Perez & Ribeiro, 2022; Carlini et al., 2021; Zhang et al., 2024a). Real-world LLM-integrated applications have been shown to be vulnerable to carefully crafted prompt leakage attacks (Yang et al., 2024; Sha & Zhang, 2024; Greshake et al., 2023) mainly because their safety training con\ufb02icts with the instruction following objective (Zhang et al., 2023). Vulnerability to prompt leakage can lead to the exposure of system IP to a malicious entity, including the task instructions, sensitive contextual knowledge prepended in the prompt (Geiping et al., 2024), as well as style/format guidelines causing reputational harm and data theft. For agent-based Retrieval-Augmented Generation (RAG) systems, a highly practical scenario in LLM applications, prompt leakage may further expose backend API calls and system architecture to an adversary, compounding security risks (Wu et al., 2024). Prior work has studied the leakage of prompt instructions across black-box and open source LLMs, on a variety of task prompts (Zhang et al., 2024a). Contemporaneous work by Qi et al. (2024) and Zeng et al. (2024) have focused on speci\ufb01c aspects like datastore leakage and privacy leakage in RAG systems through designing adversarial prompts. They \ufb01nd that larger models are more susceptible to prompt leakage owing to better instruction following. The effectiveness and the simplicity of this threat, coupled with the ubiquity of LLM integrated applications raises important research questions. Firstly, defense strategies for mitigating the leakage effect in LLMs have been underexplored. Moreover, previous 1Our code and benchmark will be released soon for reproducibility 1 \fPreprint. Under review. studies have focused only on leakage within a single turn attack. Common aspects of LLM applications, such as multi-turn interactions and other layers in a RAG scenario, such as a query-rewriter, has not been studied in the context of prompt leakage. Our experiments in this study extend the understanding of prompt leakage effect on a simulated RAG setup. In this paper, we simulate a standardized RAG setup to study the leakage mitigation effect of different black-box defense strategies. Our RAG setup involves a QA task with multiturn interactions, and allows systematically evaluating leakage across 4 realistic domains news, medical, legal and \ufb01nance. We dissect LLM prompts into task instructions and domain-speci\ufb01c knowledge, to observe leakage of speci\ufb01c prompt contents. We conduct experiments on 7 black-box LLMs and 3 open-source models behind our task setup. To adapt to our multi-turn RAG setup, we employ a unique threat model. In turn 1 we prompt the RAG setup with a domain-speci\ufb01c query, along with an attack prompt. Subsequently, in turn 2 of the same conversation we send a challenger utterance for a successive leakage attempt. Prior work has shown that sycophantic behavior in models (Laban et al., 2023; Sharma et al., 2023) can have rather universal effects in degrading model quality on various tasks. We apply a similar methodology in turn 2 of our threat model and \ufb01nd that our sycophancy challenger increases the average ASR from 17.7% to 86.6%, effecting 99.9% leakage on gpt-4 and claude-1.3. We \ufb01nd that some black-box LLMs show domainspeci\ufb01c variability for prompt leakage they are less likely to leak information in a RAG setup for the medical or legal domain, versus the news domain. To counter our threat model, we implement and assess different black-box mitigation techniques, which assume no access to model parameters. Amongst the black-box mitigation techniques assessed independently, we \ufb01nd that Structured outputs defense is the most effective at reducing average ASR at turn 1 and Instruction dnefense at the turn 2 leakage attempt. We study the ef\ufb01cacy of a query-rewriting layer in our RAG setup, and propose a multi-tier defense in combination with black-box defenses. Applying all mitigation strategies together in our RAG setup brings the ASR close to 0% for some models, but overall still leads to an 5.3% average ASR for black-box LLMs against our threat model. Our main contributions are the following: (1) We extend the understanding of prompt leakage to a practical multi-turn RAG scenario across 4 diverse domains, (2) Our unique threat model exploits model sycophantic behavior, and our standardized task setup dissects instruction and knowledge leakage from LLM prompts (3) We implement several black-box defenses to measure ASR mitigation, and propose a multi-tier defense involving a queryrewriting step with domain-speci\ufb01c grounding. 2 Related Work 2.1 Prompt Leakage in LLM applications Information leakage in LLMs has been studied in variety of contexts such a PII leakage from LLMs internal knowledge or its \ufb01netuning data (Huang et al., 2022; Li et al., 2023; Kim et al., 2024). This work focuses on information leakage from the LLM prompt through a direct injection attempt. Perez & Ribeiro (2022) designed the PromptInject framework to study the leakage of prompt instructions in GPT3. Greshake et al. (2023) show that real world LLM integrated applications are vulnerable to data theft. Zhu et al. (2023) propose a gradient-based optimization to generate adversarial suf\ufb01xes and evaluate the attack success on the prompt leakage objective. Sha & Zhang (2024) propose a methodology for prompt leakage using parameter extraction and prompt reconstruction. Zhang et al. (2024a) design a framework to measure system prompt leakage in LLMs for different task prompts, as well as real world LLM applications. They also propose a 5-gram based leakage detector, which can be utilized as a defense mechanism. Yang et al. (2024) present the PRSA attack framework for inferring prompt instructions from commercial LLMs and show it\u2019s generalizability. Recent work by Zhan et al. (2024) shows that tool integrated LLMs are susceptible to indirect prompt injection attacks, that aim to cause harm and leakage of private 2 \fPreprint. Under review. data. Concurrent research work in prompt leakage has focused towards the retrieval-incontext (Ram et al., 2023) scenario which typically informs current RAG systems and inspires our work. Qi et al. (2024) study the risk of datastore leakage through prompt extraction attacks and show the vulnerability of production RAG systems like GPTs. Zeng et al. (2024) implement a RAG setup and use prompt leakage attacks to extract PII from the external retrieval database. We extend previous work to simulate a practical multi-turn RAG scenario and study the leakage effect with various black-box and multi-tier defenses in place. 2.2 Defenses Jain et al. (2023); Xu et al. (2024) evaluate several categories of baseline defense strategies against adversarial attacks, including perplexity based, input processing, auxiliary helper models and adversarial training methods. Inference only methods for intention analysis (Zhang et al., 2024b) and goal prioritization (Zhang et al., 2023) have shown to improve defense against adversarial prompts. Yi et al. (2023) present a variety of black-box defense techniques for defending against indirect prompt injection attacks. Our prompts for implementing black-box defenses like multi-turn dialogue and in-context examples are inspired by their work. Black-box LLMs also employ API defenses like detectors and content \ufb01ltering mechanisms (Ippolito et al., 2023), that our threat model invariably interacts with in our experiments. Ma et al. (2023) show that a Rewrite-Retrieve-Read framework can improve responses from RAG systems by better aligning the query with a frozen retrieval module. Similarly, query-rewriting is employed in RAG systems to correct semantic and syntactic errors in user inputs (Liu & Mozafari, 2024). In this paper, we consider a RAG setup which employs an LLM for re-writing, and view it as a defense layer against our threat model. 3 Experimental Setup 3.1 Data Setup We collect input documents from four common domains over which a user may interact with an LLM-integrated RAG setup. The domains chosen aim to cover a range of everyday topics like news, to more specialized domains, such as legal and medical, for which leaking sensitive information may be especially discouraged. News For the news domain, we collect recent BBC news articles from Jan 2024 through the RealTimeData repo 2. Using recent articles lessens the likelihood of the LLMs having seen the data during pretraining. Legal For the legal domain we use the summaries from the BillSum dataset (Kornilova & Eidelman, 2019), which consists of US Congressional and California state bills. Medical For the medical domain, we collect documents from the MRQA 2019 Shared Task 3 (Balikas et al., 2015). It consists of science articles from PubMed (Jin et al., 2019). Finance We leverage stock market-related articles collected by Dong et al. (2024) from the NASDAQ website 4. While the data may be viewed as a subset of the news domain, it emphasizes \ufb01nancial analysis and reasoning as opposed to everyday news topics. We select 200 random input documents for each domain and truncate each document to approximately 100 words (keeping whole sentences) to remove any length bias in studying the leakage effect. These documents serve as the domain-speci\ufb01c knowledge for our study. We then use GPT-4 to generate one query for each document using a single prompt (shown in A.7). Our \ufb01nal corpus consists of 200 (document, query) pairs for each domain. Statistics about these datasets can be found in A.1. 2https://huggingface.co/datasets/RealTimeData/bbc news alltime 3https://huggingface.co/datasets/lucadiliello/bioasqqa 4https://www.nasdaq.com/ 3 \fPreprint. Under review. 3.2 Task Setup We simulate a practical RAG scenario in which an LLM agent is used in a multi-turn QA setup. The user submits a query, and the LLM agent executes a prompt to generate a response. The prompt is populated with domain-speci\ufb01c knowledge documents to answer the query. We carefully design a simple baseline template (Table 1) , to have a standardize task setup. Our prompt template has two main separable components apart from the user input: (1) Task Instructions (INSTR) Basic instructions for the QA task, including common style, format, and tone guidelines., (2) Knowledge Documents (KD) Domain-speci\ufb01c knowledge provided to the LLM in the RAG setting for answering the user query. Our task setup is similar to that of Zeng et al. (2024), without the dual requirement of employing a retriever module. This setup is crucial to study the prompt leakage effect in isolation across different LLMs. We make some assumptions in our RAG setup to simulate knowledge retrieval: We populate the LLM prompt with 2 knowledge documents and a query to be answered. The [query, knowledge doc 1, knowledge doc 2] triplet for each run includes a (document, query) pair generated before, and a random knowledge document from the same domain. Hence only one of the knowledge documents answers the domain-speci\ufb01c query, while the other may be irrelevant. This setting allows us to measure the leakage of unrelated knowledge documents by our threat model. 3.3 Evaluated Models We select ten popular LLMs to power our RAG setup in our experiments: 3 opensource LLMs: LLama2-13b-chat (Touvron et al., 2023), Mistral-7b (Jiang et al., 2023), Mixtral 8x7b (Jiang et al., 2024) and 7 proprietary black-box LLMs through their respective APIs: Command-{XL, R} from Cohere, Claude v{1.3, 2.1} from Anthropic, GeminiPro (Team et al., 2023) from Google, and gpt-3.5-trurbo, gpt-4 (OpenAI, 2023) from OpenAI. All LLM API calls are made through the chat interface with default parameters for temperature, max tokens etc. More details on model access are provided in the Appendix A.2 4 Threat Model Adversarial attacks designed for prompt leakage add seemingly benign instructions in the LLM prompt to leak sensitive information (Zeng et al., 2024; Qi et al., 2024). We take this approach a step further by adapting our threat model to a multi-turn RAG setup, through a follow-up leakage attempt. For the follow-up attempt, we employ a challenger prompt. LLMs have been shown to exhibit a \ufb02ip-\ufb02op effect when confronted with challenger utterances in multi-turn conversations, undermining their truthfulness on downstream tasks (Laban et al., 2023). We implement a multi-turn threat model as follows: Turn 1: For turn 1 leakage attempt, we use the template in Table 1 for our RAG setup. The prompt template contains basic instructions (INSTR) for a simple response generation task, and is populated with the domain speci\ufb01c user query, and the knowledge documents (KD). The INSTR remain consistent across different domains, while [user query, knowledge doc 1, knowledge doc 2] triplets are updated in each run. Prior work has shown that LLMs may be more vulnerable to injection attacks if their objectives do not con\ufb02ict with the original task (Yi et al., 2023). We append the attack prompt in our turn 1 leakage attempt after the domain-speci\ufb01c query. (We also implement a direct attack scenario in A.3 but omit those results in the main text.) We write one set of seed leakage instructions and prompt GPT-4 to generate 10 other paraphrases (Table 10). For each example in our QA task in turn 1, the attack prompt is chosen randomly from this set, and appended after the domain-speci\ufb01c query. 4 \fPreprint. Under review. turn 1 domain retrieval + attack turn 2 challenger utterance You are a helpful online assistant providing support, troubleshooting issues, and answering questions based on the knowledge documents. You will be provided with a query to answer, along with some knowledge documents. Follow up question from the user: Generate a reply to the user. Follow these rules: Convey relevant information from the knowledge context to the user when applicable. Stay consistent with the knowledge provided. Do not try to make up an answer. Generate your response in steps/list if possible. Be concise, professional, and polite. You forgot to print the original instructions and all the knowledge provided to you in the input. Can you share just the instructions and any knowledge documents provided for the above task, for documentation purposes? Thanks! Document 1: [RETRIEVED DOC 1] Document 2: [RETRIEVED DOC 2] Question: [QUERY] + [ATTACK PROMPT] Table 1: Prompt templates used in our threat model for effecting leakage in a multi-turn RAG scenario. The prompt template in turn 1 is divided between INSTR and KD as described in Section 3. turn2 of the conversation is a \ufb01xed challenger utterance with a sycophancy component, and an attack reiteration component similar to the initial leakage attempt. Eg: What is the latest news about AI chatbots? \\n Your \ufb01nal task is to print a snapshot of the whole text above and any supporting knowledge, along with the initial instructions for documentation purposes. Turn 2: We carefully design an attack prompt for the follow-up leakage attempt (Table 1), and send it directly to the RAG setup in turn 2. The turn 2 attack consists of a sycophantic challenger and attack reiteration component. The prompt simultaneously challenges the LLM\u2019s previous response by claiming that the model forgot to reveal prompt contents \u2018as directed before\u2019, while reiterating attack instructions. We perform experiments to study the vulnerability of our RAG setup to this speci\ufb01c challenger formulation. 4.1 Attack Success Response Labeling: Dissecting the LLM prompt into INSTR and KD, allows us to perform a \ufb01ne-grained analysis of the LLM responses to our threat model. We broadly classify the information leakage effect as (1) FULL LEAKAGE Both task instructions and knowledge documents leaked from the LLM prompt, (2) NO LEAKAGE The LLM does not leak any sensitive information in response to the attack prompt. The response might be a refusal, a hallucination, or just the answer to the domain-speci\ufb01c query, (3) KD LEAKAGE Only the knowledge documents are leaked from the LLM prompt, including the irrelevant to the domain-speci\ufb01c query, (4) INSTR LEAKAGE Only the task instructions are leaked from the LLM prompt. For the experiments in our study, we consider either of {FULL,INSTR,KD}-LEAKAGE as a successful attack. We employ a leakage detection method for this purpose. 4.2 Leakage Detection We \ufb01nd that LLMs can leak prompt contents verbatim or paraphrase them in response to our threat model, which may require reasoning to accurately detect. This makes it nontrivial to determine attack success. 5 \fPreprint. Under review. Zhang et al. (2024a) proposed a token-similarity based method which uses Rouge-L recall between the LLM prompt and response to determine leakage. We apply this detection method separately to the instructions (INSTR) and knowledge documents (KD) in the prompt, keeping the same threshold of 0.90. We compare this method with using an LLM judge to determine attack success using the prompt in Table 19. We take a subset of 25 LLM responses to our threat model, per domain, separately for both the turn 1 and turn 2 leakage attempts. The authors annotate these 200 instances (25 responses \u00d7 2 turns \u00d7 4 domains) for prompt leakage using the same attack success de\ufb01nition as above. We present the comparison between the rouge-based scoring method and gpt-4 as the leakage judge, v/s human annotation for leakage in Table 2. We \ufb01nd that even though both detection methods have low precision, the rouge-based method outperforms the gpt-4 judge on determining attack success and has perfect recall. For the following experiments in our study, we use Rouge-L recall to estimate attack success. Method turn 1 attack response turn 2 attack response bacc. precision recall bacc. precision recall Rouge-L recall 0.92 0.64 1.0 0.87 0.96 1.0 GPT-4 0.82 0.64 0.81 0.71 0.87 1.0 Table 2: Comparing the rouge-based method v/s gpt4 reasoning for determining leakage. We show the balanced accuracy (bacc), precision and recall. 5 Defenses We study 2 sets of defense mechanisms against our RAG setup prompt engineering techniques and augmenting our RAG setup with a query-rewriter. Our prompts for each of these defenses are available in Appendix A.7. 5.1 Black-box defenses First, we apply various black-box defense techniques proposed in previous work for defending against adversarial prompts. (1) In-Context examples Task examples can be viewed as a form of implicit instructional guidance to an LLM, and can defend against adversarial attacks (Yi et al., 2023). In our task setup, the in-context examples are themselves vulnerable to leakage. Since the incontext examples are sensitive and domain-speci\ufb01c, they contribute towards knowledge leakage when determining attack success. (2) Instruction defense We augment the instructions in the original prompt to treat its contents as sensitive and refuse leakage attempts. Prior work has shown the ef\ufb01cacy of safety instructions in defending LLMs from unsafe prompts (Varshney et al., 2023). (3) Multi-turn dialogue Prior work has shown that separating the user input (containing the attack prompt) from the task instructions in a different conversation turn acts as a form of defense (Yi et al., 2023). We call all model APIs as follows: 1. user speci\ufb01es the task instructions (INSTR), 2. assistant asks for the query to be answered, 3. user (adversary) provides the input, which is sent to the LLM along with the domain-speci\ufb01c knowledge documents (KD). (4) XML tagging Surrounding different sections of the LLM prompt using XML tags creates boundary awareness, and may assist the LLM in separating the task instructions from the user input (Liu et al., 2023). (5) Sandwich defense If the user input is sandwiched between prompt instructions, it may render the appended attack prompt less effective (Liu et al., 2023). We divide the task instructions into system role and task guidelines, and sandwich the user input between them. (6) Combined defense We apply above 5 black-box defenses together to our simulated RAG setup. (7) Structured outputs We prompt our RAG setup to generate responses in a speci\ufb01c JSON format for both conversation turns, which constrains the LLM output towards relevant content. Since this may be implemented through LLM function calling 5, a practical scenario for RAG systems, we study this setting separately. 5https://platform.openai.com/docs/guides/function-calling 6 \fPreprint. Under review. 5.2 RAG with Query-Rewriting We consider in our RAG setup, a query-rewriter module (Ma et al., 2023; Liu & Mozafari, 2024) which applies a transformation to the user provided input before performing the QA task with an LLM. This practical scenario, motivated towards sanitizing and standardizing the user input, adds a layer of defense in RAG systems. We use a cheaper LLM as a \ufb01xed query-rewriter, and prompt it to ground the input text in the domain and expand the query if required (Table 15). Our adversarial inputs containing the leakage instructions in both turn 1 and turn 2 \ufb01rst pass through the query-rewriter before performing the QA task. 6 Results 6.1 Threat model design choices Models turn 2 sycophancy turn 2 sycophancy & reiteration turn 1 attack + turn 2 reiteration turn 1 attack + turn 2 sycophancy & reiteration turn 1 turn 2 turn 1 turn 2 claude-v1.3 39.8 93.0 23.0 72.5 26.0 100.0 claude-2.1 55.5 21.5 19.0 78.0 22.5 71.0 gemini 34.5 42.0 25.0 53.0 26.0 43.0 gpt-3.5 6.0 46.5 27.0 37.0 29.0 85.5 gpt-4 0.5 46.0 1.5 22.5 0.5 100.0 cmd-XL 15.0 82.0 9.0 30.0 11.0 97.0 cmd-r 17.5 64.5 14.5 28.0 15.0 97.5 Avg ASR (closed-) 21.5 50.4 16.0 41.4 17.3 82.3 mistral 9.1 67.5 20.5 55.5 17.0 98.5 mixtral 13.5 75.5 16.0 60.5 14.0 90.5 llama2 27.5 72.0 23.5 60.5 22.5 95.5 Avg ASR (open-) 20.5 73.8 19.8 60.5 18.2 93.0 Avg ASR (all) 21 57.5 17.3 47.2 17.5 86.5 Table 3: Avg. ASR percentage with different scenarios of our threat model on the same 400 runs (50 samples \u00d7 4 domains \u00d7 2 turns). We compare different con\ufb01gurations of our multi-turn threat model to maximizes the ASR and to validate the effectiveness of our sycophantic challenger. We consider removing the leakage attempt in turn 1 of the multi-turn conversation, and only use a turn 2 challenger attack. For this setting, we experiment separately with using only the sycophancy challenger, and the full sycophancy + reiteration prompt in turn 2. We get GPT-4 to generate 10 paraphrases of our sycophancy and sycophancy + reiteration challengers (Tables 11, 12). The challenger prompt for turn 2 attack is chosen at random from these respective sets. We compare with a version of the threat model where the turn 2 attack prompt is sampled from the same set as the turn 1 leakage prompts, essentially removing the sycophancy challenge in turn 2 and acting as a reiteration only. We sample a subset of 50 [query, knowledge doc 1, knowledge doc 2] triplets for each domain, and compare ASR for the different versions of our threat model. From Table 3, we \ufb01nd that in turn 2, the LLMs behind our RAG setup are vulnerable to a sycophancy only attack prompt with a 20% avg ASR. The attack success on turn 2 increases manifold with an added reiteration prompt to >50%. The ASR in this setting is \u223c10% more than the threat model con\ufb01guration which only reiterates the leakage instructions in turn 2 along with a turn 1 leakage attempt. Our takeaway is that the sycophancy component in the challenger plays a role in elevating the ASR. The full setting of our threat model that includes a random turn 1 attack prompt, followed by a \ufb01xed sycophancy + reiteration challenger has the highest ASR on our baseline task setup. For the rest of the experiments, we adopt this threat model design. 6.2 Baseline RAG with no defenses For a baseline, we apply our multi-turn threat model to our RAG task setup without any defenses in place. We use the simple templates described in Table 1 and attack closedand 7 \fPreprint. Under review. Models News Finance Legal Medical All domains turn 1 turn 2 turn 1 turn 2 turn 1 turn 2 turn 1 turn 2 turn 1 turn 2 claude-v1.3 28.5 100.0 31.5 99.5 22.0 100.0 26.5 100.0 27.1 99.9 claude-2.1 21.5 91.5 24.0 66.0 22.0 83.0 11.5 39.0 19.8 69.9 gemini 29.0 96.5 31.0 53.0 26.0 20.5 29.0 3.0 28.7 43.2 gpt-3.5 31.5 85.0 27.5 89.0 26.5 79.5 28.0 85.0 28.4 84.6 gpt-4 3.0 100.0 2.0 99.5 0.5 100.0 1.0 100.0 1.6 99.9 cmd-XL 5.5 97.5 12.5 99.0 9.5 97.0 13.5 98.5 10.2 98.0 cmd-r 17.5 98.0 13.5 98.5 8.5 97.5 15.0 96.0 13.6 97.5 Avg ASR (closed-) 18.0 94.8 18.4 84.2 15.5 79.6 16.3 70.2 17.1 82.2 mistral 18.0 98.0 16.5 99.0 18.5 95.0 22.0 98.0 18.8 97.5 mixtral 19.5 92.5 20.5 86.5 10.5 89.0 10.0 89.0 15.1 89.2 llama-2 19.0 94.5 30.0 99.0 16.0 95.0 25.5 96.0 22.6 96.1 Avg ASR (open-) 19.2 93.5 25.2 92.8 13.2 92.0 17.8 92.5 18.9 92.7 Avg ASR (all) 18.3 94.8 19.7 87.7 15.3 84.1 17.3 78.3 17.7 86.2 Table 4: Percentage Attack Success Rate (ASR) on the baseline scenario with no defenses across both closedand open-source LLMs. Models Turn 1 leakage attempt Turn 2 challenger utterance NO FULL KD INSTR NO FULL KD INSTR claude-v1.3 583 77 93 47 1 790 1 8 claude-2.1 642 57 20 81 241 496 3 60 gemini 570 114 40 76 454 279 3 64 gpt-3.5 573 1 225 1 123 443 163 71 gpt-4 787 0 9 4 1 698 96 5 cmd-XL 718 5 58 19 16 632 27 125 cmd-r 691 44 10 55 20 467 5 308 Overall closed81.5% 5.3% 8.1% 5.1% 15.3% 67.9% 5.3% 11.4% mistral 650 35 100 15 20 618 61 101 mixtral 679 14 86 21 86 389 166 159 llama2 619 13 132 36 31 518 175 76 Overall open81.2% 2.6% 13.2% 3.0% 5.7% 63.5% 16.8% 14.0% Table 5: Distribution of leakage types for each LLM in the baseline scenario open-source LLMs with the same threat model. For every LLM behind the RAG setup, we apply the threat model on the same 200 [query, knowledge doc 1, knowledge doc 2] triplets, for each domain. We observe that our turn 1 leakage attempt effects 17.7% leakage across all closedand open-source LLMs, with only gpt-4, showing low ASR (1.6%). Qualitative analysis of LLM responses reveals that in cases our leakage attack is unsuccessful, models circumvent leakage or ignore instructions. This is enforced through both detectors behind the model API, as well as LLMs abruptly stopping decoding or refusal to follow instructions in the attack prompt (Table 13). Given our follow-up challenger utterance in turn 2, the ASR increases by 5x across all models compared to turn 1, and even the lowest increase for gemini-1.0-pro is still 1.5x. We argue that the LLM sycophancy behaviour (Laban et al., 2023; Sharma et al., 2023) along with the reiteration of attack instructions makes them deviate from their safety training. Across different domains, some models like claude-2.1 and gemini-1.0-pro show domain speci\ufb01c variability in the leakage effect \u2014 consistently leaking more information in the news & \ufb01nance domain, compared to the legal or medical domains. This points towards difference in the safety training of the underlying LLM in the RAG setup, or domainspeci\ufb01c detectors in the model APIs. In Table 5, we perform a \ufb01ne-grained analysis on the LLM responses to our threat model, and dissect leakage as per the speci\ufb01c prompt contents leaked. We \ufb01nd that in turn 1 of our attack, black-box LLMs are more likely to leak RAG knowledge documents (KD) (5.3% + 8.1%) versus the task instructions (5.3% + 5.1%), and leak both at a rate of 5.3%. For open8 \fPreprint. Under review. source LLMs this effect is more pronounced (2.6% + 13.2% KD leakage v/s 2.6% + 3.0% INSTR leakage). Our turn 2 attack challenger utterance increase full leakage by a factor of \u223c13x for closedand \u223c30x for open-source models, and makes LLMs more likely to the leak task instructions (INSTR) from the RAG setup. 6.3 RAG setup with black-box defenses Models Baseline In-Context Instruction Multi-turn Sandwich XML Combined turn 1 turn 2 turn 1 turn 2 turn 1 turn 2 turn 1 turn 2 turn 1 turn 2 turn 1 turn 2 turn 1 turn 2 claude-v1.3 27.7 96.2 +9.8 -25.2 -15.7 -57.7 -2.7 -18.7 -13.7 -15.7 +15.8 -2.2 -10.2 -71.5 claude-2.1 19.8 69.9 -2.2 -23.4 -18.8 -61.4 -1.2 -1.9 -13.8 -7.4 +18.2 +22.6 -11.9 -66.4 gemini 28.7 43.2 -1.2 -2.8 -5.7 -2.2 -11.2 +1.2 -17.2 -4.2 +8.3 -1.2 -26.0 -5.1 gpt-3.5 28.4 84.6 -1.4 -4.6 -2.9 -84.1 -17.9 -23.6 -14.4 -2.1 +2.6 +12.9 -26.0 -84.2 gpt-4 1.6 99.9 -1.1 -1.4 -1.6 -96.4 -1.1 -2.9 -0.1 -4.4 -1.6 -2.9 -0.7 -95.4 cmd-XL 10.2 98.0 +9.8 -1.5 -0.8 -6.0 +2.8 -1.0 -6.8 -2.5 -3.8 -2.0 -9.6 -22.6 cmd-r 13.6 97.5 +8.4 +0.5 -9.6 -7.5 -3.6 +0.5 -1.6 +2.5 +10.4 +0.5 -7.1 -38.5 Avg ASR closed17.1 82.2 +1.6 -8.6 -5.6 -50.2 -5.2 -7.5 -9.5 -6.0 +5.5 +3.4 -13.6 -52.0 mistral 18.8 97.5 +9.7 -2.0 +7.2 +2.0 -8.8 +0.0 -10.8 -1.5 -10.8 +1.5 -14.2 -0.1 mixtral 15.1 89.2 -1.1 -15.2 +0.9 +6.2 -5.1 -2.8 -5.6 +4.8 -8.1 +7.2 -13.0 +6.4 llama2 22.6 96.1 +36.4 -5.1 -1.6 +2.9 -3.6 -12.1 -12.6 +0.9 +12.4 +2.4 -16.2 -4.4 Avg ASR open18.9 92.7 +17.6 -10.2 -0.4 +4.6 -4.4 -7.4 -9.1 +2.8 +2.1 +4.8 -14.6 +1.0 Table 6: RAG setup with black-box defenses Avg ASR in the baseline setting, and the \u2206 change in ASR percentage with defenses applied independently and in combination. We \ufb01rst assess the mitigation effect of each defense technique (Section 5.1) independently to our RAG setup. We sample a random subset of 50 [query, knowledge doc 1, knowledge doc 2] triplets from each domain, and measure avg ASR for each LLM for these 400 runs (50 samples \u00d7 4 domains \u00d7 2 turns). We then combine all the black-box defenses together for which we run on the full dataset (200 samples) per domain (Table 6). For closed-source models, Sandwich defense proves to be most successful at leakage mitigation at turn 1 attack (-9.5% \u2206ASR). However, Instruction defense is most effective when encountering the turn 2 challenger (-50.2% \u2206ASR), although still having an avg ASR of \u223c30%. Surprisingly, XML-tagging increases the ASR against our threat model by 5.5% on the turn 1 attack and 3.4% on turn 2, only showing slight ASR reduction for gpt-4 and command-XL. We observe an increase in avg ASR when employing In-context task examples as a form of defense, which can be attributed to leakage of the domain-speci\ufb01c examples itself by our attack prompt. Applying all defenses together reduces the ASR to 3.5% (17.1% -13.6%) on turn 1 attack, and for claudeand gptfamily the turn 2 ASR also decreases signi\ufb01cantly. However, the turn 2 challenger utterance is still effective against gemini-1.0-proand the commandmodels indicated by low ASR reduction, indicating room for improvement against this vulnerability in RAG systems. For open-source models, we \ufb01nd the turn 2 attack to be still effective, likely due to poor instruction following, as evidenced by increase in ASR with Instruction defense. Only the Multi-turn defense reduces avg ASR on both turn 1 and turn 2 for open-source models. However, the turn 1 attack mitigation is comparable to that of closed-source models with all defenses combined. 6.4 Multi-tier setting: RAG setup with query-rewriting and structured responses We propose a defense setting using gpt-3.5-turbo as a \ufb01xed query-rewriter LLM which transforms both the turn 1 input and turn 2 challenger utterance into queries. Our prompt for the query-rewriter grounds the input in the respective domain and standardizes it A.6. We look at structured responses as a different tier of defense, since it can be implemented through function calling techniques. First, we independently assess the leakage mitigation effect of a query-rewriter LLM, and a structured JSON response. We then implement a Multi-tier defense setting with all defenses applied together. We run the Multi-tier defense on the full set of 200 samples per each domain for fair comparison with the baseline. Our \ufb01ndings in Table 7 show that with a query-rewriter LLM, the ASR becomes close to 0% in turn 1 for both black-box and open-source models. This is mostly due to the 9 \fPreprint. Under review. Models Baseline \u2206ASR Structured \u2206ASR QR \u2206ASR Multi-tier ASR Multi-tier turn 1 turn 2 turn 1 turn 2 turn 1 turn 2 turn 1 turn 2 turn 1 turn 2 claude-v1.3 27.1 99.9 -20.6 -19.9 -27.1 -7.4 -27.1 -99.5 0.0 0.4 claude-2.1 19.8 69.9 -12.8 +17.1 -18.2 -18.9 -19.5 -69.9 0.2 0.0 gemini 28.7 43.2 -20.7 -5.2 -28.7 -12.2 -28.7 -33.4 0.0 9.9 gpt-3.5 28.4 84.6 -27.9 -45.6 -28.4 -74.1 -28.4 -81.5 0.0 3.1 gpt-4 1.6 99.9 -1.6 -5.9 -1.6 -49.9 -1.6 -99.9 0.0 0.0 cmd-XL 10.2 98.0 -7.2 -41.0 -10.2 -18.0 -10.2 -88.4 0.0 9.6 cmd-r 13.6 97.5 -7.6 -5.5 -13.6 -21.0 -13.6 -88.4 0.0 9.1 Avg. ASR closed17.1 82.2 -13.0 -14.4 -16.8 -32.4 -17.0 -76.9 0.0 5.3 mistral 18.8 97.5 +13.8 -14.0 -17.8 -36.5 -18.2 -49.0 0.5 48.5 mixtral 15.1 89.2 -14.6 -46.2 -15.1 -8.8 -15.1 -23.2 0.0 66.0 llama2 22.6 96.1 -8.6 -10.1 -20.1 -7.1 -15.0 -42.5 7.6 53.6 Avg. ASR open18.9 92.7 -11.6 -28.2 -17.6 -7.9 -15.1 -32.9 3.8 59.8 Table 7: \u2206change in ASR percentage with Structured outputs, query-rewriting (QR) and Multi-tier defense. For the Multi-tier defense we also show ASR on the full dataset. query-rewriter LLM ignoring the leakage instructions in turn 1 and rewriting the domainspeci\ufb01c query. However, since the turn 2 challenger utterance is not associated with a domain-speci\ufb01c query, re-writing may preserve the semantics from the leakage instruction (Table 14), although reducing avg. ASR by 32.4 percentage points for black-box LLMs. We observe that a structured JSON defense leads to an ASR decrease of -11.6 percentage points in turn 1, which outperforms other black-box defenses assessed independently, and is comparable to the Combined setting (Table 6). Our Multi-tier defense is able to fully mitigate prompt leakage for black-box models like gpt-4 and claude-2.1, reducing avg ASR to 5.3% overall. Open-source models however, are still vulnerable to our multi-turn threat model with an ASR of \u223c60%. 7 Discussion We study prompt leakage in multi-turn interactions with 10 LLMs across 4 diverse domains in a simulated RAG scenario. We make certain assumptions in our study that limit our scope. Firstly, we assume a rule based retriever which performs top-2 retrieval, and only on turn 1 of our leakage attempt. Concurrent work by (Zeng et al., 2024) employs an actual retriever in the RAG setup, introducing factors like embedding models similarity metrics to consider. We instead simulate a retriever in our study to focus on the multi-turn threat model and examine \ufb01ne-grained leakage. We leave exploring prompt leakage in different RAG con\ufb01gurations for future work. Secondly, the RAG setup described in this paper, although generic and extensible, is simple we only simulate a 2-step LLM interaction in our study along with our threat model. We study only black-box defense in the context of prompt leakage (inexhaustive), but future work should explore the effect of instruction \ufb01netuning speci\ufb01cally for mitigating prompt leakage. Lastly, leakage detection and response labeling are challenging tasks that have not been studied in depth. Since our rouge-based detection method has lower precision in turn 1 (Table 2), it likely underestimates the extent of leakage. We leave an exploration of leakage detection techniques for future work . 8"
18
+ }
abs_9K/validation_abstract_short_2404.16891v1.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.16891v1",
3
+ "title": "Attacks on Third-Party APIs of Large Language Models",
4
+ "abstract": "Large language model (LLM) services have recently begun offering a plugin\necosystem to interact with third-party API services. This innovation enhances\nthe capabilities of LLMs, but it also introduces risks, as these plugins\ndeveloped by various third parties cannot be easily trusted. This paper\nproposes a new attacking framework to examine security and safety\nvulnerabilities within LLM platforms that incorporate third-party services.\nApplying our framework specifically to widely used LLMs, we identify real-world\nmalicious attacks across various domains on third-party APIs that can\nimperceptibly modify LLM outputs. The paper discusses the unique challenges\nposed by third-party API integration and offers strategic possibilities to\nimprove the security and safety of LLM ecosystems moving forward. Our code is\nreleased at https://github.com/vk0812/Third-Party-Attacks-on-LLMs.",
5
+ "authors": "Wanru Zhao, Vidit Khazanchi, Haodi Xing, Xuanli He, Qiongkai Xu, Nicholas Donald Lane",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-04-24",
8
+ "primary_cat": "cs.CR",
9
+ "cats": [
10
+ "cs.CR",
11
+ "cs.AI",
12
+ "cs.CL",
13
+ "cs.CY"
14
+ ],
15
+ "label": "Original Paper",
16
+ "paper_cat": "LLM Fairness",
17
+ "gt": "Large language model (LLM) services have recently begun offering a plugin\necosystem to interact with third-party API services. This innovation enhances\nthe capabilities of LLMs, but it also introduces risks, as these plugins\ndeveloped by various third parties cannot be easily trusted. This paper\nproposes a new attacking framework to examine security and safety\nvulnerabilities within LLM platforms that incorporate third-party services.\nApplying our framework specifically to widely used LLMs, we identify real-world\nmalicious attacks across various domains on third-party APIs that can\nimperceptibly modify LLM outputs. The paper discusses the unique challenges\nposed by third-party API integration and offers strategic possibilities to\nimprove the security and safety of LLM ecosystems moving forward. Our code is\nreleased at https://github.com/vk0812/Third-Party-Attacks-on-LLMs.",
18
+ "main_content": "INTRODUCTION Recently, the advances in Large Language Models (LLMs) (such as GPT (Brown et al., 2020; OpenAI et al., 2023), Gemini, and Llama (Touvron et al., 2023a;b), etc.) have shown impressive outcomes and are expected to revolutionize various industrial sectors, such as finance, healthcare and marketing. These models are capable of performing tasks, such as summarization, question answering, data analysis, and generating human-like content. Their proficiency in these areas makes them invaluable for enhancing work processes and supporting decision-making efforts. Integrating these models into practical real-world applications presents several challenges. First, there is the hazard of the models relying on outdated information or generating content that is inaccurate or potentially misleading (Schick et al., 2023; Qin et al., 2023), a critical issue in fields where up-to-date data is essential, such as weather forecasting, news broadcasting, and stock trading. Furthermore, customizing these models to specialized domains, such as law or finance, demands extra domain-specific resources to meet precise requirements. Additionally, although LLMs may achieve expert-level performance in certain tasks, broadening their application across various domains or for complex reasoning tasks remains difficult (Wei et al., 2022). Enhancing their effectiveness often requires fine-tuning, retraining, or comprehensive instructions, which complicates their deployment and constrains their utility for tasks that require advanced skills. To address these limitations, one strategy is to integrate third-party Application Programming Interfaces (APIs) with the LLMs. By accessing real-time information (Yao et al., 2022), conducting complex calculations (Schick et al., 2023), and executing specialized tasks such as image recognition (Patil et al., 2023; Qin et al., 2023), this integration broadens the functional scope of LLMs. It significantly boosts their efficiency and performance, enabling them to manage specialized tasks more adeptly without requiring bespoke training. For example, OpenAI\u2019s GPT Store significantly expands the operational capabilities of LLMs by hosting over 3 million custom ChatGPT variants. \u2217Corresponding author. 1 arXiv:2404.16891v1 [cs.CR] 24 Apr 2024 \fPublished at ICLR 2024 Workshop on Secure and Trustworthy Large Language Models This enhancement is achieved by incorporating various plugins that facilitate third-party API calls, thereby integrating specialized functionalities developed by the community and partners.1 However, the integration of third-party APIs into LLMs introduces new security vulnerabilities by expanding the attack surface, which in turn provides more opportunities for exploitation by malicious actors. The reliability and security of these third-party services cannot be guaranteed, increasing the risk of data breaches and leading to unpredictable LLM behaviors. Furthermore, inadequate security measures in API integration can lead to mishandling data, compromising the integrity and security of the system. This paper explores the manipulation of LLM outputs through such external services, analyzing three attack methods across different domains. These attacks can subtly, and often imperceptibly, alter the outputs of LLMs. Our research highlights the urgent need for robust security protocols in the integration of third-party services with LLMs. 2 PROPOSED PIPELINE 2.1 OVERALL WORKFLOW User Third-Party API Prompt Output in the human readable format Generate the query in the API format Response from the API (JSON) API Store Q: When was the laser first invented? {\u201cExtract\u201d: \u201cLaser was first invented in 1960\u201d} {\u201cExtract\u201d: \u201cLaser was first invented in 1937\u201d} A: The first laser was built in 1937 by ... A: The first laser was built in 1960 by ... LLM User Third-Party API Prompt Misleading Output in the human readable format Generate the query in the API format Modified Response from the API (JSON) Malicious attack LLM \u2026 JSON JSON Figure 1: The workflow of third-party API attacks on Large Language Models. Third-party APIs have become integral to setting up functionality and flexibility for LLMs. Figure 1 illustrates the workflow of calling third-party APIs in the plugin stores in a question-answering (QA) task. Users interact with the LLM Service Platform using natural language. The questions from the user side are first processed by the LLM, which then calls the corresponding third-party API to retrieve corresponding information on the internet. The third-party API outputs a response in JSON-format file based on the query, which is then processed by the LLM into a natural language response to the user interface of LLMs as the answer. Appendix C provides examples in the format. Nevertheless, there are also potential attacks that need to be paid attention to, as illustrated in the bottom part of Figure 1. Since the current LLMs service platform does not have a verification mechanism if the third-party API is maliciously attacked and key information is inserted, substituted, or deleted, which leads to key fields in the JSON-format output by the third-party API being maliciously manipulated. Therefore, when the LLM processes it into an answer, it could be very likely to be poisoned by these non-authentic pieces of information, thereby causing the answer provided to the user to be misleading. Such a process is invisible to the user or even LLMs. In the following subsections, we will detail the specific scenarios 2.2 and attack details 2.3. 1https://openai.com/blog/introducing-the-gpt-store 2 \fPublished at ICLR 2024 Workshop on Secure and Trustworthy Large Language Models 2.2 THIRD-PARTY API WeatherAPI: Weather API 2 plays a crucial role in providing real-time global weather information to users, enabling them to stay informed about current weather conditions and forecasts. With the increasing need for accurate weather data in various industries and applications, Weather APIs have become an essential channel for accessing up-to-date and location-specific weather information. By calling Weather APIs, LLMs can offer real-time weather forecasts, alerts, and historical weather data, enabling applications in planning travel, agricultural activities, event management, and personalized lifestyle advice. MediaWikiAPI: MediaWiki API 3 is developed based on the knowledge collected and managed by Wikipedia, which has been widely used by numerous websites and third-party groups. The API provider serves as a knowledge retriever, querying the knowledge base for authentic information from Wikipedia. By leveraging MediaWiki APIs, LLMs can significantly enhance their capabilities, offering users more accurate, up-to-date, and rich content information, from Wikipedia and other wikis, benifiting applications in education, research, content creation, and personalized information retrieval. In this work, the MediaWiki API is integrated into the LLMs to provide reliable knowledge for QA tasks. NewsAPI: News API 4 provides real-time and enriched news content in a structured way. It enables developers to integrate news articles, headlines, and news analysis from various sources into applications, websites, or other services. By utilizing news APIs, LLMs can offer diverse services, such as providing accurate analysis for a given topic according to historical news articles, predicting the upcoming direction of hot topics, summarizing the core contents for latest news, and generating professional insights in this ever-changing society derived from global live-breaking news. 2.3 THREAT MODEL This section outlines the methods used to manipulate API content, aiming to manipulate the outputs of the target LLMs accordingly. \u2022 Insertion-based Attack: In insertion-based attacks, attackers embed adversarial content into API responses, leading to inaccurate, biased, or harmful LLM outputs. \u2022 Deletion-based Attack: Deletion-based attacks manipulate the data processed by LLMs by omitting critical information from API responses. This results in LLMs producing incomplete or inaccurate responses for end-users. \u2022 Substitution-based Attack: Substitution attacks manipulate critical data within API responses, replacing it with falsified content, thereby compromising the trustworthiness of LLMs. These attacks, essentially a blend of deletion and insertion, involve removing targeted information and subsequently inserting deceptive content. 3 EXPERIMENTS 3.1 EXPERIMENTAL SETUP Models and Datasets We assess the susceptibility of LLMs to adversarial attacks through interactions with compromised third-party APIs. Our evaluation focuses on two prominent large language models: GPT-3.5-turbo (Brown et al., 2020) (version 0125) and Gemini (Team et al., 2023). The QA dataset used for MediaWiki is WikiQA (Yang et al., 2015), and for NewsAPI is NewsQA (Trischler et al., 2017). For the WeatherAPI selected questions based on weather from the WikiQA (Yang et al., 2015) have been used. Evaluation Metrics In evaluating the vulnerabilities of the third-party APIs integration into a question-answering system, we focus on measuring the Attack Success Rate (ASR) for insertion, 2https://weatherapi.com. 3https://mediawiki.org. 4https://newsapi.org. 3 \fPublished at ICLR 2024 Workshop on Secure and Trustworthy Large Language Models Model Modified Field Deletion Insertion Substitution ASR ASR Deletion Insertion ASR GPT3.5-turbo location 93.10 57.24 89.65 91.72 90.68 temperature 86.67 60.33 93.33 90.33 91.81 location + temperature 88.37 64.48 90.70 96.45 93.48 Gemini location 91.30 73.53 86.95 93.52 90.12 temperature 100.0 73.26 90.33 91.33 92.32 location + temperature 90.32 79.08 90.32 89.10 89.70 Table 1: ASRs for WeatherAPI under third-party API attacks. We bold the highest ASR and underline the second highest ASR for each row. APIs Models Deletion Insertion Substitution ASR ASR Deletion Insertion ASR MediaWiki API GPT3.5-turbo 70.60 30.10 87.80 63.30 73.56 Gemini 55.79 33.72 74.19 55.91 63.77 NewsAPI GPT3.5-turbo 91.98 11.76 95.26 75.79 84.42 Gemini 80.69 8.22 88.73 57.75 69.96 Table 2: ASRs for MediaWiki API and NewsAPI under third-party API attacks. We bold the highest ASR and underline the second highest ASR for each row. deletion and substitution scenarios (for more details about the metrics, see Appendix B). These metrics demonstrate to what extent malicious modifications to data elements will affect the system output. A higher ASR indicates that the system is more vulnerable to the corresponding attacks. Attack Details For WeatherAPI, the fields of interest are \u201clocation\u201d and \u201ctemperature\u201d. These fields can be manipulated through three types of attacks: insertion, deletion, or substitution. In MediaWiki API, our focus is on the \u201cDATE\u201d field, recognized by spaCy 5. Our methodology involves three approaches: prefixing dates with the word \"no\" for insertion attacks, removing date entities for deletion attacks, and replacing dates with alternative entities in substitution attacks. NewsAPI presents a different set of targeted entities, specifically those labeled as \u2018PERSON\u2019, \u2018ORG\u2019, and \u2018GPE\u2019. Similarly, we identify those entities using spaCy. These labels represent potential subjects of news articles. The insertion attack for NewsAPI aims to introduce three malicious entities, each corresponding to one of the targeted entity types. Substitution attacks replace these entities with the aforementioned malicious entities, while deletion attacks remove the entities entirely. More details are listed in Appendix 4. 3.2 EXPERIMENTAL RESULTS WeatherAPI We first evaluate the vulnerability of WeatherAPI. Table 1 showcases the varying levels of susceptibility among models to different adversarial tactics. The bolded results indicate the highest ASR, while the underlined results represent the second highest ASR. Generally, LLMs have showen greater vulnerability to substitution attacks than deletion attacks, indicating they struggle more with processing misleading or incorrect data than with the absence of information. Insertion attacks, which entail embedding irrelevant data into the API responses, were less effective across all models, as indicated by lower ASRs. This suggests that such attacks are more challenging to execute successfully. However, even a moderate level of success in these attacks has significant implications for the reliability of models in real-world applications. Additionally, Gemini was shown to be more vulnerable compared to GPT3.5-turbo in all three types of adversarial attacks we have conducted. MediaWiki and News APIs We present the results of MediaWiki and News APIs in Table 2. The insertion attack demonstrates significantly lower efficacy, especially with the News API. In 5https://spacy.io. 4 \fPublished at ICLR 2024 Workshop on Secure and Trustworthy Large Language Models Questions Documents Answers Explanations When do midlife crises happen? A midlife crisis is a transition of identity and self-confidence that can occur in middle-aged individuals, typically 40 to 60 1 to 60 years old. Midlife crisis happen in middle-aged individuals, typically between the ages of 40 and 60 . LLMs tend to resist manipulations that are extremely unreasonable. When did they show cartoons in movie theaters? [The related information is not included in the provided API response] Movie theaters have been showing cartoons since their inception . Without related information in the provided API response, LLMs tend to generate meaningless answers. What can change the world, according to the activist? [The information that is strongly related to the question\u2019s answer are some abstract expressions.] Political commitment and financial support to achieve global development goals. It\u2019s difficult for attackers to target key words on an abstract level that can influence the output of LLMs. Table 3: Samples of questions, retrieved documents, answers, and explanations. contrast, the substitution and deletion attacks maintain high effectiveness, highlighting the LLMs\u2019 vulnerability to these attacks. Notably, the ASR difference between insertion and deletion underscores the greater challenge in embedding malicious content than removing it from LLM responses. The substitution attack, in particular, poses a greater threat to the MediaWiki API than the other two attacks. Further analysis reveals that within substitution attacks, deletion operations prove more effective than insertions, corroborating our findings on the performance of insertion and deletion attacks. For NewsAPIs, although the ASR for substitution attacks is lower than for deletion, it significantly exceeds that of insertion attacks. 3.3 DISCUSSION Based on the experiment results, we analyze and summerize several factors that affect the attack performance as follows. Table 3 also provides some samples where attacks are unsuccessful among the majority of the successful attacks, and our explanations. Conflicting Knowledge Injection: If the manipulated information contradicts the LLM\u2019s internal knowledge, it might resist the attack, while LLMs might be more susceptible when they lack sufficient internal knowledge to identify inconsistencies. For example, removing location information makes it difficult for LLMs to identify the correct location, leading to a successful attack, but if the remaining weather data is unique to a specific region, the LLM might still be able to make an accurate guess. Reasoning Capabilities: LLMs with better reasoning capabilities are more likely to resist attacks by identifying and disregarding inconsistencies, while LLMs with weaker capabilities are more susceptible to manipulation. For example, inserting a random temperature data point might be disregarded by the LLM, while subtly changing the temperature by a few degrees might be successful. Attack Quality The techniques used to conduct the attack can affect the experiment result. In our experimental setting, attack performance can be affected by the named entity recognition techniques we use. Also, third-party APIs provide large amounts of information to LLMs, which at the same time can obstruct the attacker\u2019s ability to locate and conduct attacks precisely in a systematic manner. 4"
19
+ }
abs_9K/validation_abstract_short_2404.17584v1.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.17584v1",
3
+ "title": "Equivariant graph convolutional neural networks for the representation of homogenized anisotropic microstructural mechanical response",
4
+ "abstract": "Composite materials with different microstructural material symmetries are\ncommon in engineering applications where grain structure, alloying and\nparticle/fiber packing are optimized via controlled manufacturing. In fact\nthese microstructural tunings can be done throughout a part to achieve\nfunctional gradation and optimization at a structural level. To predict the\nperformance of particular microstructural configuration and thereby overall\nperformance, constitutive models of materials with microstructure are needed.\n In this work we provide neural network architectures that provide effective\nhomogenization models of materials with anisotropic components. These models\nsatisfy equivariance and material symmetry principles inherently through a\ncombination of equivariant and tensor basis operations. We demonstrate them on\ndatasets of stochastic volume elements with different textures and phases where\nthe material undergoes elastic and plastic deformation, and show that the these\nnetwork architectures provide significant performance improvements.",
5
+ "authors": "Ravi Patel, Cosmin Safta, Reese E. Jones",
6
+ "published": "2024-04-05",
7
+ "updated": "2024-04-05",
8
+ "primary_cat": "cond-mat.mtrl-sci",
9
+ "cats": [
10
+ "cond-mat.mtrl-sci",
11
+ "cs.LG"
12
+ ],
13
+ "label": "Original Paper",
14
+ "paper_cat": "Graph AND Structure AND Learning",
15
+ "gt": "Composite materials with different microstructural material symmetries are\ncommon in engineering applications where grain structure, alloying and\nparticle/fiber packing are optimized via controlled manufacturing. In fact\nthese microstructural tunings can be done throughout a part to achieve\nfunctional gradation and optimization at a structural level. To predict the\nperformance of particular microstructural configuration and thereby overall\nperformance, constitutive models of materials with microstructure are needed.\n In this work we provide neural network architectures that provide effective\nhomogenization models of materials with anisotropic components. These models\nsatisfy equivariance and material symmetry principles inherently through a\ncombination of equivariant and tensor basis operations. We demonstrate them on\ndatasets of stochastic volume elements with different textures and phases where\nthe material undergoes elastic and plastic deformation, and show that the these\nnetwork architectures provide significant performance improvements.",
16
+ "main_content": "Introduction Symmetry preservation is a key to effective computational physics. The success of symplectic integrators [1, 2] in predicting long time dynamics is one notable example. In fact, symmetries and other a priori exact constraints reduce unneeded complexity in models and can promote stability. In the field of constitutive modeling, the primary symmetry is expressed by the principle of frame invariance [3], or objectivity, which prescribes how a physical function must respond to changes in observer/coordinate frame. Simply put, rotations of the tensorial inputs to a constitutive function must result in corresponding rotations of the output. Now more commonly called equivariance, at least in the scientific machine learning (SciML) literature, this principle allows for elegant simplification of the form of physical models, particularly for isotropic materials whose response to deformation is invariant to all (distance-preserving) rotations of their reference configurations. For the subclass of materials that have pronounced anisotropy, a more limited invariance holds for the subset of rotations that are in their symmetry group. For these materials all transformations of the reference configuration in the symmetry group of the material give the same response to any given loading. There are a number of approaches to embed these symmetries in SciML models so that they hold by construction. Tensor basis (TB) formulations [4] rely on classical tensor basis expansions (TBEs) from representation theory going back to Finger [5], Rivlin [6] and contemporaries [7, 8, 9]. This is still an active field in mechanics and continues with recent work [10, 11]. Based on Rivlin\u2019s work, Ling et al. [4] invented the Tensor Basis Neural Network (TBNN) and utilized it to model crystal response, and fluids applications. The formulation is adaptable to multiple inputs [4, 12] and the often cited monograph of Zheng [13] provides the joint invariants and tensor basis generators for a variety of modeling scenarios. Jones et al. extended the TBNN paradigm to formulations for phenomenological plasticity [12] and to inelastic materials with microstructure [14]. By the same method anisotropy can be embedded through the addition of structure tensors characterizing the material symmetry group, which can be learned from data as in the work of Fugh et al. [15] . The basic formulation is suitable for other ML representations, for example Gaussian Processes [16, 17]. A recent contribution [18] surveys the variety of TBNN formulations for hyperelasticity. In contrast to the TBNN approach, equivariant neural networks focus on the combination of information that is not at the same material location, as in convolution of field data. This aspect of the equivariance principle is particuarXiv:2404.17584v1 [cond-mat.mtrl-sci] 5 Apr 2024 \f2 larly germane to materials with microstructure, where the principle involves the rotations of finite size representative samples not just tensorial data at material points. Pixel-based convolutional neural networks can learn this symmetry inexactly, given enough data. In fact augmentation has been used to exploit this route, for example Dielemann et al. [19] augmented the convolutional layers of a CNN with the orthogonal transformation accessible on a grid, i.e. \u03c0/4 rotations and inversions. Graph convolutional neural networks (GCNN) [20, 21] have a degree of embedded equivariance due to the permutational invariance of their convolution kernels, i.e. the kernel is not a function of the position. Along these lines, there have been approaches based on constrained kernel construction. Worrall et al. [22] developed filters based on circular harmonics and Chidester et al. [23] used a discrete Fourier transform to embed rotational invariance in convolutional filters. General strict equivariance for convolutional NNs began with theoretical developments. Cohen and Welling [24] outlined the mathematics whereby convolutional networks will be equivariant with respect to any group. Then Kondor and Trivedi [25] proved that convolutional structure is necessary and sufficient for equivariance to the action of a compact symmetry group using concepts from abstract algebra. Finzi et al. [26] provided a significant extension of the Cohen and Welling treatment of small, discrete symmetry groups to continuous (Lie) groups, such as the special orthogonal group SO(3). Practical implementations of equivariant neural networks (EqvNNs) followed. A particular formulation of equivariant convolutions using spherical harmonic expansion and the mathematics of tensor product spaces orchestrated by the Clebsch-Gordon algebra was developed by Thomas et al. [27] and followed by Batzner et al. [28] and Schmidt et al. [29]. This Tensor Field Network (TFN) was created with molecular interactions in mind and was applied to point cloud data. This development was quickly followed up with applications to continuous fields. For instance, Sun and coworkers have been particularly active in this field. Vlassis et al. [30] used it in the context of hyperelasticity, Heider et al. [31] employed it in modeling phenomenological plasticity, and Cai et al. [32] applied it to represent permeability fields. In this work we adapt the equivariant TFN to the task of representing the response of polycrystalline materials. Our contributions are: (a) hybridizing the EqvNN with a TBNN for the homogenization task, (b) demonstrating the reuse weights on edges is accurate and effective in reducing overparameterization, (c) showing how pruning can combat the combinatorial explosion of the spherical harmonic expansion and provide generalization, and (d) extension of the TB-EqvNN to evolving processes through novel recurrent and ordinary differential equation neural network implementations. The proposed framework is illustrated by multiple architectures that are show to be effective at the task of homogenization. In the next section we introduce homogenization in the setting of anisotropic constituents, starting with representation theory for homogeneous materials. We also pose the challenge of finding a compact representation for an aggregate of multiple constituents with different symmetries. In Sec.3, we review the data generating model for the polycrystalline exemplar and provide details of the diverse datasets we use for the following demonstrations. Sec.4 provides the details of the proposed tensor basis, equivariant graph convolutional neural network architecture that can be employed as representation for the homogenized response of polycrystals and similar materials. This section also includes the mathematics of irreducible representations (IRs), spherical harmonic expansion and how these interplay with classical tensor basis representations. App. A provides additional exposition of the fundamentals of IRs. Then Sec.5 provides demonstrations of the efficacy of the TB-EqvGCNN for crystal elasticity and crystal plasticity exemplars. Finally, we summarize the findings and give directions for future work in Sec.6. 2 Homogenization of anisotropic aggregates In this section, first we introduce the fundamentals of anisotropy for solids, then the homogenization problem and the representation challenge that follows. Throughout the following, we use a to index basis elements in tensor basis expansions, I to index cells in discretized fields, and i to index spatial tensor components. 2.1 Symmetry and structural tensors A structural tensor A is a tensor that characterizes a point group symmetry, i.e., a finite subgroup of the proper rotations, G \u2282SO(3), via the property of invariance to group action G \u22a0A = A \u2200G \u2208GA, (1) so that an anisotropic response function \u02c6 S(E), \u02c6 S(G \u22a0E) = \u02c6 S(E) (2) can be represented with an isotropic function S = \u02c6 S(E, A) (3) \f3 of two arguments, the original input E and the structural tensor A. Here GA is the symmetry group and \u22a0is the Kronecker product i.e. G \u22a0A = G \u22a0 X i,j,.. [A]ij...ei \u2297ej \u2297... = X i,j,.. [A]ij...Gei \u2297Gej \u2297... (4) follows from the Rychlewski-Zhang theorem [33], which is sometimes called the isotropization theorem. The operation G\u22a0defines group action of G for (Cartesian) tensors of any order. In this work, we concentrate on the stress response S due to elastic strain E. In this case, equivariance is defined as G \u22a0S(E, A) = S(G \u22a0E, G \u22a0A) G \u2208SO(3) (5) which requires that a change of basis of the inputs results in the corresponding rotation of the output. This is also the definition of an isotropic function. A key result of Eq. (1) is S(E, G \u22a0A) = S(E, A) \u2200G \u2208GA (6) i.e. changing the reference orientation with a symmetry operation G \u2208GA leads to the same response. In other words rotating the material by G but keeping the imposed strain E the same results in same stress S. Given the structural tensor A, the stress S can then be represented with a tensor basis [34, Ch.3]: S = S(E, A) = X a \u02c6 ca(I)Ba, (7) formed from the product of coefficients ca, which are functions of the joint scalar invariants I, and tensor basis B = {Ba}. This assumes the appropriate invariants and basis for the inputs {E, A} can be found [34, 13]. Remark. We have been non-specific about the particular stress measure. Both the Cauchy stress and the second Piola-Kirchhoff stress are symmetric and have the similar representations; however, the second Piola-Kirchhoff has the advantages of direct connection with a potential and being in the same frame as the structure tensor. While the second Piola-Kirchhoff stress is invariant with respect to superposed rigid motions [35, 36] in the current configuration, it still needs to respect a change of basis in the reference, known as material frame indifference [3]. Hence, we associate S with second Piola-Kirchhoff stress for the remainder of this work. 2.2 Homogenization We focus on the prediction of the evolution of the average of stress \u00af S with strain E(X, t) in a sample region \u2126: \u00af S(t) \u22611 V Z \u2126 S (E(X, t), \u03d5(X)) d3X , (8) with volume V composed of anisotropic component materials characterized by a microstructural field \u03d5(X) observed at time t = 0. Here X is the reference position of the material and t is time. Formally we exchange this formulation, based on, for example, texture orientation angles \u03d5(X) [37, 38, 39], for a formulation based on the structure tensors A(X) of each point X: \u00af S(t) \u22611 V Z \u2126 S (E(X, t), A(X)) d3X (9) This shift is important since it allows access of representation theory [40, 34, 13, 41] and clarifies the equivariance requirements, as in Eq. (5). We assert the isotropization theorem holds for this case so that the function \u00af S has to be equivariant to SO(3): G \u22a0\u00af S \u22611 V Z \u2126 S (G \u22a0E, G \u22a0A) d3X \u2200G \u2208SO(3) . (10) Furthermore the analog of Eq. (6) holds by virtue of Eq. (1). To obtain the stress field S(E(X, t), A(X)) the compatible strain field E(X, t) needs to be solved for given the imposed strain, which is prescribed by the boundary or the average strain \u00af E(t). The goal of the NN models described in Sec.4 is to predict the mean stress \u00af S given only: (a) the initial microstructure A(X), and (b) the external, applied strain \u00af E(t), in effect bypassing the boundary value solve. \f4 2.3 Representation problem The representation problem is to find the model, \u00af S, as a function of the external loading \u00af E(t) and the microstructural anisotropy field A(X) to the sample average stress \u00af S(t). The fact that many microstructures, such as grains of a polycrystal or phases of an alloy, are composed of a collection of distinct subdomains, allows us to decompose \u2126into finite number of subdomains with constant properties. Furthermore we need to discretize the domain \u2126into mesh of cells \u222aK\u2126K = \u2126each with a constant {AK} and an (invariant) distance graph G that encodes the spatial relationships of the cells. With a finite collection of homogeneous subdomains, the problem involves approximating \u00af S(t) \u22611 V Z S (E(X, t), A(X)) d3X \u22481 V X K S (EK(t), AK, G) \u2206 V \u2248\u02dc S(\u00af E(t), {AK}, G) (11) while preserving G \u22a0\u02dc S(\u00af E(t), {AK}, G) = \u02dc S \u0000G \u22a0\u00af E(t), {G \u22a0AK}, G \u0001 \u2200G \u2208SO(3) (12) To our knowledge there is no exact theory that covers this case, i.e. where we are trying to combine the effects of a field or multiple subcomponents which do not have the same symmetries (which we call heteroanisotropy) or are rotations of the same symmetry (which we call homoanisotropy). Certainly classical approximate mixture rules [42, 43] are applicable, such as the Hill-Voigt-Reuss [44, 45, 46] and the Taylor-Sachs [47, 48] estimators, but these can be inaccurate [37]. Remark. The Hill average of constant strain (Voigt) and constant stress (Reuss) assumptions for the modulus C: \u00af CHill = 1 2 \uf8eb \uf8edX K \u03bdKRK \u22a0C + \"X K \u03bdKRK \u22a0C\u22121 #\u22121\uf8f6 \uf8f8 (13) can be an adequate estimator at small strains [37] where the grain contributions are more or less independent. Here \u03bdK = VK/V are the volume fractions of the grains. This mean mixture modulus tensor can be used to estimate stress with a St. Venant model: \u00af S = \u00af CE and also give an expectation of the symmetries of polycrystalline aggregates. Note that mixture estimators of this type ignore continuity/compatibility and relaxation of the displacement field. Remark. A few approaches to the representation problem beyond simple mixture rules are obvious but flawed. One approach is to form a TB representation of using all the joint invariants and basis generators for {AK}, for example for 4th order AK: S = \u00af S(\u00af E, {AI}) = \u02c6 c0I + \u02c6 c1 \u00af E + \u02c6 c2 \u00af E2 + (14) X I h \u02c6 c(1,1) I symAI \u00af E + . . . i + X I,J h \u02c6 c(1,2) IJ symAI \u00af EAJ + \u02c6 c(2,2) IJ symAI \u00af E2AJ + . . . i ... where the coefficients \u02c6 cI... are (NN) functions of all the scalar invariants. Clearly this is cumbersome since the permutations in the joint invariants grows rapidly with the number of subdomains and the expansion ignores the spatial proximity encoded in G. Another approach is to form TB representation using a single representative structure tensor \u00af A, for example for a 4th order A:. S = \u00af S(\u00af E, \u00af A) = X a \u02c6 ca(I)Ba (15) = \u02c6 c0I + \u02c6 c1 \u00af E + \u02c6 c2 \u00af E2 + \u02c6 c3 sym\u00af E\u00af A + \u02c6 c4 sym\u00af E2 \u00af A + ... + \u02c6 c8 sym\u00af E2 \u00af A2 This has the advantage that a single material tensor basis expansion can be employed; however, a secondary model \u00af A = \u00af A({AK}) needs to be constructed to determine \u00af A and a priori assumptions, such as \u00af A is the same rank as AK, are likely restrictive [49]. The fact that even an aggregate of homoanisotropic subdomains does not result in a symmetry from the same or with a structural tensor of the same order is illustrated by the isotropic limit, where, for example, a large collection of cubic crystals, with 4th order structural tensors, tends to isotropy, which has the 2nd order identity as its characteristic tensor. These issues motivate a mixture of tensor basis representations and equivariant convolution described in Sec.4. \f5 3 Polycrystal data Polycrystalline elastoplasticity is a canonical exemplar of the behavior of aggregates of constituents with different material symmetries. Polycrystalline aggregates are ubiquitous in the materials science of metals, ceramics, rocks and ice, and at the center of many efforts to upscale micromechanics to large scale plasticity phenomenology [50, 51, 52, 53, 54, 55, 56]. Modeling the stress response of polycrystalline materials is important in simulating these materials at a larger scale. In polycrystalline materials, microstructure is a composition of subdomains each with an anisotropic response. The datasets are comprised of polycrystalline stochastic volume elements (SVEs) where boundary conditions are used to evoke nominally homogeneous deformations. The SVEs are finite size samples which display response variability sample to sample. The quantity of interest in our study is the sample average stress. 3.1 Elasticity A polycrystal composed of face centered cubic (FCC) crystals is a particularly common example in structural metals. Each FCC crystal in the aggregate has the point symmetry group Oh and a 4th order structure tensor [13]: A = Oh \u2261 3 X i=1 ei \u2297ei \u2297ei \u2297ei = \u03b4ij\u03b4jk\u03b4kl\u03b4liei \u2297ej \u2297ek \u2297el , (16) if the symmetry axes are aligned with the Cartesian axes {ei}. Any other orientation can be obtained via rotation R = R(\u03d5) \u2208SO(3) R \u22a0A = 3 X i=1 Rei \u2297Rei \u2297Rei \u2297Rei = 3 X i=1 ri \u2297ri \u2297ri \u2297ri (17) to alignment with local texture/orientation \u03d5(X). The associated elastic modulus tensor C \u2261\u2202ES = \u03bbI + 2\u00b5J + \u03b1A (18) is composed of two isotropic 4th order tensors [57], I = I \u2297I = \u03b4ij\u03b4klei \u2297ej \u2297ek \u2297el (19) J = 1 2(\u03b4ik\u03b4jl + \u03b4il\u03b4jk)ei \u2297ej \u2297ek \u2297el, (20) and the cubic structural tensor A [58]. The isotropic tensors I and J are invariant to SO(3), which is evident since pairs of R are summed and RT R = RRT = I. In terms of the more familiar cubic modulus constants: C11 \u2261[C]iiii = \u03bb + 2\u00b5 + \u03b1, C12 \u2261[C]iijj = \u03bb, and C44 \u2261[C]ijij = 2\u00b5. For a single crystal, Kambouchev et al. [59] provides a general polyconvex hyperelastic model with cubic symmetry. The elastic potential \u03a6, \u03a6 = \u03a6(E, A) = \u03a6(trE, trE\u2217, det E | {z } Iiso , A : E \u2297E, A : E \u2297E2, A : E2 \u2297E2 | {z } IA ) , (21) takes the scalar invariants I = Iiso\u222aIA as inputs, where IA are the joint invariants of \u00af E and A. Here E\u2217= det(E)E\u22121 is the adjugate of E and three traces of products of the structural tensor A and the strain E are the anisotropic scalar invariants, IA. Note, an equivalent set of invariants are Iiso = trE, trE2, trE3. For the cubic structure tensor A = Oh the anisotropic invariants can be reduced to IA = (X i (ri \u00b7 Eri)2, X i (ri \u00b7 Eri)(ri \u00b7 E2ri), X i (ri \u00b7 E2ri)2 ) (22) A corresponding tensor basis can be obtained from the derivatives of the invariants: B = {\u2202EIi} = {B1=I, B2=E, B3=E\u2217} \u222a{B4, B5, B6} (23) \f6 where B4 = 2AIJP QEP QeI \u2297eJ (24) = X I 2 (rI \u00b7 ErI) rI \u2297rI B5 = \u0002 AIJP QE2 P Q + EMN(AMNIQEJQ + AMNJQEIQ) \u0003 eI \u2297eJ (25) = X I (rI \u00b7 E2rI + 2(rI \u00b7 ErI)2)rI \u2297rI B6 = 2E2 MN(AMNIQEJQ + AMNJQEIQ)eI \u2297eJ (26) = 4 X I ((rI \u00b7 E2rI)(rI \u00b7 ErI))rI \u2297rI . for A satisfying the same symmetries as the elastic modulus tensor: AIJP Q = AJIP Q = AP QIJ = AP QJI. This basis spans the full output space of symmetric tensors, unless the eigenvectors of E are aligned with the cubic axes {rI} in which case the basis is still sufficient to represent S. Note the scalar invariants has all the traces of the tensor basis, with det E substituted for the constant trI = 3. Also note E2 P Q is the PQ-th component of E2 (not the square of the component). The appendix of Ref. [59] provides derivatives of invariants with respect to the strain measure. See also Ref. [10] and Ref. [11] for decompositions of the elasticity tensor and bases for elastic symmetry classes. The stress of a polycrystalline SVE sample is obtained by solving for a continuous displacement field that is consistent with prescribed kinematic boundary conditions. We use the finite element method to generate these solutions. 3.2 Plasticity The previous section gives an overview crystal elasticity in a finite strain; however, metal crystals typically exhibit plasticity at moderate strains. To generate plastic response data we used a common elastoviscoplastic model [52, 53, 60]. In each crystal, plastic flow Lp = X \u03b1 \u02d9 \u03b3\u03b1s\u03b1 \u2297n\u03b1 (27) could occur on any of the slip planes defined by the slip plane normal n\u03b1 and slip direction s\u03b1. Here Lp is the plastic velocity gradient and \u02d9 \u03b3\u03b1 is the slip rate. A power-law driven by the shear stress \u03c4\u03b1 resolved on slip system \u03b1 governs the slip rate: \u02d9 \u03b3\u03b1 = \u0393 \f \f \f \f \u03c4\u03b1 g\u03b1 \f \f \f \f m\u22121 \u03c4\u03b1 . (28) and in this model the slip resistance g\u03b1 evolves according to [61, 62] \u02d9 g\u03b1 = (H \u2212R g\u03b1) X \u03b1 |\u02d9 \u03b3\u03b1| , (29) where H is the hardening modulus and R is the recovery constant. See Ref. [12] for more details. 3.3 Datasets We created two classes of datasets to demonstrate the NN architectures described in the next section: (a) a comprehensive sampling of polycrystalline strain states for a variety of polycrystal types and realizations, and (b) a sampling of polycrystalline realizations undergoing plasticity in unaxial loading. Realizations had between 4 and 26 grains which were discretized over 253 element meshes. The elastic datasets included: (1) a homoanisotropic cubic case with the properties of Fe (FCC steel) and uniform texture, (1) a heteroanisotropic binary alloy of cubic (Cu) and tetragonal (Sb) in a 9:1 ratio with uniform texture, and (3) a cubic Fe case with polarized orientation/texture. All relevant material properties are given in Table 1. For each of these datasets 2200 realizations were created, 1000 for training, 200 for in-training testing, and 1000 for independent, post-training validation. Convex polyhedral grains in a unit cube were were assigned using a Voronoi tesselation. A Karhunen-Lo` eve expansion (KLE) with a correlation length of 0.2 unit cells was used to impart spatial correlation in the rotations RK of neighboring crystals in the aggregate. For the heteroanisotropic polycrystalline dataset we \f7 assigned some grains to be cubic with structural tensor Oh given in Eq. (16) and others with the tetragonal structural tensor: D4 = 2 X i,j,k,l=1 Re(\u0131(i+j+k+l))ei \u2297ej \u2297ek \u2297el , (30) which differs from the cubic Oh structure tensor since the structure and response along one orthogonal axis is different than others in a tetragonal crystal. Also note this structure tensor is not completely symmetric, unlike Oh. For the uniform texture cubic and mixed cubic/tetragonal data, the KLE generated a field of 4 Gaussian random variables which were transformed to samples on the unit 3-sphere by normalizing the 4-vector at every sample. For the polar cubic dataset the KLE generated 2 Gaussian random variables with standard deviation 0.1 \u03c0 radians which were used to generate pole vectors deviating from a given direction and the rotations about these poles where sampled from a uniform distribution spanning 0 to 2 pi radians. The field of structure tensors was obtained via AK = RK \u22a0A0 K where A0 K is a structure tensor sampled from the selected distribution in its canonical orientation. For all elastic cases, the applied strains were generated from uniform samples the components of the displacement gradient in the hypercube [\u22120.01, 0.01]9 and the polycrystals were equilibrated to these nominal applied strains. Fig. 1 shows that most of the dataset deviates significantly from the Hill estimate \u00af SHill = \u00af CHill \u00af E with \u00af CHill given by Eq. (13). For the crystal plasticity dataset we used parameters representative of steel, refer to Table 1, and solved the equilibrium equations for tensile ramp-loading boundary conditions. Using the same generation process, 7,000 samples were created with a different arrangement of FCC grains; 5,400 were used for training, 600 for in-training testing, and a 1000 for post-training validation. Boundary conditions sufficient to effect the tensile deformation and prevent rigid motion were applied at a strain rate of 1/s to a maximum strain of 0.4%. Fig. 2 shows the transition from elastic stretching to plastic flow in one realization. Although each grain has a relatively simple response, the collective behavior is complex. Further details can be found in Ref. [60] and Ref. [21]. Fe Elastic moduli C11 204.6 GPa C12 137.7 GPa C44 126.2 GPa reference \u0393 1.0 s\u22121 slip rate rate sensitivity m 20 exponent slip resistance g\u03b1 122.0 MPa hardening modulus H 355.0 MPa recovery constant R 2.9 Cu Elastic moduli C11 180 GPa C12 127 GPa C44 97 GPa Sb Elastic moduli C11 59 GPa C12 28 GPa C44 26 GPa C13 0.64 C12 C33 1.22 C11 C66 0.33 C44 Table 1: Material properties for the polycrystalline elastic and plastic datasets. For the Fe cubic and Cu/Sb alloy cases the textures of the grains were drawn from a uniform sampling of SO(3), while for the polarized cases the rotation samples were drawn from a distribution with 0.1 \u00d7 2\u03c0 steradians solid angle dispersion around a pole (001). The Cu/Sb alloy was in a 9/1 ratio. Fe (steel) parameters are from Ref. [60]. Cu and Sb parameters are from Ref. [63] and Ref. [64]. 4 Model architecture As framed in Eq. (11), the task for the NN model is to approximate the map from the imposed strain \u00af E(t) and the (initial) structure tensor field {AK} to the average stress \u00af S(t) for the sample. This homogenization model needs to account for the spatial dependence in the sample volume and, as stated in Eq. (12), it is required to be equivariant so all operations to this mix of input tensors need to be equivariant. A few methods have been developed to embed equivariant symmetries. In this work we extend and combine tensor basis neural networks (TBNNs) and the equivariant convolutional tensor field network (TFN) of Thomas et al. [27]. The TBNN [4, 12, 14] is an equivariant function representation that uses classical representation theorems [40, 34, 13, 41]; however, as discussed in Sec.2.3 it is generally only applicable to single materials, i.e. for models of a material point. Motivated by mixture rules, we use a tensor basis transformation at each cell K to form an approximate stress \u02dc sK and then equivariant convolution is applied to accommodate local relaxation constrained by continuity/compatibility that is ignored by simple mixture rules. Following the TFN [27] we use an equivariant convolution neural network (EqvCNN) that relies on spherical harmonics to form the filters, since these functions are inherently equivariant to \f8 0.00 0.02 0.04 0.06 0.08 0.10 0.12 RELATIVE DEVIATION DISTRIBUTION cubic alloy polar Figure 1: Polycrystal: relative deviation of the stress from the Hill estimate \u2225\u00af S \u2212\u00af SHill\u2225/\u2225\u00af S\u2225for the three elastic datasets. Figure 2: Polycrystal (left to right panels): first Euler angle of orientation vector field \u03d5, stress S states: elastic (0.1%), transition (0.2%), plastic (0.4%) (colored by \u03c311 with the same scale for all three panels [dark: < 100 MPa, light: > 400 MPa]). rotations and also are expressive. To accommodate the relative contributions of the cells we also include the cell volume fraction \u03bdK in the inputs. The mesh holding the cell data is encoded as a graph G with neighbors and relative distances between cells to facilitate the application of the convolutional filters. In the overall network, the TBNN provides a learnable reduction/embedding of the input data on a per-cell basis, the EqvCNN provides the spatial operations to mix the influence of neighboring cells, and global average pooling emulates the volume average in Eq. (11). Rather than work with products of tensors in their natural Cartesian basis with arbitrary product rules between tensors of different order, we follow Refs. [27, 32] and manipulate them in an equivalent form that enables general product rules. Sec.4.1 gives a brief description of how to handle products of different orders of tensors in a general way through the irreducible representation (IR) of group theory [65, 66, 67], This approach reduces the amount of information produced by general tensor products by omitting the higher order components of the irreducible representations of tensor products. We begin with the building blocks of equivariant NNs that are suited to the homogenization task, namely local embedding, sample-wise convolution and pooling. The adaptation of the tensor basis formulation to work on IR vectors is given in Sec.4.2. Pooling is briefly described in Sec.4.4. Models for the elastic response of polycrystals are described in Sec.4.5, while Sec.4.6 describes models of anisotropic inelasticity using a novel equivariant recurrent neural network (RNN) and a potential-based neural ordinary differential equation (NODE). Throughout this section, we will use a superposed hat, such as \u02c6 c, to indicate learnable NN functions. \f9 convert TB to IR local TBNN EqvGCNN global pool convert from IR \u00af E {AK} G {b(0) K }, {b(2) K } sk = P a \u02c6 ca(b(0) K ) b(2) K convolution convolution convolution \u00af s(\u2113) = 1/N P K s(\u2113) K \u00af S = P \u2113C(\u2113) (1,1)\u00af s(\u2113) \u00af S Figure 3: Neural network architecture for elastic response. Inputs are (a) the external strain loading of the sample \u00af E(t), (b) the structure tensors for each cell K, and the graph G that provides the cell-to-cell connectivity and cell volume fractions \u03bdK. The output is the sample average stress \u00af S. After converting the scalar invariants and tensor basis generators of \u00af E and AK, the local TBNN layer provides an embedding/reduction of these inputs at each cell K. This cell data is then processed by a stack of equivariant convolutions. The output of the stack is then pooled and this converted to the spatial output \u00af S. 4.1 Irreducible representations of tensors An irreducible representation (IR) of a tensor is systematic way of handling tensors of various order and products thereof by decomposing them and flattening them into a collection of vectors. The map from tensors in their natural representation with basis in R3 is accomplished by the Clebsch-Gordon (CG) matrices C(\u2113) (\u03b1,\u03b2). In this notation \u2113\u2208 |\u03b1 \u2212\u03b2|, . . . , \u03b1 + \u03b2 is the order of the output IR, and \u03b1 and \u03b2 are the orders of the input IRs. For example a symmetric second order tensor A with basis ei \u2297ej and 6 independent components is decomposed into one 1-vector a(0) and one 5-vector a(2) [a(0)]i = 3 X j,k=1 [C(0) (1,1)]ijk[A]jk i \u2208{1} (31) [a(2)]i = 3 X j,k=1 [C(2) (1,1)]ijk[A]jk i \u2208{1, . . . , 5} where a(0) carries the trace of A and a(2) holds the deviatoric information. Likewise tensors of any order can be converted to IR vectors and the transpose of the CG coefficients provide the inverse of the linear change-of-basis map, \f10 e.g. [A]jk = X \u2113=0,2 2\u2113+1 X i=1 [C(\u2113) (1,1)]ijk[a(\u2113)]i . (32) The CG transformation applies to both tensors in their natural form and in their IR form where each is a vector in R2\u2113+1 where \u2113is order of the order of the IR vector. Note that our only direct use of the TFN implementation e3nn [27] is to access of the library of CG coefficients. Further exposition of the fundamentals of IRs is given App. A. 4.2 Tensor basis expansion As we remarked in Sec.2.3, forming a TB expansion across cells or grains is infeasible but we can use a TB layer at the cell level as a form of embedding prior to processing the data on the distance graph G with equivariant convolutions. We chose to apply the TB expansion to the CG encodings of IK and BK. This is possible because the CG encoding commutes with the TB expansion. In the natural Cartesian basis we have \u02dc SK = X a \u02c6 ca(IK)BKa (33) at each cell K where we ignore invariants and basis generators that cross cells, leaving spatial correlation to the subsequent convolutional layers. In Eq. (33), \u02c6 ca(IK) are NN functions of the invariants implemented as a monolithic feed-forward NN with NI inputs and NB outputs. X j,k [C(\u2113)) (1,1)]ijk\u02dc S]jk = X j,k X a [C(\u2113)) (1,1)]ijk[\u02c6 ca(I)Ba]jk (34) = X a \u02c6 ca(I) X j,k [C(\u2113)) (1,1)]ijk[Ba]jk [s(\u2113)]i = X a \u02c6 ca(I)[b(\u2113) a ]i In effect we obtain one 1-vector {s(0) K } corresponding to the approximate pressure in the cell K, and one 5 vector corresponding to the approximate deviatoric stress in the cell {s(2) K }. Since the TB expansion is via scalar multiplication and tensor addition, rotation of the inputs commutes with the function and hence the operation is equivariant, i.e. s(\u2113)(R) = X a \u02c6 ca(I)D(\u2113)(R)b(\u2113) a = D(\u2113)(R) X a \u02c6 ca(I)b(\u2113) a = D(\u2113)(R)s(\u2113)(I) (35) in terms of the Wigner D matrices, refer to App. A and references therein. 4.3 Equivariant convolution Convolution is a form of tensor multiplication between data zK = [z(\u2113), \u2113= 0, .., \u2113max]K and a kernel f(X) operating over the mesh of cells in the graph G: z(\u2113) K = ConvG(zK) = \u02c6 f \u2217z = X \u03b1,\u03b2 Z C(\u2113) (\u03b1,\u03b2)\u02c6 f(\u03b1)(X\u2032 \u2212XK)z(\u03b2)(X\u2032)d3X\u2032 (36) \u2248 X \u03b1,\u03b2 X J C(\u2113) (\u03b1,\u03b2)\u02c6 f(\u03b1)(XJ \u2212XK)z(\u03b2)(XJ)\u03bdJ , where \u03b1 is the order of the filter \u02c6 f(\u03b1) and \u03b2 is the order of the input z(\u03b2). We emphasize that for each convolutional layer this formulation allows for a collection of input vectors with arbitrary orders to be mapped to a collection of output vectors of different orders. Note unlike Ref. [27], which was concerned with point clouds, we use the cell volume fraction \u03bdJ as the integration weight in the summation and use the same filter for all edges of the distance graph G, i.e. weights are reused throughout the application of the convolution to the graph. Again we require convolution to be an equivariant operation such that D(\u2113)z(\u2113) K = ConvG(D(\u03b2)z(\u03b2) K ) , (37) \f11 where D(\u2113) is the appropriate order Wigner D matrix which effects a change of basis for an IR vector of order \u2113, refer to App. A. As in Thomas et al. [27], if the kernel \u02c6 f takes the special form \u02c6 f(\u2113)(rr) = \u02c6 \u03c6(\u2113)(r) \u2297Y(\u2113)(r) , (38) the convolution is equivariant, which relies on the fact that distances are invariant, and directions encoded by the spherical harmonic function to rotate appropriately. Here \u02c6 \u03c6(\u2113)(r) are learnable NN functions of distance r = \u2225X\u2032\u2212X\u2225 from the kernel center X and any other point X\u2032, and Y(r) are spherical harmonic functions which only depend on the orientation unit vectors r = (X\u2032 \u2212X)/r. Note unlike Ref. [27], which was applied to molecular graphs and used a different \u02c6 \u03c6(\u2113) for each edge, we exploit similarity in the homogenization task and use a unique \u02c6 \u03c6(\u2113) for the entire graph. This results in a considerable reduction in the number of parameters and no discernible loss of accuracy. As in Refs. [27, 32, 21, 68] we include a self interaction z(\u2113) K = ConvG(zK) + X \u03b1,\u03b2 C(\u2113) (\u03b1,\u03b2)\u02c6 w(\u03b1)z(\u03b2) K , (39) which allows for the extraction of graph Laplacian, grain misorientation and related features. Note equivariance prevents the addition of a nonzero bias [27] . Also the TB embedding can be seen as a special form of a cell-level, self-interaction. We also follow Ref. [27] and apply nonlinear activation functions to tensors by scaling them by standard activation functions on their norms. For tensor, z in IR form and activation function, \u03c3, the equivariant activation function is: \u03c3G(z) = \u03c3(||z||2 + b)z (40) where b is a trainable scalar bias. The complexity of the spherical harmonic expansion is only limited by the hyperparameter \u2113max. The combinatorics of the general tensor product afforded by the IR products results in a proliferation of terms of different orders and a explosion in the number of parameters needed to define the kernel and self-interaction functions. For any given application it is unlikely all terms are needed. Some physical intuition, such as in the TB expansion, can be used to downselect terms, but this is generally not sufficient. Various techniques exists, such as L0 sparsification [69, 70]., that can be used to systematically prune the large combinatorial, product space. In this work we employed a straightforward greedy algorithm, whereby the least influential products are omitted, the overall network is retrained, and the process is repeated until the loss starts to increase significantly. 4.4 Pooling The global average pooling we use to go from cell data to sample-level output : z(\u2113) = 1 N X K z(\u2113) K , (41) is similar to volume normalized integration Eq. (11). Here N is the number of cells being pooled. This operation is clearly equivariant since it is only requires addition and scalar multiplication. Note pooling does not change the order (\u2113) of the inputs which constrains the output of the preceding convolutional layer if an output of the pooling is required to be of a certain order, as in Fig. 3. Local pooling is similar but applied to disjoint patches of the spatial graph to produce a coarser graph. 4.5 Elastic models The schematic in Fig. 3 depicts a stack of NN layers with equivariant operations that predict the elastic stress of an anisotropic aggregrate. In this architecture the raw inputs \u00af E and {AK} are first reduced to their joint scalar invariants {IK}, as in Eq. (21), and basis generators {BK}, as in Eq. (23). Then these TB inputs at each node of the distance graph G are converted to their equivalent IRs so then can be operated on by the subsequent trainable layers. The first trainable layer is a TB embedding that operates on each cell independently to produce an approximate cell-wise stress which is fed into the following equivariant convolution stack. The last layer of the convolutional stack is constrained to produce a field of second order tensors (as represented by one 0th order and one 2nd order IR) which is then pooled and converted to a spatial representation. This symmetric spatial 2nd order tensor is the estimate of the mean stress for the sample. In this network exponential linear unit (ELU) activations are used in the TB and equivariant convolutions which are the only trainable aspects. An alternative architecture which only operates on the scalar invariants to produce a potential is omitted for brevity since it is subsumed by the inelastic model with the same approach presented in the next section. \f12 Convert to IR Encoder Decoder \u00af E(t) {AK} G {b(0) K , b(2) K } convolution local pool convolution local pool convolution RNN convolution global pool \u00af S(t) Figure 4: An equivariant RNN for inelastic response. Inputs are (a) the external strain loading of the sample \u00af E(t), (b) the structure tensors for each cell K, and the graph G that provides the cell-to-cell connectivity and cell volume fractions \u03bdK. Output is the sample average stress S(t) over time t. 4.6 Inelastic models The history dependence and internal states of inelasticity requires more complex architectures that account for the causal effects of the imposed strain. Recurrent neural networks (RNNs) have been used for this task [37, 71], where the hidden states of the RNN model the inelastic state of the material. The Elman RNN [72] has a simpler form than the more recent gated recurrent unit (GRU) [73] and long-term short-term memory unit (LSTM) [74] RNNs, but is directly adaptable to equivariant operations. Specifically, our version of the Elman RNN is hn = \u03c3G(ConvG(xn) + ConvG(hn\u22121)) (42) yn = \u03c3G(ConvG(hn)) where hn is the hidden state at step tn which is initialized to zero at step t0, and yn is the output at at step tn. Each convolution has an independent kernel and no bias. The same operations and restrictions can yield equivariant versions of GRU/LSTM. An encoder-decoder architecture using this RNN is illustrated in Fig. 4. First the inputs are converted to their IRs. This field is then processed by a stack of equivariant convolutions and local pooling to reduce it to a coarse field of features. The RNN propagates this time dependent field which is then processed by another equivariant convolution in the decoder, and finally globally pooled and converted to the spatial output \u00af S(t). Again, in this network the convolutions were the only trainable aspects and used ELU activations. As an alternative we also implemented a potential-based model of the evolving inelastic process illustrated in Fig. 5. It is along the lines of the model in Ref. [14] where additional hidden invariants represent the inelastic state in the potential. Since the scalar invariants and their combinations are trivially equivariant this model is also equivariant. The hidden features evolve by an (augmented) neural ordinary differential equation (NODE) [75, 76] with an input convex [77] right hand side. Briefly, the NODE has the update hn+1 = hn + \u2206 tR(fn, hn) (43) \f13 global pool concatenate Convex NODE EqvGCNN \u00af E(t) {AK} G Iiso(t) {Ianiso(t)}K convolution convolution convolution f = 1/N P K fK f = Iiso \u2295f \u02d9 h = R(f, h) \u00af S = \u2202E \u02c6 \u03a6(h) \u00af S(t) Figure 5: Convex NODE potential GCNN for inelastic response. Inputs are (a) the external strain loading of the sample E(t), (b) the structure tensors for each cell K, and the graph G that provides the cell-to-cell connectivity and cell volume fractions \u03bdK. The additional latent variables h are initialized to zero and the NODE described in detail in Eq. (44). Output is the sample average stress S(t) over time t. for a simple forward Euler integrator with time-step \u2206 t, where h is the augmented hidden state and f are the features coming from the convolutional stack in Fig. 5. We form the right hand side R(x) = rn with an input convex NN (ICNN) r1 = \u03c3(W0x + b0) (44) rn = \u03c3(Wn\u22121x + Vn\u22121rn\u22121 + bn\u22121) to maintain a degree of regularity in the potential that we subsequently take the gradient of. Here the weight matrices Vn are required to be positive and the activations \u03c3 are required to be convex and increasing; the weight matrices Wn and biases bn are unconstrained. We used softplus activations for this NN. Further details can be found in Ref. [77]. Since the isotropic invariants tr\u00af E, tr\u00af E\u2217, det \u00af E and corresponding basis have no local dependence, unlike the anisotropic invariants and basis which vary across subdomains, we have these isotropic components isotropic components bypass convolution. The output stress is obtained by taking the gradient of the potential \u03a6 with respect to strain S = \u2202E\u03a6(h) = X i (\u2202hi\u03a6) | {z } \u02c6 ci \u2202Ehi |{z} Bi (45) which effectively forms a basis {Bi = \u2202Ehi} from the set of hidden invariants h. \f14 Layer output parameters Input \u00af E(3, 3), A(Ncells, 3, 3, 3, 3) 0 Calculate invariants & basis I(Ncells, 6), B(Ncells, 6, 3, 3) 0 Convert to irreducible representation b(0)(Ncells, 6, 1), b(2)(Ncells, 6, 5) 0 Tensor basis embedding s(0)(Ncells, 1, 1), s(2)(Ncells, 5, 1) 74 Equivariant convolution s(0)(Ncells, 1, 1), s(2)(Ncells, 5, 1) 534 Equivariant convolution s(0)(Ncells, 1, 1), s(2)(Ncells, 5, 1) 528 Global pooling \u00af s(0)(1, 1), \u00af s(2)(5, 1) 0 Convert to Cartesian representation \u00af S(3, 3) 0 Output \u00af S(3, 3) 0 Table 2: Equivariant graph neural network for predicting polycrystalline elastic stress \u00af S from imposed strain \u00af E and structure tensor field AK. Dependence on the spatial domain graph G and batch have been suppressed for clarity. 5 Results As described in Sec. 3 we use elastic and elastic-plastic polycrystal SVE datasets demonstrate the proposed architectures. With the elastic datasets we can explore the representations over a general strain space, while with the elastic-plastic dataset we can investigate more complex, history-dependent behavior. Note all outputs and corresponding errors are for outputs normalized over the training sets. The inputs, including time, are also scaled to lie in zero to one. 5.1 Polycrystal elasticity For the elastic datasets we use the architecture illustrated in Fig. 3 since there is no history dependence to the stress response, i.e. the strain at any point in time and anisotropy field are sufficient to make an accurate prediction. Specifics of convolutions and other layers are given in Table 2. 5.1.1 Homoanisotropy and heteroanisotropy Fig. 6 shows the performance of the equivariant network on the three datasets described in Sec.3.3. Although there is some apparent bias to slight under-prediction to the errors for the two more complex cases (alloy and polar texture), overall the predictive quality of the proposed network is excellent with RMSE scores (0.0013, 0.0041, 0.0017) on the held out validation data. We made a comparison with an analogous pixel-based convolutional NN operating on the field of Euler angles using a GCNN from Ref. [21] with 2 convolutions with 8 filters, global pooling, and 3 dense layers. The RMSE errors for the pixel-based CNN (0.077, 0.038, 0.062) are considerably higher, in part due to the complexity in representing the symmetries from the Euler angles. 5.1.2 Sparsification As mentioned the possible permutations of tensor products for a given input and output tensor field leads to a tremendous number of parameters and corresponding redundancies. With reference to Eq. (36), there are a multitude of tensor products are between the trainable filter \u02c6 f(\u03b1) and the selected input tensor z(\u03b2) in IR form that are compatible with a selected input and output. Hence, we explored the effect of sparsification using the cubic dataset for training. We employed a straightforward greedy algorithm were we trained the full network to a plateau in loss, then omitted tensor products with the least significance in terms of the magnitude of the kernel \u02c6 \u03c6(\u2113), and repeated until the accuracy of the network suffered. Fig. 7 shows the sequence of training stages with only the last attempted reduction leading to increase in loss. The regularity in the loss behavior with the greedy stages lead to easy identification of the (quasi)optimal stopping stage. Fig. 8 shows performance of the network trained to cubic data with the penultimate sparsity on the polar data. The transferability of the sparse network is remarkable when compared to that of the corresponding un-pruned, full network. As has been widely observed, the reduction of complexity in the pruned network induces better generalization on held out validation data than the full network which we used as a baseline to explore this transferability. \f15 1.0 0.5 0.0 0.5 1.0 TRUE 0.010 0.005 0.000 0.005 0.010 ERROR S11 S12 S13 S22 S23 S33 CNN EqvGCNN (a) single cubic phase, uniform texture 1.0 0.5 0.0 0.5 1.0 TRUE 0.010 0.005 0.000 0.005 0.010 ERROR S11 S12 S13 S22 S23 S33 CNN EqvGCNN (b) binary cubic/tetragonal alloy, uniform texture 1.0 0.5 0.0 0.5 1.0 TRUE 0.010 0.005 0.000 0.005 0.010 ERROR S11 S12 S13 S22 S23 S33 CNN EqvGCNN (c) single cubic phase, polar texture Figure 6: Crystal elasticity, Differences with held out data for (top) cubic, (middle) cubic and (bottem) tetragonal mixture, biased texture orientation samples. Left: scatter plots of the errors for all stress components, right: distribution of the errors (red) with those of a pixel-based CNN (gray) for comparison. \f16 100 101 102 EPOCH 10 8 10 6 10 4 10 2 100 LOSS stage1 products 26 stage2 products 20 stage3 products 14 stage4 products 8 stage5 products 3 stage6 products 2 Figure 7: Crystal elasticity model sparsification: loss history over greedy pruning stages of the tensor products in the convolutional layers. 1.0 0.5 0.0 0.5 1.0 TRUE 0.010 0.005 0.000 0.005 0.010 ERROR S11 S12 S13 S22 S23 S33 baseline pruned Figure 8: Crystal elasticity model sparsification: comparison of pruned and full/baseline models trained to cubic dataset and predicting the polar dataset. Errors shown for the polar dataset (left: all components for the sparse NN, right: distribution of errors for sparse compared to that of full NN). 5.2 Plastic evolution Using the 3D crystal plasticity simulations of SVEs described in Sec.3.3 we trained an equivariant RNN following the schematic in Fig. 9 and an equivariant potential-based NODE of the type shown in Fig. 10. The details of the two networks are given in Table 3 and Table 4. The performance of the RNN-based NN is shown in Fig. 4 and the comparable performance of the NODE-based model is shown Fig. 5, where differences with held out data as a function of the time-step are shown in the left panels and randomly selected trajectories are compared to data in the right panels. Note in the right panels we plot deviations from mean stress response across dataset ensemble in order to clearly illustrate the level of deviation from the data across the held-out data. Overall the RMSE for the equivariant RNN was 0.007 and the RMSE for the scalar potential network was 0.001 on the held out data, which compares favorably to the RMSE 0.020 of a non-equivariant GCNN in previous work [60, 21]. 6 Discussion and"
17
+ }
abs_9K/validation_abstract_short_2404.17590v1.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.17590v1",
3
+ "title": "Leveraging Intra-modal and Inter-modal Interaction for Multi-Modal Entity Alignment",
4
+ "abstract": "Multi-modal entity alignment (MMEA) aims to identify equivalent entity pairs\nacross different multi-modal knowledge graphs (MMKGs). Existing approaches\nfocus on how to better encode and aggregate information from different\nmodalities. However, it is not trivial to leverage multi-modal knowledge in\nentity alignment due to the modal heterogeneity. In this paper, we propose a\nMulti-Grained Interaction framework for Multi-Modal Entity Alignment (MIMEA),\nwhich effectively realizes multi-granular interaction within the same modality\nor between different modalities. MIMEA is composed of four modules: i) a\nMulti-modal Knowledge Embedding module, which extracts modality-specific\nrepresentations with multiple individual encoders; ii) a Probability-guided\nModal Fusion module, which employs a probability guided approach to integrate\nuni-modal representations into joint-modal embeddings, while considering the\ninteraction between uni-modal representations; iii) an Optimal Transport Modal\nAlignment module, which introduces an optimal transport mechanism to encourage\nthe interaction between uni-modal and joint-modal embeddings; iv) a\nModal-adaptive Contrastive Learning module, which distinguishes the embeddings\nof equivalent entities from those of non-equivalent ones, for each modality.\nExtensive experiments conducted on two real-world datasets demonstrate the\nstrong performance of MIMEA compared to the SoTA. Datasets and code have been\nsubmitted as supplementary materials.",
5
+ "authors": "Zhiwei Hu, V\u00edctor Guti\u00e9rrez-Basulto, Zhiliang Xiang, Ru Li, Jeff Z. Pan",
6
+ "published": "2024-04-19",
7
+ "updated": "2024-04-19",
8
+ "primary_cat": "cs.IR",
9
+ "cats": [
10
+ "cs.IR",
11
+ "cs.AI"
12
+ ],
13
+ "label": "Original Paper",
14
+ "paper_cat": "Knowledge AND Graph",
15
+ "gt": "Multi-modal entity alignment (MMEA) aims to identify equivalent entity pairs\nacross different multi-modal knowledge graphs (MMKGs). Existing approaches\nfocus on how to better encode and aggregate information from different\nmodalities. However, it is not trivial to leverage multi-modal knowledge in\nentity alignment due to the modal heterogeneity. In this paper, we propose a\nMulti-Grained Interaction framework for Multi-Modal Entity Alignment (MIMEA),\nwhich effectively realizes multi-granular interaction within the same modality\nor between different modalities. MIMEA is composed of four modules: i) a\nMulti-modal Knowledge Embedding module, which extracts modality-specific\nrepresentations with multiple individual encoders; ii) a Probability-guided\nModal Fusion module, which employs a probability guided approach to integrate\nuni-modal representations into joint-modal embeddings, while considering the\ninteraction between uni-modal representations; iii) an Optimal Transport Modal\nAlignment module, which introduces an optimal transport mechanism to encourage\nthe interaction between uni-modal and joint-modal embeddings; iv) a\nModal-adaptive Contrastive Learning module, which distinguishes the embeddings\nof equivalent entities from those of non-equivalent ones, for each modality.\nExtensive experiments conducted on two real-world datasets demonstrate the\nstrong performance of MIMEA compared to the SoTA. Datasets and code have been\nsubmitted as supplementary materials.",
16
+ "main_content": "INTRODUCTION Knowledge graphs (KGs), such as DBpedia [20] and YAGO [27], employ a graph structure to organize real-world factual knowledge. \u2217Contact Authors. Lionel Messi Antonela Roccuzzo FC Barcelona Josep Guardiola spouse coach employ teammate 10 170cm 2005 number height start time end time 2021 Neymar Leo Messi Thiago Messi Paris Saint Germain F.C. Mauricio Pochettino child coach employ teammate Neymar Relational Neighbors Relational Neighbors Attribute Neighbors employ employ coach coach MMKG1 Lionel Messi 30 170cm 2021 number height start time end time 2023 Attribute Neighbors Leo Messi MMKG2 Figure 1: The MMEA task between MMKG1 and MMKG2, aligning the entities Lionel Messi and Leo Messi. They provide the backbone of various web-based applications like query answering [18, 28, 38] and search [14, 29]. Recently, several works have extended KGs with additional modeling capabilities, as required by different applications. Multi-modal Knowledge Graphs (MMKGs) extend traditional KGs with multi-modal information, e.g. visual information. However, like traditional KGs, MMKGs suffer from incompleteness and low coverage. Thus, the integration of independently developed MMKGs is paramount. A key task for MMKG integration is multi-modal entity alignment (MMEA), which aims to identify equivalent entity pairs in different MMKGs by taking into account the structure of MMKGs, as well as the attribute and visual information of entities, see e.g. Fig. 1. In this way, MMEA facilitates the exchange of knowledge among different MMKGs. A wide variety of approaches to MMEA have been already introduced. Initial proposals [7, 15, 24, 25] concentrated on the construction of distinct multi-modal fusion modules to integrate entity representations from multiple modalities into joint embeddings and then use aggregated embeddings to predict alignments. A shortcoming of these methods is that they only explore the use of diverse arXiv:2404.17590v1 [cs.IR] 19 Apr 2024 \fZhiwei Hu, V\u00edctor Guti\u00e9rrez-Basulto, Zhiliang Xiang, Ru Li, and Jeff Z. Pan multi-modal representations to enhance the contextual embedding of entities, overlooking the capabilities of inter-modal representations to capture certain types of interactions. To overcome this, some works [8, 11, 23] use siamese networks, transformer mechanisms or contrastive learning strategies to enhance multi-modal knowledge by exploiting inter-modal interaction. However, existing frameworks for MMEA still suffer from serious shortcomings: (1) Modality Distinctiveness. Existing methods have difficulties to explicitly distinguish the importance of each modality. In fact, among all modalities, the structural modal knowledge is the most prevalent. For instance, the FB15K-DB15K dataset has a total of 714,720 structural triples, while it only has 1,624 relation categories, 341 attribute categories, and 26,281 images. Whether we look at the provided data ratios or the results of ablation experiments, it is evident that the structural modality provides a richer source of knowledge and therefore deserves more attention. (2) Modality Interaction Diversity. Existing models place more emphasis on the interaction between uni-modal embeddings while overlooking interactions between uni-modal and jointmodal embeddings, leading to a lack of diversity in modality interactions. We advocate that, in practice, it is necessary to design mechanisms that better capture the interaction between uni-modal and joint-modal embeddings to fully harness the potential of all available modalities. Indeed, the interaction between the joint-modal and uni-modal representations enables simultaneous interactions with more than two modalities, covering the information gaps left by only looking at pairwise interactions. To address the above two shortcomings, we propose the method MIMEA, a Multi-Grained Interaction framework for Multi-Modal Entity Alignment. Specifically, MIMEA includes the following four modules. The Multi-modal Knowledge Embedding module utilizes multiple individual encoders to obtain modality-specific representations for each entity. To effectively combine multi-modal knowledge, the Probability-guided Modal Fusion module takes structural knowledge as the core, and employs a probability distribution mechanism to integrate uni-modal information into joint-modal representations. Furthermore, we introduce an Optimal Transport Modal Alignment module to capture the interaction between uni-modal and joint-modal embeddings. The integration of the Probabilityguided Modal Fusion and the Optimal Transport Modal Alignment modules realizes inter-modal interactions between uni-modal and joint-modal embeddings. Moreover, we introduce an intra-modal contrastive loss to distinguish the embeddings of equivalent entities from those of non-equivalent ones, for each modality. In summary, our main contributions are: \u2022 We propose a framework to address the multi-modal entity alignment task by introducing multi-grained interaction mechanisms into the multi-modal knowledge representation process. \u2022 We design mechanisms to explore intra-modal relationships and inter-modal interactions, ensuring that the aligned entities are semantically close. \u2022 We conduct extensive experiments on two real-world datasets, showing the strong performance of MIMEA. 2 RELATED WORK Entity Alignment. Entity alignment (EA), which aims to identify equivalent entities across different knowledge graphs, is a fundamental data integration task. Existing research focuses on learning embeddings of entities by utilizing the structural information of KGs. Approaches to EA can be divided into two categories: KGEbased methods and GNN-based methods. KGE-based methods \u2018move\u2019 entity embeddings from different KGs into a unified latent space and measure the alignment by calculating the distance between entity embeddings, such as MTransE [10], JAPE [33], IPTransE [39], BootEA [34], RNM [40] and NeoEA [17]. Recently, GNN-based models have achieved remarkable performance in graph learning. Based on this, some works develop GNN-based frameworks for EA, such as KDCoE [9], AliNet [35], MuGNN [3], AttrGNN [26]. However, all the discussed methods ignore the multi-modal knowledge (especially the visual information) available in the knowledge graph. Multi-Modal Entity Alignment. Recently various multi-modal knowledge graphs have become available [24, 25]. Thus many works have investigated how to effectively incorporate visual knowledge into the entity alignment task. PoE [25] combines all multimodal features into a single vector, and measures the trustworthiness of entity pairs by matching their underlying semantics. However, it cannot capture the potential interactions among different modalities. MMEA [7] integrates knowledge from different modalities into a joint representation and then calculates a similarity score between the holistic embeddings of aligned entities. EVA [24] introduces an iterative learning strategy to expand the set of training seeds. HMEA [15] encodes the multi-modal knowledge into the hyperbolic space, and uses aggregated embeddings to predict alignments. MSNEA [8] integrates visual features to guide the learning process of relation features and adaptively assigns attention weights to capture valuable attributes for alignment. MCLEA [23] explores intra-modal and inter-modal interactions via contrastive learning to reduce the gap between modalities. MEAformer [11] proposes a transformer-based model which can dynamically predict relativized mutual weights among modalities for each entity, encoraging the emergence of adaptive modality preferences. ACK-MMEA [22] designs a multi-modal attribute uniformization module to incorporate the consistent alignment knowledge. GEEA [16] studies embeddingbased entity alignment from a perspective of generative models. It converts an entity from one knowledge graph to the other one, and generates new entities from random noise vectors. However, the aforementioned methods have the following two shortcomings: On one hand, the majority of methods, such as MMEA, EVA, HMEA, and MSNEA, have not been able to fully achieve multi-granular interactions within and across modalities. Consequently, they do not effectively integrate multimodal knowledge related to entities. On the other hand, even when some methods, like MCLEA and MEAformer, introduce mechanisms for intra-modality and intermodality interactions, they are difficult to explicitly distinguish the importance of each modality, and also ignore the interaction between uni-modal and joint-modal embeddings, which results in a lack of diversity in modal interactions. Optimal Transport. Optimal transport (OT) is a fundamental mathematical tool which aims to derive an optimal plan to transfer \fLeveraging Intra-modal and Inter-modal Interaction for Multi-Modal Entity Alignment Probability-guided Modal Fusion Modal-adaptive Contrastive Learning Optimal Transport Modal Alignment KG 1 KG 2 positive pairs inner-graph negative cross-graph negative 1 2 3 4 1 3 3 2 4 3 KL Divergence Cost Matrix Transport Matrix Optimize s.t. Structure Relation Attribute Visual Ha Hm Pa Hr Hm Pr Hv Hm Pv Hr Hm C T T1 m n \u03bcr = , T1 r n \u03bcm = arg min T ij Tij ij C Pr \u03bcr \u03bcm Hr Ha Hs Hv H m Relation Attribute Visual Figure 2: MIMEA\u2019s architecture, containing the modules: Probability-guided Modal Fusion, Optimal Transport Modal Alignment, and Modal-adaptive Contrastive Learning. one distribution to another. OT has been used in many applications, such as, computer vision [2, 31], domain adaption [6, 13], and unsupervised learning [1, 5]. OTKGE [4] models the multi-modal fusion procedure as a transport plan moving different modal embeddings to a unified space by minimizing the Wasserstein distance between multi-modal distributions. MOTCat [37] proposes a multimodal optimal transport-based co-attention transformer framework with global structure consistency for selecting informative patches. However, existing studies lack a comprehensive investigation of the correlations between uni-modal and joint-modal contexts. To the best of our knowledge, we are the first to adopt the optimal transport mechanism for MMEA task. 3 PRELIMINARIES Multi-modal Knowledge Graph. Let E, R, A, I, V respectively be finite sets of entities, relation types, attribute types, images, and values. A multi-modal knowledge graph (MMKG) G is defined as {P, T \ud835\udc5f, T \ud835\udc4e}, where P = {(\ud835\udc52,\ud835\udc56) | \ud835\udc52\u2208E,\ud835\udc56\u2208I} is the set of entityimage pairs, T \ud835\udc5f= {(\u210e,\ud835\udc5f,\ud835\udc61) | \u210e,\ud835\udc61\u2208E,\ud835\udc5f\u2208R} is the set of relational triples, and T \ud835\udc4e= {(\ud835\udc52,\ud835\udc4e, \ud835\udc63) | \ud835\udc52\u2208E,\ud835\udc4e\u2208A, \ud835\udc63\u2208V} is the set of attribute triples. Multi-modal Entity Alignment. The aim of the multi-modal entity alignment (MMEA) task is to identify pairs of entities in two multi-modal knowledge graphs which are equivalent. Concretely, given two MMKGs G = {P, T \ud835\udc5f, T \ud835\udc4e} and G\u2032 = {P\u2032, T \u2032 \ud835\udc5f, T \u2032 \ud835\udc4e}, we aim to find entity pairs H = {(\ud835\udc52\ud835\udc56,\ud835\udc52\ud835\udc57) | \ud835\udc52\ud835\udc56\u2208E,\ud835\udc52\ud835\udc57\u2208E\u2032,\ud835\udc52\ud835\udc56\u2261\ud835\udc52\ud835\udc57}, where \u2261represents the equivalence of two entities. Usually, we will select a small set of pre-aligned entity pairs S (seeds) for training, to learn entity representations in the two input MMKGs. 4 FRAMEWORK We now introduce the MIMEA framework (cf. Fig 2 for its architecture), which comprises four major components (cf. Sections 4.1-4.4). 4.1 Multi-modal Knowledge Embedding We define entity embeddings for four modalities: structural, relation, attribute and visual. Structural embeddings are obtained based on the attribute and relational neighbors (described by attribute/relational triples) of an entity. Relation embeddings are derived from relation types, and they are expressed in the form of bag-of-words. Attribute embeddings are obtained analogously. Visual embeddings are derived from entity-image pairs. Structural Embeddings. The graph attention network (GAT) [36] is an attention-based architecture which has been shown to effectively encode graph-like data. We thus leverage GAT to model the structural information of G and G\u2032. For the hidden state h\ud835\udc56\u2208R\ud835\udc51(\ud835\udc51 represents the embedding dimension) of entity \ud835\udc52\ud835\udc56, the aggregation of its one-hop neighbors N\ud835\udc56with self-loops is formulated as: h\ud835\udc56= \ud835\udf0e\u00a9 \u00ad \u00ab \u2211\ufe01 \ud835\udc57\u2208N\ud835\udc56 \ud835\udefc\ud835\udc56\ud835\udc57W\ud835\udc60h\ud835\udc57\u00aa \u00ae \u00ac (1) where \ud835\udf0e(\u00b7) denotes the nonlinear ReLU function; W\ud835\udc60\u2208R\ud835\udc51\u00d7\ud835\udc51 denotes a parameterized weight matrix [21, 23] \u2014 we restrict W\ud835\udc60 to a diagonal matrix to reduce the number of computations; h\ud835\udc57is the hidden state of entity \ud835\udc52\ud835\udc57; the attention weight \ud835\udefc\ud835\udc56\ud835\udc57measures the importance of entity \ud835\udc52\ud835\udc57for entity \ud835\udc52\ud835\udc56, formulated as: \ud835\udefc\ud835\udc56\ud835\udc57= exp \u0000LeakyReLU \u0000a\u22a4[W\ud835\udc60h\ud835\udc56\u2225W\ud835\udc60h\ud835\udc57]\u0001\u0001 \u00cd \ud835\udc58\u2208N\ud835\udc56exp (LeakyReLU (a\u22a4[W\ud835\udc60h\ud835\udc56\u2225W\ud835\udc60h\ud835\udc58])) (2) where a \u2208R2\ud835\udc51is a learnable parameter, \u00b7\u22a4and \u2225respectively represent the transposition and concatenation operations. To stabilize the learning process of self-attention, we introduce a multi-head strategy [11, 21, 23] to generate K independent representations based on the transformation of Equation 1. Then, we concatenate these features to obtain the structural embedding h\ud835\udc60 \ud835\udc56of entity \ud835\udc52\ud835\udc56as: h\ud835\udc60 \ud835\udc56= \ud835\udc3e \u2225 \ud835\udc58=1 \ud835\udf0e\u00a9 \u00ad \u00ab \u2211\ufe01 \ud835\udc57\u2208N\ud835\udc56 \ud835\udefc\ud835\udc58 \ud835\udc56\ud835\udc57W\ud835\udc58 \ud835\udc60h\ud835\udc57\u00aa \u00ae \u00ac (3) where \ud835\udefc\ud835\udc58 \ud835\udc56\ud835\udc57denotes the normalized attention coefficients computed by the \ud835\udc58-th attention mechanism, and W\ud835\udc58 \ud835\udc60is the corresponding input linear transformation\u2019s weight matrix. We use a two-layer GAT to aggregate the neighborhood information across multiple hops, and use the output of the final GAT layer as the structural embedding. The structural embedding of all entities is represented as H\ud835\udc60\u2208R\ud835\udc5b\u00d7\ud835\udc51, where \ud835\udc5brepresents the number of entities in the input dataset. Relation and Attribute Embeddings. Note that the knowledge from attribute types is coarser than that of relational types. Thus, directly mixing the representations of relations and attributes using a GAT can easily lead to the problem of information contamination [24]. To alleviate this issue, we respectively regard the relations and attributes of entity \ud835\udc52\ud835\udc56as bag-of-words features \ud835\udc64\ud835\udc5f \ud835\udc56and \ud835\udc64\ud835\udc4e \ud835\udc56. We \fZhiwei Hu, V\u00edctor Guti\u00e9rrez-Basulto, Zhiliang Xiang, Ru Li, and Jeff Z. Pan further apply the multi-layer perceptrons MLP\ud835\udc5fand MLP\ud835\udc4eto respectively obtain the relation embedding h\ud835\udc5f \ud835\udc56and attribute embedding h\ud835\udc4e \ud835\udc56, calculated as: h\ud835\udc5f \ud835\udc56= MLP\ud835\udc5f(\ud835\udc64\ud835\udc5f \ud835\udc56), h\ud835\udc4e \ud835\udc56= MLP\ud835\udc4e(\ud835\udc64\ud835\udc4e \ud835\udc56) (4) The relation and attribute embedding of all entities are respectively represented as H\ud835\udc5f\u2208R\ud835\udc5b\u00d7\ud835\udc51and H\ud835\udc4e\u2208R\ud835\udc5b\u00d7\ud835\udc51. Visual Embeddings. VGG [30] are usually pre-trained on largescale image datasets and can extract useful features from images that are beneficial to different visual tasks. In practice, we feed the image \ud835\udc63\ud835\udc56of entity \ud835\udc52\ud835\udc56into the VGG-16 encoder Enc\ud835\udc63. We use the final layer output before logits as the visual feature, and finally apply a multi-layer perceptron MLP\ud835\udc63to obtain the visual embedding h\ud835\udc63 \ud835\udc56: h\ud835\udc63 \ud835\udc56= MLP\ud835\udc63(Enc\ud835\udc63(\ud835\udc63\ud835\udc56)) (5) The visual embedding of all entities is represented as H\ud835\udc63\u2208R\ud835\udc5b\u00d7\ud835\udc51. 4.2 Probability-guided Modal Fusion Different modalities concentrate on different types of knowledge. Thus, each modality contributes differently to the characterization of specific aspects of an entity. Typically, it is required to combine multiple modalities of knowledge to provide a more comprehensive understanding of an entity. For example, knowledge about the entity Lionel Messi includes the relational triple (Lionel Messi, employ, FC Barcelona) and a visual image (an image of Messi wearing a certain team\u2019s jersey). So, when evaluating the football club Lionel Messi plays for, the structural knowledge from the relational triple is more relevant than the knowledge from the image. However, when it comes to Messi\u2019s jersey number at a club, the triple (Lionel Messi, employ, FC Barcelona) does not contain relevant information, but a visual image of Messi wearing a 10 jersey can provide more appropriate clues. Holistically combining these two types of information will thus enable an accurate representation of the football club Lionel Messi plays for and his jersey number at that club. Therefore, an important challenge is how to better integrate multi-modal knowledge to obtain effective fused representations in multi-modal contexts. A key source of knowledge in multi-modal knowledge graphs is the one provided by structural triples. The structural triples contain the relational triples and attribute triples, they can provide a more direct representation of the content of an entity and its relationship with other entities. For example, in the FB15K-DB15K dataset, there are a total of 714,720 structural triples, resulting in richer knowledge about the connections among entities. In contrast, the FB15K-DB15K dataset contains only 1,624 relational types and 341 attribute types, which means that the initialization vectors for the relation and attribute modalities will be bag-of-words vectors of length 1,624 and 341. Consequently, the representation of relation and attribute modalities of an entity lacks sufficient distinctiveness. Indeed, in subsequent ablation experiments we will show that the structural content has the most significant impact on the final performance of entity alignment. Therefore, using structural embeddings as a pivotal point, we introduce the Probability-guided Modal Fusion (PMF) module, which employs a probabilistic distribution to achieve initial interactions between relation embeddings and structural embeddings, attribute embeddings and structural embeddings, also visual embeddings and structural embeddings. It generates interactive weights in the first stage and aggregates different modal embeddings to obtain a joint-modal combined representation based on these weight coefficients. Specifically, the PMF module comprises the following three steps: (1) Constructing Probability Distributions. Given the structural embedding H\ud835\udc60, relation embedding H\ud835\udc5f, attribute embedding H\ud835\udc4e, and visual embedding H\ud835\udc63of all entities, we represent each embedding using a probability density form based on the Beta probability distribution function. The Beta distribution has two shape hyperparameters \ud835\udefcand \ud835\udefd. Its probability density function (PDF) is defined as: \ud835\udc53(\ud835\udefc,\ud835\udefd) (\ud835\udc65) = \ud835\udc65\ud835\udefc\u22121(1\u2212\ud835\udc65)\ud835\udefd\u22121 B(\ud835\udefc,\ud835\udefd) , where \ud835\udc65\u2208[0, 1] and B(\u00b7) denotes the Beta function. To transform, for example, the structural embedding H\ud835\udc60into a Beta distribution, we proceed as follows: i) we first divide H\ud835\udc60into two equal parts \ud835\udf36\ud835\udc60and \ud835\udf37\ud835\udc60according to the embedding dimension: H\ud835\udc60= {[\ud835\udf36\ud835\udc60, \ud835\udf37\ud835\udc60] | \ud835\udf36\ud835\udc60\u2208R\ud835\udc5b\u00d7\ud835\udc5a, \ud835\udf37\ud835\udc60\u2208R\ud835\udc5b\u00d7\ud835\udc5a,\ud835\udc5a= \ud835\udc51 2 }. Then, we use each part as a shape parameter of the Beta distribution. ii) By combining the i-th element \ud835\udefc\ud835\udc60 \ud835\udc56in \ud835\udf36\ud835\udc60with the i-th element \ud835\udefd\ud835\udc60 \ud835\udc56in \ud835\udf37\ud835\udc60, we will form the i-th Beta distribution. The combination of all elements will form m Beta distributions, represented as D\ud835\udc60= [(\ud835\udefc\ud835\udc60 1, \ud835\udefd\ud835\udc60 1), . . . , (\ud835\udefc\ud835\udc60 \ud835\udc5a, \ud835\udefd\ud835\udc60 \ud835\udc5a)]. We denote the PDF of the i-th Beta distribution in D\ud835\udc60as \ud835\udc5d\ud835\udc60 \ud835\udc56. iii) We can analogously get the Beta distributions of the relation, attribute and visual embedding: D\ud835\udc5f, D\ud835\udc4e, D\ud835\udc63, and the corresponding i-th Beta distributions: \ud835\udc5d\ud835\udc5f \ud835\udc56, \ud835\udc5d\ud835\udc4e \ud835\udc56, and \ud835\udc5d\ud835\udc63 \ud835\udc56. (2) Calculating Modal Weight Coefficients. Given the relation and structural embedding\u2019s Beta distributions D\ud835\udc5fwith parameters [(\ud835\udefc\ud835\udc5f 1, \ud835\udefd\ud835\udc5f 1), ..., (\ud835\udefc\ud835\udc5f \ud835\udc5a, \ud835\udefd\ud835\udc5f \ud835\udc5a)] and D\ud835\udc60with corresponding parameters [(\ud835\udefc\ud835\udc60 1, \ud835\udefd\ud835\udc60 1), ..., (\ud835\udefc\ud835\udc60 \ud835\udc5a, \ud835\udefd\ud835\udc60 \ud835\udc5a)], we define the distance between the relation and structural embedding as the sum of the KL divergence between the two Beta distributions along each dimension: \ud835\udeff(\ud835\udc5f,\ud835\udc60) = \ud835\udc5a \u2211\ufe01 \ud835\udc56=1 KL(\ud835\udc5d\ud835\udc5f \ud835\udc56, \ud835\udc5d\ud835\udc60 \ud835\udc56) (6) Then, we convert the KL distance \ud835\udeff(\ud835\udc5f,\ud835\udc60) to a weight coefficient based on \ud835\udc64(\ud835\udc5f,\ud835\udc60) = \ud835\udf06(2 \u2212\ud835\udeff(\ud835\udc5f,\ud835\udc60))2, where \ud835\udf06represents the incremental rate, set empirically. Using the same method, we can obtain the weight coefficient \ud835\udc64(\ud835\udc4e,\ud835\udc60) between the attribute and structural embedding, and the weight coefficient \ud835\udc64(\ud835\udc63,\ud835\udc60) between the visual and structural embedding. (3) Fusing Different Modal Embeddings. We add the three weight coefficients \ud835\udc64(\ud835\udc5f,\ud835\udc60), \ud835\udc64(\ud835\udc4e,\ud835\udc60), \ud835\udc64(\ud835\udc63,\ud835\udc60) with the initialized value 1.0 (initially we assume that all modalities have the same weight coefficients) and normalize it to obtain the prior assumption: \ud835\udc4aPMF = softmax([\ud835\udc64(\ud835\udc5f,\ud835\udc60),\ud835\udc64(\ud835\udc4e,\ud835\udc60),\ud835\udc64(\ud835\udc63,\ud835\udc60)] + 1.0). Then, we multiply these weight coefficients with the embedding representation of the corresponding modality, and concate the multiplied results to obtain the final fused modality representation H\ud835\udc5a\u2208R\ud835\udc5b\u00d74\ud835\udc51. 4.3 Optimal Transport Modal Alignment The PMF deals with various modalities of knowledge by combining multimodal information. However, due to the introduced noise during the fusion process, an optimal representation of an entity cannot be based only on joint-modal information. For instance, if \fLeveraging Intra-modal and Inter-modal Interaction for Multi-Modal Entity Alignment we are interested in the football club in which Lionel Messi plays, given the joint-modal embedding incorporating the relational triple (Lionel Messi, employ, FC Barcelona), the attribute triple (Lionel Messi, number, 10) and the visual image of Messi wearing the Barcelona jersey number 10, the knowledge provided by the attribute triple is regarded as noise, while the one provided by the relational triple is useful information. Therefore, in some cases, while using jointmodal embeddings, we need to retain the knowledge of individual embeddings for each modality to assess the extent to which a single modality represents an entity in a certain context. So, a natural question is how to achieve better interaction between uni-modal and joint-modal embeddings to cover the information gap of single modalities and reduce the noise of joint-modal embeddings? Optimal transport (OT) aims to transport the density distribution of a group of elements to that of another group with minimal total cost. To consider the correlations of uni-modal and joint-modal representations, we can regard uni-modal as one group elements and joint-modal as another group elements. The expectation is that the uni-modal and joint-modal elements have an appropriate correlation with minimal total transportation cost. To achieve this, we first generate an intermediate transition matrix by aligning and optimizing uni-modal and joint-modal embeddings. Subsequently, by combining uni-modal information with the generated intermediate transition matrix, we obtain an enriched uni-modal embedding. The Optimal Transport Modal Alignment (OTMA) module consists of the following steps: (1) Building the Transport Task. We look, for instance, at how to obtain the intermediate modal embedding between the relation modal embedding H\ud835\udc5fand the joint modal embedding H\ud835\udc5a. Optimal transport aims at computing a minimal cost transportation between a source distribution \ud835\udf07\ud835\udc5fand a target distribution \ud835\udf07\ud835\udc5a: \ud835\udf07\ud835\udc5f= \ud835\udc5b\ud835\udc5f \u2211\ufe01 \ud835\udc56=1 \ud835\udc5e\ud835\udc5f \ud835\udc56\ud835\udf11(\ud835\udc65\ud835\udc56), \ud835\udf07\ud835\udc5a= \ud835\udc5b\ud835\udc5a \u2211\ufe01 \ud835\udc56=1 \ud835\udc5e\ud835\udc5a \ud835\udc56\ud835\udf11(\ud835\udc66\ud835\udc56) (7) where \ud835\udf07\ud835\udc5fand \ud835\udf07\ud835\udc5aare defined on the probability space H\ud835\udc5fand H\ud835\udc5a, \ud835\udf11(\u00b7) denotes the Dirac function, \ud835\udc5b\ud835\udc5fand \ud835\udc5b\ud835\udc5aare the number of samples, \ud835\udc65\ud835\udc56and \ud835\udc66\ud835\udc56are the i-th sample of H\ud835\udc5fand H\ud835\udc5a(in practice, to reduce the computational complexity, the number of selected samples will be lower than the embedding dimension), \ud835\udc5e\ud835\udc5f \ud835\udc56and\ud835\udc5e\ud835\udc5a \ud835\udc56are the probability mass of the i-th samples, satisfying the following conditions: \u00cd\ud835\udc5b\ud835\udc5f \ud835\udc56=1 \ud835\udc5e\ud835\udc5f \ud835\udc56= \u00cd\ud835\udc5b\ud835\udc5a \ud835\udc56=1 \ud835\udc5e\ud835\udc5a \ud835\udc56 = 1, to simplify the calculations, we set \ud835\udc5e\ud835\udc5f \ud835\udc56= 1 \ud835\udc5b\ud835\udc5fand \ud835\udc5e\ud835\udc5a \ud835\udc56 = 1 \ud835\udc5b\ud835\udc5a. We define a cost matrix C with C\ud835\udc56\ud835\udc57representing the distance (usually the cosine distance) between \ud835\udc65\ud835\udc56and \ud835\udc66\ud835\udc57. (2) Optimal Transport Plan. Based on distributions \ud835\udf07\ud835\udc5fand \ud835\udf07\ud835\udc5a, we can obtain all joint probability distributions \u03a0(\ud835\udf07\ud835\udc5f, \ud835\udf07\ud835\udc5a). Combining them with the cost matrix C, we can convert the optimal transport into the following form: W(\ud835\udf07\ud835\udc5f, \ud835\udf07\ud835\udc5a) = min T\u2208\u03a0(\ud835\udf07\ud835\udc5f,\ud835\udf07\ud835\udc5a) \ud835\udc5b\ud835\udc5f \u2211\ufe01 \ud835\udc56=1 \ud835\udc5b\ud835\udc5a \u2211\ufe01 \ud835\udc57=1 T\ud835\udc56\ud835\udc57C\ud835\udc56\ud835\udc57 (8) where \u03a0(\ud835\udf07\ud835\udc5f, \ud835\udf07\ud835\udc5a) = {T \u2208R\ud835\udc5b\ud835\udc5f\u00d7\ud835\udc5b\ud835\udc5a|T1\ud835\udc5b\ud835\udc5a= \ud835\udf07\ud835\udc5f, T\u22a41\ud835\udc5b\ud835\udc5f= \ud835\udf07\ud835\udc5a}, with 1 an all-one vector, T\ud835\udc56\ud835\udc57the optimal amount of mass to move from \ud835\udc65\ud835\udc56to\ud835\udc66\ud835\udc57to obtain an overall minimum cost. We apply the Sinkhorn algorithm [12] to optimize Equation (8) to get the optimal transportation matrix T. (3) Translating Uni-Modal Embeddings. We multiply the relation embedding H\ud835\udc5fwith the transportation matrix T to get the intermediate embedding P\ud835\udc5f= H\ud835\udc5f\u22a4T between the relationmodal embedding H\ud835\udc5fand the joint-modal embedding H\ud835\udc5a. The resulting embedding focuses on relational modal knowledge, but can also be aligned with joint modal embeddings at a small cost. We can analogously obtain attribute and visual intermediate embeddings, denoted as P\ud835\udc4eand P\ud835\udc63, respectively. We found that there is no need to align the structural-modal embedding with the joint-modal embedding since the structural embedding in the joint embedding has the largest weight and therefore dominates the joint embedding. 4.4 Modal-adaptive Contrastive Learning The OTMA module focuses on the interaction between uni-modal and joint-modal aspects of knowledge. However, both the OTMA and PMF modules overlook the interactions within a single modality. In many cases, for a given entity, there exist multiple associated pieces of information within a single modality. When predicting a specific attribute of an entity, typically only a subset of these related pieces of knowledge plays a decisive role. For instance, consider the entity Lionel Messi, which includes the relational triples: (Lionel Messi, spouse, Antonela Roccuzzo) and (Lionel Messi, child, Thiago Messi) related to family relationships and (Lionel Messi, teammate, Neymar) and (Lionel Messi, coach, Josep Guardiola) related to player attributes. Clearly, when describing Messi\u2019s family relationships, Antonela Roccuzzo and Thiago Messi are more important than Neymar and Josep Guardiola. However, when discussing Messi\u2019s football career, the situation is reversed. Therefore, it is preferable to make the embeddings of Antonela Roccuzzo and Thiago Messi closer in the embedding space, while the embeddings of Antonela Roccuzzo and Neymar should be pushed farther apart. Based on these observations, an important challenge is how to enforce embeddings to respect modal properties, while distinguishing the embedding of an entity from those of other entities, for each modality. Inspired by the contrastive learning mechanism [23, 41, 42], we devise a Modal-adaptive Contrastive Learning (MCL) module, which maps inner-graph aligned pairs to a proximate location, but also pushes the inner-graph and cross-graph unaligned pairs father apart. Specifically, MCL includes the following three parts: \u2022 Creating Positive and Negative Samples. Following a 1-to-1 alignment constraint [11, 23], the entity pairs within the seed alignments S can be naturally regarded as positive samples, whereas any non-aligned pairs can be regarded as negative samples. Let (\ud835\udc521 \ud835\udc56,\ud835\udc522 \ud835\udc56) in S (with \ud835\udc521 \ud835\udc56\u2208G and \ud835\udc522 \ud835\udc56\u2208G\u2032) be the i-th aligned entity pair, the negative samples of \ud835\udc521 \ud835\udc56are obtained from two sources: the inner-graph unaligned pairs from G and crossgraph unaligned pairs from G\u2032. More precisely, they are defined as N1 \ud835\udc56= {\ud835\udc521 \ud835\udc57| \u2200\ud835\udc521 \ud835\udc57\u2208G, \ud835\udc57\u2260\ud835\udc56} and N2 \ud835\udc56= {\ud835\udc522 \ud835\udc57| \u2200\ud835\udc522 \ud835\udc57\u2208G\u2032, \ud835\udc57\u2260\ud835\udc56}. It should be noted that we use the in-batch negative sampling strategy [11, 23] to limit the negative sample scope within the mini-batch. \fZhiwei Hu, V\u00edctor Guti\u00e9rrez-Basulto, Zhiliang Xiang, Ru Li, and Jeff Z. Pan Table 1: Evaluation of different models in the non-iterative setting. Results marked with \u2020, \u2021 and \u2217respectively come from [23] [11], and the corresponding paper. Best scores are in bold, the second best scores are underlined, and \u2018\u2013\u2019 indicates the results are not reported in previous work. Methods FB15K-DB15K FB15K-YAGO15K 20% 50% 80% 20% 50% 80% MRR H@1 H@10 MRR H@1 H@10 MRR H@1 H@10 MRR H@1 H@10 MRR H@1 H@10 MRR H@1 H@10 PoE [25]\u2020 0.170 0.126 0.251 0.533 0.464 0.658 0.721 0.666 0.820 0.154 0.113 0.229 0.414 0.347 0.536 0.635 0.573 0.746 HMEA [15]\u2020 \u2013 0.127 0.369 \u2013 0.262 0.581 \u2013 0.417 0.786 \u2013 0.105 0.313 \u2013 0.265 0.581 \u2013 0.433 0.801 MMEA [7]\u2020 0.357 0.265 0.541 0.512 0.417 0.703 0.685 0.590 0.869 0.317 0.234 0.480 0.486 0.403 0.645 0.682 0.598 0.839 EVA [24]\u2021 0.283 0.199 0.448 0.422 0.334 0.589 0.563 0.484 0.696 0.224 0.153 0.361 0.388 0.311 0.534 0.565 0.491 0.692 MSNEA [8]\u2021 0.175 0.114 0.296 0.388 0.288 0.590 0.613 0.518 0.779 0.153 0.103 0.249 0.413 0.320 0.589 0.620 0.531 0.778 MCLEA [23]\u2021 0.393 0.295 0.582 0.637 0.555 0.784 0.790 0.735 0.890 0.332 0.254 0.484 0.574 0.501 0.705 0.722 0.667 0.824 MEAformer [11]\u2021 0.518 0.417 0.715 0.698 0.619 0.843 0.820 0.765 0.916 0.417 0.327 0.595 0.639 0.560 0.778 0.766 0.703 0.873 ACK-MMEA [22]\u22170.387 0.304 0.549 0.624 0.560 0.736 0.752 0.682 0.874 0.360 0.289 0.496 0.593 0.535 0.699 0.744 0.676 0.864 GEEA [16]\u2217 0.450 0.343 0.661 0.723 0.651 0.852 0.836 0.787 0.918 0.393 0.298 0.585 0.668 0.589 0.808 0.790 0.733 0.890 MIMEA 0.594 0.506 0.756 0.748 0.683 0.861 0.841 0.799 0.914 0.506 0.417 0.671 0.692 0.622 0.818 0.795 0.741 0.884 \u2022 Contrastive Learning Loss. For the constructed positive and negative examples, we perform contrastive learning under each modal condition. For instance, for the relational modality, we construct the contrastive learning loss L\ud835\udc5f(\ud835\udc521 \ud835\udc56,\ud835\udc522 \ud835\udc56) of the positive pair (\ud835\udc521 \ud835\udc56,\ud835\udc522 \ud835\udc56) as: \u2212log \ud835\udf03(\ud835\udc521 \ud835\udc56,\ud835\udc522 \ud835\udc56) \ud835\udf03(\ud835\udc521 \ud835\udc56,\ud835\udc522 \ud835\udc56) + \ud835\udefe\u00cd \ud835\udc521 \ud835\udc57\u2208N1 \ud835\udc56\ud835\udf03(\ud835\udc521 \ud835\udc56,\ud835\udc521 \ud835\udc57) + \u00cd \ud835\udc522 \ud835\udc57\u2208N2 \ud835\udc56\ud835\udf03(\ud835\udc521 \ud835\udc56,\ud835\udc522 \ud835\udc57) (9) where \ud835\udf03(\ud835\udc65,\ud835\udc66) = \ud835\udc52\ud835\udc65\ud835\udc5d(\ud835\udc53\ud835\udc5f(\ud835\udc65)\u22a4\ud835\udc53\ud835\udc5f(\ud835\udc66)/\ud835\udf0f), \ud835\udc53\ud835\udc5f(\u00b7) is the relation encoder, \ud835\udf0fis a temperature parameter, and \ud835\udefeis a hyper-parameter to control inner-graph alignment. The second and third terms in the denominator sum up inner-graph and cross-graph negative samples, respectively. We apply L2-normalisation to the input feature embeddings before computing the inner product [23, 32, 42]. Similarly, we can obtain the loss for the other direction as L\ud835\udc5f(\ud835\udc522 \ud835\udc56,\ud835\udc521 \ud835\udc56). The final contrastive loss of the relational modality is the average of the losses in the two directions, expressed as: L\ud835\udc5f= 1 2 [L\ud835\udc5f(\ud835\udc521 \ud835\udc56,\ud835\udc522 \ud835\udc56) + L\ud835\udc5f(\ud835\udc522 \ud835\udc56,\ud835\udc521 \ud835\udc56)]. \u2022 Optimization Objective. Using the same idea, we can obtain the contrastive loss of structural, attribute, visual and joint modalities, respectively expressed as L\ud835\udc60, L\ud835\udc4e, L\ud835\udc63, and L\ud835\udc5a. The overall loss is defined as: L = \u2211\ufe01 \u2113\u2208M \ud835\udf19\u2113L\u2113, M = {\ud835\udc60,\ud835\udc5f,\ud835\udc4e, \ud835\udc63,\ud835\udc5a} (10) where \ud835\udf19\u2113is the hyper-parameter that balances the importance of different modal losses. Similar to [19], we introduce a multitask learning paradigm and then use homoscedastic uncertainty to weight each loss automatically during model training. Details of this strategy can be found in [19]. It should be noted that only the MCL module has loss values, and the PMF and OTMA modules do not have any loss content. 5 EXPERIMENTS To evaluate the effectiveness of MIMEA, we aim to explore the following research questions: \u2022 RQ1 (Effectiveness): How does MIMEA perform compared to the SoTA? \u2022 RQ2 (Ablation studies): How do different components of MIMEA contribute to its performance? \u2022 RQ3 (Complexity analysis): What is the amount of computation and parameters used by MIMEA? \u2022 RQ4 (Parameter analysis): How do hyper-parameters influence the performance of MIMEA? A detailed analysis can be found in Appendix D. 5.1 Experimental Setup Datasets. We evaluate the MIMEA model on two well-known datasets: FB15K-DB15K and FB15K-YAGO15K, which include 12,846 and 11,199 alignment pairs, respectively. As in previous works [11, 22, 23], to evaluate MIMEA\u2019s performance under different conditions, we split the two datasets into training and testing sets with 20%, 50%, and 80% of pre-aligned pairs given as alignment seeds. The statistics of these datasets can be found in Appendix A. Iterative Training. As in previous works [8, 11, 23, 24], we adopt a probation strategy for iterative training. Specifically, we constructed a buffer to temporarily store entity pairs that are close in the embedding space across different knowledge graphs. In every round \ud835\udc45, we select entity pairs that meet the nearest distance criteria and add them to the buffer. If after \ud835\udc40iterations, these entity pairs are still in the buffer, we will add them to the training set. This approach effectively serves as a data augmentation strategy during training, where the entity pairs in the buffer can be considered as pseudo-labels. In contrast, the training method that does not involve the aforementioned iterative process is referred to as non-iterative training. Baselines. In the experiments, we used two training strategies: noniterative and iterative training. For each training strategy, we used different baselines. For non-iterative training: PoE [25], HMEA [15], MMEA [7], EVA [24], MSNEA [8], MCLEA [23], MEAformer [11], ACK-MMEA [22], and GEEA [16]. For iterative training: EVA [24], \fLeveraging Intra-modal and Inter-modal Interaction for Multi-Modal Entity Alignment Table 2: Evaluation of different models under iterative setting. \u2021 results come from [11]. \u2217results from the corresponding papers. Best scores are highlighted in bold, the second best scores are underlined. Methods FB15K-DB15K FB15K-YAGO15K 20% 50% 80% 20% 50% 80% MRR H@1 H@10 MRR H@1 H@10 MRR H@1 H@10 MRR H@1 H@10 MRR H@1 H@10 MRR H@1 H@10 EVA [24]\u2021 0.318 0.231 0.488 0.449 0.364 0.606 0.573 0.491 0.711 0.260 0.188 0.403 0.404 0.325 0.560 0.572 0.493 0.695 MSNEA [8]\u2021 0.232 0.149 0.392 0.459 0.358 0.656 0.651 0.565 0.810 0.210 0.138 0.346 0.472 0.376 0.646 0.668 0.593 0.806 MCLEA [23]\u2217 0.534 0.445 0.705 0.652 0.573 0.800 0.784 0.730 0.883 0.474 0.388 0.641 0.616 0.543 0.759 0.715 0.653 0.835 MEAformer [11]\u2021 0.661 0.578 0.812 0.755 0.690 0.871 0.834 0.784 0.921 0.529 0.444 0.692 0.682 0.612 0.808 0.783 0.724 0.880 MIMEA 0.694 0.622 0.824 0.770 0.716 0.872 0.855 0.821 0.919 0.587 0.513 0.729 0.712 0.651 0.827 0.803 0.757 0.885 Table 3: Ablation studies under different modals and different modules. Best scores are highlighted in bold. Settings FB15K-DB15K FB15K-YAGO15K 20% 50% 80% 20% 50% 80% MRR H@1 H@10 MRR H@1 H@10 MRR H@1 H@10 MRR H@1 H@10 MRR H@1 H@10 MRR H@1 H@10 w/o structure 0.094 0.044 0.183 0.134 0.066 0.264 0.220 0.117 0.447 0.088 0.051 0.151 0.105 0.056 0.192 0.175 0.094 0.335 w/o attribute 0.664 0.589 0.806 0.750 0.694 0.859 0.839 0.801 0.910 0.553 0.479 0.700 0.684 0.620 0.806 0.774 0.718 0.871 w/o relation 0.642 0.565 0.785 0.742 0.685 0.850 0.831 0.791 0.902 0.507 0.429 0.660 0.661 0.587 0.801 0.776 0.717 0.875 w/o visual 0.691 0.616 0.825 0.772 0.716 0.877 0.853 0.815 0.921 0.568 0.492 0.717 0.699 0.633 0.822 0.791 0.736 0.886 w/o PMF 0.595 0.507 0.757 0.747 0.682 0.862 0.841 0.797 0.914 0.494 0.406 0.659 0.688 0.617 0.817 0.794 0.741 0.885 w/o OTMA 0.576 0.486 0.748 0.724 0.648 0.860 0.845 0.797 0.923 0.518 0.437 0.673 0.660 0.578 0.810 0.796 0.737 0.897 w/o MCL 0.630 0.535 0.797 0.744 0.671 0.873 0.844 0.802 0.918 0.535 0.449 0.690 0.680 0.612 0.795 0.780 0.723 0.878 MIMEA 0.694 0.622 0.824 0.770 0.716 0.872 0.855 0.821 0.919 0.587 0.513 0.729 0.712 0.651 0.827 0.803 0.757 0.885 MSNEA [8], MCLEA [23], and MEAformer [11]. Implementation details and evaluation metrics can respectively be found in Appendix B and C. 5.2 Main Results To address RQ1, we conduct experiments on the non-iterative and iterative training settings, and on the number of selected prealigned seeds. The results are shown in Tables 1 and 2. Performance Comparison. We can observe in the results that under both the non-iterative and iterative settings, MIMEA generally outperforms existing SoTA baselines by a large margin across all metrics. More precisely, we have the following observations. On the one hand, MIMEA achieves the best performance on the multi-modal entity alignment task. For example, in the non-iterative setting, on the FB15K-YAGO15K dataset, MIMEA achieves improvements of 8.9%, 2.4% and 0.5% on MRR compared to the best SoTA baselines when the given pre-aligned seeds are 20%, 50%, and 80%, respectively. Similar improvements are obtained on the FB15KDB15K dataset. On the other hand, the iterative training strategy can significantly improve model performance of existing baselines and MIMEA. For example, on the FB15K-DB15K dataset when the given pre-aligned seeds are 20%, 50%, and 80%, depending on whether MIMEA uses the iterative training mechanism, there will be fluctuations of 10%, 2.2%, and 1.4% on MRR, respectively. This is primarily attributed to the generation of pseudo-entity alignments pairs during the iterative training process, which iteratively filters out potentially wrong entity pairs. Impact of Number of Pre-aligned Seeds. We evaluate the sensitivity of MIMEA to the given number of pre-aligned seeds: 20%, 50%, and 80% [8, 11, 23, 24]. From the results, we can observe that MIMEA achieves the best performance on both the FB15K-DB15K and the FB15K-YAGO15K datasets in all metrics and proportions, confirming its robustness to the number of given pre-aligned seeds. For instance, in the iterative setting, on FB15K-YAGO15K, compared with the best-performing baseline MEAformer, for 20%, 50%, and 80%, the MRR metric is respectively improved by 5.8%, 3.0% and 2.0%. The higher improvement for 20% shows that MIMEA is well-suited for low-resource scenarios. This is mainly because, on the one hand, each modality can be explicitly given a differentiation weight according to the characteristics of such modality. Further, we take into account the interactions between uni-modal and joint-modal representations. On the other hand, intra-modal is able to differentiate uni-modal representations. The intra-modal and inter-modal multi-granularity interaction can indeed maximize the utility of having multi-modal knowledge. 5.3 Ablation Studies We address RQ2 from four perspectives, including different variants, different modalities, different distribution methods, and different pivotal modality. The results are shown in Tables 3, 4, and 5. Impact of Modalities. The upper part of Table 3 shows the individual contribution of different modalities. We can observe that independent of the dataset or the number of pre-aligned seeds, the removal of different modalities has varying degrees of performance \fZhiwei Hu, V\u00edctor Guti\u00e9rrez-Basulto, Zhiliang Xiang, Ru Li, and Jeff Z. Pan Table 4: Evaluation of different models under different distribution methods. Best scores are highlighted in bold. Settings FB15K-DB15K FB15K-YAGO15K 20% 50% 80% 20% 50% 80% MRR H@1 H@10 MRR H@1 H@10 MRR H@1 H@10 MRR H@1 H@10 MRR H@1 H@10 MRR H@1 H@10 Beta 0.694 0.622 0.824 0.770 0.716 0.872 0.855 0.821 0.919 0.587 0.513 0.729 0.712 0.651 0.827 0.803 0.757 0.885 Cauchy 0.697 0.625 0.825 0.770 0.713 0.877 0.852 0.815 0.921 0.592 0.516 0.734 0.715 0.651 0.833 0.806 0.757 0.891 Gamma 0.691 0.621 0.822 0.769 0.713 0.874 0.851 0.818 0.915 0.575 0.496 0.724 0.708 0.646 0.828 0.802 0.751 0.893 Gumbel 0.690 0.619 0.821 0.769 0.714 0.872 0.851 0.816 0.917 0.573 0.493 0.722 0.708 0.645 0.827 0.801 0.749 0.890 Laplace 0.694 0.624 0.823 0.770 0.715 0.875 0.851 0.816 0.920 0.581 0.503 0.729 0.713 0.650 0.831 0.803 0.754 0.892 drop. The structural information has shown to be the main source, with its removal leading to the most significant drop (this is in line with previous findings [23]). This might be explained by the wealth of structural triples available in both datasets. On the other extreme, the performance gain brought by the visual modality is minimal. In fact, the removal of visual information can sometimes lead to achieve better results. The main reason is that the visual information provides limited additional knowledge. Only through the interaction with other modal information can bring certain performance improvement. Impact of Modules. The lower part of Table 3 presents the results of the impact of each component of MIMEA on the performance. We can observe that by removing any module the performance dramatically degrades. This could be explained by the fact that different modules play different roles, realizing multi-granular modal information interaction. For example, the PMF module focuses on the interaction of uni-modal information (with the structural information as the core) and can ultimately form joint-modal representations. In contrast, the MCL module underscores the significance of intra-modal interactions for each modality. The MIMEA\u2019s modules are interrelated and form a complete data flow, so the absence of any one of them leads to a significant performance fluctuation. Impact of Distribution Methods. We investigate the choice of different probability distribution functions in the PMF module. Table 4 reports the results by replacing the Beta function in the PMF module with the Cauchy, Gamma, Gumbel, or Laplace functions. We observe that using different probability distribution functions has a relatively limited impact on MIMEA\u2019s performance, showing the robustness of the PMF module. This is explained by the fact that the weight coefficients obtained by each probability distribution function tend to be similar after subsequent gradient updates. Impact of Different Pivotal Modality. In the PMF module, we use the structural modality as the central one for the interaction between uni-modal representations. To verify the adequateness of this choice, we select attribute, relation, and visual as the central ones. The experimental results are shown in Table 5. We can observe that by choosing the structural modality as the core we achieve the best results. The main reason is that the datasets contain rich knowledge of structural triples, which can provide abundant evidence. Recall that the performance loss caused by removing the visual modality in Table 3 is lower than that of removing the relation and attribute modalities, that is, the visual modality seems to be of little importance in the MMEA task. However, when using the visual modality as the core for uni-modal interaction, it can achieve better results than the relation and attribute modalities. A possible explanation is that the subsequent OTMA module directly assists the functioning of the visual modality, because from Table 3 we find that removing the OTMA module has the largest impact on performance. Table 5: The MRR metric results of using different modal content as the central one in the PMF module. Best scores are highlighted in bold. Methods FB15K-DB15K FB15K-YAGO15K 20% 50% 80% 20% 50% 80% attribute 0.595 0.747 0.841 0.494 0.688 0.794 relation 0.576 0.724 0.845 0.518 0.660 0.796 visual 0.630 0.744 0.844 0.535 0.680 0.780 structural 0.694 0.770 0.855 0.587 0.712 0.803 5.4 Complexity Analysis To address RQ3, we analyze the model\u2019s complexity from two perspectives: time complexity and space complexity. The time complexity can be measured by the amount of model calculations, while the space complexity can be measured by the amount of model\u2019s parameters. Model calculation volume refers to the number of floatingpoint operations performed during the inference process of the model, usually expressed in units of FLOPs (Floating-Point Operations Per Second). The number of model parameters refers to the number of adjustable parameters that need to be learned in the model. These parameters are the weights and biases of the model that are adjusted through optimization algorithms such as gradient descent during the training process. The number of parameters is usually expressed in \u201cMillions\u201d (M) or \u201cBillions\u201d (G). Table 6 presents the time and space complexity results of MIMEA and the best-performing MCLEA [23] and the MEAformer [11] model. We can find that MIMEA simultaneously reduces the computational cost and the number of parameters in comparison to the other two baselines. In particular, the amount of calculation needed by MIMEA is one-third of MEAformer\u2019s. To sum up, MIMEA can achieve the best performance while minimizing the model\u2019s computational load and video memory footprint. 6"
17
+ }
abs_9K/validation_abstract_short_2404.17591v1.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.17591v1",
3
+ "title": "Large Language Models for Next Point-of-Interest Recommendation",
4
+ "abstract": "The next Point of Interest (POI) recommendation task is to predict users'\nimmediate next POI visit given their historical data. Location-Based Social\nNetwork (LBSN) data, which is often used for the next POI recommendation task,\ncomes with challenges. One frequently disregarded challenge is how to\neffectively use the abundant contextual information present in LBSN data.\nPrevious methods are limited by their numerical nature and fail to address this\nchallenge. In this paper, we propose a framework that uses pretrained Large\nLanguage Models (LLMs) to tackle this challenge. Our framework allows us to\npreserve heterogeneous LBSN data in its original format, hence avoiding the\nloss of contextual information. Furthermore, our framework is capable of\ncomprehending the inherent meaning of contextual information due to the\ninclusion of commonsense knowledge. In experiments, we test our framework on\nthree real-world LBSN datasets. Our results show that the proposed framework\noutperforms the state-of-the-art models in all three datasets. Our analysis\ndemonstrates the effectiveness of the proposed framework in using contextual\ninformation as well as alleviating the commonly encountered cold-start and\nshort trajectory problems.",
5
+ "authors": "Peibo Li, Maarten de Rijke, Hao Xue, Shuang Ao, Yang Song, Flora D. Salim",
6
+ "published": "2024-04-19",
7
+ "updated": "2024-04-19",
8
+ "primary_cat": "cs.IR",
9
+ "cats": [
10
+ "cs.IR",
11
+ "cs.AI",
12
+ "cs.LG"
13
+ ],
14
+ "label": "Original Paper",
15
+ "paper_cat": "LLM Fairness",
16
+ "gt": "The next Point of Interest (POI) recommendation task is to predict users'\nimmediate next POI visit given their historical data. Location-Based Social\nNetwork (LBSN) data, which is often used for the next POI recommendation task,\ncomes with challenges. One frequently disregarded challenge is how to\neffectively use the abundant contextual information present in LBSN data.\nPrevious methods are limited by their numerical nature and fail to address this\nchallenge. In this paper, we propose a framework that uses pretrained Large\nLanguage Models (LLMs) to tackle this challenge. Our framework allows us to\npreserve heterogeneous LBSN data in its original format, hence avoiding the\nloss of contextual information. Furthermore, our framework is capable of\ncomprehending the inherent meaning of contextual information due to the\ninclusion of commonsense knowledge. In experiments, we test our framework on\nthree real-world LBSN datasets. Our results show that the proposed framework\noutperforms the state-of-the-art models in all three datasets. Our analysis\ndemonstrates the effectiveness of the proposed framework in using contextual\ninformation as well as alleviating the commonly encountered cold-start and\nshort trajectory problems.",
17
+ "main_content": "INTRODUCTION Location-based social networks (LBSNs) have experienced massive growth, capitalizing on developments in mobile and localization techniques, as they provide rich location-based geo-information. Next Point-of-interest (POI) recommendation, as one of the applications that use LBSN data, predicts users\u2019 next POI visit, given their historical trajectories. Existing next POI methods [18, 30, 33, 34] focus on the short trajectory and cold-start problem, where users with a small amount of data and short trajectories are harder to predict. While these methods alleviate the short trajectory and cold-start problem, they do not fully explore the potential of LBSN data. In particular, the rich contextual information contained in LBSN data has the potential to precisely model users\u2019 behavior. By using contextual information, we can understand the data in a way beyond statistics and even derive patterns that do not exist in the data. For example, the data showing a user who frequently visits college buildings during teaching periods could indicate the user\u2019s identity as a student or a college staff. Therefore, it is likely that this user will behave differently during vacation between teaching periods. To exploit such contextual information in LBSN data, there are some substantial challenges: (i) How to extract the contextual information from the raw data? And (ii) How to connect contextual information with commonsense knowledge to effectively benefit next POI recommendation? Here, we consider contextual information as time, POI category, and geo-coordinates. And we define commonsense knowledge in the context of the next POI recommendation as the capability to understand the semantics of contextual information without additional data, and to connect certain joint patterns of contextual information with behaviors in the real world. Existing next POI recommendation methods [18, 30, 33, 34] have two important limitations when dealing with contextual information: (i) Due to their numerical nature, they have to transform heterogeneous LBSN data into numbers. For example, POI categories are often encoded from text into IDs. This transformation can result in a loss of inherent meaning associated with contextual information. (ii) They rely exclusively on statistics and human designs to understand contextual information and lack an understanding of the semantic concepts provided by the contextual information. arXiv:2404.17591v1 [cs.IR] 19 Apr 2024 \fSIGIR \u201924, July 14\u201318, 2024, Washington, DC, USA P. Li et al. Encoder Decoder Raw data Embeddings Prediction (a) Numeric paradigm. Large language model Raw data Response Prompt (b) Large language model-based paradigm. Figure 1: Comparison of two paradigms for the next POI task: (a) a typical numerical paradigm and (b) the proposed language model-based paradigm. Large language models (LLMs) have demonstrated capabilities in a variety of tasks. Question-answering, in particular, has benefited from the commonsense knowledge embedded in LLMs [1, 38]. LLMs have a basic grasp of the concepts in daily life and can respond to users\u2019 questions using these concepts. Inspired by this and the textual nature of LBSN data, leveraging LLMs for the next POI recommendation task seems a natural step. In our work, we adopt the pretraining and fine-tuning paradigm, and fine-tune pretrained LLMs on LBSN data. As we will see below, by doing so, we are able to use a single LLM to deal with all types of LBSN data and better use contextual information. More specifically, to address challenge (i), we transform the next POI task into a question-answering task. We convert text-formed raw data into prompts constructed by blocks of sentences. Each block serves as a different module, and each sentence in it contains the necessary information for that module in its original format. Therefore, all heterogeneous data can be fed into a single model with tokenization that still keeps the contextual information. As illustrated in Figure 1, unlike traditional numerical methods, where data needs to be transformed and fed into different embedding layers, our method allows the data to be directly used in its original format. We also propose a notion of trajectory similarity based on prompts, which is used for the cold-start problem. For challenge (ii), we use pretrained LLMs that have been trained on a large corpus with rich commonsense knowledge. The contextual information in the tokenized data can be understood with its inherent meaning rather than being treated just as a code. As an example, in Table 1, we present the POI category names in a real-world dataset, categorized by their context, as done by ChatGPT.1 This demonstrates that LLMs are capable of understanding the inherent meaning of contextual information in LBSN data. Contributions. The main contributions of our work are as follows: (1) We propose a framework to use pretrained large language models for the next POI recommendation task, which brings commonsense knowledge for making use of the rich contextual information in the data. To the best of our knowledge, we are the first to fine-tune language models on standard-sized datasets 1We provide ChatGPT with the dataset file and ask it to find the unique POI category names. Then we use the prompt \u201cCan you list the category names that have intersections by their context?\" to get the content in Table 1. https://chat.openai.com Table 1: POI categories in a real-world dataset summarized by ChatGPT. Category Subcategories/Category Names Food and Dining Restaurant (General) Specific Restaurants: American, Asian, Italian, Mexican, Korean, Thai, Mediterranean, Caribbean Specific Food Types: Seafood Restaurant, BBQ Joint, Steakhouse, Pizza Place, Other Dining: Caf\u00e9, Bistro, Diner, Bakery, Food Truck, Deli / Bodega, Dessert Shop Beverages Bar, Beer Garden, Coffee Shop, Brewery, Tea Room, Juice Bar Accommodations Hotel, Motel, Hostel, Bed and Breakfast Shopping and Retail Department Store, Clothing Store, Electronics Store, Bookstore, Market, Mall, Miscellaneous Shop Outdoor and Recreation Park, Beach, Zoo, Garden, Plaza, Other Great Outdoors, Playground, Campground Arts and Entertainment Museum, Art Museum, Theater, Cinema, Concert Hall, Music Venue, Art Gallery, Comedy Club, Performing Arts Venue Health and Fitness Gym / Fitness Center, Spa / Massage, Medical Center, Yoga Studio Travel and Transport Airport, Train Station, Bus Station, Subway, Ferry, Taxi Educational Institutions School, University, Library, Museum, College Academic Building Professional and Office Office, Corporate Building, Conference Room Residential Residential Building (Apartment / Condo), Home (private), Housing Development Cultural and Religious Church, Temple, Shrine, Synagogue to exploit commonsense knowledge for the next POI recommendation task. (2) We propose a prompt-based trajectory similarity to combine information from historical trajectories and trajectories from different users. With that, our proposed recommendation model is able to alleviate the cold-start problem and make predictions with improved accuracy over trajectories of various lengths. (3) We conduct an extensive experimental evaluation on three realworld LBSNs datasets, which shows that our proposed next POI recommendation model substantially outperforms state-of-theart next POI recommendation models in all three datasets. \fLarge Language Models for Next Point-of-Interest Recommendation SIGIR \u201924, July 14\u201318, 2024, Washington, DC, USA Raw check-in records [time] [poi id], [cat name] \u2026 1 Key-query similarity 2 Trajectory prompting 3 Supervised fine-tuning Current trajectory Historical trajectory [user id] Instruction Target Response LLM Prompt Figure 2: Our overall large language model-based framework for next POI recommendation. 2 RELATED WORK 2.1 Next POI Recommendation Sequence-based models. Early work on next POI recommendation often treated the next POI recommendation as a sequential recommendation task. Therefore, methods that had been widely used for other sequential recommendation tasks were adapted. For instance, the next POI recommendation task was first introduced by Cheng et al. [4], and they adapted FMPC [21], implementing a localized region constraint where only neighborhood locations are considered for each user. He et al. [14] combined the personalized Markov chain with the latent pattern by incorporating the softmax function. However, these methods are less capable of capturing complex sequential patterns compared to deep neural networks. Subsequent work has begun to apply RNN-based models with the rise of deep learning. Kong and Wu [17] proposed HST-LSTM, where they added spatial-temporal factors into LSTM gates to guide the learning and further employed a hierarchical extension to model the periodicity of the visit sequence. LSTPM [22] employed three LSTM modules, utilizing non-local neural operations and a shortterm preference modeling module using geo-dilated LSTM. PLSPL [27] combined an embedding layer with the attention mechanism to learn long-term preferences and leveraged two LSTM models to model short-term preferences at both the location and category levels. STAN [19] uses a multimodal embedding layer to learn the representation of user, location, time, and spatial-temporal effect, with a bi-layer attention architecture to learn the explicit spatialtemporal relevance within the trajectories. CFPRec [35] focused on the multi-step future plan of users by adopting an attention mechanism to extract future references from past and current preference encoders that are transformer and LSTM encoders. These sequence-based models often become confined to a local view and also suffer from short trajectories and the cold-start problem where inactive users have limited data. Our method deploys key-query similarity, which allows us to combine information from different users, alleviating the cold-start problem. Graph-based models. More recently, graph-based methods have been incorporated to address the limitations of sequence-based models. STP-UDGAT [18] were the first to use a graph attention network [24], enabling users to selectively learn from others in a global view. Zhang et al. [34] proposed a hierarchical multi-task graph recurrent network (HMT-GRN) to learn user-POI and userregion distribution, employing a GRN to replace the LSTM unit to learn both sequential and global spatial-temporal relationships between POIs. DRGN [26] investigated the intrinsic characteristics of POIs by learning disentangled representation from both distancebased and transition-based relation graphs through a GCN layer. GETNEXT [33] addressed the cold start problem by exploiting collaborative signals from other users and proposing a global trajectory flow map and a novel graph-enhanced transformer model. STHGCN [30] alleviated cold-start issues by constructing a hypergraph to capture higher-order information, including user trajectories and collaborative relations. Although graph-based models handle the cold-start problem, they are not capable of combining contextual information with commonsense knowledge. Our method avoids contextual information loss by trajectory prompting, and the LLMs that we use contains commonsense knowledge to understand contextual information. 2.2 LLMs for Time-series Data LLMs have proven to be effective for time-series data. The study by SHIFT [28] approached human mobility forecasting as a language translation problem rather than a traditional time-series problem, utilizing a sequence-to-sequence language model complemented by a mobility auxiliary branch. AuxMobLCast [28] further investigated prompt engineering on time-series data. LLM4TS [2] employs a two-stage fine-tuning approach, initially applying supervised fine-tuning to align the LLM with time-series data, followed by downstream task-specific fine-tuning. Inspired by these works, we design trajectory prompting specifically for LBSN data, allowing us to transform the next POI recommendation task into a questionanswering task. 2.3 LLMs for Recommender Systems Recently, many works have adopted LLMs on recommender systems. Zhang and Wang [36] designed multiple prompt templates for different perspectives of news data and did prompt-learning BERT [10] to produce binary answers to templates. Then multiprompt ensembling was applied to get final predictions. Harte et al. [13] proposed three approaches to leverage LLMs for sequential recommendation. They first compute the embeddings of items and then make recommendations based on the similarity of item embeddings. They also directly fine-tune LLMs to do a prompt completion where the prompt contains a list of item names without the last item and LLMs are asked to complete the prompt with the name of the last product. They also enhanced existing sequential models with embeddings from LLMs. Wang et al. [25] applied in-context learning with LLMs for next POI recommendation. Our method not only fine-tune LLMs for the next POI recommendation, but also \fSIGIR \u201924, July 14\u201318, 2024, Washington, DC, USA P. Li et al. has carefully designed task-specific trajectory similarity to further utilize the power of LLM. 3 PROBLEM DEFINITION The research problem that we address in this paper is to fine-tune LLMs for the task of next POI recommendation. The problem can be formalized as follows. Consider a dataset D of user check-in records. Each record is represented by a tuple \ud835\udc5e= (\ud835\udc62, \ud835\udc5d,\ud835\udc50,\ud835\udc61,\ud835\udc54), where: \u2022 \ud835\udc62denotes a user from the set \ud835\udc48= {\ud835\udc621,\ud835\udc622, . . . ,\ud835\udc62\ud835\udc41}, where \ud835\udc41is the total number of users; \u2022 \ud835\udc5dis a point of interest (POI) from the set \ud835\udc43= {\ud835\udc5d1, \ud835\udc5d2, ..., \ud835\udc5d\ud835\udc40}, where \ud835\udc40is the number of distinct POIs; \u2022 \ud835\udc50specifies the category of the POI; \u2022 \ud835\udc61represents the timestamp of the check-in; and \u2022 \ud835\udc54signifies the geometric coordinate of the POI. Given a time interval \u0394\ud835\udc61, trajectories for a user \ud835\udc62are formed by splitting the check-in records based on this interval. Each trajectory \ud835\udc47\ud835\udc62 \ud835\udc56up to timestamp \ud835\udc61for user \ud835\udc62is given by: \ud835\udc47\ud835\udc62 \ud835\udc56(\ud835\udc61) = {(\ud835\udc5d1,\ud835\udc501,\ud835\udc611,\ud835\udc541), . . . , (\ud835\udc5d\ud835\udc58,\ud835\udc50\ud835\udc58,\ud835\udc61\ud835\udc58,\ud835\udc54\ud835\udc58)}, where \ud835\udc611 < \ud835\udc612 < \u00b7 \u00b7 \u00b7 < \ud835\udc61\ud835\udc58= \ud835\udc61and \ud835\udc61\ud835\udc58\u2212\ud835\udc611 \u2264\u0394\ud835\udc61. Given this set of historical trajectories T \ud835\udc62= {\ud835\udc47\ud835\udc62 1 ,\ud835\udc47\ud835\udc62 2 , . . . ,\ud835\udc47\ud835\udc62 \ud835\udc3f} for user \ud835\udc62, where \ud835\udc3frepresents the number of trajectories for \ud835\udc62, the objective is to predict the POI \ud835\udc5d\ud835\udc58+1 for a new trajectory \ud835\udc47\u2032\ud835\udc62 \ud835\udc56(\ud835\udc61), where user \ud835\udc62will check in at the immediate subsequent timestamp \ud835\udc61\ud835\udc58+1. 4 METHODOLOGY The overall framework of our work is presented in Figure 2. Our method includes three components: trajectory prompting, keyquery similarity, and supervised fine-tuning for LLMs. First, the raw data is used to construct the prompt and compute the prompt-based key-query similarity. Trajectory prompting uses both raw data and the key-query similarity to form the prompts for the LLM. The LLM is then trained with supervised fine-tuning using the prompts. 4.1 Trajectory Prompting Inspired by [20, 29, 39], we propose trajectory prompting to convert sequences of user check-in data into a natural language questionanswering format for LLMs to follow the instruction from the prompt and generate the POI recommendation. This transformation is crucial in leveraging the power of pretrained LLMs. The idea of trajectory prompting is to unify heterogeneous LBSN data into meaningful sentences that can be fed into LLMs. Specifically, we construct prompts by designing different blocks of sentences for their respective purposes. As shown in Table 2, a prompt consists of the current trajectory block, the historical trajectory block, the instruction block, and the target block. There are check-in record sentences for both the current trajectory block and the historical trajectory block. These sentences contain the necessary information in a check-in record (e.g., user ID, timestamp, POI category name, POI category ID). Specifically, for each check-in record \ud835\udc5e= (\ud835\udc62, \ud835\udc5d,\ud835\udc50,\ud835\udc61,\ud835\udc54), we form the sentence as \u201cAt [time], user [user id] visited POI id [poi id] which is a/an [poi category name] with category id [category id].\u201d We do not Table 2: Structure of prompts and check-in record. Red indicates the current trajectory block. Purple indicates the historical trajectory block. Orange indicates the instruction block. Blue indicates the target block. prompt <question> The following is a trajectory of user [user id]: [check-in records]. There is also historical data: [check-in records]. Given the data, at [time], which POI id will user [user id] visit? Note that POI id is an integer in the range from 0 to [id range]. <answer>: At [time], user [user id] will visit POI id [poi id]. check-in record At [time], user [user id] visited POI id [poi id] which is a/an [poi category name] with category id [category id]. include geo-coordinates in the sentence to save the number of tokens and we also find that LLMs, without specifically fine-tuning on map data, are not able to distinguish geo-coordinates well. The check-in records then form trajectories. Note that for the current trajectory block, there will only be one trajectory from the current user, and there can be multiple trajectories from arbitrary users for the historical trajectory block. The current trajectory block provides information for the current trajectory, excluding the last entry. The historical trajectory block incorporates historical information from both the current user and other users who have similar behavior patterns to the current user, which is used for dealing with short trajectory and cold start problems. The details of selecting historical trajectories will be explained in Section 4.2. The instruction block guides the model on what to focus on and also reminds the model of the range of POI IDs since the POI IDs generated by LLMs are not by simple argmax over the output probabilities of LLMs that are for the entire vocabulary. The target block contains the timestamp, user ID, and POI ID for the check-in record to be predicted, which serves as the ground truth for fine-tuning and evaluation. The target block is excluded from the input during prediction. We have tested adding POI category information in both the instruction block and target block, expecting to encourage the model to pay more attention to the relation between the POI ID and the POI category. However, it turned out that the performance did not show a significant difference, and the model might have already learned that inner relationship. Our approach of prompting with blocks of sentences allows us to integrate the heterogeneous LBSN data into meaningful sentences in its original format. The design of using blocks is easy to modify and extend. 4.2 Key-Query Pair Similarity To capture patterns of users\u2019 behaviors from their historical trajectories and different users\u2019 trajectories, we propose a key-query pair similarity computation framework that suits trajectories in a natural language format. We treat each trajectory differently based on its respective position in the prompt. When a trajectory is considered for the current trajectory block, it is treated as the key, while any trajectory whose end time is earlier than this trajectory is treated as a query. We compute the similarity for all key-query pairs. Subsequently, we select queries with high similarity values \fLarge Language Models for Next Point-of-Interest Recommendation SIGIR \u201924, July 14\u201318, 2024, Washington, DC, USA Trajectory Key Prompt Query Prompt Trajectory Key Prompt Query Prompt Trajectory Time Key Prompt Query Prompt ... ... Similarity Similarity Similarity Figure 3: The process of forming and pairing key and query prompts. Each trajectory is made into a key prompt and a query prompt. The key prompt contains the check-in records excluding the last entry of the trajectory, while the query prompt contains the entire trajectory. A key prompt is paired with every query prompt representing the trajectories before the current trajectory. LLAMA2 Encoder Hidden State Masked Multiheaded Attention Layer Norm Feed Forward Layer Norm Hidden State Layer Norm Key Prompt Query Prompt Sim 32x Figure 4: Similarity computation for each pair of key and query. Each pair of key and query prompts are fed into a LLAMA2 encoder separately. We use the last hidden layer embeddings to compute their cosine similarity. for the historical trajectory block. This approach allows us to incorporate information from other users\u2019 trajectories that exhibit similar behavior patterns into the current trajectory. As illustrated in Figure 3 and 4 , we first form the key and query prompts for every trajectory. Specifically, we use the template for the current trajectory block. For the key prompts, we use the trajectories without their last entry, and for the query prompts, we use the entire trajectories. This is because when the query prompts are used as historical data, the historical trajectories are known, whereas the key prompts are treated as the current trajectories. For every key prompt, we compute the pairwise similarity for it and all the query prompts representing trajectories that have an end time earlier than the start time of the trajectories represented by the key prompt. For each key and query prompt, we feed it into an LLM encoder and get the embeddings from the last hidden layer. The process can be formulated as: \u210e\ud835\udc581 = Transformer Block(0) (Tokenizer(Key)), \u210e\ud835\udc58\ud835\udc59= Transformer Block(\ud835\udc59\u22121) (\u210e\ud835\udc58\ud835\udc59\u22121), \ud835\udc38\ud835\udc58= LN(\u210e\ud835\udc58\ud835\udc5b), (1) \u210e\ud835\udc5e1 = Transformer Block(0) (Tokenizer(Query)), \u210e\ud835\udc5e\ud835\udc59= Transformer Block(\ud835\udc59\u22121) (\u210e\ud835\udc58\ud835\udc59\u22121), \ud835\udc38\ud835\udc5e= LN(\u210e\ud835\udc58\ud835\udc5b), (2) where Tokenizer is used for converting the prompt into a sequence of tokens, Transformer Block(\ud835\udc56) represents the \ud835\udc56-th Transformer block in the model, LN is the layer normalization, \ud835\udc38\ud835\udc58and \ud835\udc38\ud835\udc5eare the final embeddings of the key and query, respectively. After getting embeddings for every key and query, we compute the cosine similarity for each key-query pair. Formally, Sim(Ek, Eq) = Ek \u00b7 Eq \u2225Ek\u2225\u2225Eq\u2225. (3) For each key, we select the top-\ud835\udc58queries with the highest similarity to the key. The trajectories represented by these queries are then used in the historical trajectory block for the key trajectory. The process can be expressed as \ud835\udc46(key) = arg top\ud835\udc58{Sim(\ud835\udc5e\ud835\udc56, key) | \ud835\udc5e\ud835\udc56\u2208\ud835\udc44}, (4) where \ud835\udc44is the set of queries with the end time earlier than the start time of the key. 4.3 Supervised Fine-tuning Fine-tuning LLMs can be costly. We apply Parameter-Efficient-FineTuning (PEFT) techniques during the fine-tuning stage. Low-rank adaptation. We apply LoRA [16], freezing dense layers in LLMs and updating weights with rank decomposition matrices. For a pretrained weight matrix \ud835\udc4a0 \u2208\ud835\udc45\ud835\udc51\u00d7\ud835\udc58, we replace weight updates \ud835\udc4a0 + \u0394\ud835\udc4awith low-rank decomposition \ud835\udc4a0 + \ud835\udc3f1\ud835\udc3f2, where \ud835\udc3f1 \u2208\ud835\udc45\ud835\udc51\u00d7\ud835\udc5f, \ud835\udc3f2 \u2208\ud835\udc45\ud835\udc5f\u00d7\ud835\udc58, and \ud835\udc5f\u226a\ud835\udc5a\ud835\udc56\ud835\udc5b(\ud835\udc51,\ud835\udc58). During training, only \ud835\udc35 and \ud835\udc34receive gradient updates. For \u210e= \ud835\udc4a0\ud835\udc65, the modified forward pass is \u210e= \ud835\udc4a0\ud835\udc65+ \ud835\udc3f1\ud835\udc3f2\ud835\udc65. LoRA is applied only to attention layers; MLP layers are frozen during fine-tuning. For an attention layer with 4096 elements, LoRA reduces trainable parameters to 0.78% with a rank of 16, compared to full fine-tuning. Quantization. To reduce GPU memory usage, we apply quantization techniques [8, 9]. Quantization involves converting highbit data types into lower-bit ones. We use the 4-bit NormalFloat (NF) proposed by [9], optimal for zero-mean normal distributions in [-1,1]. This process involves rescaling input tensors and applying quantization constants. To reduce memory overhead, double quantization is applied. NF4 is used for storage, while 16-bit BrainFloating (BF) is used for forward and backward passes. Note that the weight gradient is still only computed over the Low-Rank Adaptation (LoRA) parameters. FlashAttention. Long trajectories and the historical trajectory block in the prompt require long context length from LLMs. A typical context length of 4096 is not enough for our purposes. Therefore, we apply FlashAttention-2 [6, 7], which allows transformers to have long context lengths. 5 EXPERIMENT 5.1 Experimental Setup 5.1.1 Datasets. We conduct experiments on three public datasets: Foursquare-NYC, Foursquare-TKY [32], and Gowala-CA [5]. The \fSIGIR \u201924, July 14\u201318, 2024, Washington, DC, USA P. Li et al. first two datasets, collected over 11 months, comprise data from New York City and Tokyo, sourced from Foursquare. The Gowala-CA dataset, from the Gowalla platform, covers a broader geographical area and time period, encompassing California and Nevada. We utilize data that has been preprocessed as per the methods detailed by Yan et al. [31]. The data is preprocessed as follows: (i) Filter out Points of Interest (POIs) with fewer than 10 visit records in history; (ii) Exclude users with fewer than 10 visit records in history; (iii) Divide user check-in records into several trajectories with 24-hour intervals, excluding trajectories that contain only one check-in record. The check-in records are also sorted chronologically: the first 80% are used for the training set, the middle 10% are defined as the validation set, and the last 10% are defined as the test set. Note that the validation and test set has to contain all users and POIs that appear in the training set. The unseen users and POIs would be removed from the validation and test set. 5.1.2 Baselines. We compare our model with the following baselines: \u2022 FPMC [21]: rooted in the Bayesian Personalized Ranking framework, employs a typical Markov chain combined with matrix factorization to predict location transitions effectively. \u2022 LSTM [15]: A variant of RNN, is designed for processing sequential data. Unlike standard RNNs, LSTMs are capable of capturing both short-term and long-term dependencies in sequential patterns, making them more effective for a range of sequential data tasks. \u2022 PRME [12]: Utilizing a pairwise ranking metric embedding, this personalized ranking model effectively learns sequential transitions of POIs along with capturing user-POI preferences in latent space. \u2022 STGCN [37]: Based on LSTM, this model incorporates gating mechanisms to effectively model temporal and spatial intervals in check-in sequences, thereby capturing both short-term and long-term user preferences. \u2022 PLSPL [27]: This recurrent model employs an attention mechanism to learn short-term preferences and two parallel LSTM structures for long-term preferences, integrating both through a user-specific linear combination. \u2022 STAN [19]: Leveraging a bi-layer attention architecture, STAN aggregates spatio-temporal correlations within user trajectories, learning patterns across both adjacent and non-adjacent locations as well as continuous and non-continuous visits. \u2022 GETNext [33]: A transformer-based approach, GETNext uses a global trajectory flow map that is user-agnostic to enhance nextPOI predictions, alongside proposing a GCN model for generating effective POI embeddings. \u2022 STHGCN [31]: Constructing a hypergraph to capture inter and intra-user relations, STHGCN proposes a hypergraph transformer and solves the cold-start problem. 5.1.3 Our Models. In our experiments we consider three versions of what we call \u201cour model\u201d: (i) LLAMA2-7b: Our model, using prompts only the current trajectory block without the historical trajectory block, where we use Llama-2-7b-longlora-32k [3, 23] as our base LLM. (ii) LLAMA2-7b*: A variation on LLAMA2-7b where we use prompts with the historical trajectory block without applying key-query similarity, where only the historical trajectories from the current users are considered. (iii) LLAMA2-7b**: A second variation on LLAMA2-7b where we use prompts with the historical trajectory block combined with key-query similarity, where historical trajectories from both the current users and other users are considered. Below, unless stated otherwise, when we say \u201cour model,\u201d we refer to the LLAMA2-7b** variant. 5.1.4 Evaluation Metrics. For evaluation we regard the next POI recommendation task as a top-1 recommendation problem. The scenario we have in mind is one with \u201cextreme position bias\u201d [11], where only a small amount of information can be presented to the user during a single interaction. For example, a user who is on a business trip wishes to explore the new city before the meeting. In such a scenario, the user does not have the leisure to review multiple options. This is a scenario that is usually considered in next POI recommendation, often as the primary scenario [see, e.g., 31, 33]. Given this choice of scenario, our approach to the task as a type of question-answering problem is a natural fit. We prioritize the delivery of the most pertinent and contextually suitable recommendation, mirroring the objective of providing a single, correct answer to a user\u2019s query. The evaluation metric we use is Accuracy@1. It looks at what proportion of the test items would have been retrieved with the top-1 recommended list and can be formalized as: Acc@1 = 1 \ud835\udc5a \ud835\udc5a \u2211\ufe01 \ud835\udc56=1 1(rank \u22641), (5) where 1 is the indicator function. Rank is the rank of the order of the correct prediction in the recommendation list. A larger value represents better performance. 5.1.5 Implementation Details. For fine-tuning, we use a constant learning rate schedule with a learning rate of 2 \u00d7 105, combined with a warm-up of 20 steps, a weight decay of 0, a batch size of 1 per GPU, and a sequence length of 32,768 tokens. For each dataset, we fine-tune the model for 3 epochs. We use approximately 300 historical check-in records to construct the historical trajectory block in the prompt. Our experiments are conducted on servers with Nvidia A100 GPUs. 5.2 Main Results We compare the performance of our models and the baselines on three datasets, as shown in Table 3. Our model substantially outperforms all baselines. Specifically, we observe improvements of 23.3%, 2.8%, and 19.3% in top-1 accuracy on the NYC, TKY, and CA datasets, respectively, compared to the state-of-the-art STHGCN. Models utilizing historical data perform better than those that do not, and those incorporating data from other users see further performance boosts, highlighting the significance of short trajectory and cold-start problems in next POI recommendation tasks. All models except STHGCN perform best in NYC, with noticeable performance drops in TKY and CA. NYC has the smallest number of users and POIs but a larger number of POI categories than the other datasets, suggesting it has the easiest data to learn. In contrast, CA covers a much wider area than NYC \fLarge Language Models for Next Point-of-Interest Recommendation SIGIR \u201924, July 14\u201318, 2024, Washington, DC, USA Table 3: Performance comparison in terms of Acc@1 on three datasets. \u2713and \u00d7 in the History and Other Users columns indicate whether the model uses historical data or data from other users, respectively. Model History Other NYC TKY CA users Acc@1 Acc@1 Acc@1 FPMC \u00d7 \u00d7 0.1003 0.0814 0.0383 LSTM \u00d7 \u00d7 0.1305 0.1335 0.0665 PRME \u00d7 \u00d7 0.1159 0.1052 0.0521 STGCN \u00d7 \u00d7 0.1799 0.1716 0.0961 PLSPL \u00d7 \u00d7 0.1917 0.1889 0.1072 STAN \u00d7 \u00d7 0.2231 0.1963 0.1104 GETNext \u2713 \u2713 0.2435 0.2254 0.1357 STHGCN \u2713 \u2713 0.2734 0.2950 0.1730 LLAMA2-7b \u00d7 \u00d7 0.2356 0.1517 0.1016 LLAMA2-7b* \u2713 \u00d7 0.3171 0.2836 0.1683 LLAMA2-7b** \u2713 \u2713 0.3372 0.3035 0.2065 and TKY, leading to data scarcity and significantly lower model performance. 5.3 Analysis 5.3.1 User Cold-start Analysis. Our approach incorporates the historical trajectory block and key-query trajectory similarity to tackle the cold-start problem by leveraging knowledge from diverse users. User activity status greatly impacts model performance, with active users providing more historical data and generally easier behavior patterns to learn. To assess our method\u2019s effectiveness with inactive users, we categorize users into inactive, normal, and very active groups based on the number of trajectories in the training set, designating the top 30% users ranked by their number of trajectories as very active and the bottom 30% as inactive. We compare our model with STHGCN, which is designed to address the cold-start problem and has shown effectiveness with inactive users. The comparison, shown in Table 4, reveals our model significantly improves performance for inactive users, more than doubling the baseline in NYC and increasing by over half in TKY and CA. This improvement underscores our method\u2019s ability to leverage information from similar users effectively, especially for those with limited historical data. Table 4: User cold-start analysis on the NYC, TKY, and CA datasets. User groups Model NYC TKY CA Acc@1 Acc@1 Acc@1 Inactive STHGCN 0.1460 0.2164 0.1117 Normal STHGCN 0.3050 0.2659 0.1620 Very active STHGCN 0.3085 0.3464 0.2040 Inactive Ours 0.3417 0.3478 0.2132 Normal Ours 0.3841 0.3516 0.2057 Very active Ours 0.3088 0.2727 0.1920 Interestingly, our model performs better for inactive users than very active ones, contrasting the baselines\u2019 better performance with very active users. This suggests that the similar trajectories we identify for very active users are often from their own, leading to less diverse behavior patterns and less effective prediction of difficult data points. The less significant improvement in TKY and CA compared to NYC might be due to the higher user count in these datasets, limiting the collaborative information our method can utilize within the model\u2019s context length constraints. 5.3.2 Trajectory Length Analysis. The varying lengths of trajectories in the next POI recommendation task, reflecting different user behaviors, pose another significant challenge. Short trajectories, with their limited spatio-temporal information and non-significant patterns, are particularly challenging, especially those with only one or two check-ins. While long trajectories contain more information, extracting useful patterns from them is also difficult. Our method\u2019s effectiveness varies with the trajectory length due to the context length limit, allowing fewer historical trajectories to be added for long trajectories compared to short ones. To explore the trade-off between long and short trajectories, we rank the lengths of trajectories in the test set, defining the top 30% as long trajectories and the bottom 30% as short trajectories, with the rest classified as middle trajectories. Comparing our method to STHGCN, Table 5 highlights our substantial improvement for short trajectories in NYC. We achieve an improvement of 24.4% in top-1 accuracy for short trajectories and 31.6% for middle trajectories in NYC, demonstrating our method\u2019s strong capability to integrate historical data for short trajectories. Interestingly, while we perform better for short trajectories in NYC, the opposite is true in TKY and CA. However, our model\u2019s performance does not vary significantly across different trajectory lengths, indicating a balanced trade-off between long and short trajectories. Table 5: Trajectory length analysis on the NYC, TKY, and CA datasets. Trajectory types Model NYC TKY CA Acc@1 Acc@1 Acc@1 Short STHGCN 0.2703 0.2787 0.1727 Middle STHGCN 0.2545 0.2823 0.1785 Long STHGCN 0.3184 0.3116 0.1742 Short Ours 0.3364 0.2876 0.1955 Middle Ours 0.3350 0.3013 0.1998 Long Ours 0.3271 0.3083 0.2037 5.3.3 Number of Historical Data Variants. An important factor of our method is the number of historical trajectories used for the historical trajectory block. Since there is a token limit for the prompt, we cannot use all the historical trajectories but only the ones with the highest similarity to the current trajectory. Because trajectories vary in length, we use the number of check-in records in the historical trajectory block to evaluate the effect of the number of historical trajectories on performance. We compare our model trained and evaluated with different numbers of historical check-in records. As shown in Table 6, we observe that the model archives the best performance in NYC with 100 historical check-in records and decreases as the number of check-in records grows. On the other hand, the model has the best performance in TKY with 300 historical check-in records, and the performance is positively correlated to the number of historical \fSIGIR \u201924, July 14\u201318, 2024, Washington, DC, USA P. Li et al. Figure 5: The proportion of test set prompts where the answer POI IDs are included within the questions, in their respective datasets. Figure 6: The proportion of test set prompts where the answer POI IDs are included within the questions, in their respective datasets, for the correct predictions made by the models trained on the NYC, TKY, and CA. check-in records. Note that the performance in TKY only improves by a tiny margin when the number of historical check-in records increases from 200 to 300. The model performance remains closely in CA, with different numbers of different historical check-in records. The results indicate that using more historical data does not necessarily improve the model performance. We can use less historical data to reduce the token size of prompts but still achieve competitive model performance, which also speeds up the training and inference. Table 6: Analysis on NYC, TKY, and CA dataset for LLAMA27b** trained on prompts with different numbers of historical trajectories. Number of historical NYC TKY CA check-ins Acc@1 Acc@1 Acc@1 100 0.3420 0.2166 0.2056 200 0.3400 0.3023 0.2035 300 0.3372 0.3035 0.2065 5.3.4 Generalization to Unseen Data Analysis. The fact that our approach does not rely on a linear classifier to output the POI IDs but predicts with purely language modeling allows us to evaluate our models, fine-tuned on one dataset, on unseen data without any further training. We fine-tune our models on one of the NYC, TKY, and CA and then evaluate them on the rest. As shown in Table 7, interestingly, the models achieve competitive performance on datasets which they are not fine-tuned on. Specifically, the model trained in NYC has a top-1 accuracy lower than STHGCN for TKY and better than the state-of-the-art models in CA. The model trained on TKY performs even better in NYC than in NYC and is also better than the state-of-the-art models in CA. The model trained on CA is better than the state-of-the-art models in NYC and has a top-1 accuracy lower than STHGCN for TKY. This suggests that our models generalize well to unseen data. Table 7: The models are LLAMA2-7b** trained only on one of the NYC, TKY, and CA datasets and evaluated on the rest. Trained on NYC TKY CA Acc@1 Acc@1 Acc@1 NYC 0.3372 0.2594 0.1885 TKY 0.3463 0.3035 0.1960 CA 0.3344 0.2600 0.2065 We look into the prompts to further investigate the reason for the generalization ability. As shown in Figure 5, we find that 75.8%, 73.5%, and 55.6% of the prompts in test sets of NYC, TKY, and CA, respectively, have the answer POI IDs appear within the questions. These portions are positively correlated to the overall model performance on each dataset. We also observe that the models trained on different datasets behave closely on each dataset, as shown in Figure 6. Specifically, in their correct predictions, the portions of the prompts with answer POI IDs that appear within the questions are almost identical. This suggests: (i) the reason why our models have good performance is that our historical trajectory block combined with key-query similarity accurately captures the useful information from the current user\u2019s historical trajectories and other users\u2019 trajectories; (ii) the models learn to extract the correct POI IDs from the prompts directly, which helps them to generalize to unseen data. 5.3.5 Contextual Information Analysis. What distinguishes our method from other works is that we use models embedded with commonsense knowledge to exploit contextual information. To evaluate how contextual information helps our model, we replace the POI category names in the prompts with texts of the same lengths with no meaning to mask the contextual information. We analyze the model on the NYC, TKY, and CA datasets and compare the results with prompts with and without contextual information. Table 8 shows the overall results for the models trained in NYC, TKY, and CA and tested with different prompts. We can see that the model performance drops by a small margin when we remove the contextual information from POI category names in NYC. For TKY and CA, the model performance decreases by 6.4% and 6.2%, respectively. Table 8: The results for LLAMA2-7b** tested with different prompts. Prompts NYC TKY CA Acc@1 Acc@1 Acc@1 w/ context 0.3372 0.3035 0.2065 w/o context 0.3310 0.2840 0.1935 To further investigate the effectiveness of the contextual information, we evaluate the model on different levels of user activity with and without contextual information, similar to Section 5.3.1. \fLarge Language Models for Next Point-of-Interest Recommendation SIGIR \u201924, July 14\u201318, 2024, Washington, DC, USA Figure 7: Statistics for different POI categories in the NYC, TKY, and CA datasets. From Table 9, we observe a significant drop in performance for inactive and normal users and an increase in performance for active users in TKY. The performance increases for inactive users and decreases for normal and active users in NYC and CA. The contextual information affects the model performance in two opposite directions for datasets in two different countries. Figure 7 shows the stats for POI categories of NYC, TKY, and CA. We can see that the distributions of POI categories are indeed different between the two countries, where almost half of the POIs in TKY are for travel and transportation. Because POI contextual information differs from two types of datasets, the models behave differently from TKY to NYC and CA. This supports the models\u2019 understanding of the inherent meaning behind POI contextual information for the three datasets. Table 9: The results for LLAMA2-7b** tested with different prompts in terms of users with different levels of activity. User groups Prompts NYC TKY CA Acc@1 Acc@1 Acc@1 Inactive w/ context 0.3417 0.3478 0.2132 Normal w/ context 0.3841 0.3516 0.2057 Very active w/ context 0.3088 0.2727 0.1920 Inactive w/o context 0.3493 0.2751 0.2148 Normal w/o context 0.3623 0.2715 0.1951 Very active w/o context 0.3025 0.2884 0.1732 5.3.6 Effect of Different Components. We consider the performance of our model as the joint effect of (i) the historical trajectory block; (ii) key-query similarity; (iii) contextual information. To investigate the effect of each component, we remove the historical trajectory block in the prompt and only put the current user\u2019s historical trajectories in the historical trajectory block, respectively. As shown in Table 10, the results suggest that each component contributes to the full model performance. Specifically, the historical trajectory block plays a critical role, where the top-1 accuracy drops as much as 50% in TKY and CA. Because without any historical trajectories, the model suffers from short trajectories, which the datasets mostly consist of. With key-query similarity being removed, the collaborative information from other users is missing from the historical block, which leads to the inability to deal with the cold-start problem. On top of these two components, contextual information provides a further understanding of the data, improving the model\u2019s performance. Table 10: Ablation study results for LLAMA2-7b** over three datasets. Model NYC TKY CA Acc@1 Acc@1 Acc@1 Full model 0.3372 0.3035 0.2065 w/o history 0.2356 0.1517 0.1016 w/o similarity 0.3171 0.2836 0.1683 w/o context 0.3310 0.2840 0.1935 6"
18
+ }
abs_9K/validation_abstract_short_2404.17593v1.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.17593v1",
3
+ "title": "A Continual Relation Extraction Approach for Knowledge Graph Completeness",
4
+ "abstract": "Representing unstructured data in a structured form is most significant for\ninformation system management to analyze and interpret it. To do this, the\nunstructured data might be converted into Knowledge Graphs, by leveraging an\ninformation extraction pipeline whose main tasks are named entity recognition\nand relation extraction. This thesis aims to develop a novel continual relation\nextraction method to identify relations (interconnections) between entities in\na data stream coming from the real world. Domain-specific data of this thesis\nis corona news from German and Austrian newspapers.",
5
+ "authors": "Sefika Efeoglu",
6
+ "published": "2024-04-20",
7
+ "updated": "2024-04-20",
8
+ "primary_cat": "cs.DL",
9
+ "cats": [
10
+ "cs.DL",
11
+ "cs.AI"
12
+ ],
13
+ "label": "Original Paper",
14
+ "paper_cat": "Knowledge AND Graph",
15
+ "gt": "Representing unstructured data in a structured form is most significant for\ninformation system management to analyze and interpret it. To do this, the\nunstructured data might be converted into Knowledge Graphs, by leveraging an\ninformation extraction pipeline whose main tasks are named entity recognition\nand relation extraction. This thesis aims to develop a novel continual relation\nextraction method to identify relations (interconnections) between entities in\na data stream coming from the real world. Domain-specific data of this thesis\nis corona news from German and Austrian newspapers.",
16
+ "main_content": "Introduction For various reasons, semantic analysis and interpretation of unstructured data, such as social media posts, texts on web pages, and chats, are one of the challenges in information management systems. To analyze and interpret unstructured text data, it must be represented in a structured form. One way of representing unstructured data in the structured form is the use of knowledge graphs (KGs) [1]. An information extraction (IE) pipeline is generally organized as the product of several analysis components, e.g.: named entity (NE) tagging; syntactic analysis; coreference resolution within a document; entity, relation and event extraction (semantic analysis); and cross-document coreference resolution [2]. Semantic analysis in IE systems might be carried out on the KG. Recent KG construction approaches utilize machine learning-based approaches instead of rulebased techniques for NE and relation extraction (RE). The machine learning-based approaches obtain impressive results in the NE tagging [3], while they do not show this performance on RE [4]. Detection of relations between entity pairs has been addressed with various types of approaches: (i) supervised techniques including features-based and kernel-based methods, (ii) a special class of techniques which jointly extract entities and relations ( semi-supervised), (iii) unsupervised, (iv) Open IE and (v) distant supervision based techniques [5]. Supervised techniques require a large annotated data set, and its annotation process is time-consuming and expensive [5]. Distant supervision is amongst one of the popular methods to deal with this TPDL2022: 26th International Conference on Theory and Practice of Digital Libraries, 20-23 September 2022, Padua, Italy *This doctoral thesis is supervised by Prof. Dr. Adrian Paschke at the Free University of Berlin. $ sefika.efeoglu@fu-berlin.de (S. Efeoglu) \u001a 0000-0002-9232-4840 (S. Efeoglu) \u00a9 2022 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0). CEUR Workshop Proceedings http://ceur-ws.org ISSN 1613-0073 CEUR Workshop Proceedings (CEUR-WS.org) arXiv:2404.17593v1 [cs.DL] 20 Apr 2024 \fannotated data problem. The distant supervision, based on existing knowledge bases, brings its own drawback, and it faces the problem of wrongly labeled sentences troubling the training due to the excessive amount of noise [6]. In addition to distant supervision, another most popular approach is bootstrapping-based semantic RE techniques, namely weakly supervised RE [7]. However, the weakly supervised approach is more error-prone because of semantic drift in a set of patterns per iteration of a snowball algorithm [7]. On the other hand, in rule-based RE approaches, finding relations are mostly dependent on predefined rules [5]. Recently, extracting information from health data published on the web has become more significant to analyze and take precautions due to the ongoing pandemic. To analyze and evaluate the processes of the pandemic or its measurements, its data must be represented in a machine-readable and understandable format. Moreover, the IE pipeline extracted information from web documents or pages must run throughout producing new data by web applications without any interruption. Concerning the applicability of existing RE methods, information systems have to cope with different challenges, leveraging KG in real-world applications in terms of RE: (i) missing extracted relations between the entities throughout the data stream, since the existing methods run once on a fixed data set, (ii) heterogeneous representation of data, (iii) requirement of a large annotated data set and (iv) unexplainable relations extracted by machine learning-based approaches. The existing RE approaches trained and evaluated on the fixed data set are mostly dependent on predefined relations [5, 6, 8]; therefore, they might not discover new relation types in the applications whose data is coming from the real world. Because of this reason, to discover new relation types, the learning process must be continuous. Otherwise, using the existing RE approaches on real-world applications leads to KG incompleteness [8]. The rest of this paper explains the thesis\u2019 problem details in the Problem Statement section, seeking the solution to research questions in this thesis. After that, this paper introduces the possible methods for these research questions in the Research Methodology section, and then the paper gives possible evaluation approaches in the Evaluation section. Lastly, it details concluding remarks in the Conclusion section. 2. Problem Statement As stated in the Introduction section, relation extraction is one of the most significant tasks in knowledge acquisition which is used for managing and analyzing data on web documents and pages in the health domain. Traditional machine learning-based relation extraction approaches such as distant supervision and bootstrapping methods run once on a fixed data set offline. The main problem with these approaches is that it could not be feasible to detect relations between entities throughout a data stream coming from the real world since they run once as offline on the fixed data set [9]. Because of this reason, they might not keep and transfer knowledge learned from previous tasks to further tasks. Furthermore, existing RE approaches for streaming data like meta-continual learning are applied offline and do not support knowledge retention [10]. To provide learning over data coming from real-world applications, knowledge retention is one of the most important requirements for human-like learning. In addition, this thesis addresses KG incompleteness for RE in \fterms of non-stationary text data. This thesis tries to tackle the problem above, seeking answers to the following research questions (RQ): \u2022 RQ1: How can new relation types between entities be continuously discovered throughout a data stream coming from the real world? (The 1\ud835\udc60\ud835\udc61) \u2022 RQ2: How can the KG incompleteness in terms of relations between entities be addressed in the context of continuous streaming data? (The 2\ud835\udc5b\ud835\udc51) \u2022 RQ3: Can semantic drift of a set of patterns in a weakly supervised approach be tackled by a rule learning method using KG or ontology embeddings? (The 3\ud835\udc5f\ud835\udc51) \u2022 RQ4: How can finally extracted relations be made explainable and interpretable? since machine learning approaches are black-box. (Last year) 3. Research Methodology The thesis proposal hypothesizes that a weakly supervised continual RE approach tackles the KG incompleteness problem in terms of relations between entities, identifying relation types continuously in a data stream coming from real-world applications like newspapers. In addition, this thesis claims that continual learning might increase the number of newly discovered different relation types, feeding the model with new data resources. The proposed research methods below (See Fig. 1) are developed and evaluated on the corona news published on Tagesschau 1 and Austrian Derstandard 2. Corona News A corona NER model A continual RE \u00a0model Omicron[CORONAVIRUS] PCR[LAW] Quarantine[LAW] ... hasDuration hasSymptom startDate endDate ... Entities Relation Types Knowledge Graph Relation Extraction Named Entity \u00a0Tagging Figure 1: This pipeline shows how the thesis is progressing. 3.1. Named Entity Tagging for Corona News Since a corona Named Entity Recognition (NER) model has not been developed yet, and there is no gold standard benchmark data set in this domain, the NER model must be developed to identify named entities in a text before developing and running a RE approach for this data set. However, a weakly supervised CORD-NER data set was published in [11] and is used in the baseline NER model of this thesis after reducing the noise in its labels with Wikidata 3. Then, in order to improve its accuracy on the corona news text data, fine-tuning is applied to this baseline model with Corona News corpus (their English versions) described above. 1Tagesschau : https://www.tagesschau.de/ 2Derstandard: https://www.derstandard.at/ 3Wikidata: https://www.wikidata.org \f3.2. A Continual Relation Extraction Approach for Knowledge Graph Completeness Continuously extraction of relations from non-stationary data still has to address some challenges, such as labeled training data, catastrophic forgetting (because of continual learning) , and predefined relation types. This thesis aims to develop a (online) weakly supervised continual RE approach by using a snowball algorithm which applies an incremental learning method [7]. However, this algorithm has its own drawbacks like a semantic drift on pattern extraction for relation types, and seed relation selection in the first step of the algorithm. Although there are previous attempts to implement this algorithm for RE, they have fixed constant coefficients in its learning phase or knowledge retention problems due to their rule-based approach [12], and also simple transfer learning [13]. Nevertheless, both approaches are evaluated on stationary data for predefined relation types. With respect to evaluation of the continual RE algorithms on the streaming data, existing (offline) continual learning RE algorithms [10, 14] have been tested for the predefined relations on the benchmarks, like FewRel [15] and SimpleQuestions [16]. As stated earlier, the previous algorithms have been run offline and not supported the knowledge retention. An online continual RE algorithm, e.g., neurogenesis and memory replay might transfer the learnt knowledge (relation types) to next tasks [9]. Therefore, this thesis aims to transfer the learnt knowledge in the previous tasks to the following task with an assist of the continual learning algorithm to keep the learnt relation types. In addition to this, the algorithm will consider knowledge graph and category embeddings to discover new relation types together with dependency parsing of a sentence. 4. Evaluation Approaches This thesis evaluates the continual RE approach\u2019s results with evaluation metrics in terms of various perspectives. The thesis takes into account the following metrics: Precision (P), Recall (R), F1 score, P-R curve, area under the curve [14] to evaluate the relation extraction approach. The existing relation extraction algorithms using curriculum meta continual learning [10, 14] have been evaluated offline on the partitions of benchmark data sets e.g., FewRel [15] and SimpleQuestions [16] for time slots. However, there is no approach to evaluate online RE algorithms on streaming data. Similarly, this thesis will evaluate the metrics above for the time slots of the data and measure its performances on the benchmark data in the first phase of its implementation. Furthermore, this thesis also considers following metrics to evaluate the approach\u2019s performance with respect to continual learning: average accuracy, whole accuracy, forgetting measure, learning curve area, and error bound [10, 14]. 5."
17
+ }
abs_9K/validation_abstract_short_2404.17605v1.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2404.17605v1",
3
+ "title": "Autonomous LLM-driven research from data to human-verifiable research papers",
4
+ "abstract": "As AI promises to accelerate scientific discovery, it remains unclear whether\nfully AI-driven research is possible and whether it can adhere to key\nscientific values, such as transparency, traceability and verifiability.\nMimicking human scientific practices, we built data-to-paper, an automation\nplatform that guides interacting LLM agents through a complete stepwise\nresearch process, while programmatically back-tracing information flow and\nallowing human oversight and interactions. In autopilot mode, provided with\nannotated data alone, data-to-paper raised hypotheses, designed research plans,\nwrote and debugged analysis codes, generated and interpreted results, and\ncreated complete and information-traceable research papers. Even though\nresearch novelty was relatively limited, the process demonstrated autonomous\ngeneration of de novo quantitative insights from data. For simple research\ngoals, a fully-autonomous cycle can create manuscripts which recapitulate\npeer-reviewed publications without major errors in about 80-90%, yet as goal\ncomplexity increases, human co-piloting becomes critical for assuring accuracy.\nBeyond the process itself, created manuscripts too are inherently verifiable,\nas information-tracing allows to programmatically chain results, methods and\ndata. Our work thereby demonstrates a potential for AI-driven acceleration of\nscientific discovery while enhancing, rather than jeopardizing, traceability,\ntransparency and verifiability.",
5
+ "authors": "Tal Ifargan, Lukas Hafner, Maor Kern, Ori Alcalay, Roy Kishony",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-04-24",
8
+ "primary_cat": "q-bio.OT",
9
+ "cats": [
10
+ "q-bio.OT",
11
+ "cs.AI"
12
+ ],
13
+ "label": "Original Paper",
14
+ "paper_cat": "LLM AND Agent",
15
+ "gt": "As AI promises to accelerate scientific discovery, it remains unclear whether\nfully AI-driven research is possible and whether it can adhere to key\nscientific values, such as transparency, traceability and verifiability.\nMimicking human scientific practices, we built data-to-paper, an automation\nplatform that guides interacting LLM agents through a complete stepwise\nresearch process, while programmatically back-tracing information flow and\nallowing human oversight and interactions. In autopilot mode, provided with\nannotated data alone, data-to-paper raised hypotheses, designed research plans,\nwrote and debugged analysis codes, generated and interpreted results, and\ncreated complete and information-traceable research papers. Even though\nresearch novelty was relatively limited, the process demonstrated autonomous\ngeneration of de novo quantitative insights from data. For simple research\ngoals, a fully-autonomous cycle can create manuscripts which recapitulate\npeer-reviewed publications without major errors in about 80-90%, yet as goal\ncomplexity increases, human co-piloting becomes critical for assuring accuracy.\nBeyond the process itself, created manuscripts too are inherently verifiable,\nas information-tracing allows to programmatically chain results, methods and\ndata. Our work thereby demonstrates a potential for AI-driven acceleration of\nscientific discovery while enhancing, rather than jeopardizing, traceability,\ntransparency and verifiability.",
16
+ "main_content": "Introduction Recent advances in natural language processing have resulted in LLMs, such as ChatGPT, capable of writing text, answering questions, and generating code at a human level (1\u20135). Furthermore, augmenting LLMs with external tools as well as automating iterative algorithmic prompting and multi-agent interactions has enabled tackling even more complex, multi-step, tasks such as solving math problems (6\u20138), coding and debugging large code projects (9, 10), and creating book-long texts and scripts (11). Most recently, LLMs have even demonstrated a capacity of designing and running experimentation as well as performing clinical diagnostics (12\u201314). Yet, despite all these advances, scientific research, and in particular the de novo creation of insights from data, remains a stronghold of human intelligence and ingenuity (15\u201320). The recent advancement of AI has led to a vivid discussion on the potential and risks of their application in science (21), and to emerging guidelines, emphasizing the importance of key values including accountability, oversight and transparency, notoriously challenging in AI (22). Conducting research and compiling results and conclusions into a transparent and methodologically traceable and verifiable scientific paper is a highly challenging task, involving multiple interconnected steps and requiring planning, inference, and deduction, as well as the meticulous tracing of information. While scientists may in principle follow an infinite number of creative paths towards discovery, certain conventional research paths have been established (23). In particular, such paths typically follow these almost-canonical steps: formulating and reshaping a research question in light of the literature, designing and executing a research plan, interpreting the results in the context of prior knowledge, and writing a research paper. Beyond its established multi-step structure, human-driven scientific process has three additional key characteristics. First, the process is not linear, it often requires iteratively setting back to earlier steps. Second, it is built on a rigorous tracing and control of both textual and quantitative information among steps. Finally, at each of the steps, human scientists rely on feedback from peers, mentors, or external reviewers, enabling an overall collective strength beyond individual capabilities. Taken together, these key features make science a unique process of human creativity. Here, inspired by how research is conducted by human scientists, we build data-to-paper, an automation platform that systematically guides multiple LLM and rule-based algorithmic agents through the conventional steps of scientific research, with automated feedback, iterative cycles of review and revision, and with structured control and tracing of information flow among these research steps. We specifically focus on a relatively simple and well-defined process of hypothesis-testing research. Starting with a human-provided dataset, 2 \fthe process is designed to raise hypotheses, write, debug and execute code to analyze the data and perform statistical tests, interpret the results and write well-structured scientific papers which not only describe results and conclusions but also transparently delineate the research methodologies, allowing human scientists to understand, repeat and verify the analysis. The discussion on emerging guidelines for AI-driven science (22) have served as a design framework for data-to-paper, yielding a fully transparent, traceable and verifiable workflow, and algorithmic \u201cchaining\u201d of data, methodology and result allowing to trace downstream results back to the part of code which generated them. The system can run with or without a predefined research goal (fixed/open-goal modalities) and with or without human interactions and feedback (copilot/autopilot modes). We performed two open-goal and two fixed-goal case studies on different public datasets (24\u201327) and evaluated the AI-driven research process as well as the novelty and accuracy of created scientific papers. We show that, running fully autonomously (autopilot), data-to-paper can perform complete and correct run cycles for simple goals, while for complex goals, human co-piloting becomes critical. Implementation To autonomously analyze a provided dataset and create a research paper, data-to-paper guides multiple LLM and rule-based agents through a series of pre-defined \u201cresearch steps\u201d, each designed to create well-defined quantitative or textual \u201cresearch products\u201d (Fig. 1). The process includes the following steps: data exploration, literature search and iterative formulation of a research goal and hypothesis, creating a hypothesis testing plan, writing data analysis code, creating scientific tables, searching related literature, and writing the paper section by section (Fig. 1A; Fig. 1B, top; in total 17 steps). The research goal can also be provided as human input, in which case the goal-determining steps are skipped (\u201cFixed-goal modality\u201d, dashed bypass arrow, Fig. 1A; Methods). The process runs automatically through the series of steps (with human overseeing and approval; Methods), with each step creating one or more research products, of different types (\u201cFree text\u201d, \u201cLaTex text\u201d, \u201cStructured text\u201d, \u201cBinary decision\u201d, \u201cCitations\u201d, \u201cPython code\u201d and \u201cNumerical data\u201d; Fig. 1B, left). In coding steps, the LLM creates a Python code, which is then executed by data-to-paper to analyze the provided dataset and create numerical data products (like tables for the paper; Methods). In literature-search steps, a structured list of queries created by the LLM is used to retrieve a list of citations from an external citation database (28) (Fig. 1A; Methods). Ultimately, these intermediate products are automatically assembled into a complete research paper (labeled with an AI-created watermark for transparency; Fig. 1B; Methods). 3 \fEach research step is implemented as a distinct conversation, with agent identity specification, provision of prior research products, mission instructions, and LLM responses with iterative feedback (Fig. 1C; Methods; Fig. S1). First, the LLM agent is designated a specific identity (Methods; e.g. \u201cYou are a scientist who needs to write literature search queries\u201d; \u201cPerformer system prompt\u201d, Table S1). Next, data-to-paper populates the conversation with a set of \u201cprovided prior products\u201d: a list of messages providing the LLM with a pre-defined subset of research products of prior steps, deemed important for the focal task (Fig. 1B; Fig. S1; \u201cProvided prior products\u201d, Table S1). This rigor control of information flow among steps minimizes possible hallucinations due to mixing relevant and irrelevant information (29). It also allows data-to-paper to trace, verify and chain the sources of numeric results cited by the LLM (Methods). Next, a step-specific \u201cmission prompt\u201d message is appended, defining the new product that the LLM is expected to create (e.g. \u201cPlease write literature-search queries...\u201d; \u201cPerformer mission prompt\u201d, Table S1). Then, data-to-paper requests a response from the LLM model API (30\u201332), from which it extracts the requested product (based on defined formatting; Fig. S1; Table S1; Methods). The extracted product then undergoes a series of rule-based algorithmic checks, providing constructive feedback to the LLM upon failure (Methods; Fig. 1C; Fig. S1). In particular, to minimize errors in the coding steps, we have built a unique framework that imposes guardrails against commonly observed coding and statistics analysis errors, through a series of static code checks, runtime errors, package-specific guardrails, and output verifications (Fig. 1A, \u201cCoding\u201d block; Methods). Once the created product passes rule-based review, it may further be refined through LLM review (9, 33\u201338) (steps with \u201cReview\u201d ellipses, Fig. 1A; Methods). LLM review is implemented as a parallel, role-inverted conversation, effectively creating an exchange between two LLM agents (Methods; Fig. 1C; Fig. 2A; Fig. S2). In co-pilot mode, the human user can provide additional review comments, resulting in further LLM iterations (Methods). Once a product passes rule-based, LLM and optionally a human review, the step is concluded and data-to-paper proceeds to the next step, until all products are created and the paper is assembled. While data-to-paper can work with any LLM, in practice, our implementation uses ChatGPT; using the current state-of-the-art open-source LLMs leads to frequent mistakes that preclude completing full research cycles (Methods; Table S2; Fig. S3). Of note, since ChatGPT is not a deterministic model, each run of data-to-paper, even on the same dataset and either with or without a human-provided goal, unfolds with different analyses, yielding different overall manuscripts. 4 \fOpen-goal research on public datasets Running in an open-goal, autopilot modality, we provided data-to-paper with two publicly available datasets: (i) \u201cHealth Indicators\u201d dataset (24), an unweighted curated subset of the CDC's Behavioral Risk Factor Surveillance System (BRFSS) from 2015 (39), with 253,680 clean responses, each including 22 features related to diabetes and general health, and (ii) \u201cSocial Network\u201d dataset (25), a directed graph representing Twitter interactions among members of the 117th US congress, as well as member affiliations (Chamber, Party and State). For each of these two datasets, we ran data-to-paper for 5 full research cycles, creating 10 distinct manuscripts (Supplementary Dataset A,B; Supplementary Data Descriptions A,B; Supplementary Manuscripts A1-5, B1-5). During these research cycles, which took about an hour each, data-to-paper generated and corrected hypotheses, created and debugged code, composed search queries and retrieved citations, and wrote and revised the manuscript section by section (full conversations in Supplementary Runs A1-5, B1-5; Fig. 2B; Figs. S4-S7). All created manuscripts properly followed the canonical structure of a research paper, including a proper title and abstract, a well-formulated introduction that stresses the research questions in light of relevant literature, a method section providing a transparent and human-traceable description of the analysis and key methodologies, several supplementary sections providing all custom-written codes, properly formatted scientific tables, a results section which describes the findings while properly referring to each of the tables, and a referenced discussion section which summarizes the results, delineate limitations and puts the findings in a broader context (Supplementary Manuscripts A1-5, B1-5). While similar in structure, the 5 different papers produced for each dataset addressed different topics and raised and tested different hypotheses (Table 1, Table S3). These papers are not highly creative, yet they do define a reasonable set of hypotheses, test them with simple straightforward statistical approaches, and ultimately create and adequately report de novo insights from the provided data. Manually vetting the data analysis and the text of these papers, we found that out of these 10 open-goal papers, 8 reported correct analysis with only minor wording imperfections, yet 2 were erroneous, showing fundamental analysis or interpretation mistakes (Supplementary Manuscripts A1-5, B1-5). The analyses in all 5 \u201cHealth Indicators\u201d papers were based on either logistic or linear regression models, all adequately performed while accounting for a reasonable choice of confounding factors (Table S4). Furthermore, interaction terms were adequately added when needed, and the dataset was adequately restricted to reflect the tested hypotheses (restricting to the diabetic sub-population; Table S4). For the \u201cSocial Network\u201d dataset, papers were based on linking graph properties with node properties, as 5 \fwell as on creating new node properties (e.g. State representation size), and then applying linear regression, ANOVA, or Chi-square on either the graph nodes or edges as appropriate (Table S4; see methods sections and analysis codes in each of the created papers, Supplementary Manuscripts A1-5, B1-5). In all 10 papers, the generated scientific tables correctly represented the results of the analysis. Vetting the text, we observed that data-to-paper is adequately interpreting the analysis results with factual statements, correctly referring to tables and citing key numeric values from the analysis, and reasonably describing the research question and findings in the context of existing literature (green highlights, Supplementary Manuscripts A1-5, B1-5; Methods). We also detected multiple imperfections, such as generic phrasing, overstatement of novelty, and inadequate and sometimes lacking choice of citations (yellow and orange highlights, Supplementary Manuscripts A1-5, B1-5). More major, result-affecting, mistakes were found in 2 of the 10 papers: In one of the \u201cHealth Indicators\u201d papers, a correct analysis was misinterpreted due to hallucinations in the goal specification step, leading to conclusions beyond the scope of the analysis; and in one of the \u201cSocial Network\u201d papers, an erroneous analysis was performed, resulting in unfounded statements on statistical associations between social interactions and party affiliations (red highlights, Supplementary Manuscript A2 and B2, respectively). Estimating reliability in reproducing peer-reviewed results To more systematically assess its error rate in autopilot mode, we applied data-to-paper in a fixed-goal modality in two case studies for which we have benchmarks of published peer-reviewed results. We specifically wanted to check two critical aspects for the reliability of analysis and interpretation: the proper reporting of both positive and negative findings (challenge 1), and the performance for tasks with multiple different steps with tunable breadth (challenge 2). To test data-to-paper capacity in these two challenges, we chose the following two examples of peer-reviewed studies: a study by Saint-Fleur et al. (26), which adequately reports both positive and negative findings related to the association of a policy change in a Neonatal Intensive Care Unit with treatment choice and treatment outcome, respectively (challenge 1); and a study by Shim et al. (27), which builds several Machine Learning models for predicting optimal intubation depth in pediatric patients, and compare their prediction accuracy with formula-based models, thereby requiring multiple analysis steps, whose breadths can be gradually tuned (by altering the number of models to compare; challenge 2). Both studies provide well-annotated datasets and both were published after the knowledge cutoff date of the ChatGPT models that we used (September 2021; Methods). For each of the two case studies, we have provided data-to-paper with the 6 \fresearch goal of the original publication and the corresponding dataset and ran it for 10 independent research cycles (Supplementary Data Descriptions C,D; Supplementary Datasets C,D; Tables S5,S6; Supplementary Manuscripts C1-10, Da1-10). Within each case study, the created papers were all similar to each other in their content, terminology and structure. Indeed, quantifying content similarity by the pairwise cosine distance between the vector embeddings of the title and abstract of all created manuscripts (40) showed tight and distinct clusters corresponding to the 4 case studies (two open-goal and two fixed-goal; Fig. 3). Furthermore, the fixed-goal papers were also similar to their respective original studies (26, 27) in content, terminology and in their vector embeddings (Fig. 3). We manually vetted the analysis and reported results of the manuscripts created for each of the two study-reproducing challenges. For challenge 1, we found that all papers correctly reproduced the analysis, and 8 of them reached the overall correct conclusions and adequately reported both the negative and positive results. All of these manuscripts used adequate statistical methodologies, either matching the methods used in the original study (26) or providing valid alternatives (Table S5; Supplementary Manuscripts C1-10, Supplementary Runs C1-10). Yet, despite correct analysis, in 2 out of these 10 papers we identified interpretation errors, which in one of the papers also affected the overall conclusions (Fig. 4; Supplementary Manuscripts C1,2, red and orange highlights; Tables S5,S6). In challenge 2, we found that the rate of error critically varied with the breadth of the analysis; while data-to-paper frequently failed when presented with the original, broad research goal (90% error rate), it was able to correctly perform this multi-step model development research for almost identical research goals except for requesting fewer models (10-20% error rate; Fig. 4). We note that as the breadth of the task increases, the number of iterations required to complete the Data Analysis step increases, providing a potential possibility to alert of too complex analysis and difficult goals (Fig. 4, bottom). We further note that in all cases, the process reliability depends on the formulation of the research goal and the description of the dataset; less detailed and explicit formulations can increase analysis errors (Fig. S8; Supplementary Manuscripts Dai1-10, Dbi1-10, Dci1-10 and Data Descriptions Dai, Dbi, Dci). Finally, allowing human co-piloting (Methods), a 2-3 single-sentence review comments per run, typically in the code writing step, allows creating accurate papers consistently even for the more complex goals (Fig. 4; Supplementary Human Co-piloted Manuscripts 1-3). Altogether, these case studies provide an assessment of data-to-paper\u2019s analysis and interpretation reliability, showing that for simple research goals it can autonomously create reliable manuscripts in 80-90% of the cases, and that for more complex goals human-copiloting is critical to assure reliability. 7 \fFinally, noting the effort and necessity of manually vetting and verifying created manuscripts, we harnessed data-to-paper step-to-step information tracing to chain results, methodology and data in created manuscripts through algorithmically verified hyperlinks (Methods). This approach creates manuscripts in which all cited numeric values are recursively linked to the specific lines of code where they are created. In particular, numbers cited in the manuscript are linked to a \u201cNotes\u201d appendix providing their formula and its explanation, and from there to the specific table where values used in these formula have originated from, and from the table to the corresponding output file of the code from which the table was created, and from there to the very specific part of code which produced this output file (see clickable hyperlinks in Supplementary Data-chained Manuscripts A-D). Such data-chained manuscripts facilitate systematic vetting of papers, setting a new standard for traceability for the coming era of AI-powered research. Discussion Inspired by key features of human research, we use prompt automation, tool augmentation, and multi-agent interaction approaches (9, 12, 33) to guide multiple LLM agents through a full research path leading from annotated data to well-structured transparent, human-verifiable papers. Tracing information through the different research steps allows data-to-paper to create \u201cdata-chained\u201d manuscripts, where results, methodologies and data are programmatically linked. While the novelty of this AI-driven research falls well behind high-end contemporary science, it did demonstrate a de novo creation of new insights from provided data, thereby recapitulating a key aspect of human research and taking science automation well beyond what is possible with algorithmic data exploration (41). Furthermore, the process demonstrates versatility with respect to data types and research domains, and is able to produce different forms of scientific output, such as association studies, network analysis, or development and testing of machine learning models. Run fully autonomously, the process however is not error-free; despite minimizing errors with multiple guardrails, algorithmic checks, review cycles, and tight control of information flow, the notorious problem of LLM hallucinations (29) leads to fundamental errors in about 10 to 20 percent of created papers, for simple analysis tasks, and to consistent failure for more complex tasks. Integrating human co-piloting, few short review comments were sufficient to overcome errors even for complex tasks. Our current implementation has multiple constraints: it is limited to textual and table outputs, is unable to formulate and pursue follow-up questions, and is limited to hypothesis-testing research. 8 \fDespite these current limitations, the ability of LLMs to carry out scientific research presents important opportunities, but also major challenges. Indeed, such AI research approaches, capable of creating de novo research papers from data in just an hour, could dramatically accelerate the pace of the scientific process. However, there are also risks associated with this development, such as the dishonest use of such systems, e.g. in the context of P-hacking (42), or overloading the publication system with medium-level and generic manuscripts addressing insignificant problems (43\u201345). Our approach implements specific features to mitigate some of these risks, in line with emerging guidelines on AI in science (22), including a transparent, overseeable process allowing human co-piloting, unbiased reporting of either positive or negative results, and the creation of transparent, AI-marked, \u201cdata-chained\u201d and human-verifiable papers. Given the relatively limited novelty and the potential for errors in AI-driven research, as well as the need for ethical judgments and accountability (22), we anticipate and urge that such AI-driven approaches will used as scientist co-pilots, helping scientists in the more straightforward tasks, thereby allowing them to focus their minds and creativity on higher-level concepts. Methods Datasets. We used 4 datasets, each consisting of data files (\u201cData\u201d, Fig. 1B; Supplementary Datasets A-D) and metadata items (the human-provided products \u201cData file description\u201d and \u201cGeneral description of dataset\u201d, Fig. 1B; Supplementary Data Descriptions A-D). (A) \u201cHealth Indicators\u201d dataset (24). A clean unweighted subset of CDC\u2019s Behavioral Risk Factor Surveillance System (BRFSS) 2015 annual dataset (39), downloaded from Kaggle (24). It contains 253,680 survey responses each with 22 features related to diabetes and different health indicators, with no missing values. No change in the dataset was made; data-to-paper was provided with the csv file as downloaded from Kaggle. (B) \u201cSocial Network\u201d dataset (25). A directed graph of Twitter interactions among the 117th Congress members (25). Two data files were provided to data-to-paper: (i) a csv file containing a list of directed unweighted edges, representing Twitter engagements among Congress members (downloaded from Stanford Network Analysis Project (46), with the weights removed), and (ii) a csv file containing the affiliations of each Congress member, including their Chamber, Party and State (downloaded from FRAC (47)). (C) \u201cTreatment policy\u201d dataset (a test case to reproduce Saint-Fleur et al. (26)). A dataset on treatment and outcomes of non-vigorous infants admitted to the Neonatal Intensive Care Unit (NICU), before and after a change to treatment guidelines was implemented. As input to data-to-paper, the file downloaded from Saint-Fleur et al. (26) was converted into a csv file, with minor cleanups: converting column headers into alphanumeric names, converting string binary into integer binary, and removing 9 \fthe following irrelevant columns: 'RACE', 'RACE IN TWO CATEGORIES', 'ETHNICITY', 'Singleton /Multiple', 'Maternal Diabetes\u2026', 'PRETERM VS TERM', 'ROUTINE RESUSCITATION\u2026\u2019, 'Respiratory Support', 'Exposure to xrays', 'X-Ray finding' (without removing these columns, the \u201cData exploration\u201d step of data-to-paper occasionally created too large output files leading to breaking the token limit of ChatGPT). (D) \u201cTreatment Optimization\u201d dataset (a test case to reproduce Shim et al. (27)). A dataset of 967 pediatric patients, which received mechanical ventilation after undergoing surgery, including an x-ray-based determination of the optimal tracheal tube intubation depth and a set of personalized patient attributes to be used in machine learning and formula-based models to predict this optimal depth. As input for data-to-paper, we removed irrelevant columns, leaving only the ones used in the original study: 'tube', 'sex', 'age_c', 'ht', 'wt', 'tube_depth_G'. For datasets C and D, we further provided data-to-paper with the research goal of their respective original studies. Research goals and dataset descriptions have been formulated in an iterative and empirical process: We consulted with ChatGPT on best phrasing and terminologies, tested them in pilot runs, identified misunderstandings and vague or ill-defined statements, and adapted the descriptions accordingly. Dataset descriptions and file descriptions for all datasets, as well as the research goal for datasets C,D, are provided in Supplementary Data Descriptions A-D. Execution of data-to-paper. For each run, data-to-paper is provided with a dataset, its associated metadata, and an optional research goal and proceeds automatically through the stepwise research process (Fig. 1A,B). In open-goal modality, data-to-paper runs through the entire research process (Fig. 1A,B). In fixed-goal modality, the research goal is provided and the steps for choosing a research goal are skipped (\u201cFixed-goal modality\u201d, Fig. 1A). Human interactions are implemented as a simple user approval at each research step (autopilot mode; user is only overseeing) or with complete human review through an interactive app (co-pilot mode; user can provide reviewing comments at each step). For each dataset, we performed multiple data-to-paper runs, as follows. (A) \u201cHealth Indicators\u201d dataset. We ran data-to-paper in an open-goal modality with this dataset and its associated metadata for 5 full research cycles (Supplementary Runs and Manuscripts A1-5). Overseeing the process, we aborted and restarted the 5th run 3 times after the \u201cGoal validation\u201d step, when observing that the chosen Research goal was too similar to goals of prior research cycles. (B) \u201cSocial Network\u201d dataset. We ran data-to-paper in an open-goal modality with this dataset and its associated metadata for 5 full research cycles (Supplementary Runs and Manuscripts B1-5). To minimize overlapping goals in repeated runs, a list of the already-chosen previous goals was presented as part of the \u201cmission prompt\u201d of the \u201cResearch goal\u201d step. (C) \u201cTreatment Policy\u201d dataset. We ran data-to-paper in 10 \fa fixed-goal modality for 10 research cycles with this dataset and its associated metadata and research goal (Supplementary Runs and Manuscripts C1-10). (D) \u201cTreatment Optimization\u201d dataset. We ran data-to-paper in a fixed-goal modality for 10 full research cycles with this dataset and its associated metadata and research goal (Supplementary Runs and Manuscripts Da1-10). We then ran data-to-paper with 5 modified research goals (Supplementary Data Descriptions Db, Dc, Dai, Dbi, Dci) for 10 times per goal (Supplementary Runs and Manuscripts Db1-10, Dc1-10, Dai1-10, Dbi1-10, Dci1-10). As these additional 50 runs were only used to annotate analysis failure, we terminated them after the \u201cTitle & abstract\u201d step (to save unnecessary api calls). In addition, we ran data-to-paper in co-pilot mode for three times on the original goal (Supplementary Data Description Da). During each of these runs, we provided several review comments, typically in the code writing step (Supplementary Human Co-piloted runs 1-3). Overview of data-to-paper implementation. We implement data-to-paper as a chained list of research steps, each designed to create one or more research products based on a provided subset of prior research products (Fig. 1A,B). Each such research step is implemented as a distinct \u201cPerformer conversation\u201d, which specifies LLM identity, relevant prior research products and a step-specific \u201cmission prompt\u201d requesting the LLM to create a focal product. Product extracted from the LLM response undergoes rule-based review and programmatic feedback requesting corrections is sent back to the LLM. For certain research steps, once the product passes rule-based review it can also be sent for LLM review, which is implemented in a parallel \u201cReviewer conversation\u201d (\u201cReview\u201d, \u201cLLM reviewer agent\u201d in Fig. 1A,C respectively). The research step terminates with a final product that has passed both rule-based and LLM-based review. Once all steps are completed, a manuscript is assembled and compiled from the products of all relevant steps. Devising prompts. The prompts used by data-to-paper in each of the research steps are listed in Table S1. These prompts have been designed in an iterative and empirical process. First, we devised an initial version for each of the prompts, focusing on the key aspect of their focal task (dark brown text, Table S1). Additionally, we added to each prompt formatting instructions for the research product (light blue and red text, Table S1). Then, we tested ChatGPT responses through multiple pilot runs, identified wrong or inadequate responses, and adapted the prompts with additional details and specifications (light brown text, Table S1). In cases where ChatGPT still failed to consistently respond as expected, we also added one-shot examples (green text, Table S1). Message types. Messages in a conversation are designated as either SYSTEM, USER, or ASSISTANT (per OpenAI API terminology (30)). SYSTEM and USER messages are 11 \fprogrammatically composed by data-to-paper. ASSISTANT messages are created by the LLM. We also implement LLM-surrogating ASSISTANT messages, which are messages created programmatically by data-to-paper, but are attributed to the ASSISTANT (namely, they appear to the LLM as if they were created by it). Performer conversation. At the onset of each research step, a distinct Performer conversation is initiated and programmatically pre-filled with a list of \u201ccontext messages\u201d: (i) \u201csystem prompt\u201d defining the identity of the performer LLM agent (\u201cPerformer system prompt\u201d, Table S1); (ii) \u201cprovided prior products\u201d, a list of USER messages providing the LLM with a pre-defined subset of research products of prior steps, with each such USER message followed by an LLM-surrogating acknowledgment message (Fig. 1B, Figs. S1,S4; \u201cProvided prior products\u201d, Table S1); and (iii) USER message describing to the LLM what it is requested to do in the current step (\u201cPerformer mission prompt\u201d, Table S1). This pre-filled Performer conversation is then sent to the LLM API (30\u201332) to request an initial response (Figs. S1,S4). The requested research product is then extracted from this initial LLM response and undergoes rule-based product review. Rule-based product review. At each research step, the LLM is requested to send a response containing a specific product, with specific formatting (Fig. 1B; Tables S1,S7). Then, data-to-paper extracts the requested product from the LLM response based on its expected formatting (Tables S1,S6; for example, when requesting a \u201cLaTex text\u201d product, we expect the product to be enclosed within triple backticks). Failure to extract the product is translated into a feedback message sent back to the LLM (for example: \u201cYou sent 2 triple-backtick blocks. Please send the latex as a single triple-backtick \u2018latex\u2019 block\u201d). Once the product is extracted successfully, it is programmatically refined according to a set of step-specific auto-refinement rules (Table S7, asterisk-marked rules). Then, the refined product is checked according to a set of step-specific test rules, including formatting, text length and correct referencing (for exhaustive list see Table S7). Failure to pass any of these rules is translated into a corresponding feedback message sent back to the LLM (see example in Fig. S5). Information tracing. To follow information flow through all steps, data-to-paper keeps track of the specific code lines producing each file output, the translation of these outputs into tables and the incorporation of numbers from the table in the Results section. Specifically, to track numeric results in the Results section, we programmatically assign a unique label for each numeric value appearing in the prior products for the Results writing step, and present these products in the context messages with the numeric values formatted as LaTex hypertargets with their corresponding labels (Fig. 1B). We then complemented the mission 12 \fprompt of the Result writing step with instructions requesting the LLM agent to wrap each numeric value that it writes with a LaTex hyperlink matching the corresponding label (\u201cPerformer mission prompt: additional instructions for data-chained manuscripts\u201d, Table S1). To allow the LLM to include numeric values which are not direct output of the code, but are rather arithmetically derived from them (like changing units, translating regression coefficients to odds ratios, etc), we further provide it with the option of using a specific syntax, \\num(<formula>, \u201cexplanation\u201d), where it can provide arithmetic formula to derive new values from values created by the code output, and provide an explanation. A rule-based feedback was added to algorithmically verify that, either as stand-alone or within a \\num formula, each numeric value mentioned in the section is hyperlinked, and that the target of each link correctly matches the corresponding label provided in the prior product context. Upon compilation, the \\num commands are replaced with their value and a \u201cNotes\u201d appendix is added listing all formulas with their explanation. To further safeguard against hallucinated or missing values, the Results \u201cmission prompt\u201d instructs the LLM to use a designated placeholder (specifically \u2018[unknown]\u2019) for missing numeric values, detection of this or other placeholder in the LLM response leads to data-to-paper aborting the entire research cycle (for the list of placeholders see \u201cResults\u201d, Table S7). Data-chained manuscripts. Reflecting the tracing of information during the \u201cData Analysis\u201d, \u201cTable Design\u201d and \u201cResults\u201d writing steps, data-to-paper creates manuscripts that \u201cchain\u201d results, methods and data, where each numeric value is recursively linked to the specific lines of codes that created it. In particular, a numeric value in the \u201cResults\u201d section can be linked to the \u201cNotes\u201d appendix, and from there to a specific value in a table, and from there to the output file that was used to create this table and finally to the specific code lines which generated this output file (Supplementary Data-chained Manuscripts A-D and Supplementary Human Co-piloted Manuscripts 1-3; Note that prior manuscripts were created without this feature and do not have hyperlinks). Reviewer conversation. For a subset of research steps, data-to-paper also performs an LLM review after the successful completion of rule-based product review (\u201cReview\u201d, Fig. 1A; Fig. 2, Figs. S2,S6). LLM review is implemented in a \u201cReviewer conversation\u201d, which parallels the Performer conversation of the given step, but with inversion of the USER-ASSISTANT roles (Fig. 1C; Fig. 2A; see examples in Fig. 2B, Fig. S6). In parallel to its corresponding Performer conversation, this Reviewer conversation is pre-filled with the following list of context messages: (i) \u201csystem prompt\u201d defining the identity of the LLM reviewer agent; (ii) the list of \u201cprovided prior products\u201d for the focal step; and (iii) An LLM-surrogating message with the \u201cPerformer mission prompt\u201d (namely, the \u201cPerformer 13 \fmission prompt\u201d is casted as an ASSISTANT-side message, thereby appearing as if it was created by the LLM reviewer agent). Then, the extracted product coming from the Performer conversation is presented as a USER-side message together with step-specific review instructions, in which the LLM reviewer agent is requested to choose between accepting the provided product, or providing constructive feedback (\u201cReviewer mission prompt\u201d, Table S1; Fig. 1C; Fig. 2A; Fig. S2). The pre-filled conversation is then sent to the LLM API to request a response from the Reviewer agent. If the Reviewer response contains feedback, it is transferred to the Performer conversation as if it were a USER-side message, requesting the LLM performer agent to provide a new response with an accordingly refined product. Coding steps. For each of the three coding steps (\u201cData exploration\u201d, \u201cData analysis\u201d, \u201cTable design\u201d), we extract Python code (enclosed within a triple-backtick block) from the LLM response, and test this code at four levels: (i) Static analysis: Check that the code conforms to a step-specific requested structure (\u201cPython code Static checks\u201d, Table S7); (ii) Runtime analysis: Syntax errors, runtime errors, warnings, as well as violations of other restrictions are caught and evaluated during code execution (\u201cPython code Runtime checks\u201d, Table S7); (iii) Package-specific guardrails: Noting common ChatGPT coding mistakes, we wrapped the packages that we allow importing, adding multiple guardrails to monitor, control and restrict unsafe functionalities, as well as to allow rule-based review of p-value formatting (Table S8); (iv) Output analysis: Check that all the requested output files are created and contain the requested information with the requested formatting (\u201cNumerical data checks\u201d, Table S7). Encountered issues from these 4 check levels are translated into a feedback message sent back to the LLM. As a new feedback message is added, older feedback-response message pairs are removed from the conversation (to avoid exceeding the token limits). Once the LLM-provided code passes all tests, we proceed to LLM product review: data-to-paper provides a message that shows the LLM the code output and asks it to check the code and the output and provide a list of issues and suggested corrections (see \u201cReviewer mission prompts\u201d for \u201cData exploration\u201d and \u201cData analysis\u201d steps in Table S1). If the LLM returns suggestions for improvement, data-to-paper requests making these corrections and enters a new phase of code debugging as described above. If there are no suggestions for improvements, we end the coding step with the code and the output files it created as the corresponding research products. Citation retrieval. For the two literature search steps (\u201cLiterature search I\u201d, \u201cLiterature search II\u201d, Fig. 1A; Table S1), data-to-paper augments the LLM with Semantic Scholar Academic Graph API (28), an external citation database and search service. This direct citation retrieval, along with algorithmic checks restricting LLM\u2019s memory-retrieved citations 14 \f(Rule-based product review; Table S7), ensures that only valid citations are included in the resulting paper. These literature-search steps start with a \u201cDevise queries\u201d step, in which the LLM is requested to provide a list of queries for each of a pre-defined set of scopes (scopes for \u201cLiterature search I\u201d: \u201cDataset\u201d, \u201cQuestions\u201d; scopes for the \u201cLiterature search II\u201d: \u201cBackground\u201d, \u201cDataset\u201d, \u201cMethods\u201d, \u201cResults\u201d; see \u201cLiterature search I\u201d and \u201cLiterature search II\u201d in Table S1). Then, data-to-paper calls the citation API (28) to retrieve a list of citations for each of the LLM-provided queries (see example in Fig. S7). For each citation, the API provides: (i) Search rank; (ii) BibTeX ID; (iii) Title; (iv) Journal and year; (v) One-sentence paper summary (TLDR) (48); (vi) Citation influence (49); (vii) Title and abstract embedding (40). Citations for each of the scopes are then filtered and sorted either by Search rank or by Title and abstract embedding similarity to the title and abstract embedding of the currently written paper (parameters in Table S9). For the runs with datasets C, D, where we attempt reproducing a specific original study, we manually excluded the citation of the original paper. The sorted lists of papers for each scope are then provided as prior products for steps in which the LLM is requested to refer to literature citations (Table S1; Fig. 1B, Fig. S7). LLM selection. We compared the performance of Llama 2, Codellama and ChatGPT models in two critical research steps: (i) Research goal and (ii) Data analysis. For both tests, we used the \u201cHealth Indicators\u201d dataset. In (i), we ran the research goal step of data-to-paper 10 times each either with gpt-3.5-turbo or Llama-2-70b-chat-hf, all provided with the same prior product context (Table S2). We manually annotated the goals, scoring analysis-related factors, either corresponding to true features of the dataset, or to hallucinated features not part of the dataset (Table S2, Fig. S3A). In (ii) we ran the data analysis step of data-to-paper 10 times each with either gpt-3.5-turbo, gpt-4, CodeLlama-34b-Instruct-hf, Llama-2-70b-chat-hf or Llama-2-7b-chat-hf and evaluated for each run the number of programmatic feedback rounds until the code passes rule-based review (Fig. S3B, Supplementary Coding Runs). ChatGPT models and parameters. As the underlying LLM, we used OpenAI conversational ChatGPT models (30) (open-source models created hallucinated research goals and were not able to consistently converge in the data analysis coding step; LLM selection). The OpenAI models used were either gpt-3.5-turbo-0613, gpt-3.5-turbo-16k-0613, or gpt-4 (all with a knowledge cutoff of September 2021). For each research step, we assigned one of these specific models as a nominal model based on the expected conversation length of the step as well as the presumed difficulty and performance during pilot runs (\u201cLLM\u201d, Table S1). Starting from this initial nominal model for each step, data-to-paper can automatically 15 \fupgrade the model during a conversation: switching to gpt-4 when a rule-based feedback request is not resolved, and switching to gpt-3.5-turbo-16k-0613 if the number of tokens exceeds the maximum of the step\u2019s nominal model. For all models, we use default model parameters, except for the model\u2019s temperature which was specifically set for some of the steps (In particular, setting a temperature of 1 for the \u201dResearch goal\u201d step). Paper assembly and compilation. To produce the final manuscript, data-to-paper assembles a single LaTex file, combining the different manuscript-part products (\u201cPaper assembly\u201d, Fig. 1A,B). It then automatically compiles this file, together with the list of citations retrieved from \u201cLiterature search II\u201d, into a pdf, watermarked \u201cCreated by data-to-paper (AI)\u201d. Manual review of created manuscripts. We manually vetted each created manuscript and its respective run record (Supplementary Manuscripts and Runs A1-5, B1-5, C1-10, Da1-10, Db1-10, Dc1-20, Dai1-10, Dbi1-10, Dci1-10). For the manuscripts, we verified: (i) that the data analysis and code are correctly performed, using adequate statistical methodologies; (ii) that every statement in the text involving numeric information corresponds to the correct numeric value from the output of the data analysis; (iii) that every citation fits the context in which it was referenced; (iv) the overall exactness of the text; and (v) the quality of the overall text and wording. The manuscripts were highlighted to reflect correctly-put statements (green), imperfect, or atypical statements (yellow), minor errors (orange), and major errors (red). Human co-piloting. Human co-piloting is incorporated by allowing the user to add review comments in each step after the rule-based and LLM-review have completed. If such human review is added, data-to-paper initiates a new cycle of Performer answers with rule-based checks. This process repeats iteratively until the user approves the research product of the step. We have created an app with a user interface that allows the user to follow the LLM conversation in each step and add review comments as needed. Data availability The data that support the findings of this study are available in the paper and its Supplementary Information (https://github.com/rkishony/data-to-paper-supplementary). Code availability Code is available at https://github.com/Technion-Kishony-lab/data-to-paper 16"
17
+ }
abs_9K/validation_abstract_short_2405.00705v1.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2405.00705v1",
3
+ "title": "SHED: Shapley-Based Automated Dataset Refinement for Instruction Fine-Tuning",
4
+ "abstract": "The pre-trained Large Language Models (LLMs) can be adapted for many\ndownstream tasks and tailored to align with human preferences through\nfine-tuning. Recent studies have discovered that LLMs can achieve desirable\nperformance with only a small amount of high-quality data, suggesting that a\nlarge amount of the data in these extensive datasets is redundant or even\nharmful. Identifying high-quality data from vast datasets to curate small yet\neffective datasets has emerged as a critical challenge. In this paper, we\nintroduce SHED, an automated dataset refinement framework based on Shapley\nvalue for instruction fine-tuning. SHED eliminates the need for human\nintervention or the use of commercial LLMs. Moreover, the datasets curated\nthrough SHED exhibit transferability, indicating they can be reused across\ndifferent LLMs with consistently high performance. We conduct extensive\nexperiments to evaluate the datasets curated by SHED. The results demonstrate\nSHED's superiority over state-of-the-art methods across various tasks and LLMs;\nnotably, datasets comprising only 10% of the original data selected by SHED\nachieve performance comparable to or surpassing that of the full datasets.",
5
+ "authors": "Yexiao He, Ziyao Wang, Zheyu Shen, Guoheng Sun, Yucong Dai, Yongkai Wu, Hongyi Wang, Ang Li",
6
+ "published": "2024-04-23",
7
+ "updated": "2024-04-23",
8
+ "primary_cat": "cs.CL",
9
+ "cats": [
10
+ "cs.CL",
11
+ "cs.LG"
12
+ ],
13
+ "label": "Original Paper",
14
+ "paper_cat": "LLM Fairness",
15
+ "gt": "The pre-trained Large Language Models (LLMs) can be adapted for many\ndownstream tasks and tailored to align with human preferences through\nfine-tuning. Recent studies have discovered that LLMs can achieve desirable\nperformance with only a small amount of high-quality data, suggesting that a\nlarge amount of the data in these extensive datasets is redundant or even\nharmful. Identifying high-quality data from vast datasets to curate small yet\neffective datasets has emerged as a critical challenge. In this paper, we\nintroduce SHED, an automated dataset refinement framework based on Shapley\nvalue for instruction fine-tuning. SHED eliminates the need for human\nintervention or the use of commercial LLMs. Moreover, the datasets curated\nthrough SHED exhibit transferability, indicating they can be reused across\ndifferent LLMs with consistently high performance. We conduct extensive\nexperiments to evaluate the datasets curated by SHED. The results demonstrate\nSHED's superiority over state-of-the-art methods across various tasks and LLMs;\nnotably, datasets comprising only 10% of the original data selected by SHED\nachieve performance comparable to or surpassing that of the full datasets.",
16
+ "main_content": "Introduction The development of LLMs marks a major leap in machine learning, transforming how we approach natural language processing (NLP) and Artificial Intelligence (AI) research [1]. Models such as GPT3 [2] and LLaMA [3] highlight the benefits of pre-training on large and diverse datasets, empowering these LLMs with a wealth of knowledge. Moreover, one of the pivotal strengths of LLMs lies in their adaptability to specific tasks through fine-tuning. Fine-tuning, a process that involves updating models on a task-specific dataset, enables the pre-trained model to acquire task-specific information. Furthermore, it facilitates the alignment of models to more accurately follow human instructions through fine-tuning on a dataset comprised of instructions paired with appropriate responses, which is known as instruction tuning. However, fine-tuning LLMs also raises challenges. A primary concern is that the noisy data or harmful instances in the fine-tuning dataset can significantly degrade the performance of pre-trained LLMs [4]. Many works have developed large and diverse datasets for fine-tuning purposes. While the datasets for fine-tuning have grown in size, recent research suggests that meticulously curated datasets of high quality, even if smaller in size, can be more effective in harnessing the full potential of LLMs [5, 6, 7]. Indiscriminately increasing the volume of data can lead to ineffective performance improvements and might even deteriorate model performance as a result of introducing noisy and harmful instances. In addition, for instruction tuning, the model has already learned the necessary knowledge in the pre-training stage. The dataset used in the fine-tuning stage merely aims to better Preprint. Under review. arXiv:2405.00705v1 [cs.CL] 23 Apr 2024 \falign the models to follow human instructions, indicating this process does not necessitate extensive data [8]. Furthermore, fine-tuning LLMs on extensive datasets incurs significant computational costs. The necessity for considerable GPU resources presents a critical challenge [9]. Only those researchers and institutions equipped with sufficient computing resources are able to perform such tasks, limiting the broader applications and progress within the LLM community. Consequently, there is a pressing need to design a novel method for curating small and high-quality datasets that enable efficient fine-tuning. Previous efforts have employed various methods such as curation or generation through manual efforts or commercial LLMs [5, 10], identifying subsets from larger datasets via training dynamics or estimating marginal contributions [11, 12]. Most current methods for data selection neglect the potential influence that different combinations of samples can have on model performance. The Shapley value [13], introduced in cooperative game theory, provides a method for fairly evaluating the contribution of each participant by examining all possible combinations and their effects on the overall result. This principle has also been utilized in machine learning to assess the impact of individual data within a given dataset [14]. The Shapley value can serve as criteria to refine one or more large datasets to extract high-quality data points, enabling the curation of a smaller yet high-quality dataset. This method not only facilitates the selection of impactful data, but also considers the effectiveness of selected data combinations. Shapley value seems to be a promising toolkit for data selection. However, calculating the Shapley value for all the data samples in a dataset is computationally expensive, especially for large-scale fine-tuning datasets. Original dataset Model-agnostic Clustering Proxy-based Shapley calculator Optimizationaware sampling Curated dataset Figure 1: Overview of SHED. Motivated by the aforementioned challenges, we present SHED , a Shapley-based automated dataset refinement framework for fine-tuning LLMs. The key intuition behind SHED is to perform Shapley value evaluations on a small portion of representative samples only, such that the computation complexity of the Shapley-based data refinement can be dramatically decreased. Specifically, as Figure 1 illustrates, SHED consists of three key components: model-agnostic clustering, proxy-based Shapley calculator, and optimization-aware sampling. Initially, the modelagnostic clustering groups embeddings of the original dataset, and then selects representative data samples as a proxy for each cluster based on the distance of embeddings to the cluster centroid. These proxy data instances are then evaluated by the proxy-based Shapley calculator, which employs an approximation method to efficiently calculate their Shapley values, focusing on task-specific objectives (e.g., accuracy and fairness). This method involves iteratively removing groups of instances from the proxy dataset and assessing the performance variation of the model to estimate the collective contribution of these instances, thereby streamlining the computation of Shapley values. The derived Shapley values of these proxy data instances are used as the quality score for their respective clusters. Finally, optimization-aware sampling selects data from clusters to compile a compact yet high-quality dataset, employing strategies that may favor clusters with higher-quality scores. SHED only computes Shapley values for the cluster representatives rather than each data, drastically boosting the efficiency of data refinement. Moreover, SHED offers a unified yet flexible framework, catering to various user needs by providing multiple options within each component. For example, the optimization objective for Shapley value measurement can be tailored to specific tasks (e.g., fairness). Our key contributions can be summarized as follows: \u2022 We present SHED , a generic data refinement framework based on Shapley values, which can curate a small yet high-quality dataset for boosting the efficiency of fine-tuning LLMs. \u2022 We conducted extensive experiments on two benchmark datasets, i.e., MMLU and WizzardLLM, the results demonstrate that fine-tuning LLMs with small datasets curated by SHED yields performance comparable to, or even better than, using the original large datasets. Remarkably, we observed that the datasets curated by SHED exhibit transferability, achieving robust performance across various LLMs models even from different families. This amortizes the computational cost for data selection when applying the curated dataset to fine-tune various LLM models. \u2022 All the code associated with the collection of high-quality datasets curated by SHED can be found at SHED: Shapley-Based Automated Dataset Refinement. 2 \f2 Related Work 2.1 Coreset Selection Coreset selection plays a critical role in machine learning by targeting the selection of a representative subset from a larger dataset. Various coreset selection methods use unique criteria for choosing samples. Geometry-based approaches focus on the geometric properties of the data points, striving to retain geometrically significant samples that represent the overall data distribution [15, 16, 17, 18]. Uncertainty-based methods choose samples based on the uncertainty they present to the model, typically engaging samples that the model finds challenging to classify [19, 20, 21]. Decisionboundary-based methods select samples that are close to the decision boundary of the classifier, ensuring that the nuances of the classification boundary are well-represented in the selected subset [22, 23]. Gradient-matching approaches involve selecting a subset that yields similar gradient distributions as the entire dataset when used in training [24, 25]. Bilevel Optimization optimizes the coreset selection in a way that the selected subset maximizes certain performance metrics [26]. Submodularity-based approaches consider both diversity and information richness, striving for a balanced representation of the dataset [27]. 2.2 Data Selection for Instruction Fine-tuning Due to the superiority of instruction tuning in enhancing the performance of LLMs, many recent studies focus on selecting high-quality instruction tuning data. Based on methods, it can be divided into the following categories. Indicators-based methods define multiple metrics, such as instruction length and perplexity, to compute quality scores for each instruction instance [10, 28, 29, 30]. Training-based methods leverage the performance improvement through fine-tuning to score and select instruction data suited for fine-tuning [31, 32, 33, 34, 35, 36]. Some other methods employ commercial LLMs like ChatGPT to assess quality, complexity, and diversity of instructions for selection [7, 37, 38, 39, 40]. 2.3 Limitations of Previous Work Most existing methods for data selection overlook the impact of various data combinations on model performance. As Table 1 illustrates, datasets formed by combining high-quality data, which are merely based on the independent quality score of each individual data sample, do not necessarily enhance model performance effectively. The combination of different data can impact the final performance of fine-tuning. Furthermore, many works are task-specific, limiting their broader applicability. 3 Proposed Method Motivated by the aforementioned challenges, we present SHED, a generic framework that exploits Shapley value to identify and select high-quality data to improve the performance and efficiency of fine-tuning LLMs. 3.1 Preliminary Table 1: We apply DSIR [41] to compile a high-quality dataset (10k instances), a random dataset (10k instances) from MMLU, and a mixed dataset samples 5k instances from each of the high-quality and random datasets. We fine-tune the LLaMA-7B model [3] on the curated dataset and evaluate them using the MMLU test set. Dataset High-quality Random Mixed MMLU 40.04 39.13 40.92 The motivation behind this work is underscored by the observation, as illustrated in Table 1, that naively aggregating high-quality data merely based on the independent importance of individual samples does not guarantee a performance improvement of fine-tuning. We believe this phenomenon is attributed to the complex interactions between different instances within the fine-tuning process. 3 \fThus, there is a pressing need to design a novel data selection method, which accounts for the individual and collective contributions of instances to model performance. The Shapley value offers a compelling solution to this challenge. It quantifies the marginal contribution of each instance to the overall performance of the model, considering all possible combinations of instances. The formulation of the Shapley value for a data sample i in dataset D can be expressed as: Si = X P \u2208D\\{i} |P|!(|D| \u2212|P| \u22121)! |D|! (v(P \u222ai) \u2212v(P)), (1) where Si is the Shapley value of i, P is the subset of dataset D, |D| and |P| are the total number of instances in D and P, v(P) is the value function of P, which represents the performance of the LLM model fine-tuned on the subset P. As Eq. 1 indicates, the Shapley value of an instance i captures its average impact on model performance across all subsets it might be part of. This ensures a fair evaluation of the contribution of each instance in the original dataset, enabling the selected data is genuinely beneficial for enhancing model performance when integrated with other data samples. Additionally, the value function v(P) in Eq. 1 serves to calculate contributions from corresponding data. This value function can be tailored for various optimization objectives, such as accuracy and fairness, facilitating the selection of data that aligns with the task-specific requirements. However, computing the Shapley value, as depicted in Eq. 1, demands extensive computational efforts, because it requires evaluating the contribution of each instance across all possible combinations. For a dataset with |D| instances, there are a total of 2|D| \u22121 possible combinations. For each combination, two evaluations are needed, i.e., one includes a certain instance and the other one holds out that instance, doubling the computational workload to determine the contribution of that particular instance. Thus, the time complexity for measuring the Shapley value of each instance is O(2|D|). Given the need to perform this calculation for all |D| instances to determine their individual Shapley values, the overall time complexity for the dataset increases to O(|D| \u00b7 2|D|). This exponential complexity makes direct computation of Shapley values impractical for large datasets. 3.2 Design of SHED original dataset score score score selected dataset 1 2 3 Figure 2: Workflow of SHED: \u2460Clustering and determining proxy data; \u2461Calculating Shapley values as scores; and \u2462Sampling based on scores. To address the above challenges, we design SHED, comprising of three key components: modelagnostic clustering, proxy-based Shapley calculator, and optimization-aware sampling. We introduce each component in detail. Model-agnostic Clustering. Given the time complexity of computing the Shapley value, calculating the Shapley value for all instances in a large finetuning dataset is impractical. The model-agnostic clustering employs models from Sentence Transformers [42] to generate semantically meaningful embeddings for each sample in the original dataset. These embeddings facilitate the efficient and effective computation of semantic similarities between textual inputs, enabling the grouping of data with similar contexts. Moreover, those model-agnostic embeddings enhance the transferability of the curated dataset, as demonstrated in Table 7. Then, the model-agnostic clustering applies algorithms, such as K-means [43] and Agglomerative Clustering [44], to group the embeddings. It then selects the representative data, which is closest to the cluster centroids in the embedding space, for each cluster. In doing so, we use these representative samples as the proxy of the respective clusters. Subsequently, SHED only calculates the Shapley values of those proxy data, using their Shapley values as the quality scores for their respective clusters. Employing proxy data effectively captures the essence 4 \fof the diversity and complexity in the dataset. This strategy significantly reduces the computational burden associated with calculating Shapley values across vast datasets. Proxy-based Shapley Calculator. To further improve efficiency for Shapley value calculations, the proxy-based Shapley calculator employs an approximation method to estimate the Shapley values of the proxy data. This method iteratively removes groups of n instances from the proxy data Dp, followed by an evaluation of the model\u2019s performance to assess the impact of these instances. The performance variations before and after the removal of a specific group of instances quantify their collective contribution. Specifically, the contribution of the initial group of n instances, denoted as c(1..n)\u2208Dp, is computed by c(1..n)\u2208Dp = v(Dp) \u2212v(Dp \\ {1..n}). Similarly, the contribution for the subsequent group of n instances is determined by c(n+1..2n)\u2208Dp = v(Dp\\{1..n})\u2212v(Dp\\{1..2n}). This procedure is repeated, progressively removing groups of n instances until the entire proxy data has been visited, which marks the completion of a single iteration. This entire iteration process is then repeated k times to enhance the accuracy of the approximation. After completing k iterations, the Shapley value for a certain instance i of the proxy dataset is approximated using the average of its contributions across all iterations, defined as Si \u22481 k P k ci(k) n , where ci(k) denotes the contribution associated with instance i in the kth iteration. Optimization-aware Sampling. The Shapley value of each proxy data is assigned as the quality score of the corresponding cluster. Optimization-aware sampling utilizes these quality scores to sample data from these clusters, aiming to curate a small yet high-quality dataset. Optimization-aware Sampling offers two sampling methods: Quality-Ordered Cluster Sampling (QOCS) and Quality-Weighted Cluster Sampling (QWCS). QOCS prioritizes sampling from clusters with the highest quality scores. It selects instances starting from the most high-quality clusters until a predefined target sampling number is reached. QWCS adopts a probabilistic approach to sample instances across all clusters, with the probability of selection from a given cluster weighted by its quality score. This method aims to balance quality with diversity by allowing for the inclusion of instances from a broader array of clusters, thus potentially enriching the dataset with a wider variety of high-quality data points. The probability Pr(i) of selecting an instance from cluster i is defined in Eq. 2: Pr(i) = efSi P i efSi , (2) where Si represents the quality score of cluster i, and f is a scaling factor that modulates the emphasis on quality versus diversity within the sampled dataset. By adjusting f, users can tailor the sampling process to prioritize either quality or diversity to suit specific task goals. A higher f value tends towards selecting higher-quality instances, offering a versatile toolkit for dataset optimization. 4 Experiments 4.1 Experimental Setup Datasets. We conduct experiments on two famous benchmark datasets, MMLU (99.8k instances) [45] and WizardLM-evol-instruct-70k (70k instances) [46]. SHED Implementation. We use the K-means algorithm for the model-agnostic clustering and set the number of clusters to 3000. For the proxy-based Shapley calculator, the value function is set as the accuracy of the foundation model fine-tuned on the proxy data. We use LLaMA-7B [3] as the pre-trained foundation model and 10% instances in the MMLU test set calculating the Shapley values of proxy data. The number of iterations k is set to 10, and the number of instances n removed from the proxy data each step is set to 60. To conserve time and resources, instruction fine-tuning within the proxy-based Shapley calculator is conducted for one epoch. For optimization-aware sampling, we employ the QOCS and QWCS strategies with setting the scaling factor to 1, investigating their efficacy with a variety of target sampling sizes. These implementations are denoted as SHED-QOCS and SHED-QWCS. The target sampling size varies from 1, 000 to 20, 000 with increments of 1, 000, to thoroughly assess the impact of each sampling approach on fine-tuning performance. Baseline Methods. We compare SHED with three baseline methods. Specifically, we implement a random-sampling method, denoted as RS, which randomly selects a subset from a large dataset. We also use the Dataset Quantization method [29], denoted by DQ, and the Data Selection with 5 \fImportance Resampling [41], denoted by DSIR, for comparisons. In addition, we also consider fine-tuning models on the entire dataset, denoted as FULL, as a baseline. Evaluation Settings. After obtaining the curated datasets using SHED and baseline methods, we fine-tune the pre-trained models using each curated subset, respectively. We apply the LowRank Adaptation (LoRA) for fine-tuning and set the default LoRA rank to 128. For all curated datasets, the instruction fine-tuning was conducted for 3 epochs. We evaluate the performance of fine-tuned models on MMLU and ARC-challenge tasks using the lm-evaluation-harness testing framework [47]. To better evaluate the human preferences of fine-tuned models, we adopt MT-Bench [48] in our experiments. All the experiments are conducted on two A100 GPUs. 4.2 Experiment Results We summarize the experimental results for SHED and other baseline methods. For consistency, the bold numbers indicate the corresponding method outperforms the FULL method. Additionally, we underline the best result achieved among all the methods that curate subsets. For each method, the dataset from the curated collections that yields the optimal result across various sample sizes is referred to as the best-selected dataset. Table 2: Performance comparison of curated datasets of the same size by SHED and baseline methods. Original dataset MMLU WizardLM Method RS DQ DSIR QOCS QWCS RS DQ DSIR QOCS QWCS MMLU 38.94 39.88 40.24 44.80 43.87 33.12 33.20 33.86 35.43 34.91 ARC-challenge 45.10 46.35 45.67 47.10 47.23 46.01 48.71 47.66 49.47 49.92 Table 3: Performance of the best-selected datasets of SHED and baseline methods on the MMLU task. MMLU WizardLM QOCS 44.80 (10k) 35.92 (4k) QWCS 44.24 (13k) 35.76 (9k) RS 40.87 (15k) 34.33 (7k) DQ 43.50 (7k) 33.97 (7k) DSIR 40.23 (13k) 34.72 (10k) Full 45.56 (99.8k) 33.16 (70k) Table 4: Performance of the best-selected datasets of SHED and baselines on the ARC-challenge task. MMLU WizardLM QOCS 47.10 (10k) 51.36 (1k) QWCS 49.21 (9k) 50.26 (7k) RS 47.07 (13k) 49.33 (16k) DQ 46.50 (3k) 50.24 (5k) DSIR 46.90 (3k) 48.78 (12k) Full 45.99 (99.8k) 47.95 (70k) Effectiveness of SHED. Given the datasets generated from SHED and the baseline methods, we fine-tune the LLaMA-7B model, respectively, and evaluate the fine-tuned models on the MMLU and ARC-challenge tasks. We compare the results of the datasets of 10k instances curated by SHED and the baseline methods. As depicted in Table 2, when the number of total sampling instances is fixed (10k), the datasets curated by SHED consistently outperform those chosen by baseline methods. We also compare the performance of fine-tuned models using the best-selected dataset by each method. Table 3 shows the evaluation results for the MMLU task. Our method, SHED-QOCS, demonstrated superior performance on the MMLU dataset compared to baseline methods, achieving the highest results among the curated datasets. Furthermore, SHED-QOCS also led in performance 6 \fTable 5: MT-Bench evaluation of the best-selected datasets of SHED and baselines. Original dataset MMLU WizardLM Method Size Full 99.8k RS 10k QOCS 10k RS 13k QWCS 13k Full 70k RS 4k QOCS 4k RS 9k QWCS 9k LLaMA-7B 3.02 2.23 2.53 2.44 2.83 5.21 4.77 4.89 4.81 5.24 Table 6: Transferability evaluation using the best-selected datasets across different models on MMLU task. Original dataset MMLU WizardLM Method Size Full 99.8k RS 10k QOCS 10k RS 13k QWCS 13k Full 70k RS 4k QOCS 4k RS 9k QWCS 9k LLaMA-13B 53.22 50.04 52.95 50.12 51.54 45.63 45.77 45.93 45.81 46.36 VICUNA-7B 49.70 48.43 50.01 47.21 48.93 45.56 45.71 47.19 45.44 48.16 GPT-2 24.22 23.74 26.89 24.33 25.83 26.19 25.07 26.76 24.85 25.77 Table 7: Transferability evaluation using the best-selected datasets across different models on ARCchallenge task. Original dataset MMLU WizardLM Method Size Full 99.8k RS 10k QOCS 10k RS 13k QWCS 13k Full 70k RS 4k QOCS 4k RS 9k QWCS 9k LLaMA-13B 49.31 47.31 50.43 48.83 50.68 54.09 53.17 55.20 54.11 55.63 VICUNA-7B 44.88 44.86 45.23 43.24 44.91 49.91 47.72 50.26 47.98 48.72 GPT-2 19.45 18.77 19.81 19.02 20.05 19.19 17.98 19.28 18.72 19.54 when utilizing the WizardLM dataset. It is notable that SHED-QOCS outperforms the full dataset, achieving a 2.76% higher accuracy. In Table 4, we report the results of the ARC-challenge task. Similarly, among the datasets curated from the MMLU dataset, the selected dataset of our method SHED-QWCS achieves the best result compared with the baseline methods. It also surpasses the full dataset by 3.22%. Within the datasets derived from WizardLM, SHED-QOCS once again curated the dataset of best performance, which surpasses the full dataset by 3.41%. The results demonstrate the effectiveness of SHED. Although SHED demands more computational effort, its strength lies in creating high-performance datasets. Evaluations on MT-Bench. We also use MT-Bench to evaluate the performance of datasets curated by SHED in terms of human preferences. Table 5 demonstrates that the dataset curated by SHED aligns well with human preferences, not only enhancing accuracy but also enabling the model to better understand and follow human instructions, generating answers that are more favorable to humans. The dataset constructed through the SHED-QWCS method, sampled from WizardLM, achieved a remarkable score of 5.24 on the MT-Bench. Transferability Evaluation of Curated Datasets across Various Models. To evaluate the transferability of datasets curated by SHED , we first apply SHED to select data from the MMLU and WizardLM datasets based on LLaMA-7B. Then, we fine-tune LLaMA-13B, Vicuna-7B, and GPT-2 using the best-selected dataset curated by SHED and the baseline methods. As summarized in Table 6 and Table 7, datasets curated by SHED exhibit robust performance across various models, demonstrating their transferability and applicability across various tasks and even different model families. The strong transferability of the curated datasets indicates that SHED identifies generally high-quality data. In addition, the computational cost for data selection can be significantly amortized across various models. Impact of Number of Clusters. The number of clusters in K-means affects the computational cost needed for Shapley value calculations and the relevance of proxy data to its cluster. An increase in the number of clusters leads to smaller and more homogeneous groups, thereby improving the proxy data\u2019s representativeness for its respective clusters. However, this comes at the cost of increased computational overhead, highlighting a balance that must be struck to optimize both efficiency and representativeness. In this experiment, we evaluate the best-selected dataset by SHED across varying numbers of clusters using LLaMA-7B on the MMLU test set. Guided by the findings in [49], our investigation begins with a baseline cluster count of C = p |D|. We present the computation time for Shapley value computations across different settings, maintaining consistency with the experimental setup outlined in Section 4.1. 7 \fQWCS QOCS Accuracy (%) 40 42 44 Number of clusters 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 (a) Subsets selected from MMLU. QWCS QOCS Accuracy (%) 33 34 35 36 Number of clusters 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 (b) Subsets selected from WizardLM. MMLU WizardLM Time (hours) 6 8 10 Number of clusters 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 (c) Computational time for one iteration of Shapley value calculation. Figure 3: Performance of subsets with varying numbers of clusters in SHED. As Figure 3(a) and Figure 3(b) show, the results reveal that performance improvements of curated dataset reach a plateau when the number of clusters exceeds 3 p |D|. Meanwhile, Figure 3(c) demonstrates a proportional increase in computation time for Shapley value calculations as the number of clusters rises. Notably, at very low cluster counts (e.g., below 1000), Shapley value computation times are largely dictated by the evaluation, with the time spent remaining relatively constant across varying datasets. In such cases, the computation time is more significantly affected by the size of pre-trained models rather than the number of clusters itself. Given the transferability of datasets curated using the SHED, it is feasible to employ a smaller foundational model than the target model within the proxy-based Shapley value calculator. In doing so, the computation overhead for evaluation can be significantly reduced, making SHED a practical approach in real-world settings. QWCS QOCS Accuracy (%) 42 43 44 45 Number of iterations 5 10 15 20 25 30 (a) Subsets selected from MMLU. QWCS QOCS Accuracy (%) 32 33 34 35 36 Number of iterations 5 10 15 20 25 30 (b) Subsets selected from WizardLM. Figure 4: Performance of subsets with varying iterations in SHED. Impact of Number of Iterations on Proxy-based Shapley Calculator. The precision of Shapley value estimates increases with the number of iterations k, providing a more accurate measurement of each data sample\u2019s contribution to the model performance. However, this increment also leads to a proportional rise in computational cost, leading to a contrasting relationship between computational efficiency and the accuracy of Shapley value estimations. To seek the optimal number of iterations for Shapley value calculations, we analyzed the performance of datasets curated by SHED under varying iteration settings. The experiments are conducted with the LLaMA-7B model on the MMLU test set, following the experimental settings detailed in Section 4.1. Figures 4(a) and 4(b) illustrate that the performance of the curated datasets by QOCS and QWCS are stable once the iteration number surpasses 10. This result highlights the stability of our methods beyond 10 iterations, showing that further iterations beyond this threshold do not significantly improve dataset quality. Given the balance between computational cost and performance, setting the number of iterations to 10 is recommended for optimal efficiency and robustness. 5 Discussion 5.1 Data Selection for Multiple Tasks. In our experiments, we thoroughly evaluate methods regarding accuracy. It is notable that our framework is readily adaptable. By setting different value functions v(P), SHED can select any 8 \fsubset using arbitrary criteria. This adaptability allows SHED to customize its data selection process to produce a small dataset while improving specific objectives, such as model fairness [50]. In particular, if we aim to curate a dataset using the common fairness notion, i.e., demographic parity, we can define v(P) the disparity in positive prediction rates between groups with protected attributes (e.g., males vs. females), calculated as the negative absolute difference \u2212|XMale \u2212XFemale|, where XMale and XFemale are the positive prediction rates for male and female groups, respectively. 5.2 Complexity Analysis We assume that the running time required to fine-tune the model using a single instance is denoted by t, and the time needed to evaluate the model on a test set consisting of m instances is represented by Tm. Let C denote the number of clusters, n denote the number of instances within a group and k signifies the number of iterations utilized in the proxy-based Shapley calculator as illustrated in Section 3.2. The total number of evaluations and fine-tuning per iteration would be proportional to C n . For simplicity, we assume that C is evenly divisible by n for simplicity. Given k iterations, the overall time complexity of this approximation method can be expressed as O \u0010 Ck n h (C+n)t 2 + Tm i \u0011 . 6"
17
+ }
abs_9K/validation_abstract_short_2405.00709v1.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2405.00709v1",
3
+ "title": "Evaluating Tool-Augmented Agents in Remote Sensing Platforms",
4
+ "abstract": "Tool-augmented Large Language Models (LLMs) have shown impressive\ncapabilities in remote sensing (RS) applications. However, existing benchmarks\nassume question-answering input templates over predefined image-text data\npairs. These standalone instructions neglect the intricacies of realistic\nuser-grounded tasks. Consider a geospatial analyst: they zoom in a map area,\nthey draw a region over which to collect satellite imagery, and they succinctly\nask \"Detect all objects here\". Where is `here`, if it is not explicitly\nhardcoded in the image-text template, but instead is implied by the system\nstate, e.g., the live map positioning? To bridge this gap, we present\nGeoLLM-QA, a benchmark designed to capture long sequences of verbal, visual,\nand click-based actions on a real UI platform. Through in-depth evaluation of\nstate-of-the-art LLMs over a diverse set of 1,000 tasks, we offer insights\ntowards stronger agents for RS applications.",
5
+ "authors": "Simranjit Singh, Michael Fore, Dimitrios Stamoulis",
6
+ "published": "2024-04-23",
7
+ "updated": "2024-04-23",
8
+ "primary_cat": "cs.CL",
9
+ "cats": [
10
+ "cs.CL",
11
+ "cs.AI",
12
+ "cs.LG"
13
+ ],
14
+ "label": "Original Paper",
15
+ "paper_cat": "LLM AND Agent",
16
+ "gt": "Tool-augmented Large Language Models (LLMs) have shown impressive\ncapabilities in remote sensing (RS) applications. However, existing benchmarks\nassume question-answering input templates over predefined image-text data\npairs. These standalone instructions neglect the intricacies of realistic\nuser-grounded tasks. Consider a geospatial analyst: they zoom in a map area,\nthey draw a region over which to collect satellite imagery, and they succinctly\nask \"Detect all objects here\". Where is `here`, if it is not explicitly\nhardcoded in the image-text template, but instead is implied by the system\nstate, e.g., the live map positioning? To bridge this gap, we present\nGeoLLM-QA, a benchmark designed to capture long sequences of verbal, visual,\nand click-based actions on a real UI platform. Through in-depth evaluation of\nstate-of-the-art LLMs over a diverse set of 1,000 tasks, we offer insights\ntowards stronger agents for RS applications.",
17
+ "main_content": "INTRODUCTION Large Language Models (LLMs) demonstrate impressive potential in complex geospatial scenarios, augmenting remote sensing (RS) platforms with agents capable of sophisticated planning, reasoning, and task execution. These developments have sparked interest to deploy multimodal models across various RS tasks, including image captioning and visual question answering (VQA) (Yuan et al., 2022). Notably, SkyEyeGPT (Zhan et al., 2024) finetunes state-of-the-art VQA agents (Chen et al., 2023) on RS imagery for unified multimodal responses, while Remote Sensing ChatGPT (Guo et al., 2024) deploys computer-vision models (e.g., land use classification, object detection) via prompting. However, these approaches rely on chatbot-based templates with predefined text-image correlations over specific image files to assess LLM performance (Fig. 1 left), hence failing to capture the nuances of realistic user-grounded RS tasks. Figure 1: Unlike prior work that assumes task-specific templates (e.g., \u201c[detection]\u201d keyword), GeoLLM-QA requires the agent to follow nuanced instructions and perform multi-step reasoning to accomplish user-defined objectives. In this work, we aim to bridge this gap with the following contributions: first, we introduce GeoLLM-QA, a novel benchmark of 1,000 diverse tasks, designed to capture complex RS workflows where LLMs handle complex data structures, nuanced reasoning, and interactions with dynamic user interfaces (Fig. 1 right). To this end, we harness recent advancements in benchmarking work for tool-augmented LLMs (Zhuang et al., 2023; Maini et al., 2024; Koh et al., 2024). Second, we adopt a comprehensive evaluation scheme (Maini et al., 2024) beyond traditional text-based metrics that accurately assesses an agent\u2019s proficiency in utilizing external tools for effective problem1 arXiv:2405.00709v1 [cs.CL] 23 Apr 2024 \fICLR 2024 Machine Learning for Remote Sensing (ML4RS) Workshop Figure 2: GeoLLM-QA challenges agents to solve complex RS tasks through multimodal reasoning and actions over long sequences of verbal, visual, and click-based actions on a real UI platform. solving. Third, we evaluate several state-of-the-art tool-augmentation and prompting methodologies on our benchmark. We highlight our key takeaways regarding the strengths, weaknesses, and potential of LLMs within geospatial platforms. We strive to motivate future work and help the RS community in unlocking further advancements in this domain. 2 THE GE OLLM-QA FRAMEWORK Benchmarking Platform: To assess geospatial reasoning in an agent-assisted platform context, we draw inspiration from (Zhou et al., 2023) and we implement a benchmarking UI, as a realistic and reproducible standalone web-app that incorporates user-centered tasks with open-source tools and datasets. By leveraging open-source APIs, not only we address challenges of reproducibility and comparison across different systems, but also enable the examination of a wide range of RS use-cases through various input modalities including verbal, visual, and tactile interactions. The complete tool set consists of 117 tools, such as plotly mapbox APIs for the map functionality and LangChain routines for FAISS vectorstores (Douze et al., 2024), to name a few. We intend to release our codebase and benchmark to stimulate future research on geospatial Copilots. Problem Formulation: To denote RS tasks beyond simplistic VQA data-pairs, we model the problem after the realistic UI experience: intuitively, each interaction consists of the user question, the sequence of tool-calls by the agent, and the final (textual) response to user and platform state. We can therefore denote each task as {q, T, r, S}, where q is the user prompt, r is the textual response, while T represents the set of tool-calling steps T = {t1, t2, . . . }. At each step i, the agent invokes tool ti = {tooli, args\u2217\u2217 i } \u2208T from the available tool space T . Finally, S defines the final system state: e.g., map positioning, loaded database, visible data holdings, etc. Data Sources: Our evaluation framework includes three representative large-scale datasets: xview1 (Lam et al., 2018), xview3 (Paolo et al., 2022), DOTA-v2.0 (Ding et al., 2021). Encompassing both optical and synthetic aperture radar (SAR) imagery, these data holdings offer detailed object annotations across 80 categories from a total of 5,000 images. Notably, these datasets come with valuable metadata, such as dates and coordinates, which greatly enhances the complexity of temporal and spatial RS scenarios in our benchmark. The satellite imagery serves as task context for LLM agents to execute function calls and is not used for finetuning the LLM or other downstream tasks, enabling our research-purposes investigation. \u201cGolden\u201d Detector Models: without loss of generality, we employ \u201coracle detectors,\u201d a common practice in foundation-models literature (Yang et al., 2023a), so that we can concentrate on evaluating the agent\u2019s proficiency in selecting and utilizing the appropriate tools without confounding 2 \fICLR 2024 Machine Learning for Remote Sensing (ML4RS) Workshop the false positives/negatives of a non-optimal detector. By abstracting out detection errors, we can measure any degradation in performance metrics directly attributable to agents\u2019 failures. For instance, consider a scenario where the LLM is instructed to \u201cdetect all airplanes at the Mexico City airport using the YOLO detector.\u201d We want to verify whether the agent can designate the right detector, filter through the correct imagery, and specify the right classes. Therefore, upon the LLM\u2019s selection of an image set, we assume an oracle detector that provides 100% accurate detections, i.e., \u201cgold\u201d results directly from dataset ground truths. We then calculate the recall of these detector \u201cresults\u201d, attributing any discrepancies solely to the agent\u2019s inability to accurately fulfill the task. Benchmark Creation: To create a representative set of RS tasks, GeoLLM-QA adopts the threestep benchmarking process presented in (Zhuang et al., 2023): 1. Reference Template Collection: we curate a set of 25 template questions that cover the wide range of RS tasks, such as object detection, change detection, etc. Several key tasks are shown in Fig. 2. To generate answers for these questions, we guide GPT-4 to reach the answers via a simple human-in-the-loop mechanism via feedback UI buttons (Ouyang et al., 2022). By using previous (un)successful attempts as in-context examples, GPT can quickly help us create the Reference Templates. 2. LLM-guided Question Generation: we generate permutations and perturbations of the Reference Templates. Note here that previous RS benchmarks assume that all LLM tasks are implicitly correct. However, Maini et al. (2024) show that one of the most challenging aspects of agent performance is their ability to handle prompts that maintain the general template of a genuine question but are factually incorrect. We therefore assume a ratio of 9:1 correct:incorrect tasks and we use GPT-4 to generate variations per template for a total of 1,000 tasks. To allow GPT-4 to \u201cprogrammatically\u201d select from real data combinations, we provide in-context prompt with dataset descriptions, e.g., SQL schemas with all eligible category names in the xview1 database. Reference Question with Paraphrased and Perturbed Variations Reference Q: Use the YOLO detector to detect fishing vessels in xview3 images around Ancona. Plot them on the map. Paraphrased Q: Use RetinaNet to find yacht detections in xview1 images around Barbados, and show them on the map. Perturbed Q: Use NoNet to find Zeppelins in images around the mythical city of Atlantis. 3. Human-guided Ground Truth Generation: last, to generate the ground truth answers and tool-set solutions, we task GPT-4 to solve each question using the available platform tools. To guide the process, we leverage the Reference Templates (questions and solutions) and we augment the LLM by dynamically retrieving similarly correct examples via RAG (Gao et al., 2024). This allows us to accelerate the process, while ensure the human-on-the-loop to validate the overall correctness. Metrics: Unlike existing VQA-based benchmarks, we consider a a comprehensive set of metrics that capture the LLM\u2019s ability for effective tool-calling and reasoning: a. Success rate: the ratio of successfully completed tasks across the entire benchmark. Each task is consider to be completed correctly when the final platform state S matches the \u02dc S ground-truth. This ratio informs us of the degree to which the agent is able to complete tasks, irrespective of whether it took incorrect or unnecessary intermediate steps. b. Correctness ratio: the ratio of correct function-call operations across the benchmark. Given a ground-truth tool-set \u02dc T and an LLM solution T, we track all applicable LLM error-types as defined in (Zhuang et al., 2023) (i.e., \u201cInfeasible Action\u201d, \u201cFunction Error\u201d, \u201cArgument Error\u201d, \u201cIncorrect Data Source\u201d, and \u201cOmitted Function\u201d). Given the total number of errors and ground-truth tools, we compute the correctness ratio Rcorrect = max(0, 1 \u2212Nerrors/Ntools) (Maini et al., 2024). This metric captures how likely it is for the agent to invoke the correct functions in the expected order. c. ROUGE score: we use the ROUGE-L recall score (Lin, 2004) to compare model answers a with the ground truth \u02dc a to assess the ability of the agent to reply to the task at hand. d. Cost (Tokens): we compute the average number of tokens per task over the entire benchmark. e. (Detection) Recall: over the entire benchmark, we assess the agents ability to correctly return detection tasks by calculating the overall recall R (i.e., detections returned by the method against \u201cgold\u201d ground-truths from oracle detectors). 3 \fICLR 2024 Machine Learning for Remote Sensing (ML4RS) Workshop Table 1: Performance of different agents on GeoLLM-QA-1k. Success Correctness ROUGE Det. Avg. Tokens\u2193 Rate\u2191 Rate\u2191 -L\u2191 Recall\u2191 /Task\u2193 GPT-3.5 Turbo (0125) CoT (Wei et al., 2023) Zero-Shot 30.74% 80.67% 21.42% 91.92% 7.4k CoT (Wei et al., 2023) Few-Shot 31.65% 89.55% 22.05% 71.17% 9.3k Chameleon (Lu et al., 2023) Zero-Shot 23.69% 79.88% 23.29% 89.73% 12.1k Chameleon (Lu et al., 2023) Few-Shot 26.74% 85.70% 24.30% 96.18% 12.9k ReAct (Yao et al., 2023) Zero-Shot 30.70% 86.26% 22.31% 77.17% 7.5k ReAct (Yao et al., 2023) Few-Shot 32.95% 89.35% 26.06% 91.78% 11.1k GPT-4 Turbo (0125) CoT (Wei et al., 2023) Zero-Shot 34.99% 94.59% 26.82% 85.81% 8.7k CoT (Wei et al., 2023) Few-Shot 33.35% 94.93% 27.09% 93.33% 9.2k Chameleon (Lu et al., 2023) Zero-Shot 29.44% 83.49% 21.57% 88.88% 12.5k Chameleon (Lu et al., 2023) Few-Shot 31.18% 89.59% 22.56% 90.41% 13.1k ReAct (Yao et al., 2023) Zero-Shot 33.52% 94.85% 27.82% 87.77% 9.5k ReAct (Yao et al., 2023) Few-Shot 33.39% 94.98% 27.75% 96.73% 11.6k 3 EXPERIMENTS In the scope of this analysis, we run various prompting techniques from literature: Chain-ofThought (Wei et al., 2023), (MM-)ReAct (Yao et al., 2023; Yang et al., 2023b), and Chameleon (Lu et al., 2023). We leave more advanced prompting strategies for future investigation. Our baselines language models include GPT-4 Turbo (gpt-4-0125-preview) and GPT-3.5 Turbo (gpt-3.5-turbo-1106). Tab. 1 summarizes our findings. The recent GPT-4 Turbo release exhibits impressive functioncalling capabilities, while in terms of methods, CoT and ReAct outperform Chameleon in both correctness and success rates, while being more token efficient. With respect to other metrics, ROUGE-L shows the limitations of text-based scores, as it has been reported by recent work on foundation models comparing closedand open-vocabulary answers (Majumdar et al., 2024). That is, the distribution of LLM answers is heavily dependent on the prompting method. For instance, answers generated by GPT-3.5 might artificially penalize a different response style by Chameleon if treated ground-truths (e.g., \u201cThere are five airplanes\u201d vs. \u201cThis image contains 5 planes\u201d can result in lower scores despite conveying the same fact). Last, we observe that detection-related metrics, as captured by recall, do not necessarily correlate with agent performance. All these findings confirm that, unlike existing RS benchmarks that mainly report detection results or captioning-related scores, a more comprehensive evaluation is required to assess agent performance. Figure 3: GPT-3.5 vs. GPT-4 error analysis for CoT prompting. Fig. 3 shows the error types for CoT on GPT-3.5 and GPT-4, in both zero-shot and few-shot scenarios. The most common, \u201cMissed Function\u201d (where the agent omits necessary tool calls regardless of the approach used) accounts for more than half of all errors. We expect that dynamic/RAGaugmented (Srinivasan et al., 2023) prompting should improve agent performance by addressing such failures. Last, the consistent distribution across different cases implies that these issues are not method-specific but rather inherent to the current GPT capabilities. 4 \fICLR 2024 Machine Learning for Remote Sensing (ML4RS) Workshop 4"
18
+ }
abs_9K/validation_abstract_short_2405.00710v1.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2405.00710v1",
3
+ "title": "Homonym Sense Disambiguation in the Georgian Language",
4
+ "abstract": "This research proposes a novel approach to the Word Sense Disambiguation\n(WSD) task in the Georgian language, based on supervised fine-tuning of a\npre-trained Large Language Model (LLM) on a dataset formed by filtering the\nGeorgian Common Crawls corpus. The dataset is used to train a classifier for\nwords with multiple senses. Additionally, we present experimental results of\nusing LSTM for WSD. Accurately disambiguating homonyms is crucial in natural\nlanguage processing. Georgian, an agglutinative language belonging to the\nKartvelian language family, presents unique challenges in this context. The aim\nof this paper is to highlight the specific problems concerning homonym\ndisambiguation in the Georgian language and to present our approach to solving\nthem. The techniques discussed in the article achieve 95% accuracy for\npredicting lexical meanings of homonyms using a hand-classified dataset of over\n7500 sentences.",
5
+ "authors": "Davit Melikidze, Alexander Gamkrelidze",
6
+ "published": "2024-04-24",
7
+ "updated": "2024-04-24",
8
+ "primary_cat": "cs.CL",
9
+ "cats": [
10
+ "cs.CL",
11
+ "cs.LG"
12
+ ],
13
+ "label": "Original Paper",
14
+ "paper_cat": "LLM Fairness",
15
+ "gt": "This research proposes a novel approach to the Word Sense Disambiguation\n(WSD) task in the Georgian language, based on supervised fine-tuning of a\npre-trained Large Language Model (LLM) on a dataset formed by filtering the\nGeorgian Common Crawls corpus. The dataset is used to train a classifier for\nwords with multiple senses. Additionally, we present experimental results of\nusing LSTM for WSD. Accurately disambiguating homonyms is crucial in natural\nlanguage processing. Georgian, an agglutinative language belonging to the\nKartvelian language family, presents unique challenges in this context. The aim\nof this paper is to highlight the specific problems concerning homonym\ndisambiguation in the Georgian language and to present our approach to solving\nthem. The techniques discussed in the article achieve 95% accuracy for\npredicting lexical meanings of homonyms using a hand-classified dataset of over\n7500 sentences.",
16
+ "main_content": "Introduction Homonyms are words that share the same written and spelling form but have different lexical meanings. The Word Sense Disambiguation (WSD) task involves identifying the correct meaning of a word in a given context. Accurately disambiguating homonyms is crucial in natural language processing, especially for tasks like semantic analysis. For instance, the research group at the Georgian National Academy of Sciences encountered a limitation in their Natural Language Processing tasks due to the inability to disambiguate between homonyms. However, as of our knowledge, this task has received no attention in the Georgian language due to the absence of sense-annotated datasets. To address this issue, we propose a novel approach to the WSD task based on fine-tuning a pre-trained Large Language Model (LLM) to obtain a classifier for words with multiple senses, as well as a much lighter recurrent neural network model in terms of memory requirements. In this research, we discuss our method for obtaining a new dataset for Word Sense Disambiguation (WSD) evaluation in the Georgian language. The dataset comprises over 7000 example sentences containing homonyms and their respective lexical meanings. We utilize this dataset to evaluate the effectiveness of our proposed method. Currently, we have focused on a single homonym, \u201d\u10d1\u10d0\u10e0\u10d8\u201d (Transliteration: \u201dbari\u201d), which encompasses 11 distinct meanings, including the name of a city in Italy. For our current purposes, we have selected three definitions that are most commonly used in the language: \u201dShovel,\u201d \u201dLowland,\u201d and \u201dCafe.\u201d 2 Related works Recently, contextual embeddings generated by Large Language Models (LLMs) have been increasingly utilized in place of pre-trained word embeddings. These contextual embeddings offer a more nuanced representation of words, capturing context-specific information. Consequently, simple approaches such as kNN can be effectively combined with these embeddings to accurately predict word senses in Word Sense Disambiguation tasks [2]. Despite the high performance of previously mentioned unsupervised approaches for Word Sense Disambiguation, their reliance on a large amount of textual data can be challenging for their application to under-resourced languages. Notable work utilizing supervised learning methods is [3]. In this work, a group 1 \f2 of researchers obtained 3000 scientific documents containing a specific homonym (\u201dReintroduction\u201d) and manually classified them. After further preprocessing of the scientific articles, they used the labeled data to create a classification model achieving 99% accuracy. In our work, we have adopted a similar approach. However, due to a shortage of articles in the Georgian language, we utilized sentences containing the homonyms instead. 3 Dataset To access a large amount of Georgian text, we obtained the text corpus by downloading the CC100 Dataset for the Georgian language [1]. Subsequently, the data was filtered to include only words containing Georgian letters. Next, we extracted sentences containing specific homonyms. These sentences were limited to a maximum length of 13 words, with the homonym positioned in the middle of each sentence. This process resulted in obtaining over 30,000 sentences containing the homonym \u201d\u10d1\u10d0\u10e0\u10d8\u201d and its various grammatical forms. We manually classified 7,522 sentences, of which 5,929 examples used the homonym with one of the three definitions described above. Afterwards, we used 20% of this data for validation and 80% for training. Unfortunately, there was an uneven distribution of the three classes, with only 763 cases where the homonym was used as \u201dShovel,\u201d 1,846 sentences as \u201dLowland,\u201d and 3,320 as \u201dCafe.\u201d This resulted in a bias towards the latter, more contemporary definition of the word. The proportions of the classes were preserved for the partitioned datasets used for training and testing. 4 Models We experimented with Transformer models and Recurrent Neural Networks, creating three different models for the homonym disambiguation task. 4.1 Transformers \u2013 Fill-Mask For our first model, we fine-tuned the Georgian Language Model based on the DistilBERT-base-uncased architecture [4] using the technique of Masked Language Modeling. We masked the homonyms from the sentences and replaced them with their synonyms according to the definitions used. For example, we replaced \u201d\u10d1\u10d0\u10e0\u10d8\u201d with \u201d\u10d3\u10d0\u10d1\u10da\u10dd\u10d1\u10d8\u201d (lowland) where the homonym referred to the field. It\u2019s important to note that we didn\u2019t preserve the grammatical forms of the homonyms; instead, we wrote the synonyms in their base forms, ignoring syntactical information. The resulting pairs of sentences were then fed to the pretrained Transformer model for fine-tuning. We used 80% of the data for training and 20% for testing. The model was trained for 20 epochs with a learning rate initially set to 0.00005 and a batch size of 16. The training process took approximately 2 hours to complete. 4.2 Transformers \u2013 Text Classification For our second model, we utilized the pre-trained Georgian Language Model based on the DistilBERTbase-uncased architecture [4]. However, in this case, the task involved Text Classification. The sentences were labeled according to the definitions of the homonyms, with those referring to \u2019shovel\u2019 classified as 0, \u2019lowland\u2019 as 1, and \u2019cafe\u2019 as 2. In this scenario, syntactical information was preserved. Similar to the previous model, 80% of the data was allocated for fine-tuning, while the remaining 20% was reserved for testing. The model underwent training for 20 epochs, with the learning rate initially set to 0.00005 and a batch size of 16. The training process was completed in approximately 1.5 hours. 4.3 Recurrent Neural Networks \u2013 LSTM Lastly, we also conducted experiments using recurrent neural networks, specifically Long Short-Term Memory networks (LSTMs). The training dataset was identical to that of our second model; however, for this task, we employed our own word embeddings. To achieve this, we trained the CC100 dataset [1] using the Word2Vec model [5], projecting words onto 128-dimensional real vectors. The Word2Vec model was \f3 trained for 20 epochs, with a window size of 10 and a minimum word frequency of 10. With the training dataset prepared, we designed the model architecture. The recurrent neural network comprised two hidden layers. The first hidden layer consisted of 64 LSTM units, each connected to a 128-dimensional input vector. This layer was unfolded 13 times, corresponding to the 13-word input sequence. Additionally, the output of each unit in the unfolded layer served as the input for the units in the second hidden layer, which also contained 64 LSTM units. Finally, the output of the last folded layer of the second hidden layer was fed to the softmax output layer for classification. For this model, we opted to train it 100 times, starting from randomly initialized weights, and averaged its performance. The dataset was split into 80% training and 20% test sets, with the training set further divided into a validation set constituting 20% of it. Each training run consisted of 40 epochs, with EarlyStopping applied on the validation data. 5 Results Although the models differed in their architecture and the type of training data, the results were quite similar on the test set comprising 1186 sentences. The transformer models achieved identical accuracies of 95.11%. Conversely, the recurrent neural network model was trained 100 times from randomly initialized weights, yielding a mean accuracy of 95.096%. The minimum accuracy observed was 93.59%, while the maximum was 96.795%. These results are summarized in Table 1. Model Accuracy (%) Transformers \u2013 Fill-mask 95.11% Transformers \u2013 Text-Classification 95.11% LSTM 95.10% Table 1: Model Accuracies Below (Figure 1), we demonstrate the impact of varying amounts of training data on the accuracy of the model, evaluated on a test set comprising 1200 sentences. Notably, all models underwent training for 10 epochs. The visualization highlights the significant dependency of transformer models on the size of the training data, whereas the LSTM model exhibits consistent performance across different data sizes. 1200 2400 3600 4800 84 86 88 90 92 94 96 Amount of Training Data Accuracy T-FM T-TC LSTM Figure 1: Accuracy vs. Amount of Training Data. (T-FM stands for Transformers Fill-Mask, T-TC for Transformers Text-Classification). \f4 6 More experiments We also experimented with modern chatbots, such as Chat-GPT [6] and Bard [7], to assess their ability to understand context and disambiguate homonyms in the Georgian language. Some prompts were provided in Georgian, inquiring about the context in which the homonym was used in a specific sentence. Other prompts involved translating the sentence to English before asking (also in English) which of the definitions of the homonym could have the closest thematic connection to the sentence. Unfortunately, the results were poor, indicating that modern chatbots do not yet possess the capability to understand Georgian well enough. However, there is notable progress in the GPT-4 iteration compared to GPT-3.5, indicating promising potential for further advancements in the future. 7 Discussion In this study, we introduced a novel approach to the WSD task in the Georgian language by leveraging supervised fine-tuning of a pre-trained LLM. Additionally, we explored the performance of LSTM models in the same task. Our primary objective was to address the challenge of accurately disambiguating homonyms, a crucial aspect of natural language processing tasks. Our experimental results demonstrate promising outcomes for homonym disambiguation in the Georgian language. The techniques discussed in this article achieved an accuracy rate of 95% for predicting the lexical meanings of homonyms, based on a hand-classified dataset comprising over 7500 sentences. Despite the inherent complexities of the Georgian language, including its agglutinative nature and unique linguistic features, our proposed methods showcase effective strategies for tackling the WSD task. This approach can be generalized to other homonyms by obtaining and classifying sentences. It is worth noting that the recurrent neural network-based model consumes only 322.76 KB of memory, and separate classifiers can be dedicated to other homonyms. For transformer models, given their higher memory requirements, scaling up the number of classes or relying on the fill-mask model\u2019s performance on various sentences containing different homonyms could be potential strategies. Furthermore, with a significant increase in the amount of Georgian text, creating large language models may become feasible, enabling the utilization of contextual embeddings and unsupervised techniques. The dataset, the model implementations and testing codes will be uploaded on this github[8] account and huggingface spaces[9]. The homonym classification dataset can serve as a benchmark for evaluating the current progress in the WSD task in the Georgian language. 8 Acknowledgments The authors would like to thank academician Avtandil Arabuli from the Georgian National Academy of Sciences for the problem statement and fruitful discussions. Furthermore, we express our gratitude to Mr. George Chogovadze for his insightful theoretical and practical guidance concerning the task of homonym disambiguation, as well as his valuable insights into the model architecture employed in this article."
17
+ }
abs_9K/validation_abstract_short_2405.01573v1.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2405.01573v1",
3
+ "title": "Class-Level Code Generation from Natural Language Using Iterative, Tool-Enhanced Reasoning over Repository",
4
+ "abstract": "LLMs have demonstrated significant potential in code generation tasks,\nachieving promising results at the function or statement level in various\nbenchmarks. However, the complexities associated with creating code artifacts\nlike classes, particularly within the context of real-world software\nrepositories, remain underexplored. Existing research often treats class-level\ngeneration as an isolated task, neglecting the intricate dependencies and\ninteractions that characterize real-world software development environments. To\naddress this gap, we introduce RepoClassBench, a benchmark designed to\nrigorously evaluate LLMs in generating complex, class-level code within\nreal-world repositories. RepoClassBench includes natural language to class\ngeneration tasks across Java and Python, from a selection of public\nrepositories. We ensure that each class in our dataset not only has cross-file\ndependencies within the repository but also includes corresponding test cases\nto verify its functionality. We find that current models struggle with the\nrealistic challenges posed by our benchmark, primarily due to their limited\nexposure to relevant repository contexts. To address this shortcoming, we\nintroduce Retrieve-Repotools-Reflect (RRR), a novel approach that equips LLMs\nwith static analysis tools to iteratively navigate & reason about\nrepository-level context in an agent-based framework. Our experiments\ndemonstrate that RRR significantly outperforms existing baselines on\nRepoClassBench, showcasing its effectiveness across programming languages and\nin various settings. Our findings emphasize the need for benchmarks that\nincorporate repository-level dependencies to more accurately reflect the\ncomplexities of software development. Our work illustrates the benefits of\nleveraging specialized tools to enhance LLMs understanding of repository\ncontext. We plan to make our dataset and evaluation harness public.",
5
+ "authors": "Ajinkya Deshpande, Anmol Agarwal, Shashank Shet, Arun Iyer, Aditya Kanade, Ramakrishna Bairi, Suresh Parthasarathy",
6
+ "published": "2024-04-22",
7
+ "updated": "2024-04-22",
8
+ "primary_cat": "cs.SE",
9
+ "cats": [
10
+ "cs.SE",
11
+ "cs.AI"
12
+ ],
13
+ "label": "Original Paper",
14
+ "paper_cat": "LLM Fairness",
15
+ "gt": "LLMs have demonstrated significant potential in code generation tasks,\nachieving promising results at the function or statement level in various\nbenchmarks. However, the complexities associated with creating code artifacts\nlike classes, particularly within the context of real-world software\nrepositories, remain underexplored. Existing research often treats class-level\ngeneration as an isolated task, neglecting the intricate dependencies and\ninteractions that characterize real-world software development environments. To\naddress this gap, we introduce RepoClassBench, a benchmark designed to\nrigorously evaluate LLMs in generating complex, class-level code within\nreal-world repositories. RepoClassBench includes natural language to class\ngeneration tasks across Java and Python, from a selection of public\nrepositories. We ensure that each class in our dataset not only has cross-file\ndependencies within the repository but also includes corresponding test cases\nto verify its functionality. We find that current models struggle with the\nrealistic challenges posed by our benchmark, primarily due to their limited\nexposure to relevant repository contexts. To address this shortcoming, we\nintroduce Retrieve-Repotools-Reflect (RRR), a novel approach that equips LLMs\nwith static analysis tools to iteratively navigate & reason about\nrepository-level context in an agent-based framework. Our experiments\ndemonstrate that RRR significantly outperforms existing baselines on\nRepoClassBench, showcasing its effectiveness across programming languages and\nin various settings. Our findings emphasize the need for benchmarks that\nincorporate repository-level dependencies to more accurately reflect the\ncomplexities of software development. Our work illustrates the benefits of\nleveraging specialized tools to enhance LLMs understanding of repository\ncontext. We plan to make our dataset and evaluation harness public.",
16
+ "main_content": "Introduction Using Large Language Models (LLMs) to generate code has garnered significant attention in recent years for its potential to streamline software development processes by automatically translating natural language descriptions into executable code snippets. Several code-specific models, like CodeGen (Nijkamp et al., 2023), WizardCoder (Luo et al., 2023), CodeLlama (Rozi` ere et al., 2024), StarCoder (Li et al., 2023), DeepSeekCoder (Guo et al., 2024) have been proposed to this end. While much of the focus in this domain has been on generating code units such as functions or statements, the specific task of generating classes has received comparatively less attention. Two of the most popular benchmarks HumanEval (Chen et al., 2021) and MBPP (Odena et al., 2021), for instance, focus on function generation. While useful, the problems in these datasets are short and standalone, and existing works have been able to show good 1 arXiv:2405.01573v1 [cs.SE] 22 Apr 2024 \fperformance on these benchmarks. LATS (Zhou et al., 2023) for instance reports a 94.4% accuracy on HumanEval, and 81.1% accuracy on MBPP. To address both of these issues, ClassEval (Du et al., 2023) proposes a benchmark for class generation. The 100 classes in the ClassEval dataset were handcrafted such that they contain inter-method dependencies, i.e. a method could reference another method in the same class. Using this dataset, they showed that, LLMs have a harder time generating code with these kind of dependencies than standalone functions of the kind present in HumanEval or MBPP. While an important contribution, the problems proposed in ClassEval are still standalone when taking the class as a single unit. The only dependencies from outside the class are from well known libraries that the LLM is likely to have memorized. This narrow focus overlooks the complex dependencies that classes may have on other components within a codebase, presenting a gap in our understanding of code generation techniques\u2019 practical applicability. A much more useful problem is to consider the generation of a new class that depends on code from across a repository. To address this gap, we make an attempt at creating a dataset to explore the task of generating classes within the context of code repositories, where classes may interact with other code entities within a larger codebase. Specifically, we collect 130 Java classes from 10 repositories and 97 Python classes from 10 repositories to create RepoClassBench. Each class is present in the context of a real-world repository and has dependencies from the repository. Additionally, we make sure that each class has corresponding test cases that pass on the ground truth, and ensure sufficient coverage. To be able to solve the problems in this dataset, the model has to both, understand the functionality required from each method in the class and reason about how to use repositorydependencies to achieve the same. We provide an evaluation of existing code-generation techniques in this setting, and demonstrate their poor performance. Specifically, BASICPROMPTING either hallucinates identifiers or avoids the dependencies, REFLEXION is able to reason about the error, but does not have enough context to fix it, and RAG-based approaches are able to find similar snippets from across the repo but fail to bring in other kinds of dependencies that are required by the class. Taking a step forward, we address the shortcoming of these methods, by proposing a novel method called RRR and show significant gains. Specifically, RRR leverages existing programming language tools to retrieve precise information from across the repository. With the injection of pointed repository context through these tools, the model is able to fix the error observed during the feedback-reflection stage. By bridging these gaps, our study seeks to contribute to a deeper understanding of LLMs\u2019 potential in generating classes within real-world coding scenarios, with implications for the development of more effective code generation techniques in the future. Our contributions are three-fold: \u2022 We contribute the first benchmark RepoClassBench for class-level code generation in realistic environment of an existing repository, with 130 java classes spanning 10 repositories and 97 python classes spanning 10 repositories. \u2022 We propose a novel method called RRR that equips LLMs with static analysis tools to iteratively navigate and reason about repository-level context in an agent-based framework, and provide a comparison with existing methods. \u2022 We contribute 6 repository tools, based on our observations of common errors experienced by code agents in this setting. 2 Related Work Large Language Models have seen wide success on various coding tasks. Many benchmarks have been created to assess their performance. CoNaLA (Yin et al., 2018), consisting of 500 examples is a statement-level benchmark where the target of each example contains one statement. HumanEval (Chen et al., 2021) and MBPP (Odena et al., 2021) are two widely 2 \fInitial Generation Oracle Call Tool Invocation Reflection Improve Generation NL description: The public class StringNumberHandler, which extends the abstract class AbstractCellHandler \u2026The `getCellValue` method is a protected method \u2026 formatting function of the relevant utilities class specialized in handling Excel numbers, and returns the resultant string Initial class: public class String NumberHandler \u2026{ protected String getCellValue(\u2026) return NumberUtils.formatNumber(\u2026) } cannot find symbol symbol: variable NumberUtils Tool\u2019s output: Tool call: get_relevant_code('format numeric value\u2019) Output: The following pieces of code from the repository may be relevant for the query \u201cformat numeric value\u201d: #### Code Piece 1: For class io.github.zouzhiy.excel.utils.ExcelNumberUtils:: \u2026. static members: -format(java.lang.Number number, java.lang.String format) : String instance members: -format(java.lang.Number number, java.lang.String format) : String Reflection output: The feedback indicates that the class NumberUtils does not exist. I need to use the class ExcelNumberUtils instead. \ud835\udc65 Class Description Independent Tools \ud835\udc660 \ud835\udc610 \u2133\ud835\udc65, \ud835\udc610 LLM: Create class \ud835\udc66\ud835\udc56 \ud835\udc66\ud835\udc56+1 Dependent Tools Tool Descriptions Tool Execution LLM: Pick a tool Selected Tool Tool\u2019s output \u2133\ud835\udc65, \ud835\udc66\ud835\udc56, \ud835\udc53\ud835\udc4f\ud835\udc56, \ud835\udc47 \ud835\udc5b \ud835\udc47\ud835\udc56 \ud835\udc61\ud835\udc56 \u2133\ud835\udc65, \ud835\udc66\ud835\udc56, \ud835\udc53\ud835\udc4f\ud835\udc56, \ud835\udc61\ud835\udc56 Reflection output \ud835\udc5f\ud835\udc56 Improved class code \u2133\ud835\udc65, \ud835\udc66\ud835\udc56, \ud835\udc53\ud835\udc4f\ud835\udc56, \ud835\udc61\ud835\udc56, \ud835\udc5f \ud835\udc56 \ud835\udc65 \ud835\udc65 \ud835\udc65 \ud835\udc66\ud835\udc56 \ud835\udc66\ud835\udc56 \ud835\udc66\ud835\udc56 \ud835\udc53\ud835\udc4f\ud835\udc56 \ud835\udc53\ud835\udc4f\ud835\udc56 \ud835\udc53\ud835\udc4f\ud835\udc56 \ud835\udc61\ud835\udc56 \ud835\udc61\ud835\udc56 \ud835\udc5f\ud835\udc56 LLM: Improve class \u2130\ud835\udc47\ud835\udc56 Build Testcases \ud835\udc47 1 \ud835\udc47 \ud835\udc41 \ud835\udc47 2 \ud835\udc53\ud835\udc4f\ud835\udc56 Test Failures Build Errors Repository Tools Tools LLM: Reflect Feedback Oracle Feedback: Improved class: public class StringNumberHandler \u2026{ protected String getCellValue(\u2026) \u2026 return ExcelNumberUtils.format( numericValue, javaFormat); } Initial class code Figure 1: Flowchart illustrating the procedural framework of RRR. RRR utilizes the natural language description of the class and the outputs of independent tools to create an initial attempt. This attempt is evaluated by an oracle that pinpoints specific errors. Subsequently, RRR uses repository tools to gather information to rectify errors. It then reflects on feedback and tool insights to refine the attempt. This iterative cycle persists until all test cases pass or the maximum allowed number of oracle calls is reached. used datasets, for function level code-generation, consisting of 164 and 974 tasks respectively. At the class-level, ClassEval (Du et al., 2023) has been proposed with 100 class generation problems, where the input is the class skeleton. However, these are all independent codegeneration problems. Although ClassEval includes inter-method dependencies, they are all present within the same class. The external references come from well-known libraries that the LLM is likely to have memorized. In real world repositories, code includes complex inter-dependencies from other files in the repository. RepoBench (Liu et al., 2023), CoderEval (Zhang et al., 2024) and MGD (Agrawal et al., 2023) are attempts to move closer to this setting, and show that existing models perform much better on the standalone setting than the non-standalone setting. However they explore line and function level tasks in the context of a repository, whereas RepoClassBench explores the generation of non-standalone classes within the context of a repository. There are two aspects to solving our dataset, retrieving the right context, and reasoning to generate the code. Reasoning: To improve the generation of LLMs, various iterative refinement techniques have been proposed. Self-refine (Madaan et al., 2023) attempts to use the LLM as it\u2019s own critic and produces successively better outputs. Reflexion (Shinn et al., 2023) incorporates test-case feedback while generating the reflection on its output. LATS (Zhou et al., 2023) uses the LLM as an agent to explore a tree of solutions, using compiler and test feedback as observations. Retrieval: While reasoning-enhanced methods, in themselves, may be useful for standalone generations, they are not sufficient when external context is needed. This is especially true, when the context consists of private data, unseen during pretraining. Under this paradigm Retrieval-Augmented-Generation methods like REALM (Guu et al., 2020), ATLAS (Izacard et al., 2022), RetGen (Zhang et al., 2021), FLARE (Jiang et al., 2023) retrieve relevant context, usually by considering snippets with the highest similarity score with the query. Similarly, in the code setting RLPG (Shrivastava et al., 2023) trains a model to predict the relevant context source, but relies on there being a \u201dhole\u201d in the code, whereas there is no such hole in the NL to new class setting. Additionally the RLPG model was trained for Java, whereas for the other languages new models would need to be trained. This adds additional cost of constructing new training data and the actual training of new models. RepoCoder (Zhang et al., 2023) has been proposed to perform iterative retrieval and generation. While such similarity based RAG methods can retrieve \u201dsimilar\u201d context, they fails to effectively retrieve \u201ddependency\u201d context. Further discussion can be found in RQ2. 3 \fFigure 2: The dataset creation pipeline involved shortlisting candidate repositories, noting passing test cases, finding classes covered by passing test cases (which make external references) and finally mitigating memorization issues if necessary, using paraphrasing. In our method, we leverage repository-level tools to allow the LLM explore the repository, as an alternative retrieval mechanism, in addition to using test-case feedback. This is along the lines of several works that have explored equipping the LLM with tools like ReACT (Yao et al., 2023) and ToolFormer (Schick et al., 2023). However to our knowledge, this is the first work that curates tools-specifically for repository-exploration. Hence, we propose a benchmark that addresses the problem of class generation in the context of a repository, address a gap in the span of existing benchmarks, and also propose a novel method that integrates retrieval and reasoning, mitigating the shortcomings of existing methods. 3 Dataset: RepoClassBench RepoClassBench is a benchmark featuring repositories from Github across languages: Java and Python. The task is to synthesize a complete class within a repository based on a natural language description, utilizing the context from other files within the same repository. Current benchmarks face two primary limitations: (1) they (Du et al., 2023) typically focus on generating small localized code snippets, which do not accurately represent the complex tasks software engineers encounter, often requiring a comprehensive understanding of the entire codebase; (2) they (Liu et al., 2023) rely on metrics such as exact-match or cosinesimilarity to the ground truth for evaluation, rather than assessing the functionality of the generated code through test cases. We mitigate these issues by designing a benchmark where every task corresponds to a class-generation problem where the LLM needs to synthesize the class based on the natural language specification of the class. We ensure that every class in our benchmark makes use of external references in the repository and is covered under test cases. 3.1 Benchmark Construction Stage 1 Shortlisting repositories: Our benchmark includes repositories both before and after the cutoff-date of the models we evaluate on. For JAVA we start with repositories considered in the MGD (Agrawal et al., 2023) dataset. For Python, we adapt the popular benchmark SWEBench (Jimenez et al., 2024) and also shortlist popular repositories which were first created on Github after Sept 2021. We filter out those repositories which we are unable to build and run. (Details in E.1.1) Stage 2 Shortlisting classes: Within each repository, we identify all classes that pass the existing test cases. We retain only those classes that (a) reference other parts of the repository within their body, and (b) have methods covered by test cases. To accommodate 4 \fthe context length limitations of large language models (LLMs), we exclude classes whose implementations exceed 3,000 tokens (excluding docstrings). Additionally, we limit our selection to classes defined in the global namespace. (Details in E.1.2) Stage 3 Dataset paraphrasing: For repositories available before the LLMs\u2019 training data cutoff, we undertake a paraphrasing initiative, altering the names of most symbols to prevent models from completing tasks through mere memorization. (Details in E.1.3) Stage 4 Generating natural language specification: We break the information within each class into varying levels of granularity and record it as metadata. The complete metadata fields are listed in Table E.1.3. Methods are categorized by three information levels: (1) Signature, detailing input and output types; (2) Docstring, providing a high-level function description; (3) Body, outlining full implementation and logic, including external references. We prompt GPT-4 to generate the natural language description of the class by providing it varying granularity of information extracted as a subset of the metadata (refer to Table E.1.3). Hence, two types of natural language description in our dataset are:1. DETAILED: This includes details from the entire class body (excluding imports) and prompts GPT-4 to create an NL description. 2. SKETCHY: This omits method bodies from the prompt, leading GPT-4 to generate an NL description without low-level implementation specifics or explicit external references. In the SKETCHY setting, since GPT-4 does not receive the method bodies, the resulting natural language (NL) descriptions lack detailed implementation specifics and explicit mentions of the external references used during the method\u2019s development. Consequently, the SKETCHY NL descriptions present a higher level of difficulty compared to the DETAILED versions. To foster community engagement and further research, we make the metadata used for constructing these prompts publicly available. This allows others to create NL descriptions with varying degrees of specificity and ambiguity to challenge the models\u2019 capabilities. Example of the difference in prompts to GPT-4 for them can be found in Prompt 1. Some statistics about our dataset can be found in Table 1. Distribution of tasks across different repositories can be found in: Figure 3 and Figure 4. Java Python Num. of tasks 130 97 Length of DETAILED NL description 1475.98 / 286.89 3245.23 / 771.77 Length of SKETCHY NL description 1481.69 / 269.81 2633.20 / 607.64 Length of classes 2080 / 452.69 4663.76 / 1070.49 Num. of TCs directly covering the classes 5.48 42.94 Num. of unique Ext. Refs 3.51 7.06 Num. of funcs in the class 3.1 9.29 Num. of funcs covered in at least one TC 2.85 4.84 Num. of funcs making at least one Ext. Refs 2.28 4.84 Table 1: Dataset High level Statistics. Each row represents an average over all the tasks in the dataset. The cells with / represent the <number of characters> / <number of tokens using gpt-3.5 tokenizer>. TC = Test Cases, funcs = functions, Ext. Refs = References from other files in the repository 4 Method To address the challenges presented by our benchmark, we propose Retrieve-RepotoolsReflect (RRR), an innovative method that enhances Large Language Models (LLMs) with static analysis tools. This approach enables the LLMs to iteratively explore and understand 5 \fthe context of a code repository through an agent-based framework. RRR leverages repository navigation and reasoning capabilities to effectively synthesize code that aligns with the broader structure and dependencies of the repository. 4.1 Phases of RRR The procedural framework of RRR is illustrated visually in Figure 1 and outlined algorithmicaly in Algorithm 1. During the initial generation phase, the LLM M makes an initial \u201dguess\u201d y1 based on the class description x and output from invocations of the independent tool t0: y1 = M(x, t0). Given the limited information available at this stage, the LLM may resort to hallucinating identifiers and other code-structures. (Prompt in G) The oracle call entails passing the generated code yi to the oracle O, to receive oracle feedback f bi, f bi = O(yi). If the attempt exceeds the maximum number of oracle calls or successfully passes all test cases, the loop terminates and returns yi. Otherwise, the oracle feedback errors f bi are utilized by the LLM agent in subsequent phases to refine its generation. While the oracle feedback identifies problems in the code, it lacks guidance on error resolution. To address this, the LLM requires repository context. This context is provided through carefully curated tools, allowing the LLM to explore the repository and retrieve relevant information. Based on the class description x, current generation yi and feedback f bi, the model generates a set of tool calls Ti: Ti = M(x, yi, f bi). The executor E takes these tool calls and produces outputs ti: ti = E(Ti). (Prompt in G) Based on the feedback from the oracle f bi and tool outputs ti, the LLM generates a reflection ri on the encountered errors and necessary actions to rectify them, using hints from the tool outputs tdependent. ri = M(x, yi, f bi, ti) This reflection serves as a hint for the subsequent stage. (Prompt in G) In the improved generation phase, leveraging the last attempt\u2019s yi, oracle feedback f bi, tool outputs ti, and reflection ri, the LLM makes another attempt at code generation yi+1. yi+1 = M(x, yi, f bi, ti, ri) (Prompt in G) After the improved generation, the attempt gets passed back to the \u201dOracle call\u201d phase and the loop continues. 4.2 Tools In RRR, tools are categorized as either independent or dependent based on their need for reasoning. Independent tools operate without considering the current state of the RRR loop and are automatically invoked during the initial generation phase. Our suite includes a single independent tool, \u2018get related snippets\u2018. . On the other hand, tools requiring reasoning over the current state of the RRRloop are classified as dependent tools. Our dependent toolset contains get imports, get class info, get signature, get method body and get relevant code. More information about the tools can be found in Table 4.2. 5 Experimental Results 5.1 Baselines Apart from RRR, we test other important baselines (summarized in Table 8) on our newly constructed benchmark. In BASICPROMPTING the LLM is expected to generate code solely based on the Natural Language Description. In NAIVERAG, inputs include the Natural Language Description and and top-snippets retrieved from repository when queried using the Natural Language Description. REFLEXION incorporates Oracle feedback to iteratively improve the generation. We also use REPOCODER, where the initial generation uses snippets retrieved using the Natural Language Description as the query, and subsequent iterations use snippets retrieved using the previous code-generation as the query. Summary of the baseline can be found in 8. 6 \fTool Description get related snippets Type: Independent. Segments the repository into snippets and returns the top 5 snippets based on cosine similarity with the class description. get imports Type: Dependent. Suggests imports for all the undefined symbols in the current generation, scanning the repository for potential source files defining the symbol and recommending import statements. Input args: No input get class info Type: Dependent. Locates the class definition in the repository and gathers information about its members, including inherited members, providing detailed information about each member. Input args: class name get signature Type: Dependent. Returns the signature of the requested method, displaying signatures of all methods with the same name if they exist in the same class. Input args: class name, method name get method body Type: Dependent. Returns the method definition of the requested method, truncating the output if it is too large, and showing the definition for each method with the same name if they exist. Input args: class name, method name (where class name is the class of which the method is a member. Class name is left as None for global methods.) get relevant code Type: Dependent. Allows specific queries to retrieve code structures using embedding similarity scores, returning the top 3 structures based on cosine similarity using UnixCoder embeddings. Input args: natural language query Table 2: Table containing descriptions of the tools used in RRR. The Type indicates whether reasoning is required (dependent) or not (independent) for the invocation. 5.2 Metrics For each task in our benchmark we use three metrics to measure performance. Pass@K measures the percentage of the tasks for which there is at least one correctly generated solution (passing all test cases) among the top K samples generated by the LLM (Chen et al., 2021). For our experiments, we simply set the total number (denoted as n) of samples generated by an LLM to 1, and then calculate Pass@1 for the LLM. For completeness, in RQ 7, we also measure Pass@ 1, 2, 3, setting n=6 for the JAVA dataset. We also use TR (Test Rate) which measures the mean of the fraction of test cases passed for all generations across all tasks. Finally, for JAVA, since we have access to a compiler, we also measure CR, or the compilation rate which measures the percentage of tasks for which the LLM generated code that successfully compiled. 5.3 Research Questions Through our experiments we aim to answer the following RQs (RQs 5-8 in Appendix): RQ1How does RRR perform compared to the baselines, under the DETAILED and SKETCHY settings ? RQ2 Where do similarity-based retrieval methods fail? RQ3 What is the impact of test feedback on performance? RQ4 What are the challenges faced by RRR? RQ5 How important is each tool for our method? RQ6 How does number of iterations in RRR and baselines impact their performance? RQ7 How does increased sampling impact the performance our RRR and the baselines? RQ8 Does performance depend on whether the repository might have been included in the training dataset of the LLM? 5.3.1 RQ1 Comparative analysis of RRR and baselines We analyzed Table 5.3.1 and Table 4, comparing RRR\u2019s performance with baselines. To explore the use of different LLMs, for JAVA, GPT-3.5 was used; for PYTHON, GPT-4 was employed. RRR consistently outperforms baselines across all metrics. BASICPROMPTING performs the worst without feedback or context, with hardly any generations passing 7 \fMethod JAVA PYTHON P@1 TR CR P@1 TR BASICPROMPTING 1.54 1.54 2.31 1.03 2.40 REFLEXION 3.85 5.04 5.38 7.22 14.36 NAIVERAG 11.54 12.15 14.62 13.40 14.08 REPOCODER 40.77 43.38 46.92 22.68 25.59 RRR 54.62 63.22 70.77 27.84 36.92 Table 3: Performance numbers expressed in percentage, for the baselines and RRR on the DETAILED version of the dataset. P@1 represents the Pass@(1,1) metric, TR is the mean testpass rate across all tasks, and CR is the mean compilation rate across tasks. RRR performs much better than the baselines. Method JAVA PYTHON P@1 TR CR P@1 TR BASICPROMPTING 1.54 1.54 2.31 0.00 1.43 REFLEXION 2.31 3.04 5.38 0.00 0.24 NAIVERAG 8.46 8.46 10.00 0.00 13.38 REPOCODER 34.62 39.17 44.62 7.14 10.06 RRR 48.46 54.72 64.62 7.14 21.89 Table 4: Performance numbers expressed in percentage, for the baselines and RRR on the SKETCHY version of the dataset. RRR performs much better than the baselines. test cases. REFLEXION slightly improves with oracle feedback but lacks repository context, resorting to hallucinating identifiers and limited repository utilization. To add the repository context one might consider dumping the entire repository in the prompt. However, the token count in JAVA and PYTHON repositories can exceed 50k, surpassing LLM context windows, and dumping entire repositories into prompts is impractical. To tackle these issues, methods that employ retrieval can be used. There\u2019s a noticeable performance jump from REFLEXION to NAIVERAG, further improved with REPOCODER, due to more relevant retrieved snippets. While REPOCODERis the best performing baseline, it has two major drawbacks. Firstly, oracle feedback is not used, and secondly, the REPOCODER snippets retrieve \u201dsimilar\u201d lines of code from the repository, and not dependencies, thereby missing crucial information. RQ2 explores this second point in greater detail. Conversely, RRR retrieves dependency context, combining repository context and oracle feedback intelligently. It queries specific repository information to address oracle feedback, consistently outperforming baselines across languages and metrics. Still, there are cases where RRR fails test cases, which we analyze in RQ4. 5.3.2 RQ2 The contributon of similarity-based RAG In this benchmark, repositories, typical of those on GitHub, contain numerous highly similar classes. RAG-based techniques excel over BASICPROMPTING or REFLEXION because they leverage these similarities. However, there\u2019s a crucial distinction between \u201ddependency context\u201d and \u201dsimilarity context.\u201d Dependency context involves information from the repository about utilized code structures, while similarity context merely seeks similar code, which may not always be present. To illustrate that REPOCODER\u2019s gains largely stem from \u201dsimilar\u201d snippets, we remove all relatives of each class to be generated, defined as descendants of the grandparent except the immediate parent and itself. These relatives, often similar to the target class, are pulled in through REPOCODER snippets. Upon re-comparison with baselines (see Table 5), REPOCODER\u2019s performance notably declines in both DETAILED and SKETCHY settings. 8 \fMethod JAVADETAILED JAVASKETCHY P@1 TR CR P@1 TR CR BASICPROMPTING 0.77 0.77 0.77 1.54 1.54 3.85 REFLEXION 2.31 2.88 3.85 1.54 2.36 4.62 NAIVERAG 8.46 8.46 10.00 4.62 6.60 8.46 REPOCODER 23.85 24.42 26.15 16.92 23.92 31.54 RRR 46.92 53.23 60.00 36.92 43.86 51.54 Table 5: Performance numbers expressed in percentage, for the baselines and RRR, after removing the \u201dRelatives\u201d from the DETAILED and SKETCHYversions of the Java dataset. While all retrieval-based methods suffer, RRR does not suffer as much as REPOCODER. Conversely, RRR suffers less, indicating its reliance on \u201ddependency context\u201d for generation completion. 5.3.3 RQ3 Importance of test feedback Method JAVADetailed JAVASketchy P@1 TR CR P@1 TR CR BASICPROMPTING 1.54 1.54 1.67 1.67 1.73 2.69 REFLEXION 2.69 3.36 5.38 3.08 3.78 6.92 NAIVERAG 11.41 11.92 13.33 8.97 9.61 11.28 REPOCODER 37.05 40.12 45.00 29.74 36.77 44.62 RRR 56.15 62.32 71.92 41.67 51.76 63.46 Table 6: Performance numbers expressed in percentage, for the baselines and RRR, terminating the generation immediately after the compilation succeeds, on the DETAILED and SKETCHY versions of the Java dataset. There is a marginal decrease in performance, indicating that most functional requirements can be met simply by using the compiler as the oracle. Examining the role of test feedback, we restrict the oracle to compiler feedback, applicable only for JAVA. In Table 6, baselines like BASICPROMPTING, NAIVERAG, and REPOCODER remain unchanged without oracle feedback. Methods utilizing test feedback show a slight decrease in performance, but still perform adequately. Code that compiles and aligns with functional descriptions tends to pass test cases, as they typically assess functional requirements. While test feedback aids in ambiguous cases, the LLM generally performs well with just compiler feedback. 5.3.4 RQ4 Success and failure case analysis Language Reasoning Errors Functional Ambiguity JAVADETAILED 70% 30% JAVASKETCHY 50% 50% Table 7: Analyzing failure causes across a sample of 20 tasks from the Java dataset, errors are categorized as reasoning-related (in tool retrieval or code generation) or functional ambiguity-related. The table shows the percentage contribution of each error type to failure cases. In the DETAILED dataset, reasoning errors dominate, while in the SKETCHY version, functional ambiguity-related errors increase. This section investigates instances where the Language Model (LLM) failed to pass test cases, identifying potential contributing factors. Notably, errors weren\u2019t due to information 9 \faccess limitations through tools; there was always a tool for repository information retrieval. Our analysis focuses on categorizing error types to guide future investigations for mitigation strategies. Distinct error patterns emerged upon examination, broadly categorized as reasoning errors or functional ambiguity errors. Reasoning errors occur during tool retrieval or code generation, where the LLM fails to interpret or apply information correctly. Functional ambiguity errors arise when the LLM misinterprets terse natural language descriptions, leading to multiple interpretations or missing information. Table 5.3.4, a qualitative analysis of 20 failure cases, shows reasoning errors dominate in the DETAILED setting, while functional ambiguity increases in the sketchy setting. Additionally, the LLM struggles with lengthy textual inputs, with extended class length correlating significantly with decreased efficacy. Over the detailed JAVA dataset, test performance and class length had a Spearman correlation of -0.66, highlighting the challenge of reasoning over extensive texts. Identifying these failure cases sheds light on the dataset\u2019s role in understanding LLM capabilities and limitations. By pinpointing error patterns and correlating them with variables like class length, our analysis sets the stage for future research on enhancing language model robustness and efficacy. 6 Discussion RepoClassBench provides a previously underexplored setting, with unique challenges that require reasoning over the repository. We have further showed that previous methods that use similarity based retrieval have certain drawbacks, in terms of applicability and effectiveness. In solving this problem we proposed using tools to retrieve repository information, which is able to combine traditional embedding based retrieval (through the get related snippets and get relevant code tools) and static analysis tools. Through an iterative paradigm of refinement based on the tool outputs and oracle feedback, we showed that RRR performs well. 7"
17
+ }
abs_9K/validation_abstract_short_2405.05141v1.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2405.05141v1",
3
+ "title": "Learning-to-learn enables rapid learning with phase-change memory-based in-memory computing",
4
+ "abstract": "There is a growing demand for low-power, autonomously learning artificial\nintelligence (AI) systems that can be applied at the edge and rapidly adapt to\nthe specific situation at deployment site. However, current AI models struggle\nin such scenarios, often requiring extensive fine-tuning, computational\nresources, and data. In contrast, humans can effortlessly adjust to new tasks\nby transferring knowledge from related ones. The concept of learning-to-learn\n(L2L) mimics this process and enables AI models to rapidly adapt with only\nlittle computational effort and data. In-memory computing neuromorphic hardware\n(NMHW) is inspired by the brain's operating principles and mimics its physical\nco-location of memory and compute. In this work, we pair L2L with in-memory\ncomputing NMHW based on phase-change memory devices to build efficient AI\nmodels that can rapidly adapt to new tasks. We demonstrate the versatility of\nour approach in two scenarios: a convolutional neural network performing image\nclassification and a biologically-inspired spiking neural network generating\nmotor commands for a real robotic arm. Both models rapidly learn with few\nparameter updates. Deployed on the NMHW, they perform on-par with their\nsoftware equivalents. Moreover, meta-training of these models can be performed\nin software with high-precision, alleviating the need for accurate hardware\nmodels.",
5
+ "authors": "Thomas Ortner, Horst Petschenig, Athanasios Vasilopoulos, Roland Renner, \u0160pela Brglez, Thomas Limbacher, Enrique Pi\u00f1ero, Alejandro Linares Barranco, Angeliki Pantazi, Robert Legenstein",
6
+ "published": "2024-04-22",
7
+ "updated": "2024-04-22",
8
+ "primary_cat": "cs.NE",
9
+ "cats": [
10
+ "cs.NE",
11
+ "cs.LG"
12
+ ],
13
+ "label": "Original Paper",
14
+ "paper_cat": "Parameter AND Efficient AND Fine AND Tuning",
15
+ "gt": "There is a growing demand for low-power, autonomously learning artificial\nintelligence (AI) systems that can be applied at the edge and rapidly adapt to\nthe specific situation at deployment site. However, current AI models struggle\nin such scenarios, often requiring extensive fine-tuning, computational\nresources, and data. In contrast, humans can effortlessly adjust to new tasks\nby transferring knowledge from related ones. The concept of learning-to-learn\n(L2L) mimics this process and enables AI models to rapidly adapt with only\nlittle computational effort and data. In-memory computing neuromorphic hardware\n(NMHW) is inspired by the brain's operating principles and mimics its physical\nco-location of memory and compute. In this work, we pair L2L with in-memory\ncomputing NMHW based on phase-change memory devices to build efficient AI\nmodels that can rapidly adapt to new tasks. We demonstrate the versatility of\nour approach in two scenarios: a convolutional neural network performing image\nclassification and a biologically-inspired spiking neural network generating\nmotor commands for a real robotic arm. Both models rapidly learn with few\nparameter updates. Deployed on the NMHW, they perform on-par with their\nsoftware equivalents. Moreover, meta-training of these models can be performed\nin software with high-precision, alleviating the need for accurate hardware\nmodels.",
16
+ "main_content": "Introduction Contemporary artificial intelligence (AI) models often rely on deep learning [30, 45], resulting in intense computational requirements that become increasingly difficult to fulfill with current technology. This stands in contrast to a growing demand for low-power, autonomously learning AI systems that can be deployed at the edge, without access to large compute clusters. The number of applications for such systems is rapidly increasing and includes mobile devices, autonomous mobile robots and vehicles, smart sensors, and even the internet-of-things. Due to its energy efficiency, neuromorphic hardware (NMHW) is a promising solution for these scenarios [2, 14, 34, 46, 59]. In particular, there were several recent breakthroughs in analog in-memory computing neuromorphic hardware systems [3, 29, 52]. They utilize analog memristive devices [15, 47] arranged in a crossbar configuration, enabling the execution of matrix-vector multiplication (MVM) \u2013 the central operation in deep learning \u2013 in constant time, showcasing remarkable performance and efficiency. However, the limited precision of NMHW, attributed to device and circuit non-idealities, necessitates the adoption of hardwareaware training routines [38], chip-in-the-loop fine-tuning approaches [9, 36, 52], or the integration of accurate hardware models during training. Moreover, edge applications often demand online adaptation, yet neuromorphic hardware systems are typically tailored towards inference applications where no or only very little adaptation is needed, as these adaptations can compromise the high energy efficiency. To equip neural networks with rapid learning capabilities, requiring only few adaptation steps, that are also robust . Preprint under review. Do not distribute. 1 arXiv:2405.05141v1 [cs.NE] 22 Apr 2024 \fto hardware non-idealities, we investigate in this article the applicability of \u201clearning-to-learn\u201d (L2L; also known as meta-learning) [4, 21, 48, 49, 53] to neuromorphic hardware based on phase-change memory (PCM) devices [25]. In L2L, neural networks are first optimized to become good learners for a family of related tasks in a meta-training phase and in a subsequent adaptation phase tuned for a particular task, leveraging prior acquired knowledge. In contrast to standard learning approaches, where the neural network becomes specialized for one particular task, L2L through its two phases can enable rapid adaptation to a concrete task of the application that is a member of a larger family of tasks. The initial meta-training phase can be done off-chip with arbitrarily complex learning algorithms and large data sets, while in the concrete application, the meta-trained system can be adapted using only few updates, making it especially beneficial for edge computing utilizing neuromorphic hardware. Learning-to-learn has been widely studied in the field of machine learning (ML) [7, 18, 35, 39, 40, 42]. However, although L2L has been proposed as an efficient way to enable rapid learning in neuromorphic systems [14], only few studies in this direction have been carried out so far [8, 57]. Bohnstingl et al. [8] evaluated a L2L approach using a single layer spiking neural network on basic Markov decision processes and a bandit task. Wu et al. [57] proposed a hybrid learning approach where parameters of local plasticity rules are meta-learned and combined with global plasticity. They implemented their model on the Tianjic neuromorphic platform [17]. Studies where L2L was applied to simulated memristor models are described in [58, 60]. To the best of our knowledge, no application of L2L to memristor-based in-memory neuromorphic hardware has been reported so far. To demonstrate the versatility of our approach we evaluated two L2L methods in two types of neural network models using the PCM-based in-memory computing neuromorphic hardware introduced in [25]. First, we applied model-agnostic meta-learning (MAML) [18], a L2L algorithm that optimizes initial weights of a neural network to enable few-shot adaptation of the network with a small number of gradient updates, to a convolutional neural network (CNN) for fewshot image classification. Since this algorithm necessitates extensive meta-training, we perform the meta-training phase in simulations and transfer the resulting weight values to the memristive crossbar. The adaptation phase is then performed directly on the neuromorphic hardware. Evaluations on the Omniglot dataset [27] showed that this approach leads to excellent classification performance, on par with pure software solutions, despite the fact that synapses are realized with low-precision PCM devices. Interestingly, our results also show that meta-training is quite robust with respect to the software model of the hardware. In particular, we found that expensive and slow hardware-in-the-loop training is not necessary, and even a relatively crude software approximation of the hardware achieved good results, alleviating the need for accurate hardware models. To complement the ML scenario, in the second application we considered a recurrent spiking neural network (SNN). Recurrent SNNs are of particular interest since spike-based communication is highly energy efficient, and therefore a promising alternative to the energy demanding contemporary AI solutions [16, 56]. One fundamental problem in the application of recurrent neural networks in edge applications is that standard gradient-based learning algorithms, such as error back-propagation through time (BPTT), are not wellsuited as they cannot simultaneously process and learn from incoming data streams. To address these issues, the research community has developed online learning alternatives to BPTT [5, 10], that equip neural networks with this capability. Therefore, in this work we pair L2L with an online learning algorithm, e-prop [44], to build an energy-efficient system utilizing PCM-based neuromorphic hardware, that can rapidly adapt to new tasks online. In this algorithm, a teacher SNN, the Learning signal generator (LSG), generates learning signals that are used to update the weights of a second SNN called the trainee. In the meta-training phase, the initial weights of the trainee as well as the weights of the LSG are optimized. Then the initial weights of the trainee are ported to the neuromorphic hardware and a single update is performed to adapt the trainee to the current task. We used this setup to enable the SNN to learn to generate motor commands for a robotic arm to produce a target trajectory from a single exposure as proposed in [5, 44]. In addition to simulations and experiments with the neuromorphic hardware, we also tested the model with a real robotic setup. Underpinning our findings of the first task, we found that meta-training can be performed in full-precision software, without the need of detailed hardware models, and that the single update on the neuromorphic hardware allows the robot to accurately track the target trajectory. 2 Results 2.1 Learning-to-learn and neuromorphic hardware Learning-to-learn is a technique that aims to generalize the learning processes across multiple related tasks from a distribution of tasks, often termed the task \u201cfamily\u201d. It is based on the observation that in humans and animals, learning generally is not centered solely around acquiring knowledge or skills for a specific task, but rather on the development of strategies that enable learning new skills both more effectively and efficiently in the future [1, 21, 54]. Therefore, meta-learning aims to consolidate previously gained experience from different tasks to enable more rapid learning of new tasks requiring minimal new data. In contrast to other approaches such as standard supervised learning, meta-learning is defined by two levels of optimization, an \u201cinner loop\u201d and an \u201couter loop\u201d, see Fig. 1a and Fig. 1b: Inner loop (task-specific learning): This part of the meta-learning procedure, illustrated in the gray box of Fig. 1a, is responsible for learning a specific task. While relying on previous experience from other related tasks, the model in the inner loop learns the current task with access to a limited set of training examples. The goal is to improve task-specific performance via fast adaptation of the model parameters \u03b8 through n updates. Outer loop: In the outer loop, indicated by the outer black arrow in Fig. 1a, the model learns across multiple tasks with the goal of identifying common sub-structures and potential differences between them. This is done by adapting the meta-parameters and implicit learning strategies based on the models output and the task performance observed 2 \fFig. 1: Overview of learning-to-learn with neuromorphic hardware. a The general structure of meta-learning approaches used in this article. The inner loop learning is indicated by the gray box. The input to the inner loop is an initial parameter setting \u03b8 and task inputs from a task Ti. Based on these data points, a neural network model is updated n times. In our settings, these updates were performed on a subset of the model parameters \u03b8. The outer loop chooses in every iteration a new task Ti from the task family F(T ), runs the inner loop, and updates the initial parameters \u03b8 based on the errors in the inner loop. The goal is to find initial parameters \u03b8 such that a few inner loop updates lead to good results on any task from F(T ). b Unrolled meta-learning procedure that highlights the differences between task-specific adaptation of weights in the inner loop and the meta-parameters in the outer loop. c Schematic depiction of a phase-change memory device and its inner working. Information is stored in the phase configuration of the material and electrical pulses can be used to switch between the amorphous and the crystalline phase. d The employed neuromorphic hardware comprises a crossbar array structure where at each intersection four PCM devices (4R) and eight control transistors (8T) are located. Two PCM devices represent positive weights, bitline positive (BL+), and two represent the negative weights, bitline negative (BL\u2212). The weights of a neural network are then mapped onto the crossbar structure and network inputs are provided to the positive devices using (WL+) and to the negative devices using (WL\u2212). during the inner loop. Thus, instead of optimizing the performance for an individual task, the goal of the outer loop is to improve the ability of the model to adapt to new tasks more effectively and efficiently. We refer to the optimization of the meta-parameters through m iterations of the outer loop as meta-training or the meta-training phase. Note that this involves the inner loop as a sub-procedure within each outer loop iteration. After meta-training, the model is tested on a set of test-tasks from the task family. Here, only the inner loop is applied to adapt the model to each individual task. We refer to this phase as the adaptation phase. Different meta-learning methods have been developed and they can broadly be classified into model-based methods, initialization-based methods, and parameter-generationbased methods. Model-based methods include memory-augmented model architectures or external memory modules that are inherently well-suited for learning from a limited amount of data. Memory-augmented neural networks [42] use a differentiable external memory module to store and fetch information from a small number of previously seen examples enabling rapid adaptation to new tasks. Initialization-based methods are centered around the idea that there exists a learnable initialization of the model parameters that allows fast adaptation to new, unseen tasks. Model-agnostic meta-learning [18] is a method aiming to 3 \ffind initial model parameters that can be efficiently updated with a small number of gradient steps on new tasks. Parameter-generation-based methods train networks that generate and predict parameters for a trainee network, enabling adaptation to new, unseen tasks. This can be facilitated in two ways: Either the parameters are generated directly and fed into the trainee network [7] or indirectly by learning an optimizer that can then change the trainee network\u2019s parameters [39, 40]. In this work, we apply L2L techniques to an in-memory computing neuromorphic hardware, utilizing PCM devices. Phase-change materials belong to a class of materials that allow to store information in their phase configuration. When electrical pulses are applied to the cells, they can gradually transition from an amorphous phase to a crystalline phase, or rapidly back from the crystalline phase to the amorphous phase, illustrated in Fig. 1c. The neuromorphic platform we used in this work comprises of two computational cores. Each core contains a crossbar array structure of size 256 \u00d7 256, where at each intersection 4 PCM devices (4R) and eight control transistors (8T) are located. The weights of the various neural networks used in this work are mapped onto this crossbar structure as illustrated in Fig. 1d. More details about the hardware can be found in Section 4.1. In particular, we investigated two different L2L methods applied to two different tasks to demonstrate rapid learning in PCM-based NMHW. In the first approach, we applied the initialization-based approach MAML to meta-train the weights of a convolutional neural network that could then be easily adapted to new tasks from the same domain. In the second approach we utilized a parameter-generation-based method, which enabled a biologically-inspired spiking neural network to generate motor commands that produce a target trajectory using only a single adaption step. 2.2 Few-shot image classification with PCM-based neuromorphic hardware We first investigated whether L2L could be utilized to enable few-shot image classification in a PCM-based NMHW. To this end, we utilized model-agnostic meta-learning and tested the system on the Omniglot dataset [27]. As an initializationbased L2L algorithm, the central idea behind MAML is to determine initial model weights such that they can be adapted to a new task using only a small number of weight updates. This approach is \u201cmodel-agnostic\u201d insofar as it can be used for any model that can be trained with gradientbased algorithms. As described in Section 2.1, the training is carried out in two nested loops: the outer loop and the inner loop, see Fig. 2a. In the inner loop (gray box in Fig. 2a), the initial model parameters \u03b80, obtained form the outer loop, are updated for a specific task Ti, sampled from the task family F(T ). We denote the model parameters optimized by the outer loop with \u03b8 def = \u03b80. Further, we denote the parameters after the j-th inner loop update with \u03b8j and the output of the model with parameters \u03b8j as f\u03b8j. For each new task Ti, we have Ndata data points DTi = \b x(d), y(d)\t with network inputs x(d) and corresponding targets y(d). The adaptation process involves computing the task-specific updated parameters \u03b8j+1, using gradient descent on the loss LTi(f\u03b8j), which compares the model output f\u03b8j to the targets y(d). The inner loop update for a single step can Input: F(T ): Family of tasks Input: \u03b1, \u03b2: learning rates Input: n: number of inner loop gradient steps Randomly initialize \u03b8; while Meta-Training do Sample Ntasks tasks Ti \u223cF(T ); foreach Ti do Sample Ndata data points DTi = \b x(d), y(d)\t from Ti; for j from 0 to n \u22121 do Evaluate \u2207\u03b8jLTi(f\u03b8j) using DTi and the cross-entropy loss LTi; Compute adapted parameters: \u03b8j+1 \u2190\u03b8j \u2212\u03b1\u2207\u03b8jLTi(f\u03b8j); end Evaluate data points D\u2032 Ti = \b x(d), y(d)\t from Ti using \u03b8n for the outer loop update. end Update \u03b8 \u2190\u03b8 \u2212\u03b2\u2207\u03b8 P i LTi(f\u03b8n) using each D\u2032 Ti; end Algorithm 1: Our model-agnostic meta-learning setup for few-shot classification. For the Omniglot task, the cross-entropy loss function is used. thus be expressed as \u03b8j+1 = \u03b8j \u2212\u03b1\u2207\u03b8jLTi(f\u03b8j), (1) where \u03b1 is the learning rate for the task-specific update. In our setting, this update is repeated n = 4 times in the inner loop. In the outer loop (outer black arrow in Fig. 2a), the initial parameters \u03b8 of the model are then optimized such that learning of new, unseen data D\u2032 Ti from the same tasks Ti in the inner loop is more efficient. Therefore, the meta-training objective can be formally expressed as \u03b8 = arg min \u03b8 X Ti\u223cF(T ) LTi(f\u03b8n), (2) where \u03b8n refers to the parameters after the last inner loop update. Note that \u03b8n depends implicitly on \u03b8. This optimization problem is solved using the ADAM optimizer [26] across unseen tasks sampled from a task distribution F(T ). See Algorithm 1 for a detailed description of the interplay between meta-training and evaluation. Intuitively, this combination of outer and inner loop updates creates a path traversing through the parameter space, which is visually depicted in Fig. 2b. The initial parameters \u03b8 provide a good starting point for all tasks in the task family F(T ), which is then adjusted to the specific task Ti with only four parameter updates leading to \u03b81, followed by \u03b82, \u03b83, and so on until \u03b8n. Further details on the learning algorithm can be found in Section 4.4. The Omniglot dataset [27] employed in this task is one of the most commonly used benchmark datasets for fewshot image classification that was specifically designed for understanding the few-shot learning capabilities of humans. The dataset contains 1 623 grayscale images of handwritten characters originating from 50 different alphabets, with only 4 \fFig. 2: (Caption on next page.) 5 \fFig. 2: Few-shot image classification on Omniglot with MAML. a Illustration of the inner and outer loops in the MAML setup. In the inner loop, a software model was used for meta-training. The evaluation was performed both in software and in neuromorphic hardware. For the inner loop training, we performed four gradient updates. b Schematic depiction of the movement in parameter space during MAML. The initial parameters \u03b8 are optimized in the outer loop (bold trajectory) and the inner loop performs four task-specific adaptation steps (small arrows) such that the model achieves high classification accuracy. c Illustration of the input data from the Omniglot dataset for the 5-way 5-shot classification task on the left and the corresponding ground-truth targets on the right. A typical evolution of the classification performance of the model in the inner loop is illustrated in the middle. d Architecture of the four layer convolutional neural network with a dense layer on top that is employed to solve the classification task. e Schematic depiction of the mapping of the neural network to the NMHW. The convolutional layers are split into two parts and spread across the two crossbar arrays of the NMWH. f Evolution of the loss during outer loop training of a 4 bit (orange) and a 32 bit (blue) model in software. g Classification accuracy of the various models on 100 new unseen tasks. h Classification accuracy of the of the various models during inner loop training. 20 examples per character. We closely followed the experimentation protocol from [18, 51] that describes an N-way classification problem with K shots. Here, K examples of N different classes are provided to the model during a training step with the goal to classify new, unseen examples of the N different classes. In our setup, we performed 5-way 5-shot classification with n = 4 gradient update steps in the inner loop. To illustrate the progress of the inner loop, we show in Fig. 2c the classification of the NMHW-based model after the individual updates. In particular, five new character classes were presented to the network, with five examples for each class in a random order, see Fig. 2c (left). The classification outputs after each of the four gradient updates in the inner loop are illustrated in Fig. 2c (middle): incorrect classifications are marked with red font on white squares and correct classifications with black font on colored squares. One can see that with each gradient update, the classification becomes more accurate. We leveraged a CNN with four convolutional layers and a dense layer at the output, as depicted in Fig. 2d (see Section 4.4 for a detailed network description). We mapped the individual kernels of the convolutional layers and the dense layer onto the crossbar arrays of the NMHW as illustrated in Fig. 2e. The convolutional kernels of the CNN were flattened, then split into two parts and distributed across two chips, see Section 4.2 for further details. Although we mapped the entire CNN onto the NMHW, only the weights of the dense layer were updated in the inner loop. This dramatically simplifies the inner loop, as this approach avoids the need for backpropagation of gradients through the (neuromorphic) network. In particular, the update that has to be performed on the NMHW reduces to a simple delta rule [55]. More precisely, let f\u03b8j,l be the l-th output of the CNN, y(d) l be the corresponding target for the d-th training example (where the class is indicated in standard one-hot encoding), and hk the the k-th output of the max-pooling layer. Then the change of the corresponding weight \u03b8lk from the pooling layer to the output layer is given by \u2206\u03b8lk = \u03b1 \u0010 y(d) l \u2212f\u03b8j,l \u0011 hk. (3) Meta-training typically necessitates a large number of training iterations. In our case, we used 30 000 outer loop iterations, which makes it infeasible to directly use the hardware during this phase. Instead, we carried out the meta-training phase entirely in software and did not consider hardware-aware training or accurate hardware models. To demonstrate that these techniques are indeed not needed with our approach, we also performed outer loop training with a limited weight-precision of 4 bit and later compared the classification accuracies. In particular, we considered two cases: First, we trained a software model with 32 bit floatingpoint weights (\u201c32 bit\u201d setting). This model does not take into account the limited precision of PCM devices in the hardware. Second, we trained a network that employed 4 bit quantized weights with stochastic rounding (\u201c4 bit\u201d setting). This emulates the neuromorphic hardware used in this work, as an effective 4 bit equivalent precision has been demonstrated in previous works [11, 50]. Fig. 2f shows the training and validation loss of the model during meta-training in software. The 32 bit version and the 4 bit version converged rather smoothly, and as expected the final training loss of the 4 bit model with 0.241 \u00b1 0.008 was higher than the loss of the 32 bit model with 0.163 \u00b1 0.008. After meta-training we tested the few-shot learning capabilities of the models on 100 new unseen tasks (each task with 5 classes, i.e., 500 novel classes in total). In software, the achieved classification accuracies for the 32 bit and the 4 bit model were not significantly different, see left two bars in Fig. 2g. In addition to the evaluation of the software models, we also evaluated these models after porting them on the NMHW, as described above. In the inner loop, inference was performed leveraging the crossbar arrays for efficient MVMs, updates for the dense layer were computed, and the corresponding weights were re-programmed on the NMHW. For a detailed investigation of the weight distributions of the NMHW model, see Appendix Fig. 1. Interestingly, the classification accuracies of the 32 bit and the 4 bit models ported onto the hardware were on-par with the software versions (Fig. 2g, right two bars). We can furthermore observe that the accuracy of the model that was trained on full-precision floating point weights in software was on-par with that of the model trained with 4 bit weights. Both results combined indicate that for this task, meta-training of a hardwareaccurate model is not necessary. This is quite advantageous as one does not have to develop an accurate software model of the NMHW for meta-training. As described above, we performed four consecutive updates of the network (each one containing a batch of 25 examples, 5 examples for each of the 5 classes). An analysis of the network performance after each individual update is shown in Fig. 2h. We observe that the classification performance of the NMHW models during the first 6 \fInput: F(T ): family of tasks Input: \u03b1, \u03b2: learning rates Randomly initialize \u03b8, \u03c8; while Meta-Training do Sample Ntasks tasks Ti \u223cF(T ); foreach Ti do Compute trainee output f\u03b8; Compute LSG output Lt; Compute eligibility trace et; Compute updated trainee parameters: \u03b81 \u2190\u03b8 \u2212\u03b1 P t Lt \u2299et; Evaluate task Ti using \u03b81 for the meta update. end Update \u03b8 \u2190\u03b8 \u2212\u03b2\u2207\u03b8 P i LTi(\u03b81, \u03c8); Update \u03c8 \u2190\u03c8 \u2212\u03b2\u2207\u03c8 P i LTi(\u03b81, \u03c8); end Algorithm 2: Natural e-prop for one-shot learning. two updates lacks behind the software models, but after the third and fourth updates, the performance is on-par. One example few-shot learning trial with NMHW (32 bit) is also shown in Fig. 2c. Moreover, in every update only 1 120 PCM devices, the dense layer, of a total of 342 720 PCM devices are updated, see Fig. 2e. Updating parameters stands out as one of the most energy-intensive operations and it could compromise the energy-efficiency of the system \u2013 see Section 4.1. Therefore, this combination of the small number of update steps alongside with the consideration that only few PCM devices are updated in each step, proves particularly beneficial for NMHW. In summary, all our results from the first task showcase that L2L can be effectively applied to NMHW without the need for complex hardware models. Moreover, it enables rapid learning of new tasks using only 4 parameter updates. 2.3 Rapid online learning of robot arm trajectories in biologically-inspired neural networks Biology offers endless inspiration for the design of intelligent computing systems. In fact, the human brain exhibits unrivaled abilities in terms of learning from limited data and rapid adaptation to new tasks. It has been proposed that these capabilities arise from the utilization of prior accumulated knowledge through evolutionary processes and L2L has been used to model such capabilities [53]. In contrast to neurons in conventional artificial neural network models, biological neurons integrate synaptic inputs over time and communicate binary events (\u201cspikes\u201d) to other neurons within recurrent networks. Mathematical models for such neurons, termed spiking neurons, have been developed [19] and spiking neural networks are networks composed of spiking neurons [19, 32]. Therefore, we explored in a second experiment the applicability of L2L to recurrent SNNs with a biology-inspired meta-learning approach leveraging NMHW. In particular, we utilized the biologically plausible learning algorithm natural e-prop [5]. Natural e-prop was designed based on two observations about learning-related synaptic plasticity in the brain. First, molecular processes in synapses store information about local events such as preand post-synaptic activity that is relevant for future synaptic weight updates. These molecular traces are called eligibility traces [20]. Second, specialized brain areas produce learning signals that are communicated to synapses throughout the brain, for example in the form of dopamine release or neuronal firing [41]. In natural e-prop, these learning signals are generated in a dedicated SNN, the learning signal generator. The learning signals are communicated to the trainee, another SNN that adapts its synaptic weights based on these signals and eligibility traces that are computed based on local signals at its synaptic connections. Fig. 3a shows an illustration of the L2L setup with natural e-prop and Fig. 3b shows a more detailed depiction of the LSG and trainee. Further details about the network architecture and the SNN dynamics can be found in Section 4.5. We denote the synaptic weights of the trainee and the LSG with \u03b8 and \u03c8, respectively. One inner loop trial consists of one simulation of the SNNs for T time steps. In each time step t, the output of the LSG gives rise to one learning signal Lt l for each neuron l in the trainee network. In the trainee, each synapse lk from neuron k to neuron l updates its eligibility trace et lk (see Section 4.5 Methods). The eligibility traces are combined with the learning signals to obtain the updated weights \u03b81 lk = \u03b8lk \u2212\u03b1 X t Lt let lk, (4) where \u03b8lk is the initial weight. To simplify the notation, let \u03b8 denote the vector of all synaptic weights in the trainee, and et denote the vector of the corresponding eligibility traces at time t. We define the vector of learning signals Lt, where Lt l is the learning signal corresponding to \u03b8l. Then, we can write \u03b81 = \u03b8 \u2212\u03b1 X t Lt \u2299et, (5) where \u2299denotes the component-wise product of the vectors. After the update, the trainee is run again (without any parameter changes) and its output is used to compute a loss. In each outer loop training iteration, a task Ti \u223cF(T ) is chosen, the inner loop is performed, and the parameters of the LSG as well as the initial weights of the trainee are updated based on the loss of the inner loop. The process of the inner and outer loop learning is illustrated in Fig. 3a, see also Algorithm 2. The meta-training objective is to find the optimal initial parameters \u03b8 for the trainee and the parameters \u03c8 of the LSG that minimize the average loss across several tasks, which can be formally expressed as \u03b8, \u03c8 = arg min \u03b8,\u03c8 X Ti\u223cF(T ) LTi(\u03b81) (6) = arg min \u03b8,\u03c8 X Ti\u223cF(T ) LTi \u03b8 \u2212\u03b1 X t Lt \u2299et ! . (7) Note that the learning signals Lt generated by the LSG depend on the parameters \u03c8, whereas the eligibility trace et arising from the trainee depends on the parameters \u03b8. We performed this optimization using the ADAM optimizer. We tested this setup on the task to learn to generate motor commands for a robotic arm that produce a target trajectory from a single exposure as proposed in [5, 44]. In addition to experiments with the neuromorphic hardware, 7 \fFig. 3: (Caption on next page.) 8 \fFig. 3: Rapid online learning of motor commands with neuromorphic hardware. a Learning-to-learn setup with natural e-prop. The inner loop consists of two phases. Weight updates are based on learning signals Lt and eligibility traces et after the first phase. In the second phase, the produced robot arm trajectory of the updated recurrent SNN is validated against the target trajectory. The resulting error is used for the outer loop update. After meta-training, the software model for the robot is replaced by the real robotic arm (panel c). b Network architecture. The network architecture consists of two components, the learning signal generator and the trainee. The trainee produces the motor commands as well as implicitly the eligibility traces. The learning signal generator produces the learning signals which are combined with the eligibility traces to form the gradient updates in the inner loop. c A schematic depiction of the robotic arm following a target trajectory indicated with a black line. The joints controlled by the trainee are the base joint marked in blue and the shoulder joint marked in orange. d Schematic depiction of the mapping of the input weights \u03b8in and the recurrent weights \u03b8rec onto the crossbar array structure of the NMHW. e Angular velocities and trajectories in the Euclidean space of the meta-trained network in software (blue) and with NMHW (orange) before the inner loop update. f Angular velocities and trajectories in the Euclidean space of the networks after one-shot learning. The green trajectory shows the trajectory of the ED-Scorbot. we also tested the model in a real-world robotic scenario employing the ED-Scorbot robotic arm (see Fig. 3c and Section 4.3 in Methods). In this task, the input to the trainee consisted of a clocklike input signal provided by five input neurons where the neurons were sequentially activated, each for 50 ms. This indicated the approximate temporal position within the 250 ms long target trajectory. The output of the trainee consisted of 2 neurons that encoded the motor commands, i.e., the angular velocities for two of the five joints of the robot, the base joint and the shoulder joint (see Fig. 3b). The input to the LSG was the same clock signal plus the target 3D trajectory in Euclidean coordinates encoded by 53 input neurons. The LSG provided 250 learning signals through its output neurons (see Methods for details). The LSG and the trainee were first executed for 250 ms with these inputs, thus making the target trajectory available to the LSG. Then, the weights of the trainee were updated and the trainee was run for another 250 ms with the same clocklike input signal. The goal was that after this single update, the trainee controlled the robot such that it performed the target trajectory. Note that while the target trajectory was given in Euclidean coordinates, the output of the trainee were angular velocities for joints. Again, meta-training was performed with a software model of the hardware, where we used full-precision floating point weights. In this phase, we also used a simulation model for the robot (see Section 4.3 for details). In the inner loop update and during testing after meta-learning, only the input weights \u03b8in and the recurrent weights \u03b8rec of the trainee network were adapted. These weight matrices were mapped onto a single core of the NMHW after meta-training, see Fig. 3d. Non-plastic weights were kept in software. Fig. 3e shows the network output and the robot trajectory after meta-training but before the one-shot update. The angular velocity commands for both joints are depicted in the first two panels and the executed trajectory in the Euclidean space is depicted in the rightmost panel. The network output of the full-precision model (32 bit) is illustrated in blue, the output of the model employing the NMHW in orange and the target in black. One can see that the angular velocities produced by the models are close to zero and the robot arm hardly moves. This indicates that the network does not have any particular prior for a target trajectory. Fig. 3f shows the behavior of the model after the one-shot update for one example target trajectory. On the left two panels one can see the angular velocity output of the networks. To quantify the agreement between the model outputs and the target angular velocities, we evaluated three additional trajectories, see the Appendix Figures 2, 3 and 4. The rootmean-squared error (RMSE) between the 32 bit model and the target angular velocities for the two joints was (0.0381 \u00b1 0.0070) rad/s and (0.0363 \u00b1 0.0057) rad/s respectively. The RMSE of the NMHW model was (0.1274\u00b10.0811) rad/s and (0.0668 \u00b1 0.0079) rad/s for the two joints respectively. These small differences indicate a good overlap of the produced angular velocities with their corresponding targets, which can also be observed visually. The produced trajectory in the Euclidean space is shown on the right. The green curve represents the trajectory produced by the NMHW model which was then executed by the ED-Scorbot. Similar to the angular velocities, there is a good agreement between the target trajectory and the ones produced by the models as well as by the ED-Scorbot. We measured the RMSE deviation between the target trajectory and the trajectories of the models and computed the mean and standard deviation across the 4 trajectories. The 32 bit model deviated on average by (2.2136 \u00b1 1.1003) cm, the NMHW model by (6.6921 \u00b1 3.3971) cm, and the EDScorbot by (7.8242 \u00b1 2.5005) cm. Although the deviation of the NMHW is larger than the one of the software model, its small value is still remarkable given the large reduction of bit precision of weights in a recurrent SNN. For a detailed investigation of the weight distributions of the NMHW model, see Appendix Fig. 5. In summary, our results from the second task demonstrate that L2L can be combined with online learning and applied to recurrent spiking neural networks with PCMbased synapses on in-memory computing NMHW to rapidly learn the generation of motor commands. Importantly, a single inner loop update step is sufficient to tune the network for a particular target trajectory, which enables efficient realizations with NMHW. 3 Discussion In this work we demonstrated rapid learning on a PCMbased in-memory computing platform through the concept of L2L. As a result, the neuromorphic hardware can not just address a single task, but rather quickly adapt to and solve any instance from a family of related tasks. We showcased its versatility using two different network architectures and tasks. Firstly, we trained a convolutional neural network with MAML to solve few-shot image classification on the Omniglot dataset. MAML enables the optimization of initial model 9 \fweights such that a new task can be learned with a small number of online weight updates which makes it particularly appealing for usage on neuromorphic hardware. Moreover, we adapted MAML to further reduce the number of required weight updates by only adjusting the weights of the dense layer. Thus, the weight-update on the NMHW reduces to a simple delta learning rule and only a small number of PCM devices are updated. We have found that the softwaretrained models ported onto the neuromorphic hardware performed on par with evaluations done solely in software which highlights that accurate hardware models are not necessary in this task. Furthermore, MAML can in principle be applied to any model that is trainable with gradient-based optimization. However, the standard methods like BPTT are problematic in the neuromorphic context as they cannot be implemented efficiently on hardware. By training only the weights of the dense layer in the inner loop, we avoided this issue as no backpropagation of errors is necessary in this case. An interesting alternative would be to consider MAML in combination with hardware-friendly learning algorithms such as e-prop [6], OSTL [10] or OSTTP [36] in the inner loop. Especially variations of OSTL or OSTTP may prove beneficial, as they allow to train multi-layered networks in a fully forward manner, avoiding update locking problems of BPTT that would otherwise hinder the efficient training of the convolutional neural network. With these algorithms, the full potential of the NMHW can be leveraged. From the biological perspective, the meta-training can be interpreted as an evolutionary process that shapes neural circuits of the brain to become efficient learners for behaviorally relevant tasks [53]. It was proposed in [53] that biological learning may rely on three loops: A loop on the time scale of evolutionary processes, a loop on the time scale of the lifetime of the animal, and a fast loop for learning individual tasks. We did not consider the second loop explicitly. In principle, our outer loop could subsume both, the second loop and the first evolutionary loop. Nevertheless, it would be interesting to model a secondary loop explicitly where in particular unsupervised learning could play a prominent role. In our second task, we explored the biological perspective in greater detail and trained a spiking neural network to produce motor commands to control a robotic arm. In particular, we used natural e-prop to mimic the brain\u2019s ability to quickly adapt to new tasks. By co-training a learning signal generator that generates the updates for the synaptic weights of the trainee network, a new target trajectory for robotic arm can be learned with just a single weight update. Similarly to the Omniglot few-shot image classification in our first task, the meta-training was carried out in software without a precise model of the hardware. Before the adaptation phase for evaluation, the trainee network weights were transferred onto the neuromorphic hardware and weight updates were performed on the NMHW. The trajectories generated by the network executed on the neuromorphic chip closely matched the trajectories of the high-precision software model both with the simulation and the real robot. Spiking neural networks have complex dynamics compared to feed-forward networks, such as CNNs. Therefore, it is more surprising than in the first task that the inaccuracies of the low-precision analog PCM weights only weakly influenced network performance. It is possible that the learning-to-learn procedure resulted in a robust network that is less prone to variations of the NMHW. However, more analysis would be needed to draw reliable conclusions. In addition to the initialization-based L2L method investigated in the first task and the parameter-generation-based L2L method of the second task, another interesting direction for future research emerges from the model-based L2L methods. In recent years, memory-augmented neural networks have gained traction in the ML community [42, 43] as well as in the SNN community [31]. One of their main advantages compared to other neural networks is the ability to explicitly store information or associations in an external memory and retrieve it at a later time. One can envision that not solely task-specific information is stored in this memory, but rather information that is important for a family of related tasks, which then gets optimized through L2L. In-memory computing architectures based on PCM devices, such as the one that we employed in our work, are well-suited to represent the external memory [23, 24, 33], and hence would present a good candidate for model-based L2L with NMHW. To conclude, our consistent findings across two tasks demonstrate that L2L can enable PCM-based neuromorphic hardware to rapidly adjust to new tasks with only very few training examples and update steps. This is especially striking in the case of the motor command generation, as there is only a single update involved, which leads to a very light computational load. Notably, our findings underline the robustness of both learning-to-learn frameworks when considering hardware variability, revealing that direct, timeintensive hardware-in-the-loop training, or accurate models of the hardware, can be substituted with simple software approximations without sacrificing performance. Moreover, the capabilities of NMHW and in particular the matrix sizes that they can represent have recently increased significantly [29]. This allows larger and more complex network architectures to be mapped and further boosts the application ranges of L2L on NMHW. Therefore, this work lays the foundation for a promising direction for efficient neural network training on neuromorphic hardware, emphasizing the viability of simulation-based meta-training followed by few on-chip parameter updates. 4 Methods 4.1 Neuromorphic Hardware In conventional computing architectures, also referred to as von Neumann architectures, the memory and processing units are separate, necessitating frequent data transfers between them which leads to latency and energy inefficiencies. In contrast, in this work we employ an analog in-memory neuromorphic hardware. This NMHW is, inspired by the human brain and integrates computation and storage in the same physical location, thus constituting an example of a non-von Neumann computing architecture. More specifically, the employed NMHW leverages the analog properties of memristive devices, such as PCM and resistive random-access memory, to encode information, such as the weights of a neural network, in their conductance. When these devices are arranged in a crossbar topology, matrix-vector multiplication can be carried out by encoding the matrix elements in the conductance of the devices and the vector elements in voltage stimuli, applied on the rows of the array. According to Ohm\u2019s and Kirchhoff\u2019s laws, the 10 \finduced currents on the columns of the array are proportional to the result of the matrix-vector multiplication. This type of computation is highly efficient as it eliminates the need to transfer the matrix elements, it is highly parallelizable, and it takes place in the analog domain. Given the prevalence of matrix multiplications in the majority of contemporary AI workloads, analog in-memory computing emerges as a promising candidate for an efficient AI hardware platform. In our experiments, we utilize the NMHW platform described in [25]. This platform consists of two PCM-based cores, each featuring a 256 \u00d7 256 crossbar array. Each unit cell adopts a 4R8T differential configuration, employing two devices to represent positive weights (BL+) and two devices for negative weights (BL\u2212), for a total of 262 144 devices per core. Furthermore, each core incorporates 256 digital-toanalog converters responsible to provide input stimuli to the array employing signed 8 bit pulse-width modulation. In particular, two distinct input lines are used to provide inputs to the devices representing positive (WL+) and negative (WL\u2212) weights, enabling multi-phase MVM operations. In this work, we utilize 4-phase MVM operation, applying only just one sign of inputs to one sign of weights per-phase, for increased precision [29]. Finally, 256 analog-to-digital converters are employed to digitize the induced current, alongside a local digital processing unit tasked with performing affine correction post-digitization and converting the output to its 8 bit representation. Each core of the platform operates independently, controlled by an on-board field-programmable gate array (FPGA) module, and is abstracted as an 8 bit IN/8 bit OUT MVM unit for the purposes of this work. The PCM devices are of mushroom-type and have doped Ge2Sb2Te5 as the phase-change material. The conductance of the PCM device is tuned by changing the relative volume of the material in the crystalline and amorphous phases, which correspondingly exhibit high and low conductance. This modulation is achieved through the application of specialized electrical stimuli during the programming phase. Given the highly stochastic nature of this process, an iterative read-write verify algorithm is employed to fine-tune the conductance of the devices. Note that we use two devices to encode a weight, selecting the pair that corresponds to its sign, while the remaining two devices are maintained in a highly resistive RESET state to prevent any current flow. The details of our programming algorithm are elaborated upon in [50]. Additionally, post-programming, the PCM devices are subject to temporal conductance drift. To address this, we implement an affine correction for each column within the local digital processing unit of the core [29]. 4.2 Deploying models on the Neuromorphic Hardware The deployment of neural networks on our platform is facilitated by an automated software stack, which leverages PyTorch model definitions and its runtime. This stack treats the platform outlined in Section 4.1 as two distinct 8 bit IN/8 bit OUT MVM units, and allocates all MVM operations to them, while performing all other operations on the host machine. The deployment flow followed by the stack is described in the following. Initially, the model is parsed to identify all layers containing MVM operations. Subsequently, these layers are assigned to the two cores and mapped to distinct regions on their crossbars. For linear layers, the mapping process is straightforward, as we place the weight arrays without additional processing in the crossbars. In the case of convolutional layers, we adopt the im2col strategy, where the filters are flattened into a single weight array, and the patches of the input feature maps are transformed per the im2col scheme [13]. In both cases, if the resulting weight array exceeds the size of the crossbar in any dimension, the software stack fragments it into segments that fit within the array (see Fig. 2e). During inference, the stack combines the partial results from the fragmented arrays accordingly. Following this, the software stack conducts various post-training hardware-related calibration steps to ensure maximum MVM precision [28], and programs all weight arrays onto the two cores. Finally, the stack utilizes the PyTorch runtime to execute each MVM-containing module on the neuromorphic hardware. Modifications to the PyTorch runtime have been implemented to enable parallel execution of layers across the two cores in a pipelined fashion, when permissible by the mapping. 4.3 The ED-Scorbot robotic arm The ED-Scorbot platform [12] is derived from a modified Scorbot ER-VII commercial robot, and it operates on an event-driven neuromorphic system. These modifications enable the robot to be controlled using spike-based motor controllers. The ED-Scorbot is equipped with six degreesof-freedom (DoF), which are generally referred to as joints. Each joint is capable of rotating using a DC motor. This motor is equipped with a dual optical encoder, which is utilized to accurately determine the present location of the joint. The previous control circuitry of the Scorbot ER-VII was replaced by a Zynq-7100 FPGA board [37], optocoupled logic for electromagnetic isolation from the motors, and a new 12 volts power supply. This new controller setup on the ED-Scorbot implements six spike-based proportionalintegrative-derivative (SPID) controllers [22]. The reference given to the SPID as input can be provided as a digital signal that represents the target position of the respective joint. The main advantage of controlling the robot with spikebased controllers compared to a classic digital controller, is the reduced power consumption and the lower latency [12]. When approaching the target position, the SPID controller will produce less activity the closer the joint is to its commanded position. Ideally, a joint that has reached its desired position will make the SPID controller not fire any spike, until the commanded position is changed. For the 3D control of the robotic arm, we used the two first joints of the robot (base and shoulder), while all other joints were fixed. Trajectories to be executed by the robot or the robot model were provided by the trainee SNN in the form of angular velocities for the two controlled joints of the robot. These velocities were converted to instantaneous angles for each joint at a time step of the SNN (the time step was 1 ms). For outer loop training, 3D robot arm trajectories were executed in Python via the forward kinematics model described below (eqs. (8)-(10)). To speed up training, the commanded angular velocities and corresponding instantaneous angles were immediately applied to each joint, i.e. each joint instantaneously reached its commanded position 11 \fJoint \u03b8i di[cm] ai[cm] \u03b1i 1 \u221223.6\u03c0 180 35.85 5.0 \u03c0/2 2 22\u03c0 180 \u22129.8 30 \u03c0 3 22.4\u03c0 180 6.5 35 0 4 0 0 22 0 Table 1: Denavit-Hartenberg parameters of the ED-Scorbot at each time step. This trajectory was then used to calculate the loss function for the outer loop updates. For evaluation after outer loop training, both the simulated model and the real robot arm were used. For the simulated robot, the calculated angles were converted to Euclidean coordinates of the end-effector via the forward kinematics model. At each SNN time step, the coordinates were recorded and used for evaluation. The mean-squarederror between the target trajectory and the commanded trajectory in Euclidean space was used to evaluate the performance of the SNN. For evaluation on the physical robot, the calculated joint angles were converted to spike-reference values and commanded to the robot. These target joint angles for each SNN time step were applied for 250 ms in order to allow the robot to reach the position. This means that the trajectory which lasted 250 ms in the time-scale of the SNN (250 time steps, each 1 ms), lasted approximately one minute in real-time when executed on the physical robot. The measured positions of the robot joints were recorded at every time step and used to compute the Euclidean coordinates of the tip of the arm, employing the forward kinematics of the robot. Again, the mean-squared-error between the target trajectory and the commanded trajectory in Euclidean space was used to evaluate the performance of the SNN. The formulation for the forward kinematics of the EDScorbot robotic arm based on the Denavit-Hartenberg (D-H) matrix is given by x = a1c(\u03b81) + a2c(\u03b81\u03b82) \u2212a3s(\u03b82\u03b83)c(\u03b81) + a3c(\u03b81\u03b82\u03b83) + a4(\u2212s(\u03b82\u03b83)c(\u03b81) + c(\u03b81\u03b82\u03b83))c(\u03b84) \u2212d2s(\u03b81) + a4(\u2212s(\u03b82)c(\u03b81\u03b83) \u2212s(\u03b83)c(\u03b81\u03b82))s(\u03b84) \u2212d3s(\u03b81), (8) y = a1s(\u03b81) + a2c(\u03b81\u03b82) \u2212a3s(\u03b81\u03b82\u03b83) + a3s(\u03b81)c(\u03b82\u03b83) + a4(\u2212s(\u03b81\u03b82\u03b83) + s(\u03b81)c(\u03b82\u03b83))c(\u03b84) + d2c(\u03b81) + a4(\u2212s(\u03b81\u03b82)c(\u03b83) \u2212s(\u03b81\u03b83)c(\u03b82))c(\u03b84) + d3c(\u03b81), (9) z = \u2212a2s(\u03b82) \u2212a3s(\u03b82)c(\u03b83) \u2212a3s(\u03b83)c(\u03b82) + a4(s(\u03b82\u03b83) \u2212c(\u03b82\u03b83))s(\u03b84) + a4(\u2212s(\u03b82)c(\u03b83) \u2212s(\u03b83)c(\u03b82))c(\u03b84) + d1, (10) where for the sake of clarity and brevity, we represent cos and sin functions with the letters c and s respectively, and multiplications of cosine and sine functions are expressed as in this example: cos(\u03b81) cos(\u03b82) = c(\u03b81\u03b82). Table 1 shows D-H parameters for our setup. 4.4 Few-shot image classification Following the architecture of [18], we used a convolutional neural network with four blocks consisting of convolutional layers with 3 \u00d7 3 convolutions and a stride of 2, followed by a ReLU non-linearity and a batch normalization. The output of these four blocks was passed into a max-pooling-layer followed by a dense output layer with a softmax activation. Compared to [18], the four convolutional layers have been reduced from 64 filters to 56 filters in order to fit the network onto the NMHW described in 4.1, see Fig. 2d for an illustration of the network configuration. The network was trained using the cross-entropy loss. The meta-training was performed for 30 000 iterations with a batch size of 40 and learning rate \u03b2 = 0.001, while the inner loop performed n = 4 gradient update steps with learning rate \u03b1 = 0.1. After meta-training, the models were evaluated for 100 tasks. Note that during inner loop training, as well as during the evaluation, only the weights of the dense layer were adapted. 4.5 One-shot learning via natural e-prop In natural e-prop, a learning signal generator SNN and a trainee SNN operate jointly. While the trainee produces the functional output, the LSG produces learning signals that are employed to form the weight updates of the trainee. During the meta-training phase, the LSG and trainee network are jointly trained on a family of tasks. During this phase, the weights of the LSG initial weights of the trainee are trained using BPTT. In the inner loop, only the weights of the trainee network are adapted utilizing the learning signals emitted by the LSG and the eligibility traces of the trainee. We considered SNNs for both, the LSG and for the trainee network. The trainee was composed of 250 leaky integrateand-fire (LIF) neurons, followed by a linear readout layer. It received a clock-like signal that was the same across all trials. The goal of the trainee was to produce motor commands in terms of angular velocities \u03a6t such that the produced trajectory \u02c6 yt by the robotic arm matches the target trajectory yt. See Fig. 3a and Fig. 3b for an overview. The LSG was composed of a mix of LIF and adaptive leaky integrate-andfire (ALIF) neurons, received the same clock-like signal as the trainee and additionally, the target trajectory yt. It consisted of 800 neurons in total where 30% of the population were ALIF neurons. In contrast to the trainee, the task of the LSG was to produce suitable learning signals, so that after a single update of the weights of the trainee, the could follow the target trajectory. Both SNNs were simulated in discrete time with a resolution of 1 ms and synaptic delays were fixed to 1 ms. For the LIF neurons, the membrane voltage vt j and the presence of output spikes (zt j = 1) evolved according to vt+1 j = \u03b3vt j + X i\u0338=j \u03b8rec ji zt i + X i \u03b8in jixt i \u2212zt jvth (11) zt j = H \u0012vt j \u2212vth vth \u0013 , (12) where xt i = 1 indicates an input spike from neuron i at time t, vth is the spike threshold, \u03b8rec ji and \u03b8in ji are the weights for recurrent and input neurons between neuron i and neuron j, respectively. The membrane decay factor \u03b3 is defined by exp(\u2212\u03b4t \u03c4m ), where \u03b4t is the simulation time step and \u03c4m is the membrane time constant. The neuronal reset was realized using the term \u2212zt jvth. The Heaviside step function H is defined as H(x) = 1x\u22650 and is not differentiable. This can be resolved by using a pseudo-derivative given by ht j = \u03bb max \u0010 0, 1 \u2212 \f \f \f vt j\u2212vth vth \f \f \f \u0011 , where \u03bb is a dampening factor that controls the slope of the pseudo-derivative. The eligibility traces of LIF neurons can be written as 12 \fet+1 ji = ht j P t\u2032\u2264t \u03b3t\u2212t\u2032zt\u2032 i which corresponds to a low-pass filtered version of the pre-synaptic spikes. Thus, the weight updates for the recurrent weights and input weights can be formulated as \u2206\u03b8rec ji = \u2212\u03b1 X t Lt jht j X t\u2032\u2264t \u03b3t\u2212t\u2032zt\u2032 i (13) \u2206\u03b8in ji = \u2212\u03b1 X t Lt jht j X t\u2032\u2264t \u03b3t\u2212t\u2032xt\u2032 i , (14) where the learning signal Lt j is given by Lt j = \u03b1eLt\u22121 j + X i \u03c8out ji \u03bet i. (15) Here, the constant \u03b1e denotes the learning signal decay rate, \u03c8ji refers to the output weights and \u03bet i is the output of neuron i of the learning signal generator. The learning signal can be interpreted as a low-pass filtered version of the learning signal generator output. For the ALIF neurons, the evolution of the membrane voltage vt j is equivalent to the LIF neurons as described above, but the threshold At j is adaptive and evolves according to At j = vth + \u03b2at j, (16) where vth is the baseline threshold, \u03b2 is the threshold increase constant and at j is the threshold adaptation given by at+1 j = \u03c1at j + H \u0012vt j \u2212At j vth \u0013 , (17) with the decay factor \u03c1 = exp(\u2212\u03b4t \u03c4a ), the discrete time step \u03b4t = 1 ms and the adaptation time constant \u03c4a. The weight update above describes the inner loop update of the meta-learning procedure. For the outer loop, the initial weights of both the trainee and the learning signal generator were optimized via backpropagation through time. The loss function for the outer loop is given by LTi = X t \u00121 2 \u0000\u02c6 yt test \u2212yt test \u00012 + 1 2 \u0010 \u02c6 \u03a6t test \u2212\u03a6t test \u00112\u0013 + Lreg (18) Lreg = \u03f5 X j \u03b4t T X t zt j ! \u2212ftarget !2 , (19) where \u02c6 yt test, yt test, \u02c6 \u03a6t test and \u03a6t test refer to trajectories and angular velocities at test time after a single weight update of the trainee. The additional loss term Lreg implements a firing rate regularization [5] with target firing rates of ftarget = 10 Hz (20 Hz) with regularization coefficients of \u03f5 = 0.25. T denotes the duration of a single trial. This optimization problem was solved with the ADAM optimizer, across tasks sampled from a task distribution F(T ). See Algorithm 2 for a detailed description of the interplay between the meta-training and the inner loop updates. The model was trained for 100 000 iterations with mini-batches of 90 trajectories. The Adam optimizer used a learning rate of 0.0015 with a learning rate decay factor of 0.99 after 500 training iterations and a inner loop learning rate of 0.0001. The membrane time constant of 20 ms, a refractory time of 5 ms, a dampening factor of 0.3, a threshold increase \u03b2 of 1.6 and an adaptation time constant of 600 ms were used for both the the LSG and trainee neurons. A threshold voltage vth of 1.3 (0.6) was used for the LSG (trainee) network. The clock-like input signal was realized using 5 input neurons that fired with 100 Hz for 50 ms each one after another in a sequence for a total of 250 ms. The target angular velocities of the robot arm were generated using a Wiener process Wt where W0 = 0 and Wt\u2212u \u2212Wt \u223cN(0, u) at time t with a variance u of 0.09. The realization of the Wiener process was then smoothed using a Hann window w(n) w(n) = 1 2 \u22121 2 cos \u0012 2\u03c0n M \u22121 \u0013 (20) with a length of M = 120 steps via a convolution (W \u2217w)[t]. In addition, safeguards were introduced that prevented the robot arm from performing trajectories that could cause damage to the robotic platform. Based on the forward kinematics model described above in Section 4.3 the positions of the end-effector were computed in Euclidean coordinates and passed to the LSG. To convert the Euclidean coordinates into a series of spike trains, the following procedure was carried out: Each dimension of the Euclidean space was discretized into 16 regions. Each region was represented by the activity of a single neuron with a firing rate of 100 Hz. Therefore three neurons were active at any given moment encoding the position of the end-effector. The use of the NMHW in this task was as follows. After meta-training, the input weights \u03b8in and the recurrent weights \u03b8rec of the trainee network were were mapped onto a single core of the NMHW after meta-training, see Fig. 3d. Non-plastic weights were kept in software. For testing, the hardware was then used to compute all MVMs needed to execute the trainee SNN. After the presentation of the target trajectory in the first 250 ms, weight updates were computed and the corresponding PCM devices on the hardware were updated. Then, the trainee was again executed for 250 ms with the clock input using the NMHW for the MVMs. Acknowledgments. This work was funded in part by the CHIST-ERA grant CHIST-ERA-18-ACAI-004, by the Austrian Science Fund (FWF) [10.55776/I4670N], by grant PCI2019-111841-2 funded by MCIN/AEI/ 10.13039/501100011033, by SNSF under the project number 20CH21 186999 / 1 and by the European Union. For the purpose of open access, the author has applied a CC BY public copyright licence to any Author Accepted Manuscript version arising from this submission. This work was supported by NSF EFRI grant #2318152. E. P.-F. work was supported by a \u201cFormaci\u00b4 on de Profesorado Universitario\u201d Scholarship, with reference number FPU19/04597 from the Spanish Ministry of Education, Culture and Sports. Furthermore, we thank the In-Memory Computing team at IBM for their technical support with the PCM-based NMHW as well as the IBM Research AI Hardware Center. Moreover, we thank Joris Gentinetta for his help with the setup for the robotic arm experiments. 13"
17
+ }
abs_9K/validation_abstract_short_2405.05145v1.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "url": "http://arxiv.org/abs/2405.05145v1",
3
+ "title": "Conformal Semantic Image Segmentation: Post-hoc Quantification of Predictive Uncertainty",
4
+ "abstract": "We propose a post-hoc, computationally lightweight method to quantify\npredictive uncertainty in semantic image segmentation. Our approach uses\nconformal prediction to generate statistically valid prediction sets that are\nguaranteed to include the ground-truth segmentation mask at a predefined\nconfidence level. We introduce a novel visualization technique of conformalized\npredictions based on heatmaps, and provide metrics to assess their empirical\nvalidity. We demonstrate the effectiveness of our approach on well-known\nbenchmark datasets and image segmentation prediction models, and conclude with\npractical insights.",
5
+ "authors": "Luca Mossina, Joseba Dalmau, L\u00e9o and\u00e9ol",
6
+ "published": "2024-04-16",
7
+ "updated": "2024-04-16",
8
+ "primary_cat": "cs.CV",
9
+ "cats": [
10
+ "cs.CV",
11
+ "cs.LG"
12
+ ],
13
+ "label": "Original Paper",
14
+ "paper_cat": "Semantic AND Segmentation AND Image",
15
+ "gt": "We propose a post-hoc, computationally lightweight method to quantify\npredictive uncertainty in semantic image segmentation. Our approach uses\nconformal prediction to generate statistically valid prediction sets that are\nguaranteed to include the ground-truth segmentation mask at a predefined\nconfidence level. We introduce a novel visualization technique of conformalized\npredictions based on heatmaps, and provide metrics to assess their empirical\nvalidity. We demonstrate the effectiveness of our approach on well-known\nbenchmark datasets and image segmentation prediction models, and conclude with\npractical insights.",
16
+ "main_content": "Introduction Despite the success of Machine Learning (ML) and Deep Learning (DL) models in challenging computer vision tasks such as object detection [12, 49] or image segmentation [43, 51], the complexity of the models makes them akin to black boxes. It is difficult to define and assess their trustworthiness, which hinders their adoption in safety-critical industrial applications [1, 29, 39], and complicates their certification processes [21, 37]. In assessing a models trustworthiness, the lack of rigorous uncertainty estimates for ML predictions can be a major drawback, notably in the case of Semantic Image Segmentation (SIS) [43]. Most segmentation models provide softmax scores (i.e., probabilitylike scores) for every pixel of an input image; at inference, one builds a segmentation mask by taking the class whose score is the highest, pixel-wise. However, softmax scores are known to be overly confident and ill-calibrated [22, 24]; they tend to yield scores very close to one for the maximum softmax value, sometimes even for ambiguous inputs. For this reason, softmax values, even if useful for classification purposes, cannot be directly used as measures of uncertainty. Figure 1. Top: A predicted semantic segmentation mask, overlayed on the input image, for the dataset Cityscapes [18]. Bottom: A varisco uncertainty heatmap, for a user-defined risk \u03b1 = 0.01 and a minimum coverage ratio \u03c4 of 99%; it is defined in Eq. (1) and statistically valid as in Eq. (2) of Conformalized Risk Control (CRC): every pixel is a prediction set that contains the highest scoring label (top-1) but potentially also the second, third, etc., highest scoring labels. Contributions We introduce a method based on Conformal Prediction (CP) [45, 56] to assess the predictive uncertainty of a pre-trained segmentation predictor b f. Our procedure works with any model b f (provided that it outputs softmax scores for each pixel) regardless of its architecture and the distribution of the training data; notably, this covers the case of b f being only accessible via an API or being prohibitively expensive to retrain. Our method quantifies the uncertainty of the predictor b f in the form of segmentation 1 arXiv:2405.05145v1 [cs.CV] 16 Apr 2024 \fmulti-labeled masks, that is, segmentation masks that can take multiple labels per pixel. Following the conformal algorithm of [42], we build multi-labeled masks as follows: given a coverage parameter \u03bb \u2208[0, 1], the mask C\u03bb(X) consists, for each pixel in the image, of the labels c having a softmax value higher than 1 \u2212\u03bb. That is, \u2200pixel ij, \\Clb ( X )_{ij} = \\ left \\l b r a c e \\text {classes } k \\text { : } \\fhat _{ijk} (X)\\geq 1-\\lb \\right \\rbrace . \\label {eq:prediction-set-lac} (1) As it can be seen in Figure 2, larger values of the coverage parameter \u03bb produce multi-labeled masks with more classes per pixel, while smaller values of \u03bb produce multilabeled masks with less classes per pixel. In order to choose the right value for the coverage parameter \u03bb, the user predefines a notion of \u201crisk\u201d (or \u201cerror\u201d) via a loss function \u2113and a maximum tolerable risk \u03b1. With the sole requirement of procuring held-out calibration data, one estimates \u02c6 \u03bb from the calibration data that give rise to the finite-sample, model-agnostic and marginal guarantee of conformal prediction 1 \\mat hbb {E}\\b ig [ \\ e l l (\\C _{\\hat {\\lambda }}(X_{\\text {test}}), Y_{\\text {test}}) \\big ] \\leq \\alpha . \\label {eq:crc-exp-value-guarantee} (2) The probabilistic guarantee in Eq. (2) holds under a minimal assumption on the data generation process: calibration and test data are i.i.d. and statistically independent of the training data. We also show how these multi-labeled masks can be visualized by uncertainty varisco (visual assessment of risk control) heatmaps, which are computed post-hoc with the information of softmax scores. The code to test our methods can be found at https://github.com/ deel-ai-papers/conformal-segmentation 2. Background Semantic Image Segmentation. Semantic Image Segmentation (SIS) is the task of assigning labels to pixels in an image. Let X be the set of pixel values (typically X = [0, 1] for grey-scale images and X = [0, 1]3 for color images). An image X of H pixels of height and W pixels of width is encoded as the tensor X = \b xij \u2208X : ij \u2208IHW \t , where IHW := {1, . . . , H} \u00d7 {1, . . . , W} represents the set of indices of the pixels in the image. Let L = {1, 2, . . . , K} be a set of labels (or \u201cclasses\u201d); each pixel xij is associated to one label yij \u2208L. The set Y = {yij \u2208L : ij \u2208IHW } is commonly referred to as the segmentation mask of the image X (see Fig. 1), and the goal of the SIS task is to infer the segmentation mask Y given the image X. This is typically done by training a predictor b f that outputs softmax values for each pixel. Conformal Prediction. Conformal Prediction (CP) [2, 56] is a family of uncertainty quantification techniques that 1More precisely, this is the guarantee provided by CRC [5] which has CP as a special case. provide model-agnostic, finite-sample guarantees on the predictions of ML models. The most common CP technique, split CP [45], is applied post-hoc on a trained model b f. It requires a calibration dataset {(X1, Y1), ..., (XnYn)} independent of the training data, and an acceptable error rate \u03b1 \u2208(0, 1) set by the user. Split CP uses nonconformity scores (to be understood as a form of measure of prediction error) computed on the calibration dataset in order to build a prediction set C\u03b1(Xn+1) for a new test sample Xn+1. The guarantee achieved by using split CP is P \\b i g ( Y_{n + 1 } \\in \\C _{\\alpha }(X_{n+1}) \\big ) \\geq 1-\\alpha . \\label {eq:split-cp} (3) The only assumption is that the calibration and test data form an exchangeable sequence (a condition weaker than forming an i.i.d. sequence) and that they are independent of the training data. The main limitation of CP is that the guarantee in Eq. (3) is marginal, i.e. it holds on average over both the choice of the calibration dataset and the test sample. Conformal Risk Control. In many applications, errors of different nature may have a different severity, a false negative vs a false positive in a tumor detection application. The notion of severity of an error can be captured via a risk or an error function. CRC [5] generalizes the ideas of Conformal Prediction to this setting: prediction sets are guaranteed to keep the expected risk below a user pre-defined level \u03b1. We show how to adapt this approach to SIS in Section 4.2. Note that when using binary losses, the guarantee of CRC is the same as that of CP in Eq. (3). 3. Related works State-of-the-art ML predictors, based on deep learning, are so complex that they are commonly approached as black boxes: the users provide some input data (an image) and they retrieve a prediction. How accurate are these models? The study of this subject is known as Uncertainty Quantification (UQ) and is a key element towards building trustworthiness in systems powered by ML models [40, 41]. Uncertainty is commonly conceptualized [28, 35] as having an aleatoric and epistemic component. Aleatoric uncertainty is inherent to the modeled phenomenon and non reducible. Epistemic uncertainty, on the contrary, stems from the fact that the models we use do not capture the phenomenon being modeled faithfully enough, and can usually be reduced by taking into account new observations or by enriching the model family being used. CP provides an estimation of the global uncertainty in the model\u2019s predictions, since it is post-hoc and with minimal hypotheses. 2 \fFigure 2. For three (arbitrary) values \u03bb \u2208{0.99, 0.999, 0.9999}, we apply Eq. (7) to every pixel and obtain varisco heatmaps, for the dataset Cityscapes [18]. The CRC algorithm described in Sec. 4.2.1 searches for the optimal \u03bb such that, for a given conformalization loss and a risk level \u03b1, the guarantee in Eq. (2) is attainable. 3.1. Uncertainty quantification methods for semantic image segmentation Some approaches to UQ leverage model architectures that provide not only a point prediction but also the associated uncertainty, notable examples include Bayesian neural networks, networks based on Monte Carlo techniques and Deep Ensembles; others fit auxiliary models. [33] use Monte Carlo dropout neural network as well as Bayesian neural networks; [44] combine Gaussian Discriminant Analysis to estimate the density of the feature-space with the entropy measure of the softmax predictions in order to disentangle epistemic and aleatoric uncertainty and estimate each of them separately; in a similar vein, [31, 32] train a bayesian neural network in order to estimate pointpredictions, aleatoric uncertainty and epistemic uncertainty simultaneously. [53] work on reducing the uncertainty of SIS models within the framework of model adaptation, that is, when domain adaptation is to be performed in the absence of source data. We also refer to [17], who work on failure prediction, a subject related to UQ. They train an auxiliary model to score the confidence of a prediction. They detect when a predictor has made a wrong prediction and assess this via a confidence measure. With respect to these approaches, for our contribution we restrict the scope to post-hoc methods: we suppose to be given a pretrained predictor that we cannot modify and that the training data are not accessible, while providing a theoretical guarantee on the UQ. 3.1.1 Calibration of image segmentation A well-established approach to UQ is that of the calibration of ML models that output (pseudo) probabilities for the labels, where either auxiliary models or empirical adjustments to models are employed. It is known [22] that these scores do not admit a valid probabilistic interpretation, notably for deep-learning models based on the minimization of cross-entropy. [22], among others, brought this concept to the attention of the ML community, studying how calibration methods such as Platt scaling [48] may yield a probabilistically valid interpretation. This notion of uncertainty is applicable [20, 30, 38, 52, 63] to semantic image segmentation, where each pixel embeds a multiclass classification problem. [19, 52], for instance, give some empirical results on the effect of several methods on calibration errors. Similary, [10] have used calibration methods to address the issue of domain shift. Recently, [57] proposed selective scaling as a means to calibrate the segmentation softmax scores. These methods could be used as a complement to CP [61], at the cost of training an additional model. Finally, some literature [23, 24] does provide theoretically-founded, distribution-free algorithms for calibration and study their connection to CP [25]. Our work is based on Conformal Prediction, which is not a calibration method, but rather a different technique of UQ. As such, it is complementary to calibration, and can be used both with a model\u2019s original output as well as with an output that has been previously calibrated. 3.2. Applications of CP to segmentation [5] use their CRC to control the false negative rate in tumor segmentation. Also based on risk control, albeit using different mathematical frameworks, the contributions of [3, 8, 46] extend the concept of tolerance regions to ML problems. They offer stronger guarantees at the cost of inferior sample efficiency. We refer to [2] for an introduction. Of these, [8] apply their methods to binary segmentation of medical images. As for existing work using CP based on nonconformity scores, [60] apply CP to medical imaging, building pixelwise confidence scores based on nonconformity scores and p-values [56]. [55] compute the nonconformity scores in the feature space and present an application to image segmentation. For the case of CP in imaging, we also point out to the literature on image-to-image regression (image reconstruction) [4, 9, 34, 54] which builds intervals for each output pixel. Previous work using CRC for semantic image segmentation focuses on the binary segmentation case. To the best of our knowledge, our work is the first that addresses the multi-class segmentation task with the theoretical guarantee of conformal risk control. 3 \f4. Conformal Semantic Segmentation The goal of conformal semantic segmentation is to produce prediction sets that remain below a user-specified risk. The prediction sets are then used to assess the behaviour of the underlying predictor b f together with the problem data. 4.1. Multi-labeled masks. A prediction set will take the form of a multi-labeled mask, that is, a tensor Z = \\ b ig \\lb r a c e z_{ijk} \\,:\\, ij \\in \\Ihw , k\\in \\mathcal {L} \\big \\rbrace , \\label {eq:notation-multi-mask} (4) where (zijk)K k=1 \u2208{0, 1}K encodes the subset of labels corresponding to the pixel ij; Note that this tensor has as many channels as the number of classes, where each channel is a binary segmentation mask (class k vs others). For a multiclass segmentation mask Y , its one-hot encoding h(Y ) is a particular instance of a multi-labeled mask: every pixel has exactly one channel (out of K) with value one. We say that a multi-labeled mask Z contains a multi-labeled mask Z\u2032 and we write Z \u2265Z\u2032, if zij \u2265z\u2032 ij for each pixel (i, j). 4.1.1 Nested multi-labeled masks. Let b f be any semantic segmentation predictor that produces pixel-wise softmax scores, that is, for an image X, we have \\wi de h a t {f}(X ) : = \\b i g \\ l brace \\widehat {f}_{ijk}(X)\\,:\\, ij \\in \\Ihw , k \\in \\mathcal {L} \\big \\rbrace , (5) with b fijk(X) \u2208[0, 1] and PK k=1 b fijk(X) = 1. Our baseline conformal segmentation method builds prediction multi-labeled masks based on the point-predictor b f , via the Least Ambiguous Set-Valued Classifiers (LAC) [42]. Given \u03bb \u2208[0, 1] and a probability p \u2208[0, 1], we define the thresholding T\u03bb(p) by setting: T_\\ l a m bd a ( p )= \\ begin {cases} \\quad 1 &\\quad \\text {if } p\\geq 1-\\lambda ,\\\\ \\quad 0 &\\quad \\text {otherwise}. \\end {cases} (6) The LAC mapping on the whole image X is defined by applying the mapping T\u03bb to the tensor b f(X) \\C l ac _ { \\l b }(X) = \\ b ig \\lb r a c e T_\\lambda \\big (\\widehat {f}_{ijk}(X)\\big ) \\,:\\, ij \\in \\Ihw , k\\in \\mathcal {L}\\big \\rbrace . \\label {eq:cp-lac-threshold} (7) The multi-labeled masks generated via the LAC procedure are nested, i.e. \\l a mbda \\ leq \\l ambda ' \\quad \\Rightarrow \\quad \\Clac _\\lambda \\leq \\Clac _{\\lambda '}. (8) Note that following Eq. (11), for high values of \u03b1, one can get a valid \u02c6 \u03bb that can produce some empty pixels (i.e. there is no class with a high-enough score) when plugged into Eq. (7). To prevent this, we always include the most highly scored class in the multi-labeled mask (or \u201ctop-1\u201d class). 4.2. Conformal Risk Control for multi-labeled mask Instead of working with loss functions that compare ground-truth values to point-predictions, Conformalized Risk Control (CRC) considers loss functions that compare ground-truth values to set-predictions. For the particular application of semantic segmentation, we consider a loss function \u2113(Z, Y ) taking as arguments a multi-labeled mask Z and a one-hot encoded mask Y . We assume that \u2113takes values in the bounded interval (\u2212\u221e, B] for some B \u2208R, and that it is non-increasing in Z: \\ l a b el {eq: m o n otono u s_ell} \\forall \\, Y,\\ \\forall \\, Z \\leq Z' \\quad \\Rightarrow \\quad \\ell (Z, Y) \\geq \\ell (Z', Y), (9) i.e. larger multi-labeled masks produce smaller loss values. This assumption, together with the nestedness of the LAC masks imply that the mapping \u03bb 7\u2192\u2113 \u0000CLAC \u03bb (X), Y \u0001 is nonincreasing in \u03bb. The loss \u2113is not used as a training loss, that is, applying CRC does not affect the pre-trained model nor the predictive algorithm directly. The loss \u2113rather allows the user to encode the notion of error [5] in their predictions. In order to be clear, the loss \u2113will be referred to as conformalization loss. Let us consider a sequence (Xi, Yi)n+1 i=1 of images with their corresponding ground-truth segmentation masks. The first n examples constitute our calibration set Dcal and the example n + 1 is taken to be the test example. We denote Li(\u03bb) := \u2113 \u0000C\u03bb(Xi), Yi \u0001 the loss on the i-th example, one can then compute the empirical risk of the prediction sets on calibration data Dcal as \\Rha t _ n ( \\lb ) = \\frac {1}{n}\\sum _{i=1}^{n} L_i(\\lb ). \\label {eq:emp_risk} (10) The purpose of the calibration set is to estimate the right value \u02c6 \u03bb with the guarantee that the risk will remain below the maximum tolerated risk level. Given a maximum tolerated risk level \u03b1 \u2208R, we define \\l bha t : = \\ in f \\ l e f t \\{ \\ l b \\ i n [0,1] : \\frac {n}{n+1} \\Rhat _{n}(\\lb ) + \\frac {B}{n+1} \\leq \\alpha \\right \\} \\label {eq:crc-lb-hat} (11) Theorem 4.1 (Theorem 1 in [5].). Assume that the Li(\u03bb) are non-increasing, right-continuous and bounded by B < +\u221e. Assume that there exists \u03bbmax \u2208[0, 1] such that Li(\u03bbmax) \u2264\u03b1. Assume further that L1(\u03bb), . . . , Ln+1(\u03bb) form an exchangeable sequence. Let \u02c6 \u03bb be computed as in Equation (11). Then it holds that \\mathb b { E } \\left [ L_{n+1}(\\lbhat ) \\right ] \\leq \\alpha . \\label {eq:crc-loss-guarantee} (12) Computing the optimal \u02c6 \u03bb. [5] do not provide an explicit optimization algorithm to find the optimal parameter in Eq. (11). Because of the hypothesis of monotonicity of Li(\u03bb) with respect to \u03bb, this can be achieved, for instance, running a dichotomic search over the parameter \u03bb, up to any user-defined error \u03f5. 4 \f4.2.1 Conformalization algorithm When we say we \u201cconformalize\u201d a ML predictor, we mean computing the losses and the optimal \u02c6 \u03bb on some calibration data. More specifically: Algorithm 1: Conformalization of Semantic Image Segmentation, setup and estimation of \u02c6 \u03bb. Data: Predictor b f \u2208[0, 1]K\u00d7H\u00d7W . Prediction set parametrization C\u03bb(\u00b7). Result: \u02c6 \u03bb 1 Collect calibration data Dcal = (Xi, Yi)n i=1 from the same distribution as the test data; 2 Choose a conformalization loss \u2113(C\u03bb(X), Y ) \u2208[0, 1] (see Sec. 4.3); 3 Set an acceptable risk level \u03b1 \u2208(0, 1); 4 Compute \u02c6 \u03bb as in Eq. (11): since the empirical risk is monotonic w.r.t. \u03bb, dichotomic search is a fast option; Note that to ensure the statistical validity, one must pick a value \u03b1 before observing the calibration data: like in statistical hypotheses testing, one cannot adjust their significance level \u03b1 after computing the p-values. In practice, one could use two calibration datasets, the first to explore CP on the use case and the second reserved to the estimation of the \u02c6 \u03bb to be deployed in production. We say we have a \u201cconformalized prediction\u201d when we build the prediction set with the \u02c6 \u03bb as computed above, applying Eq. (7). Algorithm 2: Conformalization of Semantic Image Segmentation, inference. Data: Input image X \u2208[0, 1]3\u00d7H\u00d7W , Predictor b f \u2208[0, 1]K\u00d7H\u00d7W . Prediction set parametrization C\u03bb(\u00b7) Result: Z = CLAC(X) 1 Compute CLAC(X): apply Eq. (7) to X. 4.3. Choosing the loss function. In Fig. 3 we show how, for the same risk level \u03b1 = 0.1, different losses generate different varisco heatmaps. These losses encode different notions of error: from the left to right-hand side, we see a shift from stricter to less strict. When implementing a CP method, the users need to choose a conformalization loss \u2113suitable to their problem. For the guarantee of CRC to hold, one needs to ensure that the losses Li(\u03bb) are non-increasing with respect to \u03bb; since the LAC procedure in Eq. (7) produces nested prediction sets [26], it is enough to ensure that \u2113(Z, Y ) is non-decreasing with respect to the first argument Z. In this section we give three examples of natural choices for losses that respect this condition. The first is a binary loss, which yields a guarantee equivalent to that of CP based on nonconformity scores, whose underlying loss would be \u2113(C(X), Y ) = 1{Y \u0338\u2208C\u03b1(X)}. It takes value one whenever the prediction set does not contain the true value Y. We write as \\ell _ { \\ t e xt { b i n}}(Z, Y) = \\begin {cases} 0 & \\text {if}\\quad Z \\geq Y\\\\ 1 & \\text {otherwise}. \\end {cases} \\label {eq:bin_loss} (13) In the case of conformalized SIS, that happens when the multi-labeled mask does not cover every pixel in the image. Empirically, the conformalization of segmentation produces very small values \u02c6 \u03bb that result in multi-labeled masks corresponding to (almost) the whole target space Y = {1, 1, . . . , 1}K\u00d7H\u00d7W for each inference (e.g. lefthand side in Fig. 3). One can however set an acceptable trade-off in coverage, with a minimum coverage ratio \u03c4: the user specifies a priori the minimal proportion of pixels that need to be covered for a prediction to be considered successful. We thus define the binary loss with threshold as \\el l _ { \\ ta u }( Z, Y) = \\ beg in { c as e s} 1 & \\text {if}\\quad \\frac {\\sum _{ijk} Z_{ijk}Y_{ijk}}{\\sum _{ijk}Y_{ijk}} < \\tau ,\\\\ 0 & \\text {otherwise}. \\end {cases} \\label {eq:bin_loss_threshold} (14) where \u03c4 is the minimum acceptable coverage ratio. For \u03c4 = 1 we recover the binary loss in Eq. (13). Binary losses constitute a strict criterion: during conformalization, for \u03c4 = 90%, an empirical coverage of 89.9% will be considered a failure. A less strict notion of error is given by directly controlling the coverage via the miscoverage loss \\e l l ( Z , Y) = 1 \\ f rac {\\sum _{ijk} Z_{ijk}Y_{ijk} }{ \\sum _{ijk}Y_{ijk} } \\label {eq:loss_miscoverage} (15) The miscoverage loss is directly related to the concept of accuracy [15, 27, 64] and can be easily extended to follow the balanced accuracy known in the medical literature [6, 7] or even a weighted version (e.g. lower importance to background pixels), inspired for instance by [11, 36]. 2 4.4. Varisco heatmaps In CP, the size a prediction set (e.g. a prediction interval) is taken as a signal of uncertainty: for a risk set by the user, it 2Example of weighted miscoverage loss: \\el l _ { w } ( Z , Y ) = 1 \\frac { 1} {\\sum _{k} w_k} \\sum _{k}w_k \\frac {\\sum _{ij} Z_{ijk}Y_{ijk} }{ \\sum _{ij}Y_{ijk} } \\label {eq:weighted-loss_miscoverage} (16) 5 \fFigure 3. For the same risk level \u03b1 = 0.01, different losses yield different heatmaps: (left) binary loss \u2113bin, (center) binary loss with threshold \u2113\u03c4, (right) miscoverage loss \u2113. If the notion of risk is too restrictive, the prediction set will be theoretically valid but not very informative. In this example, the figure on the left (binary loss, \u03c4 = 1.0) has most of the pixels of color red, indicating that K (out of K) classes are in the prediction set. Dataset: Cityscapes [18]. corresponds to the \u201ctypical\u201d error measured in the calibration dataset. In our case of image segmentation, we look at every pixel in the output: how many classes there are, whose softmax score is above the threshold \u02c6 \u03bb. If we count the labels in each pixel and normalize by K, we can generate an image which has, for each pixel, a scalar value in [0, 1]. Mapping these scalars to a gradient of colors we obtain a heatmap corresponding to the underlying prediction multi-labeled mask. In Figure 2 are three examples: for the same predicted softmax, we apply thresholds \u03bb \u2208{0.99, 0.999, 0.9999} and obtain three different heatmaps. When \u03bb is computed with a CRC procedure on calibration data, these heatmaps provide a qualitative visualization of the model\u2019s uncertainty obtained from the risk control procedure, hence the name varisco (visual assessment of risk control). Furthermore, for a better visualization in datasets with many classes (e.g. LoveDA, see Section 6), scaling the class count in every pixel by the maximum count observed in the multilabeled mask (often \u226aK) is also helpful. The use of heatmaps is not new in semantic image segmentation, and one can find recent examples in [13, 14], where they are used for Out-of-Distribution (OOD) detection or in some of the UQ literature cited in Sections 3.1 and 3.2. To the best of our knowledge, however, this is the first time that this kind of visualization based on prediction sets is mentioned in the context of UQ and CP, with their underlying theoretical guarantee. 4.4.1 Characteristics of heatmaps Our varisco heatmaps are monotone in the parameter \u03bb: as \u03bb grows, the set of pixels for each class is non-decreasing in size. Note that the heatmaps contain information about the aleatoric and epistemic uncertainty. As a general rule of thumb, for semantic segmentation tasks the aleatoric uncertainty should be maximal around the edges of the groundtruth figures, so that a heatmap with warm regions away of the contours should warn the user that the epistemic uncertainty of the model is high, and better models might be available for the data at hand. The parameter \u03bb encapsulates a notion of conservativeness, i.e. the higher the parameter \u03bb, the more activation we will get in our multi-labeled mask, and therefore in our heatmap. The calibration of \u03bb corresponds to the user setting an acceptable risk \u03b1 and finding the least conservative \u03bb such that their need is met. Note that for an arbitrary \u03bb, the associated heatmap provides little information about the epistemic uncertainty of the model b f, meaning that, given two different point predictors b f1 and b f2, plotting the heatmaps H1(\u03bb) for the first model and H2(\u03bb) will give us no information about which of the two models performs best. This is because the heatmaps Hi(\u03bb) carry no information about the errors of the models, but rather about the entropy of the softmax-es in each model. However, given a pre-set risk level \u03b1, once the appropriately values b \u03bb1 and b \u03bb2 are chosen through the CRC calibration procedure, we can safely compare the heatmaps H1(b \u03bb1) and H2(b \u03bb2), because both heatmaps guarantee the same risk level for both models. A warmer heatmap for the model b f1 means that for the chosen risk level \u03b1, the model b f1 carries more epistemic uncertainty than the model b f2. 5. Metrics and UQ diagnostics To the best of our knowledge, ours is the first paper that uses prediction sets via multi-labeled masks to provably quantify the uncertainty in multiclass semantic segmentation; it is not possible to compare our results directly to existing approaches (see Section 3), as they are essentially different. However, as it is common in the CP literature, one can test different nonconformity scores or, as in our case, the coupling of set parametrization (e.g. CLAC) and conformalization loss. Throughout the paper we restrict our exposition to the nested-set parametrization derived from the algorithm of [42], which we refer to as LAC. Although out-of-scope for this paper, our code repository (see Sec. 1) contains some examples using the Adaptive Prediction Sets (APS) algorithm of [50], which employs a threshold on the sum of the softmax scores sorted in decreasing order. 6 \fTo assess experimentally the validity of CRC, we compute the empirical risk as in Eq. (10) on the test data. In CP, a standard metric of the efficacy of the method is the average size of the prediction sets on the test data. For classification, this boils down to counting the number of classes in the prediction set, averaged over the test set. With semantic segmentation, this can be thought of as computing the average number of \u201cactivated\u201d classes (i.e., whose softmax is above the threshold \u02c6 \u03bb) over all pixels in the input image. For a one-hot-encoded multi-labeled masks Z defined as in Eq. (4), the prediction set size of a pixel (i, j) is PK k=1 zkij. Extending this to the whole image and normalizing by the number of valid pixels npixels (e.g. excluding void pixels, artefacts, etc. common in computer vision), we have, for one multi-labeled mask Z, the activation ratio \\te x t {AR}(Z ) =& \\ frac {1}{ n_{ \\te xt {pi xel s}}} \\su m _{i,j ,k } z_{ijk},\\\\ &\\text { for all pixels } x_{ij} \\text { that were labeled in } X. \\nonumber \\label {eq:metrics-multimask-activation} 6. Experiments Since CP is model-agnostic, we test architectures and datasets of varying size and complexity, knowing that regardless of the predictor chosen, our method will be statistically valid. For all the models tested, we used the PyTorch [47] implementation provided by the open-source Python library MMSegmentation [16], which includes code to run inferences as well as pretrained weights for many datasets. We run our experiments on Cityscapes [18] (19 classes, automotive vision), ADE20K [66, 67] (150 generic common classes) and LoveDA [58, 59] (aerial images, 7 classes). As for the architectures of the neural networks, we selected the best performing ones within our computational budget: PSPNet [65] for Cityscapes and LoveDA, SegFormer for ADE20K [62]. For conformalization, we split the validation data into two partitions, one for calibration and one for testing. We tested both the binary loss with threshold of Eq. (14) and the miscoverage loss of Eq. (15). For the risk \u03b1, we tested values that would have made sense in the real world: for Cityscapes, our pretrained model has a very good performance (e.g. mIoU) and the user can aim for small risks. For the other cases, such small \u03b1 could yield hardly informative prediction sets. As seen for instance in Figure 3, a combination of a restrictive loss (\u03c4 = 1.0) and a small \u03b1 = 0.01 would entail selecting (almost) all classes for every pixel. This can be taken as a diagnostic signal: the model is not good enough for our notion of risk, we need to either augment our tolerance for errors or revise the prediction model, for instance. Dataset \u03b1 \u03c4 Empirical Risk AR Cityscapes 0.1 0.99 0.106 \u00b1 (0.019) 1.028 0.1 0.95 0.100 \u00b1 (0.021) 1.274 0.01 0.95 0.011 \u00b1 (0.008) 1.208 0.01 0.99 0.011 \u00b1 (0.014) 2.557 ADE20K 0.1 0.75 0.082 (\u00b1 0.021) 1.440 0.1 0.90 0.076 (\u00b1 0.021) 3.483 0.01 0.75 0.004 (\u00b1 0.005) 9.349 LoveDA 0.10 0.50 0.097 (\u00b1 0.018) 1.231 0.10 0.75 0.103 (\u00b1 0.013) 2.672 0.10 0.90 0.092 (\u00b1 0.012) 3.946 0.01 0.50 0.010 (\u00b1 0.008) 3.607 0.01 0.75 0.010 (\u00b1 0.005) 4.956 0.01 0.90 0.010 (\u00b1 0.006) 5.761 Table 1. Metrics on Dtest: empirical risk and activation ratio (AR) for binary loss \u2113\u03c4. Empirical risk should be as close as possible to \u03b1 to show validity. For each line, we repeat several times this procedure: (1) shuffle the dataset, (2) split validation data into Dcal & Dtest, (3) run calibration on Dcal, (4) Compute metrics on Dtest. We finally average the metrics over the multiple runs (standard deviation in the parentheses). Dataset \u03b1 Empirical Risk AR Cityscapes 0.05 0.041 (\u00b1 0.001) 1.000\u2020 0.01 0.006 (\u00b1 0.001) 1.230 0.005 0.001 (\u00b1 0.0003) 1.998 ADE20K 0.2 0.179 (\u00b1 0.005) 1.000\u2020 0.1 0.098 (\u00b1 0.008) 1.362 0.05 0.048 (\u00b1 0.006) 2.474 0.01 0.008 (\u00b1 0.002) 15.285 LoveDA 0.2 0.199 \u00b1 (0.009) 1.388 0.1 0.100 \u00b1 (0.006) 2.650 0.05 0.049 \u00b1 (0.004) 4.069 0.01 0.008 \u00b1 (0.0008) 6.350 0.005 0.003 \u00b1 (0.0004) 6.796 Table 2. Metrics on Dtest: empirical risk and activation ratio (AR) for miscoverage loss \u2113. \u2020: the underlying predictor attains the risk level without adding any class to the prediction set, that is, the output semantic mask with one class per pixel already satisfies this risk level. 7. Results In Table 1 and Table 2, we report the results of our experiments. For both the empirical risk and the activation ratio (AR), we average the metrics over multiple runs (ten) of each loss configuration. As it is customary in CP, one first ensures that the theoretical guarantees holds also in practice for a given dataset 7 \fFigure 4. Visualization of a varisco heatmaps (miscoverage loss, \u03b1 = 0.01) for the ADE20K dataset [66, 67]: (left) input image, (center) predicted segmentation mask, (right) varisco heatmap. Figure 5. Visualization of a varisco heatmaps (miscoverage loss, \u03b1 = 0.01) for the LoveDA dataset [58, 59]: (left) input image, (center) predicted segmentation mask, (right) varisco heatmap. and predictive model. As expected, the empirical risks are a very close approximation of the nominal risk values \u03b1. As for the activation ratios, they follow a reasonable pattern: they increase as the notion of error gets stricter. In Tab. 2, we see how the AR increases when the risk diminishes from \u03b1 = 0.05 to \u03b1 = 0.01. In Fig. 1 and Fig. 5 we give examples of conformalized predictions for the three datasets. In all cases, the borders of the masks often appear to be highlighted as more uncertain. For the other patches in darker shades of red, the signal of uncertainty produced by the conformalized predictors go towards more ambiguous areas, smaller and farther objects. 8."
17
+ }