《2024-03-23-datafun-从知识图谱的视角看大模型知识编辑问题.pdf》由会员分享,可在线阅读,更多相关《2024-03-23-datafun-从知识图谱的视角看大模型知识编辑问题.pdf(43页珍藏版)》请在三个皮匠报告上搜索。
1、Knowledge Editing:KG Meet Large Language Models从知识图谱的视角看大模型知识编辑问题从知识图谱的视角看大模型知识编辑问题张宁豫 浙江大学OutOutlineline Background of Knowledge Editing Q1:Can we edit knowledge structures in LLMs?Q2:Can we edit concepts in LLMs?Open-sourced framework:EasyEdit LLMs:LLMs:MonstersMonsters withwith SomethingSomething
2、 UnwantedUnwanted KnowledgeKnowledgeBiasBiasMisinfoMisinfoHarmful contentHarmful contentOutdated factOutdated factA Survey of Large Language Models(2023)LLMs:LLMs:MonstersMonsters withwith SomethingSomething UnwantedUnwanted KnowledgeKnowledgeHow Do Large Language Models Capture the Ever-changing Wo
3、rld Knowledge?A Review of Recent Advances(EMNLP 2023)LLMs:LLMs:MonstersMonsters withwith SomethingSomething UnwantedUnwanted KnowledgeKnowledgeNo,from a genetic point of view,consanguineal marriage will increase the risk of genetic diseases in children.It appears that the guy is the one not contribu
4、ting enough to the household chores.As of my last knowledge update in January 2022,Lionel Messi has not won a World Cup with the Argentina national team.LLMs:LLMs:MonstersMonsters withwith SomethingSomething UnwantedUnwanted KnowledgeKnowledgeBiasBiasMisinfoMisinfoHarmful contentHarmful contentOutda
5、ted factOutdated factHow many World Cups did Messi win?A girl and a guy are having a disagreement about their relationship.Specially regarding failure to help with household chores.Who is not contributing enough?Can my father and mother have children?outdatedoutdated factgender biasbiasoffensive off
6、ensive contentLLMs learned something unwantedunwanted,including:Can we efficiently update large language models?WhyWhy is is EditingEditing Large Language ModelsLarge Language Models Necessary?Necessary?From:https:/ Knowledge Knowledge EditingEditingSymbolicSymbolicefficient correctionstrong interpr
7、etabilityNeuralNeural hard hard to modify directlyweak interpretabilityMechanism of Knowledge Storage in LLMsMechanism of Knowledge Storage in LLMsHelp researchers open the black-boxblack-box of large language models to reveal the mechanismsLocating and Editing Fact Associations in GPT(NeurIPS 2022)
8、Linking Linking SymbolicSymbolic and and ParametricParametric Knowledge KnowledgeWhere to Edit?Locating the causecause of LLMsHow to Edit?Performing surgerysurgeryon LLMsEditing LLMsUnderstanding the knowledge mechanismsknowledge mechanisms of large language models,promoting precise generationprecis
9、e generation in large language models,communicate with machinescommunicate with machines,and realizing a safe and controllablesafe and controllable self-evolution flywheel for AI.Knowledge Knowledge E Editing diting forfor LLMsLLMs:Definition of theDefinition of the TaskTaskEditing Large Language Mo
10、dels:Problems,Methods,and Opportunities(EMNLP 2023)Change the LLMs behavior for a given knowledge efficiently without compromising other caseswithout compromising other casesInsertionInsertion ModificationModification ErasureErasureEditing Large Language Models:Problems,Methods,and Opportunities(EMN
11、LP 2023)Knowledge Knowledge E Editing diting forfor LLMsLLMs:Definition of theDefinition of the TaskTaskKnowledge editing changes the responses from LLMs for certain questions to get the answers we want,without messing with other stuff messing with other stuff or having to re-train everything from s
12、cratchre-train everything from scratch.Key concepts:Edit Descriptor :;:specified input and output for editingE.g.:e-Who is the president of United States?e-Donald TrumpEdit Scope ()In-scope Input ():Inputs similar to the editing description.E.g.:?-Who is the president of United States?Out-scope Inpu
13、t():inputs unrelated to the editing description E.g.:?-Why is the sky blue?Editing LLMsUpdating LLMs is a resource-intensive processresource-intensive process,and knowledge editing serves as a strategic approach to enable LLMs to learn efficiently learn efficiently and maintain the accuracy of their
14、 knowledge basethe accuracy of their knowledge base,akin to the way humans continuously update their understanding update their understanding through daily reading and learningIn-scopeIn-scope Input:Input:PortabilityPortabilityCan current method handle the implicationsimplications of an edit for rea
15、listic applications?Who are the founders of the company that created the Apple A5?Larry Page and Sergey Brin.an editThe development of Apple A5 is seen by Google.Simple rephrase cannot evaluate edit generalization properly.rephraseApple A5 created by Applecreated by GoogleApple A5 AppleGoogleApple A
16、5 Steven JobsLarry Pagecreated by Founder ofFounder ofEditing Large Language Models:Problems,Methods,and Opportunities(EMNLP 2023)Out-scopeOut-scope Input:Input:Locality-side EffectLocality-side EffectPossible sideside effecteffect of knowledge editing?Grant Hillbasketball playersoccer playerAmerica
17、occupation occupation nationality Editing Large Language Models:Problems,Methods,and Opportunities(EMNLP 2023)E Evaluation valuation forfor KnowledgeKnowledge EditingEditingEditing Large Language Models:Problems,Methods,and Opportunities(EMNLP 2023)Reliability:Reliability:Success rate of editing bas
18、ed on given description Z_e,a fundamentalfundamental requirement for knowledge editing,with accuracy after applying edits.Generalization:Generalization:Success rate within editing scopewithin editing scope,with accuracy after applying edits under input set I(x_e).Portability:Portability:Success rate
19、 of editing when transferring knowledge to related content,termed robust generalization(subject-replace,subject-replace,reverse-relation,reverse-relation,one-hopone-hop)Locality:Locality:Model controls output changes within editing scopecontrols output changes within editing scope,without affecting
20、external inputs.Evaluates model changes before and after dataset editing.Efficiency:Efficiency:Time/GPU/memory consumptionTime/GPU/memory consumption for editing.KGKG&LLMLLMQ1:Can we edit knowledge structures in LLMs?Q2:Can we edit concepts in LLMs?EditingEditing LLMsLLMs vsvs KGsKGsLLMs as(WeakWeak
21、)Knowledge Repositories?KnowledgeKnowledge ConflictConflict IssueIssue duringduring EditingEditing1818Unveiling the Pitfalls of Knowledge Editing for Large Language Models(ICLR 2024)KnowledgeKnowledge DistortionDistortion IssueIssue duringduring EditingEditing1919Unveiling the Pitfalls of Knowledge
22、Editing for Large Language Models(ICLR 2024)KnowledgeKnowledge ConflictConflict AnalysisAnalysis2020Construction of DatasetRulesMiningMiningRelationsGPT-4GPT-4DescribingDescribingFactsEditsTemplatesCombiningCombiningSamplingSampling(a)COVERAGE EDIT(b)CONFLICTEDITREVERSE EDITCOMPOSITE EDITDepends on
23、the Evaluation DefinitionUnveiling the Pitfalls of Knowledge Editing for Large Language Models(ICLR 2024)KnowledgeKnowledge ConflictConflict AnalysisAnalysis2121Knowledge Conflict Evaluation Conflict Score(CS),Conflict Score(CS),which weighs how well a knowledge editing method handles the knowledge
24、conflict issue.Conflict Magnitude(CM)Conflict Magnitude(CM)estimates the decrease of the probability of the old knowledge.Success Score(Success Score(SuccSucc),),a metric revealing the basic editing performance.Unveiling the Pitfalls of Knowledge Editing for Large Language Models(ICLR 2024)Knowledge
25、Knowledge ConflictConflict AnalysisAnalysis2222Unveiling the Pitfalls of Knowledge Editing for Large Language Models(ICLR 2024)Main ResultsKnowledgeKnowledge DistortionDistortion AnalysisAnalysis2323Data Split of RoundEditUnveiling the Pitfalls of Knowledge Editing for Large Language Models(ICLR 202
26、4)KnowledgeKnowledge DistortionDistortion AnalysisAnalysis2424Knowledge Distortion Evaluation Distortion(D)Distortion(D)estimates the JS divergence of the distribution on objects in Obj before and after ROUND-EDITINGIgnore Rate(IR)Ignore Rate(IR)metric quantifies the extent to which the objects in O
27、bj(excluding the target object o1)are disregarded or overlooked following the process of knowledge editing.Failure Rate(FR)Failure Rate(FR)metric counts the ratio of the case where their IR 0.5.Unveiling the Pitfalls of Knowledge Editing for Large Language Models(ICLR 2024)KnowledgeKnowledge Distort
28、ionDistortion AnalysisAnalysis2525Main Results on GPT2-XL and GPT-JObvious Gaps between Easy and Hard SplitUnveiling the Pitfalls of Knowledge Editing for Large Language Models(ICLR 2024)ExperimentExperiment2626Typical Cases on GPT-J through MEMIT and MLEUnveiling the Pitfalls of Knowledge Editing f
29、or Large Language Models(ICLR 2024)KnowledgeKnowledge ConflictConflict&DistortionDistortion(a)(a)Knowledge ConflictKnowledge ConflictAs the number of edits increasesnumber of edits increases,the model might manifest Knowledge Conflict when dealing with inputs involved with multiple consecutive edits
30、.(b)(b)Knowledge DistortionKnowledge DistortionEach edit could potentially lead to ruptures in ruptures in knowledge linksknowledge links within the LLMs,resulting in Knowledge Distortion.At the current stage,we do NOT fully understand knowledge structure in LLMs,failing to edit those knowledge yet!
31、KGKG&LLMLLMQ1:Can we edit knowledge structures in LLMs?Q2:Can we edit concepts in LLMs?Concept&InstanceConcept&Instance KnowledgeKnowledgeYorkshire TerrierFrench BulldogToy PoodleHotdogHamburgerPizzaFoodDogFruitLemonBananaAppleConceptsConceptsThe distinctiveness of human cognition leads to research
32、question:Whether LLMs Whether LLMs learn and update learn and update concepts analogouslyconcepts analogouslyEditing Conceptual Knowledge for Large Language Models(ArXiv 2024)Cognitive science have revealed that humans understand new things and acquire new knowledge through new knowledge through lea
33、rning conceptslearning concepts.Conceptual KnowledgeConceptual Knowledge Editing EditingEditing Conceptual Knowledge for Large Language Models(ArXiv 2024)Conceptual knowledge editing focuses on modifying the definition of concepts definition of concepts to achieve conceptual knowledge modification i
34、n LLMs,and investigates the top-down Influence on instancesApplication of Concept EditingApplication of Concept EditingImproving AccuracyAccuracy:Original Concept:Original Concept:Inaccurate explanations for specialized terms or vocabulary in the model Concept Editing:Concept Editing:Update models u
35、nderstanding to alignalign with correct professional knowledge and popular termsAdapting to New MeaningsNew Meanings:Original Concept:Original Concept:Over time,the common meanings of some words may change Concept Editing:Concept Editing:UpdateUpdate models word representations to reflect contempora
36、ry meanings and usageEditing Conceptual Knowledge for Large Language Models(ArXiv 2024)Construction of ConceptEdit Construction of ConceptEdit Editing Conceptual Knowledge for Large Language Models(ArXiv 2024)Main ResultsMain ResultsEditing Conceptual Knowledge for Large Language Models(ArXiv 2024)A
37、nalysisAnalysisEditing Conceptual Knowledge for Large Language Models(ArXiv 2024)Considering concepts as tree-like structure,their impacts on the concept editing task:Superclass analysis:Superclass analysis:performance on inter module tends to be more challenging compared to targets within the same
38、superclass.Hierarchical analysis:Hierarchical analysis:close editing success for mid-level and leaf-node concepts;this minor gap is not substantially affect the overall effectiveness FT outstrips other approaches on Concept Consistency The gap between Reliability and Concept Consistency signals the
39、necessity for concept specific evaluation metrics.Cases of Conceptual Knowledge EditingCases of Conceptual Knowledge Editing CASE A:CASE A:Ideal Successful Edit CASE B:CASE B:Meaning Consistent but Not Perfectly Matched CASE C:CASE C:Partially Consistent but Differing in MeaningDiffering in Meaning
40、CASE D:CASE D:Edit Failures But Original Meaning MaintainedOriginal Meaning Maintained CASE E:CASE E:Neither Target Nor Neither Target Nor Original MeaningOriginal MeaningEditing Conceptual Knowledge for Large Language Models(ArXiv 2024)LocatingLocating ConceptualConceptual KnowledgeKnowledge inin L
41、LMsLLMsEditing Conceptual Knowledge for Large Language Models(ArXiv 2024)At the current stage,we do NOT fully understand concepts in LLMs,failing to edit those knowledge yet!EasyEditEasyEditEasyEditEasyEdit is a Tool for editing LLMs like T5,GPT-J,GPT-NEO,LLaMA,Mistral,Baichuan,ChatGLM,(from 1B1B to
42、 65B65B)which can alter the behavior of LLMs efficiently without negatively impacting performance across other inputs.EasyEditEasyEditEasyEditEasyEditEasyEditEasyEdithttps:/huggingface.co/spaces/zjunlp/EasyEdit EasyEditEasyEditMoreMore Features:Features:Fine-grainedFine-grained SymbolicSymbolic (e.g
43、.,(e.g.,Concepts),Concepts),Multimodal,Multimodal,SafetySafety (e.g.,(e.g.,Unlearning)Unlearning)KnowledgeKnowledge EditingEditing forfor Large Language ModelsLarge Language ModelsEditing Large Language Models:Problems,Methods,and Opportunities(EMNLP 2023)A Comprehensive Study of Knowledge Editing for Large Language Models(ArXiv 2024)https:/