Knowledge boundary identification method based on interpretability of large language model and related device
By extracting and injecting the intermediate state of the large language model, generating natural language interpretations, and evaluating its correlation with the target problem, quantifying the knowledge boundary of the large language model, the problem of insufficient perception of the knowledge boundary of the large language model is solved, the reliability and accuracy of the model are improved, and the risk of model hallucination is avoided.
Patent Information
- Application Number
- CN202411914850.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-03-11
AI Technical Summary
When large language models face complex, fuzzy and unknown problems, they lack knowledge boundary perception capabilities, resulting in a lack of sufficient information within the model parameters, generating incorrect content, reducing the credibility and reliability of model output, especially in high-risk areas, which may bring serious consequences.
In the process of inference answering target problems in the large language model, intermediate states are extracted and prompt words are constructed to inject intermediate states into the large language model to obtain natural language interpretation. Then, by evaluating the correlation between natural language interpretation and target problems, the knowledge boundaries of large language models are quantified.
Effectively evaluate model capabilities, avoid model hallucination risks, improve model reliability and accuracy, and provide highly interpretable and scalable knowledge boundary recognition methods.
Smart Images

Figure CN119599136A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of large language models, and in particular to a knowledge boundary identification method and related devices based on the interpretability of large language models. Background Art
[0002] At present, large language models have shown excellent performance in various tasks and have been widely used in finance, medical care, education, law and other industries. However, the most prominent reason affecting the accuracy of the model is the lack of knowledge boundary perception ability of large language models.
[0003] The lack of knowledge boundary perception ability means that when a large language model faces complex, ambiguous, and unknown problems, the model parameters lack sufficient information and try to use rules or associations to fabricate answers, generating incorrect content. This will not only reduce the credibility and reliability of the model output, but also bring potential serious consequences in applications in high-risk fields such as finance and medicine. Summary of the invention
[0004] In view of the above problems, this application provides a knowledge boundary identification method and related devices based on the interpretability of a large language model to achieve the purpose of quantifying the knowledge boundary of a large language model. The specific scheme is as follows:
[0005] The first aspect of the present application provides a knowledge boundary identification method based on the interpretability of a large language model, and the knowledge boundary identification method based on the interpretability of a large language model includes:
[0006] In the process of the large language model reasoning and answering the target question, extracting the intermediate state of the large language model;
[0007] Constructing a prompt word, and injecting the intermediate state into the large language model to obtain a natural language interpretation of the output of the large language model;
[0008] The knowledge boundary of the large language model is quantified by evaluating the relevance of the natural language interpretation to the target question.
[0009] In a possible implementation, extracting the intermediate state of the large language model includes:
[0010] Cache the Embedding output by the middle layer of the large language model;
[0011] The index position of the target problem is used as the horizontal coordinate and the number of layers of the intermediate layer is used as the vertical coordinate to generate the embedding position;
[0012] Sampling the Embedding position to obtain a sampling position;
[0013] The Embedding at the sampling position is extracted from the cache result as the intermediate state.
[0014] In a possible implementation, injecting the intermediate state into the large language model by constructing a prompt word includes:
[0015] Acquire common cue words for context understanding and information extraction;
[0016] Generate a target prompt word corresponding to the intermediate state based on the general prompt word, and input the target prompt word into the large language model;
[0017] The intermediate state is injected into a target intermediate layer of the large language model, where the target intermediate layer is a non-first intermediate layer of the large language model.
[0018] In a possible implementation, quantifying the knowledge boundary of the large language model by evaluating the relevance of the natural language interpretation to the target question includes:
[0019] The natural language interpretation is used as knowledge to form a question-answer pair with the target question;
[0020] Scoring the question-answer pair using a ranking model, wherein the score is used to characterize the relevance of the knowledge to the target question;
[0021] The target knowledge with the highest score is selected from the knowledge, and the average of the scores of the target knowledge is used as the quantitative score of the knowledge boundary.
[0022] In a possible implementation, quantifying the knowledge boundary of the large language model by evaluating the relevance of the natural language interpretation to the target question further includes:
[0023] A quantitative hint of the knowledge boundary is output according to the quantitative score.
[0024] In a possible implementation, quantifying the knowledge boundary of the large language model by evaluating the relevance of the natural language interpretation to the target question further includes:
[0025] An internal knowledge base of the large language model is constructed based on the knowledge.
[0026] A second aspect of the present application provides a knowledge boundary identification device based on the interpretability of a large language model, and the knowledge boundary identification device based on the interpretability of a large language model includes:
[0027] A state extraction module, used to extract the intermediate state of the large language model during the process of the large language model reasoning and answering the target question;
[0028] A state injection module, used for constructing a prompt word and injecting the intermediate state into the large language model to obtain a natural language interpretation output by the large language model;
[0029] A knowledge boundary quantification module is used to quantify the knowledge boundary of the large language model by evaluating the relevance of the natural language interpretation to the target problem.
[0030] The third aspect of the present application provides a computer program product, including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements the knowledge boundary identification method based on the interpretability of a large language model according to the above-mentioned first aspect or any implementation method of the first aspect.
[0031] A fourth aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:
[0032] The memory is used to store computer programs;
[0033] The processor is used to execute the computer program so that the electronic device can implement the knowledge boundary identification method based on large language model interpretability of the above-mentioned first aspect or any implementation method of the first aspect.
[0034] In a fifth aspect, the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement the knowledge boundary identification method based on the interpretability of a large language model according to the above-mentioned first aspect or any implementation method of the first aspect.
[0035] Through the above technical solution, the present application provides a knowledge boundary identification method and related devices based on the interpretability of a large language model. In the process of the large language model reasoning and answering the target question, the intermediate state of the large language model is extracted; prompt words are constructed, and the intermediate state is injected into the large language model to obtain the natural language interpretation output by the large language model; by evaluating the correlation between the natural language interpretation and the target question, the knowledge boundary of the large language model is quantified. Starting from the perspective of the interpretability of the large language model, this application uses natural language to explain the intermediate state, analyzes the internal knowledge recall process of the large language model, and uses correlation evaluation to accurately quantify the knowledge boundary, which can effectively evaluate the model capability and avoid the risk of model hallucination. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0037] Figure 1 A flowchart of a knowledge boundary identification method based on the interpretability of a large language model provided in an embodiment of the present application;
[0038] Figure 2 A partial flow chart of a knowledge boundary identification method based on the interpretability of a large language model provided in an embodiment of the present application;
[0039] Figure 3 A schematic diagram of another part of the flow chart of a knowledge boundary identification method based on the interpretability of a large language model provided in an embodiment of the present application;
[0040] Figure 4 A schematic diagram of another part of the flow chart of a knowledge boundary identification method based on the interpretability of a large language model provided in an embodiment of the present application;
[0041] Figure 5 A schematic diagram of the structure of a knowledge boundary identification device based on the interpretability of a large language model provided in an embodiment of the present application;
[0042] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.
[0044] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0045] The terms "first", "second" etc. in the specification of the application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable in appropriate circumstances, and this is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0046] To facilitate understanding of this application, the following first describes the relevant concepts involved in this application:
[0047] Big Language Model: It is a natural language processing model trained on a large amount of text data using deep learning technology, designed to understand, generate and process natural language text. The Big Language Model is based on the Transformer architecture and is a major breakthrough in deep learning and natural language processing. It can use the richness of language to abstract concepts, sort out thought processes, understand complex queries, and formulate strategies and solutions in decision-making scenarios, providing a solid technical foundation for automation and intelligence.
[0048] Embedding: refers to the internal representations generated by each intermediate layer (attention layer, feedforward network layer) in the large language model. These internal representations reflect the understanding and feature extraction of the input information at different levels of the large language model.
[0049] Knowledge boundary: refers to the range of questions that the large language model itself can grasp and accurately answer. Once it exceeds this range, the accuracy and credibility of the generated content may decline. The knowledge boundary is limited by the quality, coverage and timeliness of the training data.
[0050] Large language model hallucination: It is one of the main factors affecting the accuracy and reliability of the model, and can be divided into two categories: factual hallucination and faithfulness hallucination. Among them, factual hallucination refers to the inconsistency between the content generated by the large language model and the verifiable real-world facts, while faithfulness hallucination refers to the inconsistency between the content generated by the large language model and the user's instructions or context.
[0051] After research, the applicant found that the lack of knowledge boundary perception ability of large language models is mainly due to the following reasons:
[0052] 1) Incomplete training data: The training data of large language models often cannot cover all knowledge.
[0053] 2) Outdated knowledge: Large language models are trained based on static data and it is difficult to fully cover the latest and accurate knowledge information.
[0054] 3) Impact of learning paradigm: The learning mechanism of instruction fine-tuning and alignment is designed to encourage large language models to generate text content. Regardless of whether it knows relevant knowledge or not, the large language model will cater to human preferences, force a sentence to be completed, and generate content that seems reasonable but is actually wrong.
[0055] At present, artificial intelligence represented by large language models is promoting technological innovation at an unprecedented speed. Identifying the knowledge boundaries of large models, reducing the risk of hallucinations in the output of large language models, and improving model reliability and accuracy are pain points that need to be solved urgently.
[0056] To solve the above problems, this application designs a general and scalable knowledge boundary identification method from the perspective of large language model interpretability. It does not require labeled data, nor does it require training or fine-tuning of the model. It is applicable to the mainstream large language model of the Decode-Only architecture. The following is a detailed introduction to the knowledge boundary identification method based on the interpretability of the large language model in the embodiment of this application in conjunction with the accompanying drawings.
[0057] See also Figure 1 , Figure 1 A flow chart of a knowledge boundary identification method based on the interpretability of a large language model provided in an embodiment of the present application. Figure 1 As shown, a knowledge boundary identification method based on the interpretability of a large language model provided in an embodiment of the present application may include steps S10 to S20, and these steps are described in detail below.
[0058] S10, extracting the intermediate state of the large language model during the process of the large language model reasoning and answering the target question.
[0059] In the embodiment of the present application, the target question is input to the large language model so that the large language model can reason and answer the target question. In the process of reasoning and answering by the large language model, the intermediate state of the large language model is cached and extracted, and the intermediate state is the vector representation of the output of the intermediate layer, i.e., Embedding.
[0060] In a possible implementation, the intermediate state can be extracted by sampling the embedding position. Figure 2 , Figure 2 A partial flow chart of a knowledge boundary identification method based on the interpretability of a large language model provided in an embodiment of the present application. Figure 2 As shown, an embodiment of the present application provides a knowledge boundary identification method based on the interpretability of a large language model, wherein step S10 "extracting the intermediate state of the large language model" may include steps S101 to S104, and these steps are described in detail below.
[0061] S101, cache the Embedding output by the middle layer of the large language model.
[0062] In an embodiment of the present application, the transformer_lens framework is used to cache the Embeddings output by each intermediate layer of the large language model.
[0063] S102, using the index position of the target problem as the horizontal coordinate and the number of the middle layer as the vertical coordinate to generate the Embedding position.
[0064] In the embodiment of the present application, the input layer of the large language model converts the target question into a token sequence through operations such as word segmentation, so different phrases in the target question have unique index positions (i.e., token index positions) in the token sequence. To this end, the different index positions corresponding to the target question can be used as the horizontal coordinates and the number of layers in the middle layer as the vertical coordinates to generate multiple coordinate points representing the embedding positions. middle , ,in, Indicates the length of the Token sequence, Indicates the total number of intermediate layers.
[0065] S103, sampling the Embedding position to obtain a sampling position.
[0066] In the embodiment of the present application, the coordinate points are sampled according to a certain sampling ratio. Sampling is performed, and the sampled multiple coordinate points are used as sampling positions.
[0067] S104, taking the Embedding at the sampling position extracted from the cache result as the intermediate state.
[0068] In the embodiment of the present application, embeddings (expressed as ), for subsequent interpretation and evaluation.
[0069] S20, constructs prompt words and injects the intermediate state into the large language model to obtain a natural language interpretation of the output of the large language model.
[0070] In the embodiment of the present application, prompt words are constructed to give full play to the decoding ability of the large language model with a decode-only architecture, so that the large language model can explain its own middle-layer Embedding in natural language, that is, to restore the problem-related knowledge stored in the parameters of the large language model into the form of natural language.
[0071] In one possible implementation, the intermediate state can be injected into the shallow layer of the large language model to obtain the natural language interpretation of the intermediate state output by the large language model. Figure 3 , Figure 3 Another partial flow chart of a method for identifying knowledge boundaries based on the interpretability of a large language model provided in an embodiment of the present application. Figure 3 As shown, an embodiment of the present application provides a knowledge boundary identification method based on the interpretability of a large language model, wherein step S20 "injecting the intermediate state into the large language model by constructing prompt words" may include steps S201 to S203, and these steps are described in detail below.
[0072] S201, obtaining common prompt words for context understanding and information extraction.
[0073] Large language models have strong context understanding and information extraction capabilities. For example, given a prompt word " Context , please summarize the above content: ", the large language model will extract the key content in the context and respond. Based on this, in the embodiment of the present application, "context" can be replaced with "intermediate state", so that the knowledge contained in the embedding of the middle layer can be summarized and output in the form of natural language, so as to achieve the purpose of explaining the knowledge recall process inside the large language model.
[0074] However, since the input of the large language model is a sequence of tokens, the intermediate state cannot be directly fed into the input layer of the large language model. To this end, this application needs to inject the intermediate state into the shallow layer of the large language model (for example, the middle layer of the second or third layer), reserve a position for the intermediate state in the prompt word, and set a placeholder "0".
[0075] Therefore, the general prompt words constructed are: 0 Please summarize the above:".
[0076] S202, generating a target prompt word corresponding to the intermediate state based on the general prompt word, and inputting the target prompt word into the large language model.
[0077] In the embodiment of the present application, for different Embeddings in the intermediate state, the Embeddings can be placed in the general prompt words respectively to obtain the target prompt words corresponding to the Embeddings, and the target prompt words are input into the large language model.
[0078] S203, injecting the intermediate state into a target intermediate layer of the large language model, where the target intermediate layer is a non-first intermediate layer of the large language model.
[0079] In an embodiment of the present application, for different Embeddings in the intermediate state, after the target prompt word is input into the large language model, the Embedding is further injected into the shallow layer of the large language model, and the shallow layer is the target intermediate layer that is not the first intermediate layer, and the target intermediate layer is preferably the second or third intermediate layer.
[0080] The large language model obtains a natural language interpretation of the Embedding based on the injected Embedding and the target prompt word by repeatedly speaking the next token.
[0081] S30, quantifies the knowledge boundaries of large language models by evaluating the relevance of natural language explanations to the target question.
[0082] In an embodiment of the present application, for the natural language interpretations of different Embeddings in the intermediate state, the natural language interpretation of each Embedding and the target question can be combined into a question-answer pair to evaluate the correlation between the natural language interpretation and the target question in the question-answer pair, and the average of multiple scores with the highest correlation is used as the quantitative score of the knowledge boundary.
[0083] In one possible implementation, a ranking model can be used to assess the relevance of natural language explanations to the target question. Figure 4 , Figure 4 Another partial flow chart of a method for identifying knowledge boundaries based on the interpretability of a large language model provided in an embodiment of the present application. Figure 4 As shown, an embodiment of the present application provides a knowledge boundary identification method based on the interpretability of a large language model, wherein step S30 "quantifies the knowledge boundary of the large language model by evaluating the relevance of the natural language interpretation to the target problem" may include steps S301 to S303, and these steps are described in detail below.
[0084] S301, taking the natural language interpretation as knowledge and the target question to form a question-answer pair.
[0085] In an embodiment of the present application, for the natural language interpretations of different Embeddings in the intermediate state, the natural language interpretation of each Embedding can be used as knowledge and the target question to form a question-answer pair.
[0086] On this basis, the internal knowledge base of the large language model can be constructed based on the knowledge of different embeddings. Specifically, the knowledge of different embeddings is summarized, and a dictionary-like data structure is obtained in the form of key-value pairs of "coordinate point: natural language interpretation", and stored as a Json file. The Json file contains a series of relevant knowledge decoded by the large language model during the forward transmission process based on the input (i.e., the target question) and the internal parameters of the model, which can be called the internal knowledge base.
[0087] S302, using the ranking model to score the question-answer pair, the score is used to characterize the relevance of the knowledge to the target question.
[0088] In the embodiment of the present application, in order to measure the knowledge boundary of the large language model, that is, the degree to which the large language model has mastered the knowledge required to answer the target question, it is necessary to evaluate the relevance of the knowledge in each question-answer pair to the target question. Specifically, the BGE reordering model can be used to score each question-answer pair, and the score can reflect the relevance of the knowledge in the question-answer pair to which it belongs and the target question, which can be understood as the degree of support of the knowledge for the large language model to answer the target question. The higher the score, the higher the relevance.
[0089] S303, selecting the target knowledge with the highest score from the knowledge, and taking the average of the scores of the target knowledge as the quantitative score of the knowledge boundary.
[0090] In the embodiment of the present application, according to the score of each question-answer pair, the knowledge with the top N scores (N is generally 5) can be selected as the target knowledge to form the most relevant knowledge set. The mean score of the knowledge set is used as the quantitative score of the knowledge boundary of the large language model to indicate the mastery of the target question by the large language model.
[0091] On this basis, quantitative hints of knowledge boundaries can be output based on the quantitative scores. Specifically, if the quantitative score is greater than 1.0, it indicates that the large language model is proficient in this type of knowledge; if the quantitative score is between -1.0 and 1.0, it indicates that the knowledge boundary of the large language model is relatively vague, and the output may be hallucinatory; if the quantitative score is less than -1.0, it indicates that the large language model does not have this type of knowledge, the target problem exceeds the knowledge boundary of the large language model, and the output is likely to be hallucinatory. In this regard, the quantitative score can be fed back to the large language model as a quantitative hint to prompt the large language model to refuse to output at this time and admit that it "does not know" the relevant knowledge.
[0092] Through the above description, the embodiment of the present application provides a knowledge boundary identification method based on the interpretability of a large language model, which explores the knowledge boundary of a large language model from the perspective of the interpretability of a large language model, and realizes the organic combination of the interpretability of a large language model and the quantification of the knowledge boundary. This application has the following advantages:
[0093] 1) High interpretability. This application is based on the interpretability of embeddings in large language models, exploring the knowledge boundaries of large language models, and maintaining high interpretability while quantifying the model's mastery of relevant knowledge.
[0094] 2) Universality. This application does not require a large amount of labeled data or fine-tuning of the training model, but can accurately quantify the knowledge boundaries of large models, effectively evaluate model capabilities, and avoid model hallucination risks.
[0095] 3) Scalability. The embedding extraction, interpretation, and model internal knowledge scoring process proposed in this application is universal and applicable to large language models with mainstream Decode-Only architecture.
[0096] The above introduces a knowledge boundary identification method based on the interpretability of a large language model provided in an embodiment of the present application. The following will introduce a device for executing the above-mentioned knowledge boundary identification method based on the interpretability of a large language model.
[0097] See also Figure 5 , Figure 5 A schematic diagram of the structure of a knowledge boundary identification device based on the interpretability of a large language model provided in an embodiment of the present application. Figure 5 As shown, an embodiment of the present application provides a knowledge boundary identification device based on the interpretability of a large language model, including:
[0098] A state extraction module 10 is used to extract the intermediate state of the large language model during the process of the large language model reasoning and answering the target question;
[0099] A state injection module 20, used to construct a prompt word and inject the intermediate state into the large language model to obtain a natural language interpretation of the output of the large language model;
[0100] The knowledge boundary quantification module 30 is used to quantify the knowledge boundary of the large language model by evaluating the relevance of the natural language interpretation to the target problem.
[0101] In a possible implementation, the state extraction module 10 for extracting the intermediate state of the large language model is specifically used to:
[0102] Cache the Embedding output by the middle layer of the large language model; use the index position of the target question as the horizontal coordinate and the number of layers in the middle layer as the vertical coordinate to generate the Embedding position; sample the Embedding position to obtain the sampling position; extract the Embedding at the sampling position from the cached result as the intermediate state.
[0103] In a possible implementation, the state injection module 20 for injecting the intermediate state into the large language model by constructing a prompt word is specifically used to:
[0104] Obtain common prompt words for context understanding and information extraction; generate target prompt words corresponding to the intermediate state based on the common prompt words, and input the target prompt words into the large language model to inject the intermediate state into the target intermediate layer of the large language model, where the target intermediate layer is a non-first intermediate layer of the large language model.
[0105] In a possible implementation, the knowledge boundary quantification module 30 is specifically configured to:
[0106] The natural language interpretation is used as a question-answer pair consisting of knowledge and the target question. The question-answer pairs are scored using a ranking model, and the score is used to characterize the relevance between the knowledge and the target question. The target knowledge with the highest score is selected from the knowledge, and the mean of the target knowledge's scores is used as the quantitative score of the knowledge boundary.
[0107] In a possible implementation, the knowledge boundary quantification module 30 is further configured to:
[0108] Output quantitative hints of knowledge boundaries based on the quantitative scores.
[0109] In a possible implementation, the knowledge boundary quantification module 30 is further configured to:
[0110] Build an internal knowledge base of a large language model based on knowledge.
[0111] It should be noted that the detailed functions of each module in the embodiment of the present application can be found in the corresponding public part of the above-mentioned knowledge boundary identification method embodiment based on the interpretability of a large language model, and will not be repeated here.
[0112] The present application also provides an electronic device in an embodiment. Figure 6 , Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Figure 6 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0113] like Figure 6 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 to a random access memory (RAM) 603. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 603. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0114] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a memory card, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0115] An embodiment of the present application also provides a computer program product, including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any one of the knowledge boundary identification methods based on large language model interpretability provided in the embodiments of the present application.
[0116] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any one of the knowledge boundary identification methods based on the interpretability of a large language model provided in the embodiment of the present application.
[0117] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0118] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0119] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0120] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
Claims
1. A knowledge boundary identification method based on the interpretability of a large language model, characterized in that: The knowledge boundary identification method based on the interpretability of the large language model includes: In the process of the large language model reasoning and answering the target question, extracting the intermediate state of the large language model; Constructing a prompt word, and injecting the intermediate state into the large language model to obtain a natural language interpretation of the output of the large language model; The knowledge boundary of the large language model is quantified by evaluating the relevance of the natural language interpretation to the target question.
2. The knowledge boundary identification method based on large language model interpretability according to claim 1 is characterized in that: The extracting the intermediate state of the large language model includes: Cache the Embedding output by the middle layer of the large language model; The index position of the target problem is used as the horizontal coordinate and the number of the intermediate layers is used as the vertical coordinate to generate the embedding position; Sampling the Embedding position to obtain a sampling position; The Embedding at the sampling position is extracted from the cache result as the intermediate state.
3. The knowledge boundary identification method based on large language model interpretability according to claim 1 is characterized in that: The step of constructing the prompt word and injecting the intermediate state into the large language model includes: Acquire common cue words for context understanding and information extraction; Generate a target prompt word corresponding to the intermediate state based on the general prompt word, and input the target prompt word into the large language model; The intermediate state is injected into a target intermediate layer of the large language model, where the target intermediate layer is a non-first intermediate layer of the large language model.
4. The knowledge boundary identification method based on large language model interpretability according to claim 1 is characterized in that: The step of quantifying the knowledge boundary of the large language model by evaluating the relevance of the natural language interpretation to the target problem comprises: The natural language interpretation is used as knowledge to form a question-answer pair with the target question; Scoring the question-answer pair using a ranking model, wherein the score is used to characterize the relevance of the knowledge to the target question; The target knowledge with the highest score is selected from the knowledge, and the average of the scores of the target knowledge is used as the quantitative score of the knowledge boundary.
5. The knowledge boundary identification method based on large language model interpretability according to claim 1 is characterized in that: The step of quantifying the knowledge boundary of the large language model by evaluating the relevance of the natural language interpretation to the target question further includes: A quantitative hint of the knowledge boundary is output according to the quantitative score.
6. The knowledge boundary identification method based on large language model interpretability according to claim 1 is characterized in that: The step of quantifying the knowledge boundary of the large language model by evaluating the relevance of the natural language interpretation to the target question further includes: An internal knowledge base of the large language model is constructed based on the knowledge.
7. A knowledge boundary identification device based on the interpretability of a large language model, characterized in that: The knowledge boundary identification device based on the interpretability of the large language model includes: A state extraction module, used to extract the intermediate state of the large language model during the process of the large language model reasoning and answering the target question; A state injection module, used to construct a prompt word and inject the intermediate state into the large language model to obtain a natural language interpretation output by the large language model; A knowledge boundary quantification module is used to quantify the knowledge boundary of the large language model by evaluating the relevance of the natural language interpretation to the target problem.
8. A computer program product, characterized in that It includes computer-readable instructions, and when the computer-readable instructions are executed on an electronic device, the electronic device implements the knowledge boundary identification method based on the interpretability of a large language model as described in any one of claims 1 to 6.
9. An electronic device, characterized in that: The method comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the electronic device can implement the knowledge boundary identification method based on large language model interpretability as described in any one of claims 1 to 6.
10. A computer storage medium, characterized in that: The storage medium carries one or more computer programs, which, when executed by an electronic device, enable the electronic device to implement the knowledge boundary identification method based on large language model interpretability as described in any one of claims 1 to 6.
Citation Information
Cited By
Big language model illusion elimination method and device, equipment and storage medium
CN119849509A
A Method, Device, Equipment and Storage Medium for Eliminating Hallucinations in Large Language Models
CN119849509B