Dynamic comparison decoding method and device based on conflict perception, equipment and medium

Through the dynamic contrast decoding method based on conflict perception, real-time decision-making uses greedy decoding or contrast decoding methods, the problem of low answer accuracy and poor readability when answering user questions is solved, and the accuracy and content quality of the question and answer are improved .

CN119293172APending Publication Date: 2025-01-10PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411362685.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

When answering user questions, the answer accuracy of the current financial model is low, and the generated content is poorly readable, especially in the conflict-free scenarios where the question-and-answer accuracy decreases and the generated content readability decreases.

Method used

Through a dynamic contrast and decoding method based on conflict perception, the internal state of the model is detected in real time. If there is conflict, the contrast and decoding method is used to focus the model on the context to reduce conflict competition; if there is no conflict, the greedy decoding method is used to combine the context and the internal parameter knowledge of the model. answer the questions.

Benefits of technology

It improves the accuracy of model Q&A and readability of generated content in conflict-free scenarios, and enhances the overall performance of the model in handling conflict-free scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119293172A_ABST
    Figure CN119293172A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of artificial intelligence, discloses a dynamic comparison decoding method and device for conflict perception, computer equipment and a storage medium, and aims to detect an internal state of a model in real time, perceive whether a conflict occurs and dynamically decide whether to use a comparison decoding mode or not based on whether a current context conflicts with internal parameter knowledge of the model or not. If it is determined that the internal state of the model is conflicts, the model is focused on the context in a contrast decoding mode, and competition between conflicts is reduced. On the contrary, if the internal state of the model is no conflict, a simple greedy decoding mode is combined with the context and the internal parameter knowledge of the model to answer the question, so that the question and answer accuracy of the model and the readability of the generated content under the conflict-free scene can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a dynamic contrast decoding method, device, equipment and medium based on conflict perception. Background Art

[0002] Currently, artificial intelligence technology is widely used in the intelligent customer service Q&A of financial big models. After the customer enters the question, the financial big model outputs the corresponding answer based on the question entered by the user and feeds it back to the user.

[0003] However, the inventors often find that the currently used models have low accuracy in providing answers to users when answering user questions, and the generated content has poor readability. Summary of the invention

[0004] The present invention provides a dynamic contrast decoding method, device, computer equipment and medium based on conflict perception to solve the technical problems of low accuracy of answers fed back to users and poor readability of generated content.

[0005] In a first aspect, a dynamic contrast decoding method based on conflict perception is provided, comprising:

[0006] Receive user questions and context;

[0007] The user question and context are input into the retrieval enhanced language model to extract the hidden layer activation value corresponding to the preset hidden layer in the retrieval enhanced language model; the internal state of the model is determined according to the hidden layer activation value corresponding to the preset hidden layer; if the internal state of the model is that there is no conflict, the greedy decoding method is used to decode to determine the answer; if the internal state of the model is that there is a conflict, the user question is input into the retrieval enhanced language model, and the contrast decoding method is used to decode to determine the answer.

[0008] In a second aspect, a dynamic contrast decoding device based on conflict perception is provided, comprising:

[0009] A receiving unit, used for receiving user questions and contexts;

[0010] A first input unit, used to input the user question and context into the retrieval enhanced language model to extract a hidden layer activation value corresponding to a preset hidden layer in the retrieval enhanced language model;

[0011] A determination unit, which determines the internal state of the model according to the hidden layer activation value corresponding to the preset hidden layer;

[0012] The judgment unit uses greedy decoding to decode to determine the answer if the internal state of the model is that there is no conflict; if the internal state of the model is that there is a conflict, the user question is input into the retrieval enhanced language model and decoded using comparative decoding to determine the answer.

[0013] In a third aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the conflict-aware dynamic contrast decoding method when executing the computer program.

[0014] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the conflict-aware dynamic contrast decoding method are implemented.

[0015] In the scheme implemented by the above-mentioned conflict-aware dynamic contrast decoding method, device, computer equipment and storage medium, user questions and context can be received; the user questions and context are input into the retrieval enhanced language model to extract the hidden layer activation value corresponding to the preset hidden layer in the retrieval enhanced language model; the internal state of the model is determined according to the hidden layer activation value corresponding to the preset hidden layer; if the internal state of the model is that there is no conflict, the greedy decoding method is used for decoding to determine the answer; if the internal state of the model is that there is a conflict, the user question is input into the retrieval enhanced language model and the contrast decoding method is used for decoding to determine the answer. In the present invention, based on whether there is a conflict between the current context and the internal parameter knowledge of the model, the internal state of the model is detected in real time, whether the conflict occurs, and whether to use the contrast decoding method is dynamically decided. If it is determined that the internal state of the model is that there is a conflict, the contrast decoding method is used to focus the model's attention on the context and reduce the competition between conflicts. On the contrary, if the internal state of the model is that there is no conflict, a simple greedy decoding method is used to combine the context and the internal parameter knowledge of the model to answer the question, which can improve the accuracy of the model question answering and the readability of the generated content in the conflict-free scenario. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0017] Figure 1 is a schematic diagram of an application environment of a dynamic contrast decoding method based on conflict perception in an embodiment of the present invention;

[0018] Figure 2 is a flow chart of a dynamic contrast decoding method based on conflict perception in one embodiment of the present invention;

[0019] Figure 3 is another flow chart of a dynamic contrast decoding method based on conflict perception in one embodiment of the present invention;

[0020] Figure 4 is another flow chart of a dynamic contrast decoding method based on conflict perception in one embodiment of the present invention;

[0021] Figure 5 is a structural diagram of an intelligent question-answering processing device in one embodiment of the present invention;

[0022] Figure 6 is a schematic diagram of a structure of a computer device in one embodiment of the present invention;

[0023] Figure 7 It is another structural schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION

[0024] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0025] Currently, artificial intelligence technology is widely used in the intelligent customer service Q&A of financial big models. After the customer enters the question, the financial big model outputs the corresponding answer based on the question entered by the user and feeds it back to the user.

[0026] However, the inventors often find that the currently used models have low accuracy in providing answers to users when answering user questions, and the generated content has poor readability.

[0027] After research, the inventors found that the model currently used is the retrieval-augmented language model (RALMs). When a customer inputs a question, RALMs first searches the external knowledge base to obtain reference materials related to the question; then the reference materials are input into the model together with the question to generate an answer. The method that is loyal to the external knowledge base can adaptively use the contrastive decoding method to improve the utilization rate of the language model in recalling external knowledge in conflict scenarios. However, the recalled external knowledge usually conflicts with the parameter knowledge inside the model. When a conflict occurs, the model will fall into a competition between external knowledge and internal knowledge, resulting in unpredictable generated content, which limits the applicability of the model. The contrastive decoding method is currently used to solve the problem of conflict between external knowledge and internal knowledge. By focusing the model's attention on the context containing the correct answer, the competition between conflicting knowledge is reduced, and the model's utilization of external knowledge is improved. However, when dealing with questions and answers in non-conflict scenarios, the contrastive decoding method will have the problems of reduced question and answer accuracy and reduced readability of generated content: (1) Reduced question and answer accuracy: Most contrastive decoding methods focus the model's attention entirely on the context, thereby guiding the model to generate answers that are more in line with the context. However, in non-conflict scenarios, the combination of the model's own parameter knowledge and contextual knowledge can provide better answers. The contrastive decoding method will damage the model's use of its own parameter knowledge, thereby reducing the accuracy of question answering in non-conflict scenarios. (2) Reduced readability of generated content: The contrastive decoding method usually needs to process inputs with and without context at the same time and compare the probability distributions of the two to highlight the results with context. However, the decoding paths of the model with and without context are inconsistent, and the generation method of contrastive decoding may lead to reduced readability of generated content.

[0028] The conflict-aware dynamic contrast decoding method provided by the embodiment of the present invention can be applied in the following aspects: Figure 1In an application environment, the client communicates with the server through a network. The server can receive user questions and contexts through the client; input the user questions and contexts into the retrieval enhanced language model to extract the hidden layer activation values ​​corresponding to the preset hidden layers in the retrieval enhanced language model; determine the internal state of the model according to the hidden layer activation values ​​corresponding to the preset hidden layers; if the internal state of the model is that there is no conflict, the greedy decoding method is used to decode to determine the answer; if the internal state of the model is that there is a conflict, the user question is input into the retrieval enhanced language model, and the contrast decoding method is used to decode to determine the answer, and the answer is fed back to the client. In the present invention, based on whether there is a conflict between the current context and the internal parameter knowledge of the model, that is, the internal state of the model is detected in real time, whether the conflict occurs, and whether to use the contrast decoding method is dynamically decided. If it is determined that the internal state of the model is that there is a conflict, the contrast decoding method is used to focus the model's attention on the context and reduce the competition between conflicts. On the contrary, if the internal state of the model is that there is no conflict, a simple greedy decoding method is used to combine the context and the internal parameter knowledge of the model to answer the question, which can improve the accuracy of the model question and answer and the readability of the generated content in the conflict-free scenario.

[0029] The client may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices. The server may be implemented by an independent server or a server cluster consisting of multiple servers. The present invention is described in detail below through specific embodiments.

[0030] See also Figure 2 As shown, Figure 2 A schematic flow chart of a conflict-aware dynamic contrast decoding method provided by an embodiment of the present invention includes the following steps S100-S400.

[0031] S100: Receive user questions and context. For example, the user question may be: What are Ping An's current main insurance products? The context may be: In recent years, Ping An has vigorously promoted financial technology and Internet insurance business, launched a variety of online insurance products, such as health insurance, auto insurance, Internet life insurance, etc., and provided customers with more efficient services through big data and artificial intelligence technologies.

[0032] S200: Inputting the user question and context into a retrieval enhanced language model to extract a hidden layer activation value corresponding to a preset hidden layer in the retrieval enhanced language model.

[0033] In the embodiment of the present application, the retrieval enhanced language model includes an input layer, a hidden layer and an output layer. The hidden layer is a layer between the input layer and the output layer, wherein the input layer is used to accept direct input from the outside world, and the output layer is used to directly output the final result. The hidden layer does not accept direct input from the outside world, nor does it directly output the final result. The number of the hidden layers can be multiple. Each neuron in the hidden layer will calculate a value based on the input and weight. The result obtained after this value is processed by the activation function is the activation value of the neuron. The activation value of the neuron reflects the processing result of the hidden layer neuron on the input data, and is the key to the nonlinear transformation and feature extraction of the neural network. The hidden layer activation value is the set of activation values ​​of all neurons in the hidden layer. The internal state of the model is different, and the hidden layer activation value will have a large fluctuation. In this way, the internal state of the model can be determined later through the hidden layer activation value.

[0034] S300: Determine the internal state of the model according to the hidden layer activation value corresponding to the preset hidden layer.

[0035] In the embodiment of the present application, the internal state of the model is no conflict and conflict exists. No conflict can be understood as no conflict between external knowledge and model internal parameter knowledge, that is, no conflict between context and model internal parameter knowledge. Conflict exists can be understood as conflict between external knowledge and model internal parameter knowledge, that is, conflict between context and model internal parameter knowledge.

[0036] In some embodiments, the step of determining the internal state of the model based on the hidden layer activation value corresponding to the preset hidden layer includes: inputting the hidden layer activation value corresponding to the preset hidden layer into a preset model to determine the internal state of the model, wherein the preset model is trained based on a conflict data set, the conflict data set includes at least one conflict data, the conflict data includes the hidden layer activation value and the internal state of the model, and the internal state of the model includes the presence of a conflict and the absence of a conflict.

[0037] In this embodiment, the conflict data set can be used to train a binary classifier to obtain a preset model. The conflict data in the conflict data set can be constructed as (h l ,0) or (h l ,1) in the form of h l It is the hidden layer activation value of the lth layer. 0 and 1 represent the internal state of the model. The internal state of the model includes the existence of conflict and the absence of conflict. 0 represents the absence of conflict and 1 represents the existence of conflict.

[0038] In some embodiments, while training the preset model using the conflict data set, the judgment accuracy of the hidden layer activation value of each hidden layer is recorded and the top K hidden layers with high judgment accuracy are determined, and the preset hidden layers are the hidden layers with high judgment accuracy of the top K; Figure 3Another flowchart of the conflict-aware dynamic contrast decoding method provided by an embodiment of the present invention, wherein the step of inputting the hidden layer activation value corresponding to the preset hidden layer into the preset model to determine the internal state of the model includes S301-S308.

[0039] S301, inputting the hidden layer activation values ​​of the hidden layers with the highest judgment accuracy of the top K names into a preset model to determine the internal state of the model;

[0040] S302, judging whether conflicts exist in the internal states of the model based on the hidden layer activation values ​​of the hidden layers with the highest accuracy of the top K judgments.

[0041] S303: If the internal states of the model determined by the hidden layer activation values ​​of the hidden layers with high judgment accuracy of the top K are all conflicts, it is finally determined that the internal state of the model is a conflict.

[0042] In this embodiment, the judgment accuracy can be understood as the accuracy of the hidden layer activation value of the hidden layer in determining the internal state of the model. Since the number of hidden layers may be multiple, in this embodiment, the top K hidden layers with high judgment accuracy are screened out. The hidden layer activation values ​​of the hidden layers with high judgment accuracy of the top K are input into the preset model to determine the internal state of the model determined by the hidden layer activation values ​​of the hidden layers with high judgment accuracy of the top K. If the hidden layer activation values ​​of the hidden layers with high judgment accuracy of the top K determine that the internal state of the model is all in conflict, then the internal state of the model is finally determined to be in conflict.

[0043] In some embodiments, S304, if the internal states of the model determined according to the hidden layer activation values ​​of the hidden layers with high judgment accuracy of the top K names are all free from conflict, then it is finally determined that the internal state of the model is free from conflict.

[0044] In some embodiments, the method further comprises:

[0045] S305. If it is determined that part of the model's internal state is in the existent state and part is in the non-existent state according to the hidden layer activation values ​​of the hidden layers with high accuracy of the top K judgments, then the number of model internal states where the model's internal state is in conflict and the number of model internal states where the model's internal state is in non-conflict are counted; S306. Compare the number of model internal states where the model's internal state is in conflict with the number of model internal states where the model's internal state is in non-conflict. S307. If the number of model internal states where the model's internal state is in conflict is greater than or equal to the number of model internal states where the model's internal state is in non-conflict, then it is finally determined that the model's internal state is in conflict; S308. If the number of model internal states where the model's internal state is in conflict is less than the number of model internal states where the model's internal state is in non-conflict, then it is determined that the model's internal state is in non-conflict.

[0046] In this way, the hidden layer activation values ​​of K hidden layers with high judgment accuracy can more accurately determine the internal state of the model and more accurately understand whether there is a conflict between the context and the internal parameter knowledge of the model.

[0047] S400: If the internal state of the model is that there is no conflict, a greedy decoding method is used for decoding to determine the answer; if the internal state of the model is that there is a conflict, the user question is input into the retrieval enhanced language model and a comparative decoding method is used for decoding to determine the answer.

[0048] In the embodiment of the present application, if the internal state of the model is that there is no conflict, directly using the comparative decoding method will result in low accuracy of the model question and answer, and low readability of the generated content, so before decoding, the internal state of the model is first determined. If there is a conflict, the comparative decoding method is used for decoding to determine the answer, so that the model can focus on the context and reduce competition between conflicts. If there is no conflict, the greedy decoding method is used for decoding to determine the answer, so that the context and the knowledge of the internal parameters of the model can be combined to answer the question, solving the problem of low accuracy of the model question and answer and poor readability of the content when the comparative decoding method is used in the scenario where there is no conflict.

[0049] Exemplarily, refer to the user question and context in the example in step S100. If the internal state of the model is that there is no conflict, the greedy decoding method is used for decoding, and the decoded answer may be that Ping An's main insurance products include traditional life insurance and auto insurance products, and the service objects widely cover individual and corporate customers. If the internal state of the model is that there is a conflict, the comparative decoding method is used for decoding, and the decoded answer may be that China Ping An's current main insurance products include health insurance, auto insurance and Internet life insurance, and it provides customers with intelligent services such as online insurance and claims through its financial technology platform.

[0050] In the embodiment of the present application, when the internal state of the model is that there is no conflict, the greedy decoding method can ensure that the model can better utilize the model's internal parameter knowledge and context at the same time to obtain a more comprehensive and accurate answer. In some embodiments, only a simple instruction can be set in the prompt word to prompt the model to answer the question in combination with the context and the model's internal parameter knowledge. Exemplary, the prompt word is to answer the question with the following context and the model's internal parameter knowledge.

[0051] In an embodiment of the present application, when the internal state of the model is a conflict, before using the contrast decoding method for decoding, the user question needs to be separately input into the retrieval enhanced language model. The subsequent contrast decoding method finally determines the answer fed back to the user based on the first answer to be selected and the corresponding probability distribution obtained by inputting the user question and context into the retrieval enhanced language model, and the second answer to be selected and the corresponding probability distribution obtained by inputting the user question into the retrieval enhanced language model. Specifically, the method also includes: inputting the user question and context into the retrieval enhanced language model to extract the hidden layer activation value corresponding to the preset hidden layer in the retrieval enhanced language model, and also determining the first answer to be selected and the probability distribution corresponding to the first answer to be selected; inputting the user question into the retrieval enhanced language model to determine the second answer to be selected and the probability distribution corresponding to the second answer to be selected; the step of using the contrast decoding method to decode to determine the answer includes: determining the answer according to the difference between the probability distribution corresponding to the first answer to be selected and the probability distribution corresponding to the second answer to be selected.

[0052] To put it another way, the retrieval enhanced language model takes the context c and question x as input under the model's internal parameter knowledge θ and generates the probability distribution y of the first answer to be selected t It can be expressed as formula (1):

[0053] y t ~p θ (y t |c,x,y <t )∝explogitθ (y t |c,x,y <t )#(1)

[0054] And only input question x, generate the probability distribution y of the second answer to be selected t It can be expressed as formula (2):

[0055] y t ~p θ (y t |x,y <t )∝explogit θ (y t |x,y <t )#(2)

[0056] When context c contains knowledge that conflicts with the model's internal parameter knowledge θ, it is difficult for the model to focus on and utilize context c, and it is caught in a tug-of-war between conflicting knowledge. To this end, in the presence of conflicts, contrast decoding is used to reduce competition between conflicting knowledge and improve the model's utilization of context. Specifically, by comparing the probability distribution with and without context, the model's attention to context when there is context is magnified, thereby encouraging the model to pay more attention to context when generating answers. The specific approach is as follows:

[0057] y t ~softmax[(1+α)logit θ (y t |c,x,y <t )-αlogit θ (y t |x,y <t )]#(3)

[0058] By amplifying the difference between the probability distribution with and without context, more consideration is given to the output with context, thereby improving the utilization of context in generating answers.

[0059] In some embodiments, Figure 4 Another flow chart of the conflict-aware dynamic contrast decoding method provided in an embodiment of the present invention, a method for determining the difference between the probability distribution corresponding to the first answer to be selected and the probability distribution corresponding to the second answer to be selected, that is, how to obtain the content of formula (3) through formulas (1) and (2) in the above text, includes S401-S402.

[0060] S401, adjusting the probability distribution corresponding to the first answer to be selected by using pointwise mutual information (PMI) and a preset weight, wherein the pointwise mutual information is determined according to the probability distribution corresponding to the first answer to be selected and the probability distribution corresponding to the second answer to be selected;

[0061] S402: subtract the probability distribution corresponding to the adjusted first answer to be selected from the probability distribution corresponding to the second answer to be selected to obtain a difference; normalize the difference to determine the difference between the probability distribution corresponding to the first answer to be selected and the probability distribution corresponding to the second answer to be selected.

[0062] To describe it another way, PMI is used to emphasize the knowledge in context. The calculation method of PMI is:

[0063]

[0064] In this case, since it is assumed in the current scenario that the provided context c must contain the answer to the question x asked by the user, then p θ (y t |c,y <t )=1. So the above formula can be simplified to:

[0065]

[0066] The probability distribution of the output using greedy decoding is p θ (y t |c,x,y <t ), the corresponding PMI should be multiplied on the probability distribution to increase the preset weight of the context, that is, the probability distribution is adjusted by the following formula, and the preset weight α is used to adjust the strength of the probability distribution adjustment:

[0067]

[0068]

[0069] Finally, we get:

[0070]

[0071] Because p θ (y t |c,x,y <t ) is the logit θ (y t |c,x,y <t ) is obtained by finding softmax (normalization), so the above formula is further simplified: y t~softmax[(1+α)logit θ (y t |c,x,y <t )-αlogit θ (y t |x,y <t )].

[0072] In the method in the embodiment of the present application, when the user asks a question, it is perceived in real time whether a conflict occurs, and a dynamic decision is made on which decoding method to use. When there is a conflict between the model's internal parameter knowledge and the context, the conflicting knowledge will form a tug-of-war within the model, resulting in a decrease in the applicability of the model. The use of comparative decoding can reduce the competition between conflicting knowledge when conflicts occur, and improve the model's utilization of context. When there is no conflict, answering questions in combination with the model's internal parameter knowledge and context can obtain more accurate and comprehensive question-and-answer results. By means of dynamic comparative decoding, the overall performance of RALMs in processing financial questions and answers can be improved.

[0073] It can be seen that in the above scheme, based on whether there is a conflict between the current context and the model's internal parameter knowledge, that is, the internal state of the model is detected in real time, whether a conflict occurs is perceived, and a decision is made dynamically whether to use the contrast decoding method. If it is determined that the internal state of the model is in conflict, the contrast decoding method is used to focus the model's attention on the context and reduce competition between conflicts. Conversely, if the internal state of the model is that there is no conflict, a simple greedy decoding method is used to combine the context and the model's internal parameter knowledge to answer the question, which can improve the accuracy of the model question answering and the readability of the generated content in conflict-free scenarios.

[0074] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.

[0075] In one embodiment, a dynamic contrast decoding device based on conflict perception is provided, and the dynamic contrast decoding device based on conflict perception corresponds to the dynamic contrast decoding method based on conflict perception in the above embodiment. Figure 5 As shown, the conflict perception-based dynamic contrast decoding device includes: a receiving unit 501 , a first input unit 502 , a determining unit 503 and a judging unit 504 .

[0076] A receiving unit 501, configured to receive user questions and context;

[0077] A first input unit 502 is used to input the user question and context into the retrieval enhanced language model to extract a hidden layer activation value corresponding to a preset hidden layer in the retrieval enhanced language model;

[0078] A determination unit 503 determines an internal state of the model according to a hidden layer activation value corresponding to the preset hidden layer;

[0079] The judgment unit 504 uses greedy decoding to decode to determine the answer if the internal state of the model is that there is no conflict; if the internal state of the model is that there is a conflict, the user question is input into the retrieval enhanced language model and decoded using comparative decoding to determine the answer.

[0080] In one embodiment, the determining unit 503 includes:

[0081] A determination subunit is used to input the hidden layer activation value corresponding to the preset hidden layer into a preset model to determine the internal state of the model, wherein the preset model is trained based on a conflict data set, the conflict data set includes at least one conflict data, and the conflict data includes the hidden layer activation value and the internal state of the model.

[0082] In one embodiment, the device further comprises:

[0083] The recording unit is used to train the preset model using the conflict data set while recording the judgment accuracy of the hidden layer activation value of each hidden layer and determining the top K hidden layers with high judgment accuracy, and the preset hidden layers are the hidden layers with high judgment accuracy of the top K; the determining subunit is specifically used for:

[0084] Input the hidden layer activation values ​​of the hidden layers with the highest judgment accuracy of the top K names into the preset model to determine the internal state of the model;

[0085] If all the internal states of the model determined by the hidden layer activation values ​​of the hidden layers with high judgment accuracy of the top K are in conflict, it is finally determined that the internal state of the model is in conflict.

[0086] In one embodiment, the determining subunit is further configured to:

[0087] If the internal states of the model determined according to the hidden layer activation values ​​of the hidden layers with high judgment accuracy of the top K are all free of conflict, it is finally determined that the internal state of the model is free of conflict.

[0088] In one embodiment, the determining subunit is further configured to:

[0089] If it is determined that part of the model's internal state is in the existent state and part is in the non-existent state based on the hidden layer activation values ​​of the hidden layers with high judgment accuracy of the top K names, then the number of model internal states in which the model's internal state is in conflict and the number of model internal states in which the model's internal state is in non-conflict are counted; if the number of model internal states in which the model's internal state is in conflict is greater than or equal to the number of model internal states in which the model's internal state is in non-conflict, then it is finally determined that the model's internal state is in conflict; if the number of model internal states in which the model's internal state is in conflict is less than the number of model internal states in which the model's internal state is in non-conflict, then it is determined that the model's internal state is in non-conflict.

[0090] In one embodiment, the device further comprises:

[0091] The second input unit is used to input the user question and context into the retrieval enhanced language model to extract the hidden layer activation value corresponding to the preset hidden layer in the retrieval enhanced language model, and also determine the first answer to be selected and the probability distribution corresponding to the first answer to be selected; input the user question into the retrieval enhanced language model to determine the second answer to be selected and the probability distribution corresponding to the second answer to be selected; the judgment unit is specifically used to: determine the answer according to the difference between the probability distribution corresponding to the first answer to be selected and the probability distribution corresponding to the second answer to be selected.

[0092] In one embodiment, the device further comprises:

[0093] a difference determination unit, configured to adjust the probability distribution corresponding to the first answer to be selected by using inter-point mutual information and a preset weight, wherein the inter-point mutual information is determined according to the probability distribution corresponding to the first answer to be selected and the probability distribution corresponding to the second answer to be selected;

[0094] Subtract the adjusted probability distribution corresponding to the first answer to be selected from the probability distribution corresponding to the second answer to be selected to obtain a difference; normalize the difference to determine the difference between the probability distribution corresponding to the first answer to be selected and the probability distribution corresponding to the second answer to be selected.

[0095] The present invention provides a dynamic contrast decoding device based on conflict perception, which detects the internal state of the model in real time based on whether there is a conflict between the current context and the internal parameter knowledge of the model, perceives whether a conflict occurs, and dynamically decides whether to use a contrast decoding method. If it is determined that the internal state of the model is a conflict, a contrast decoding method is used to focus the model's attention on the context and reduce competition between conflicts. Conversely, if the internal state of the model is that there is no conflict, a simple greedy decoding method is used to combine the context and the internal parameter knowledge of the model to answer the question, which can improve the accuracy of the model question and answer and the readability of the generated content in a conflict-free scenario.

[0096] For the specific limitations of the dynamic contrast decoding device based on conflict perception, please refer to the limitations of the intelligent question and answer method above, which will not be repeated here. The various modules in the above-mentioned dynamic contrast decoding device based on conflict perception can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0097] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client via a network connection. When the computer program is executed by the processor, it realizes the functions or steps on the server side of a dynamic comparison decoding method based on conflict perception.

[0098] In one embodiment, a computer device is provided. The computer device may be a client, and its internal structure diagram may be as follows: Figure 7As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external server through a network connection. When the computer program is executed by the processor, it realizes the functions or steps of the client side of a dynamic contrast decoding method based on conflict perception

[0099] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:

[0100] Receive user questions and context;

[0101] The user question and context are input into the retrieval enhanced language model to extract the hidden layer activation value corresponding to the preset hidden layer in the retrieval enhanced language model; the internal state of the model is determined according to the hidden layer activation value corresponding to the preset hidden layer; if the internal state of the model is that there is no conflict, the greedy decoding method is used to decode to determine the answer; if the internal state of the model is that there is a conflict, the user question is input into the retrieval enhanced language model, and the contrast decoding method is used to decode to determine the answer.

[0102] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0103] Receive user questions and context;

[0104] The user question and context are input into the retrieval enhanced language model to extract the hidden layer activation value corresponding to the preset hidden layer in the retrieval enhanced language model; the internal state of the model is determined according to the hidden layer activation value corresponding to the preset hidden layer; if the internal state of the model is that there is no conflict, the greedy decoding method is used to decode to determine the answer; if the internal state of the model is that there is a conflict, the user question is input into the retrieval enhanced language model, and the contrast decoding method is used to decode to determine the answer.

[0105] It should be noted that the above functions or steps that can be implemented by the computer-readable storage medium or computer device can refer to the relevant descriptions on the server side and the client side in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here.

[0106] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0107] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0108] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A dynamic contrast decoding method based on conflict perception, characterized in that: include: Receive user questions and context; Inputting the user question and context into a retrieval enhanced language model to extract a hidden layer activation value corresponding to a preset hidden layer in the retrieval enhanced language model; Determine the internal state of the model according to the hidden layer activation value corresponding to the preset hidden layer; If the internal state of the model is that there is no conflict, a greedy decoding method is used to decode to determine the answer; If the internal state of the model is that there is a conflict, the user question is input into the retrieval enhanced language model and decoded using a contrast decoding method to determine the answer.

2. The method according to claim 1, characterized in that The step of determining the internal state of the model according to the hidden layer activation value corresponding to the preset hidden layer comprises: The hidden layer activation value corresponding to the preset hidden layer is input into a preset model to determine the internal state of the model, wherein the preset model is trained based on a conflict data set, the conflict data set includes at least one conflict data, and the conflict data includes the hidden layer activation value and the internal state of the model.

3. The method according to claim 2, characterized in that The method further includes: using the conflict data set to train the preset model while recording the judgment accuracy of the hidden layer activation value of each hidden layer and determining the top K hidden layers with high judgment accuracy, wherein the preset hidden layers are the hidden layers with high judgment accuracy; the step of inputting the hidden layer activation value corresponding to the preset hidden layer into the preset model to determine the internal state of the model includes: Input the hidden layer activation values ​​of the hidden layers with the highest judgment accuracy of the top K names into the preset model to determine the internal state of the model; If all the internal states of the model determined by the hidden layer activation values ​​of the hidden layers with high judgment accuracy of the top K are in conflict, it is finally determined that the internal state of the model is in conflict.

4. The method according to claim 3, characterized in that The method further comprises: If the internal states of the model determined according to the hidden layer activation values ​​of the hidden layers with high judgment accuracy of the top K are all free of conflict, it is finally determined that the internal state of the model is free of conflict.

5. The method according to claim 4, characterized in that The method further comprises: If it is determined that part of the model's internal state is in the existent state and part is in the non-existent state based on the hidden layer activation values ​​of the hidden layers with high judgment accuracy of the top K names, then the number of model internal states in which the model's internal state is in conflict and the number of model internal states in which the model's internal state is in non-conflict are counted; if the number of model internal states in which the model's internal state is in conflict is greater than or equal to the number of model internal states in which the model's internal state is in non-conflict, then it is finally determined that the model's internal state is in conflict; if the number of model internal states in which the model's internal state is in conflict is less than the number of model internal states in which the model's internal state is in non-conflict, then it is determined that the model's internal state is in non-conflict.

6. The method according to claim 1, characterized in that Also includes: Inputting the user question and context into the retrieval enhanced language model to extract a hidden layer activation value corresponding to a preset hidden layer in the retrieval enhanced language model, and determining a first answer to be selected and a probability distribution corresponding to the first answer to be selected; inputting the user question into the retrieval enhanced language model to determine a second answer to be selected and a probability distribution corresponding to the second answer to be selected; The step of using the comparative decoding method to decode and determine the answer includes: An answer is determined according to a difference between a probability distribution corresponding to the first answer to be selected and a probability distribution corresponding to the second answer to be selected.

7. The method according to claim 6, characterized in that A method for determining a difference between a probability distribution corresponding to the first answer to be selected and a probability distribution corresponding to the second answer to be selected includes: The probability distribution corresponding to the first answer to be selected is adjusted using point-to-point mutual information and a preset weight, wherein the point-to-point mutual information is determined according to the probability distribution corresponding to the first answer to be selected and the probability distribution corresponding to the second answer to be selected; Subtract the adjusted probability distribution corresponding to the first answer to be selected from the probability distribution corresponding to the second answer to be selected to obtain a difference; normalize the difference to determine the difference between the probability distribution corresponding to the first answer to be selected and the probability distribution corresponding to the second answer to be selected.

8. A dynamic contrast decoding device based on conflict perception, characterized in that: include: A receiving unit, used for receiving user questions and contexts; A first input unit, used to input the user question and context into the retrieval enhanced language model to extract a hidden layer activation value corresponding to a preset hidden layer in the retrieval enhanced language model; A determination unit, which determines the internal state of the model according to the hidden layer activation value corresponding to the preset hidden layer; A judgment unit, if the internal state of the model is that there is no conflict, then uses a greedy decoding method to decode to determine the answer; If the internal state of the model is that there is a conflict, the user question is input into the retrieval enhanced language model and decoded using a contrast decoding method to determine the answer.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the conflict-aware dynamic contrast decoding method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the conflict-aware dynamic contrast decoding method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Large model context conflict resolution method and device based on dynamic coordination decoding

    CN120449863A

  • Method and device for resolving context conflicts of large model based on dynamic coordination decoding

    CN120449863B