Search enhancement generation methods, systems, and related apparatuses

CN119226435BActive Publication Date: 2026-10-30IFLYTEK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411243762.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-05
Publication Date
2026-10-30
Estimated Expiration
2044-09-05

AI Technical Summary

Technical Problem

[0002]随着人工智能技术的不断发展,越来越多的用户倾向于借助人工智能来辅助完成一些知识问答等任务,由用户输入问题然后由人工智能给出回复信息,而随着应用场景越来越复杂,为了尽量确保回复信息的准确性,人工智能检索的参考知识数量会变的越来越多,导致推理耗时越来越大,对应检索增强生成的硬性时延也变得越来越长,影响用户体验

Benefits of technology

[0008]本申请的有益效果是:区别于现有技术的情况,本申请提出的检索增强生成方法,获取知识库里所有候选文本,以及获取对候选文本进行激活值计算得到的对应的参考激活值并缓存,获取使用对象输入的输入文本,并对输入文本进行激活值计算,从而得到问题激活值,获取知识库里的至少一个候选文本作为输入文本对应的参考文本,以及获取参考文本对应的已缓存好的参考激活值,基于输入文本对应的问题激活值和参考文本对应的参考激活值,生成回复文本,由于已经预先对知识库里所有的候选文本进行了激活值计算,得到了对应的参考激活值并缓存,在后续得到输入文本后,无需对选取的对应的参考文本重新进行激活值运算,只需要加载对应的已缓存的参考激活值以及计算输入文本的问题激活值,即可生成回复文本,大大降低了推理过程中的首响计算量,从而能够降低检索增强生成的硬性时延。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119226435B_ABST
    Figure CN119226435B_ABST
Patent Text Reader

Abstract

The application discloses a retrieval enhancement generation method, system and related device, the method comprises the following steps: all candidate texts and corresponding reference activation values in the knowledge base; wherein the reference activation value is obtained by calculating the activation value of the candidate text; obtaining an input text, calculating the activation value of the input text to obtain a question activation value; obtaining at least one candidate text as the reference text corresponding to the input text, and obtaining the cached reference activation value corresponding to the reference text; generating a reply text based on the question activation value and the reference activation value. Through the above method, the application can reduce the hard time delay of retrieval enhancement generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a retrieval enhancement generation method, system, and related apparatus. Background Technology

[0002] With the continuous development of artificial intelligence (AI) technology, more and more users are inclined to use AI to assist in tasks such as answering knowledge-based questions. Users input questions, and AI provides responses. However, as application scenarios become increasingly complex, the amount of reference knowledge retrieved by AI increases to ensure the accuracy of the responses, leading to longer reasoning times and consequently longer hard latency in the generated search enhancements, impacting user experience. Therefore, reducing the hard latency of search enhancement generation has become an urgent problem to be solved. Summary of the Invention

[0003] The main technical problem addressed by this application is to provide a retrieval enhancement generation method, system, and related apparatus that can improve and reduce the hard latency of retrieval enhancement generation.

[0004] To address the aforementioned technical problems, this application provides a retrieval enhancement generation method, comprising: obtaining all candidate texts and their corresponding reference activation values ​​in a knowledge base; wherein the reference activation value is obtained by calculating the activation value of the candidate texts; obtaining input text, calculating the activation value of the input text to obtain a question activation value; obtaining at least one candidate text as a reference text corresponding to the input text, and obtaining the cached reference activation value corresponding to the reference text; and generating a response text based on the question activation value and the reference activation value.

[0005] To address the aforementioned technical problems, another technical solution adopted in this application is: providing a retrieval enhancement generation system, comprising: a first acquisition module, used to acquire all candidate texts and their corresponding reference activation values ​​in a knowledge base; wherein the reference activation value is obtained by calculating the activation value of the candidate text; a calculation module, used to acquire input text, calculate the activation value of the input text, and obtain a question activation value; a second acquisition module, used to acquire at least one of the candidate texts as reference texts corresponding to the input text, and acquire the cached reference activation value corresponding to the reference text; and a generation module, used to generate a response text based on the question activation value and the reference activation value.

[0006] To solve the above-mentioned technical problems, another technical solution adopted in this application is to provide an electronic device, including a memory and a processor coupled to each other, wherein the memory stores program instructions, and the processor is used to execute the program instructions to implement the method mentioned in the above technical solution.

[0007] To solve the above-mentioned technical problems, another technical solution adopted in this application is to provide a computer-readable storage medium storing program instructions that can be executed by a processor, the program instructions being used to implement the method mentioned in the above technical solution.

[0008] The beneficial effects of this application are as follows: Unlike the prior art, the retrieval enhancement generation method proposed in this application obtains all candidate texts in the knowledge base, as well as the corresponding reference activation values ​​obtained by calculating activation values ​​for the candidate texts and caching them; obtains the input text using object input, and calculates the activation values ​​for the input text to obtain the question activation value; obtains at least one candidate text in the knowledge base as the reference text corresponding to the input text, and obtains the cached reference activation value corresponding to the reference text; and generates the response text based on the question activation value corresponding to the input text and the reference activation value corresponding to the reference text. Since the activation values ​​of all candidate texts in the knowledge base have been pre-calculated and the corresponding reference activation values ​​have been obtained and cached, after obtaining the input text later, it is not necessary to recalculate the activation values ​​of the selected corresponding reference text. It is only necessary to load the corresponding cached reference activation value and calculate the question activation value of the input text to generate the response text, which greatly reduces the initial computational load in the reasoning process, thereby reducing the hard latency of retrieval enhancement generation. Attached Figure Description

[0009] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Wherein:

[0010] Figure 1 This is a flowchart illustrating one embodiment of the search enhancement generation method of this application;

[0011] Figure 2 This is a flowchart illustrating another embodiment of the search enhancement generation method of this application;

[0012] Figure 3 yes Figure 2 The flowchart of step S204 corresponds to one embodiment;

[0013] Figure 4 This is a schematic diagram of one implementation of the path score decay scheme of this application;

[0014] Figure 5 This is a schematic diagram of one embodiment of the search enhancement generation system of this application;

[0015] Figure 6 This is a schematic diagram of the structure of one embodiment of the electronic device of this application;

[0016] Figure 7 This is a schematic diagram of one embodiment of the computer-readable storage medium of this application. Detailed Implementation

[0017] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments, and different implementation methods can be adaptively combined. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0018] In this paper, the terms "system" and "network" are often used interchangeably. The term "and / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Additionally, the character " / " generally indicates that the preceding and following related objects have an "or" relationship. Furthermore, "many" in this paper means two or more.

[0019] The search enhancement generation method proposed in this application relies on a smart terminal, which can be a smart device that integrates at least the corresponding reply function, or it can be an application on a smart device. The aforementioned smart device can be a mobile phone, tablet computer, or personal computer, etc.

[0020] Please see Figure 1 , Figure 1 This is a flowchart illustrating one embodiment of the retrieval enhancement generation method of this application. The method includes:

[0021] S101: Obtain all candidate texts and their corresponding reference activation values ​​in the knowledge base; where the reference activation value is obtained by calculating the activation value of the candidate text.

[0022] Specifically, it retrieves all candidate texts from the knowledge base, as well as the corresponding reference activation values ​​obtained by calculating the activation values ​​of the candidate texts and caching them.

[0023] Understandably, knowledge bases typically contain standardized knowledge points derived from various types of data, such as candidate texts generated by processing various documents like txt, word, pdf, excel, jpg, and wav according to certain rules.

[0024] In one application approach, all candidate texts in the knowledge base are obtained, along with the corresponding reference activation values ​​calculated by using an activation function on the candidate texts.

[0025] In some application scenarios, activation functions such as ReLU, Sigmoid, or Softmax can be used to calculate activation values ​​for candidate text and obtain corresponding reference activation values.

[0026] In another application, all candidate texts in the knowledge base are obtained, and activation values ​​are calculated for the candidate texts using a long text processing strategy to obtain the corresponding reference activation values.

[0027] In some application scenarios, long text processing strategies such as extended context windows and chunking techniques can be used to calculate activation values ​​for candidate texts and obtain corresponding reference activation values.

[0028] In summary, this application does not impose any restrictions on how to calculate the activation values ​​of candidate texts to obtain the corresponding reference activation values.

[0029] S102: Obtain the input text, calculate the activation value of the input text, and obtain the question activation value.

[0030] Specifically, the input text obtained from the object input is retrieved, and the activation value is calculated on the input text to obtain the question activation value.

[0031] In one application approach, after obtaining the input text from the object input, the activation function is used to calculate the activation value of the input text to obtain the question activation value.

[0032] In some application scenarios, after obtaining the input text using object input, activation functions such as ReLU, Sigmoid, or Softmax can be used to calculate the activation value of the input text to obtain the corresponding question activation value.

[0033] In another application, after obtaining the input text using object input, the activation value of the input text is calculated using a long text processing strategy to obtain the question activation value.

[0034] In some application scenarios, long text processing strategies such as extended context windows and chunking techniques can be used to calculate activation values ​​for the input text and obtain the corresponding question activation values.

[0035] In summary, this application does not impose any restrictions on how to calculate the activation value of the input text to obtain the corresponding problem activation value.

[0036] S103: Obtain at least one candidate text as the reference text corresponding to the input text, and obtain the cached reference activation value corresponding to the reference text.

[0037] Specifically, at least one candidate text from the knowledge base is obtained as the reference text corresponding to the input text, and the cached reference activation value corresponding to the reference text is obtained.

[0038] In one application approach, all candidate texts in the knowledge base are obtained, the similarity between the candidate texts and the input text is compared and sorted, the top k candidate texts are selected as the reference texts corresponding to the input texts, and the cached reference activation values ​​corresponding to the reference texts are obtained.

[0039] In another application, keywords are extracted from the input text, candidate texts containing the corresponding keywords are obtained from the knowledge base as reference texts corresponding to the input text, and cached reference activation values ​​corresponding to the reference texts are obtained.

[0040] S104: Generate response text based on the question activation value and the reference activation value.

[0041] Specifically, the response text is generated based on the question activation value corresponding to the input text and the reference activation value corresponding to the reference text.

[0042] In one application method, the question activation value and the reference activation value are concatenated to obtain the corresponding concatenated activation value, and the response text is generated based on the concatenated activation value.

[0043] In one application scenario, the question activation value and the reference activation value are concatenated to obtain the corresponding concatenated activation value. This concatenated activation value is then input into a pre-trained intelligent analysis model to generate the response text. Since the reference activation value has been pre-calculated and cached, when generating the corresponding response text, it is only necessary to calculate the question activation value of the input text and load the corresponding reference activation value. There is no need to perform repeated calculations on the reference text, which greatly reduces the response calculation workload of the first character in the response text reasoning process caused by the excessive length of the reference text, i.e., the first-response calculation workload. At the same time, it reduces the overall time for generating subsequent characters of the response text, thereby reducing the hard latency of retrieval enhancement generation.

[0044] Optionally, the intelligent analysis model is a large language model, which may include, but is not limited to, deep neural networks (DNNs), convolutional neural networks (CNNs), recurrent neural networks (RNNs), long short-term memory networks (LSTM), and generative pre-trained Transformer models. No specific restrictions are placed on the specific construction and deployment of the large language model.

[0045] In another application, the question activation value and the reference activation value are concatenated to obtain the corresponding concatenated activation value. At the same time, the response text is generated by combining the sentiment and cognitive information from the external common sense base, thereby further improving the accuracy of the response text generation.

[0046] The retrieval enhancement generation method proposed in this application obtains all candidate texts in the knowledge base, as well as the corresponding reference activation values ​​obtained by calculating activation values ​​for the candidate texts and caching them. It obtains the input text using object input, calculates the activation value of the input text to obtain the question activation value, obtains at least one candidate text in the knowledge base as the reference text corresponding to the input text, and obtains the cached reference activation value corresponding to the reference text. Based on the question activation value corresponding to the input text and the reference activation value corresponding to the reference text, the response text is generated. Since the activation values ​​of all candidate texts in the knowledge base have been pre-calculated and the corresponding reference activation values ​​have been obtained and cached, after obtaining the input text, it is not necessary to recalculate the activation values ​​of the selected corresponding reference text. It is only necessary to load the corresponding cached reference activation value and calculate the question activation value of the input text to generate the response text, which greatly reduces the initial computational load in the reasoning process, thereby reducing the hard latency of retrieval enhancement generation.

[0047] Please see Figure 2 , Figure 2 This is a flowchart illustrating another embodiment of the retrieval enhancement generation method of this application. The method includes:

[0048] S201: Obtain all candidate texts and their corresponding reference activation values ​​in the knowledge base; wherein, the reference activation value is obtained by calculating the activation value of the candidate text.

[0049] Specifically, it retrieves all candidate texts from the knowledge base, as well as the corresponding reference activation values ​​obtained by calculating the activation values ​​of the candidate texts and caching them.

[0050] S202: Obtain the input text, calculate the activation value of the input text, and obtain the question activation value.

[0051] Specifically, the input text obtained from the object input is retrieved, and the activation value is calculated on the input text to obtain the question activation value.

[0052] S203: Obtain the input text features corresponding to the input text, and obtain the candidate text features corresponding to the candidate text.

[0053] Specifically, the input text features corresponding to the input text using object input are obtained, and the candidate text features corresponding to the candidate text are obtained.

[0054] S204: Based on the input text features and candidate text features, select at least one candidate text as the reference text corresponding to the input text.

[0055] Specifically, based on the input text features corresponding to the input text and the candidate text features corresponding to the candidate text, at least one candidate text is selected as the reference text corresponding to the input text.

[0056] In one application method, please refer to Figure 3 , Figure 3 yes Figure 2 Step S204 corresponds to a flowchart of one embodiment. Step S204 specifically includes:

[0057] S301: Select the first number of candidate texts based on the input text features and candidate text features.

[0058] Specifically, a first number of candidate texts are selected based on the input text features corresponding to the input text and the candidate text features corresponding to the candidate texts.

[0059] Optionally, BM-25 (Best Matching-25) or a vectorization scheme based on the BERT model can be used to select a first number of candidate texts based on the input text features corresponding to the input text and the candidate text features corresponding to the candidate texts. Both BM-25 and the vectorization scheme based on the BERT model are existing technologies and will not be elaborated upon here.

[0060] S302: Based on the features of the input text and the characters in the selected candidate text, determine the path score corresponding to each character.

[0061] Specifically, based on the input text features corresponding to the input text and the characters in the selected candidate text, the path score corresponding to each character is determined.

[0062] In one application method, characters in the selected candidate text are obtained, and the probability value of each character is determined based on the input text features corresponding to the input text and each character; the decay weight corresponding to the character is obtained, and the path score corresponding to each character is determined based on the probability value and decay weight of each character; wherein, the decay weight decreases with the order of the characters in the candidate text.

[0063] Specifically, the characters in the selected candidate text are obtained, and based on the input text features corresponding to the input text and each character, the probability value corresponding to each character is determined, and the decay weight corresponding to each character is obtained. Thus, based on the probability value and decay weight of each character, the path score corresponding to each character is determined.

[0064] In one application scenario, for each character, a sliding window is generated with the current character as the center. The decay weight corresponding to the character within the sliding window is obtained. Based on the probability value and decay weight of the character within the sliding window, the path score corresponding to the current character is determined.

[0065] Specifically, for each character, a sliding window is generated centered on the current character, the decay weights of all characters within the sliding window are obtained, and the path score corresponding to the current character is determined based on the probability value and decay weight of the characters within the sliding window.

[0066] It's important to note that for large models, when given an input text, the output is a probability distribution along the dictionary dimension. Multiple decoding paths are constructed based on the multiple characters in the output and their corresponding probability distributions. To evaluate the quality of a decoding path, a path score is typically generated. However, in existing path scoring schemes, decoding a single character might yield an extremely high score—an extremum. The existence of such an extremum can negatively impact the final path score, meaning that the later a word in the text is decoded, the lower its confidence level in the decoding score. Therefore, this application addresses the issues of extrema and score confidence by generating a sliding window centered on the current character. The decay weights for all characters within the sliding window are obtained, and these decay weights decrease sequentially with the characters in the candidate text. Based on the probability values ​​and decay weights of the characters within the sliding window, the path score for the current character is determined, thereby reducing the impact of extrema and improving the accuracy of the large model's output.

[0067] For a specific application scenario, please refer to Figure 4 , Figure 4 This is a schematic diagram of one embodiment of the path score attenuation scheme of this application. The path score calculation process provided by this application is as follows:

[0068]

[0069] Where t is the position of the current character, the window range is from tk to t+k, the window length is 2k+1, and r is the decay factor, which can be configured according to the actual situation. i ∈(tk, t+k), p ti This represents the probability value of the current character.

[0070] S303: Based on the path scores corresponding to at least some characters, select a second number of candidate texts as reference texts corresponding to the input text; wherein the second number is less than the first number.

[0071] Specifically, based on the path scores corresponding to at least some characters, a second number of candidate texts less than the first number are selected as reference texts corresponding to the input text.

[0072] In one application scenario, each pair of candidate texts corresponding to the input text is taken as a text pair, and the difference in path scores between characters at the same position in the text pair is determined. In response to the score difference exceeding a preset threshold, the candidate texts with higher path scores in the text pair are arranged in a preset order until the selected candidate texts are sorted to obtain a candidate text sequence. The second number of candidate texts are selected from the candidate text sequence in a preset order as the reference text corresponding to the input text.

[0073] Specifically, each pair of candidate texts corresponding to the input text is treated as a text pair. The path score between characters at the same position in the text pair is determined, and their score difference is calculated. When the score difference exceeds a preset threshold, the candidate texts with relatively higher path scores in the text pair are arranged in a preset order until all the selected first number of candidate texts have been sorted, resulting in a corresponding candidate text sequence. A second number of candidate texts less than the first number are selected from the candidate text sequence in a preset order as reference texts corresponding to the input text. By filtering reference texts from the candidate texts, the accuracy of subsequent response text generation can be further improved. Furthermore, for multiple candidate texts, only the path score corresponding to some characters in the candidate texts needs to be calculated to obtain the reference text, without having to calculate the path score of all candidate texts, thus reducing computation time and further reducing the hard latency of retrieval enhancement generation.

[0074] Optionally, the first quantity can be 100, 50, etc., and the second quantity can be 10, 5, etc. The preset threshold can be determined according to the actual situation, and the preset order can be sorted from high to low or from low to high path scores. This application does not make specific limitations on this.

[0075] For a specific application scenario, please refer to [link / reference]. Figure 4 Candidate texts doc1 and doc2 are treated as a pair of texts. A sliding window of the same length is generated from front to back with the current character as the center. The path scores of the characters at the same position are calculated according to the above formula, which are s1 and s2 respectively. The path score of s1 is higher than that of s2. When the difference between the path scores of s1 and s2 exceeds a threshold, the candidate text doc1 corresponding to s1 is ranked with higher priority before the candidate text doc2 corresponding to s2.

[0076] S205: Retrieve the cached reference activation value corresponding to the reference text.

[0077] Specifically, obtain the pre-calculated and cached reference activation value corresponding to the reference text.

[0078] S206: Generate response text based on the question activation value and the reference activation value.

[0079] Specifically, the response text is generated based on the question activation value corresponding to the input text and the reference activation value corresponding to the reference text.

[0080] In one application method, the question activation value and the reference activation value are concatenated to obtain the prompt activation value; the prompt activation value is input into the intelligent analysis model to obtain the response text output by the intelligent analysis model.

[0081] Specifically, the question activation value corresponding to the input text and the reference activation value corresponding to the reference text are concatenated to obtain the prompt activation value. The prompt activation value is then input into the intelligent analysis model to obtain the response text output by the intelligent analysis model.

[0082] Understandably, this intelligent analysis model, after being pre-trained, can quickly generate response text that matches the prompt activation value.

[0083] In one application scenario, the question activation value and the reference activation value are concatenated to obtain the corresponding concatenated activation value. This concatenated activation value is then input into a pre-trained intelligent analysis model to generate the response text. Since the reference activation value has been pre-calculated and cached, when generating the corresponding response text, it is only necessary to calculate the question activation value of the input text and load the corresponding reference activation value. There is no need to perform repeated calculations on the reference text, which greatly reduces the response calculation workload of the first character in the response text reasoning process caused by the excessive length of the reference text, i.e., the first-response calculation workload. At the same time, it reduces the overall time for generating subsequent characters of the response text, thereby reducing the hard latency of retrieval enhancement generation.

[0084] Please see Figure 5 , Figure 5 This is a schematic diagram of one embodiment of the retrieval enhancement generation system of this application. The retrieval enhancement generation system 50 includes a first acquisition module 500, a calculation module 501, a second acquisition module 502, and a generation module 503.

[0085] Specifically, the first acquisition module 500 is used to acquire all candidate texts in the knowledge base and their corresponding reference activation values; wherein, the reference activation value is obtained by calculating the activation value of the candidate text.

[0086] The calculation module 501 is used to acquire the input text, calculate the activation value of the input text, and obtain the question activation value.

[0087] The second acquisition module 502 is used to acquire at least one candidate text as the reference text corresponding to the input text, and to acquire the cached reference activation value corresponding to the reference text.

[0088] The generation module 503 is used to generate response text based on the question activation value and the reference activation value.

[0089] Optionally, the second acquisition module 502 is further configured to acquire the input text features corresponding to the input text, and acquire the candidate text features corresponding to the candidate text; select at least one candidate text as the reference text corresponding to the input text based on the input text features and the candidate text features; and acquire the cached reference activation value corresponding to the reference text.

[0090] Optionally, the second acquisition module 502 is further configured to select a first number of candidate texts based on the input text features and candidate text features; determine the path score corresponding to each character based on the input text features and the characters in the selected candidate texts; and select a second number of candidate texts as reference texts corresponding to the input text based on the path scores corresponding to at least some characters; wherein the second number is less than the first number.

[0091] Optionally, the second acquisition module 502 is further configured to acquire characters in the selected candidate text, determine the probability value corresponding to each character based on the input text features and each character; acquire the decay weight corresponding to the character, and determine the path score corresponding to each character based on the probability value and decay weight of each character; wherein the decay weight decreases with the order of the characters in the candidate text.

[0092] Optionally, the second acquisition module 502 is further configured to generate a sliding window centered on the current character for each character, acquire the decay weight corresponding to the character within the sliding window, and determine the path score corresponding to the current character based on the probability value and decay weight corresponding to the character within the sliding window.

[0093] Optionally, the second acquisition module 502 is further configured to take each pair of candidate texts corresponding to the input text as a text pair, determine the score difference of the path score between characters at the same position in the text pair; in response to the score difference exceeding a preset threshold, arrange the candidate texts with higher path scores in the text pair in a preset order until the selected candidate texts are sorted to obtain a candidate text sequence; and select a second number of candidate texts from the candidate text sequence in a preset order as reference texts corresponding to the input text.

[0094] Optionally, the generation module 503 is also used to concatenate the question activation value and the reference activation value to obtain the prompt activation value; and input the prompt activation value into the intelligent analysis model to obtain the response text output by the intelligent analysis model.

[0095] Please see Figure 6 , Figure 6This is a schematic diagram of one embodiment of the electronic device of this application. The electronic device 60 includes a memory 601 and a processor 602 coupled to each other. The memory 601 stores program instructions, and the processor 602 is used to execute the program instructions to implement the methods mentioned in any of the above embodiments. For a detailed description of the relevant content, please refer to the detailed description of the above method embodiments, which will not be repeated here. Specifically, the electronic device 60 includes, but is not limited to, desktop computers, laptops, tablets, servers, etc., and is not limited here. In addition, the processor 602 can also be called a CPU (Center Processing Unit). The processor 602 may be an integrated circuit chip with signal processing capabilities. The processor 602 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor or any conventional processor. In addition, the processor 602 can be implemented by integrated circuit chips.

[0096] Please see Figure 7 , Figure 7 This is a schematic diagram of one embodiment of the computer-readable storage medium of this application. The computer-readable storage medium 70 stores program instructions 700 that can be executed by a processor. The program instructions 700 are used to implement the methods mentioned in any of the above embodiments.

[0097] In the several embodiments provided in this application, it should be understood that the disclosed methods and apparatus can be implemented in other ways. For example, the apparatus implementations described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0098] It should be noted that the units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0099] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0100] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0101] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. A retrieval enhancement generation method, characterized in that, include: Obtain all candidate texts and their corresponding reference activation values ​​from the knowledge base; wherein, the reference activation value is obtained by calculating the activation value of the candidate text; Obtain the input text, calculate the activation value of the input text, and obtain the question activation value; Obtain at least one candidate text as a reference text corresponding to the input text, and obtain the cached reference activation value corresponding to the reference text; Based on the question activation value and the reference activation value, generate the response text; Wherein, obtaining at least one of the candidate texts as reference texts corresponding to the input text includes: Obtain the input text features corresponding to the input text, and obtain the candidate text features corresponding to the candidate text; Based on the input text features and the candidate text features, at least one candidate text is selected as the reference text corresponding to the input text; specifically, this includes: selecting a first number of candidate texts based on the input text features and the candidate text features; determining the path score corresponding to each character based on the input text features and the characters in the selected candidate texts; and selecting a second number of candidate texts as the reference text corresponding to the input text based on the path scores corresponding to at least some characters; wherein the second number is less than the first number. The path score for each character is obtained based on the following steps: obtaining the characters in the selected candidate text, determining the probability value of each character based on the input text features and each character; obtaining the decay weight corresponding to the character, determining the path score for each character based on the probability value and the decay weight; wherein the decay weight decreases sequentially with the character in the candidate text.

2. The method according to claim 1, characterized in that, The step of obtaining the decay weight corresponding to each character, and determining the path score corresponding to each character based on the probability value and the decay weight of each character, includes: For each character, a sliding window is generated centered on the current character. The decay weight corresponding to the character within the sliding window is obtained. Based on the probability value and decay weight corresponding to the character within the sliding window, the path score corresponding to the current character is determined.

3. The method according to claim 1, characterized in that, The step of selecting a second number of candidate texts as reference texts corresponding to the input text based on the path scores corresponding to at least some characters includes: Take each pair of candidate texts corresponding to the input text as a text pair, and determine the score difference of the path score between characters at the same position in the text pair; In response to the score difference exceeding a preset threshold, the candidate texts with higher path scores in the text pair are arranged in a preset order until the selected candidate texts are sorted to obtain a candidate text sequence. The second number of candidate texts are selected from the candidate text sequence in the preset order as reference texts corresponding to the input text.

4. The method according to claim 1, characterized in that, The step of generating response text based on the question activation value and the reference activation value includes: The problem activation value and the reference activation value are concatenated to obtain the prompt activation value; The activation value of the prompt is input into the intelligent analysis model to obtain the response text output by the intelligent analysis model.

5. A retrieval enhancement generation system, characterized in that, include: The first acquisition module is used to acquire all candidate texts and their corresponding reference activation values ​​in the knowledge base; wherein, the reference activation value is obtained by calculating the activation value of the candidate text; The calculation module is used to acquire input text, calculate activation values ​​from the input text, and obtain the question activation value. The second acquisition module is used to acquire at least one of the candidate texts as reference texts corresponding to the input text, and to acquire the cached reference activation value corresponding to the reference text; The generation module is used to generate response text based on the question activation value and the reference activation value; Wherein, obtaining at least one of the candidate texts as reference texts corresponding to the input text includes: Obtain the input text features corresponding to the input text, and obtain the candidate text features corresponding to the candidate text; Based on the input text features and the candidate text features, at least one candidate text is selected as the reference text corresponding to the input text; specifically, this includes: selecting a first number of candidate texts based on the input text features and the candidate text features; determining the path score corresponding to each character based on the input text features and the characters in the selected candidate texts; and selecting a second number of candidate texts as the reference text corresponding to the input text based on the path scores corresponding to at least some characters; wherein the second number is less than the first number. The path score for each character is obtained based on the following steps: obtaining the characters in the selected candidate text, determining the probability value of each character based on the input text features and each character; obtaining the decay weight corresponding to the character, determining the path score for each character based on the probability value and the decay weight; wherein the decay weight decreases sequentially with the character in the candidate text.

6. An electronic device, characterized in that, The method includes a memory and a processor coupled to each other, the memory storing program instructions, and the processor executing the program instructions to implement the method according to any one of claims 1-4.

7. A computer-readable storage medium, characterized in that, The system stores program instructions that can be executed by a processor, the program instructions being used to implement the method described in any one of claims 1-4.

Citation Information

Patent Citations

  • Search recommendation method and device, equipment and storage medium

    CN111274366A

  • Text matching method and device and electronic equipment

    CN116127005A