Large language model question answering method, device and storage medium based on word vector

By vectorizing the knowledge base of large language models and similarity calculation, the problem that large language models cannot adapt to the needs of specific fields is solved, and fast and accurate question-and-answer results are obtained, reducing costs and saving human resources expenditure.

CN118939781BActive Publication Date: 2025-01-14SHENZHEN DADAO CLOUD TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411420706.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2025-01-14
Estimated Expiration
2044-10-12

AI Technical Summary

Technical Problem

Due to the high training cost and large range of training text data, existing large language models cannot effectively adapt to the needs of specific fields, resulting in the cost of changing directly from internal corpus and network frameworks that cannot meet the Q&A needs of specific fields.

Method used

By receiving the file to be vectored for dense vectorization, a dense matrix is ​​generated, and it is decomposed and merged and stored in the knowledge base. The similarity calculation is performed based on the question data to determine whether there is an updated knowledge base. If it exists, the similarity value is calculated. If it is greater than the threshold, the answer is obtained from the knowledge base. If it is not greater than the threshold, the external database is retrieved and the prompt words are generated to transmit to the large language model to obtain the answer results.

Benefits of technology

It realizes that the internal training corpus and network framework of the large language model can be adapted to specific fields without directly modifying the internal training corpus and network framework. Users can quickly and accurately obtain Q&A results, save human resources expenditure, and reduce the cost of answering questions in specific fields.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118939781B_ABST
    Figure CN118939781B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of neural network applications, and discloses a large language model question-answering method, device and storage medium based on word vectors. The method includes: based on a first account, decomposing and merging a dense matrix and storing it in a preset knowledge base to obtain an updated knowledge base; combining and processing historical question-answering data and question data to generate memory question data; encoding and vectorizing the memory question data to obtain a question vector; calculating the similarity value between the question vector and the key vector in the updated knowledge base corresponding to the second account; parsing the value vector matching the similarity value in the updated knowledge base corresponding to the second account to obtain a knowledge answer; transmitting the prompt word to the large language model, obtaining the reply result fed back by the large language model, and sending the reply result to the second account. In an embodiment of the present invention, the large language model can be adapted to a specific field without modifying the internal training corpus and the internal network framework of the large language model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of neural network applications, and in particular to a large language model question-answering method, device and storage medium based on word vectors. Background Art

[0002] The Large Language Model is a natural language processing technology based on deep learning. The Large Language Model learns the structure and patterns of language by training on large amounts of text data, so that it can generate, understand and process natural language.

[0003] Large language models are usually trained using large amounts of text data to build intelligent answering systems. However, due to the high cost of training large language models and the large range of training text data, the human and material resources required are too large compared to the improvement of question-answering results, and the existing large language models cannot meet the needs of specific fields.

[0004] Therefore, in order to address the technical problem that the current large language model is too costly to change directly from the internal corpus and network framework to adapt to the needs of specific fields, a new technology is needed to solve the current problem. Summary of the invention

[0005] The main purpose of the present invention is to solve the technical problem that the cost of modifying the current large language model directly from the internal corpus and network framework is too high and cannot adapt to the needs of specific fields.

[0006] A first aspect of the present invention provides a large language model question answering method based on word vectors, and the large language model question answering method based on word vectors includes:

[0007] Receiving a file to be vectorized uploaded by a first account, and performing dense vectorization processing on the file to be vectorized according to a preset vectorization algorithm to obtain a dense matrix;

[0008] Based on the first account, the dense matrix is ​​decomposed, merged and stored in a preset knowledge base to obtain an updated knowledge base;

[0009] receiving question data from a second account, and determining whether corresponding historical question and answer data exists for the second account;

[0010] When there is corresponding historical question and answer data, the historical question and answer data and the question data are combined and processed to generate memory question data;

[0011] When there is no corresponding historical question-and-answer data, the question data is determined as memory question data;

[0012] Performing encoding vectorization processing on the memory question data to obtain a question vector;

[0013] Determine whether a corresponding update knowledge base exists for the second account;

[0014] If there is a corresponding updated knowledge base, calculating a similarity value between the question vector and a key vector in the updated knowledge base corresponding to the second account;

[0015] Determine whether the similarity value is greater than a preset matching threshold;

[0016] When it is greater than a preset matching threshold, the value vector of the similarity value matching in the updated knowledge base corresponding to the second account is parsed to obtain a knowledge answer;

[0017] When it is not greater than a preset matching threshold, the external database is searched according to the memory question data to obtain the knowledge answer;

[0018] Assembling the memory question data and the knowledge answer into a prompt word;

[0019] The prompt word is transmitted to a preset large language model, a reply result fed back by the large language model is obtained, and the reply result is sent to the second account.

[0020] Optionally, in a first implementation of the first aspect of the present invention, calculating the similarity value between the question vector and a key vector in the updated knowledge base corresponding to the second account includes:

[0021] Based on the preset database index, extract the key vector in the knowledge base corresponding to the second account;

[0022] Calculating a cosine similarity value between the question vector and the key vector;

[0023] Analyzing the number of intersection elements between the question vector and the key vector, and analyzing the number of union elements between the question vector and the key vector;

[0024] Calculate the quotient of the number of elements in the intersection and the number of elements in the union to obtain a set similarity value;

[0025] The set similarity value and the cosine similarity value are input into a preset numerical combination formula to obtain a similarity value.

[0026] Optionally, in a second implementation of the first aspect of the present invention, the inputting the set similarity value and the cosine similarity value into a preset numerical combination formula to obtain a similarity value comprises:

[0027] Z=min(X,Y)+max(0,XY), where Z is the similarity value, X is the cosine similarity value, and Y is the set similarity value.

[0028] Optionally, in a third implementation of the first aspect of the present invention, determining whether the second account has a corresponding update knowledge base includes:

[0029] Determining whether there is an updated knowledge base corresponding to the second account in the preset service memory;

[0030] When the updated knowledge base corresponding to the second account does not exist in the preset service memory, determining whether the updated knowledge base corresponding to the second account exists in the preset cloud server;

[0031] When the updated knowledge base corresponding to the second account exists in the preset cloud server, the updated knowledge base corresponding to the second account in the preset cloud server is written into the preset service memory.

[0032] Optionally, in a fourth implementation of the first aspect of the present invention, based on the first account, decomposing and merging the dense matrix and storing it in a preset knowledge base to obtain an updated knowledge base includes:

[0033] Determine whether there is a storage task executed by the first account;

[0034] When there is no storage task to be executed, the dense matrix is ​​decomposed into a question-answer matrix according to the numerical encoding of the file to be vectorized to obtain a vector key-value pair, wherein the vector key-value pair includes: a question vector and an answer vector corresponding to the question vector;

[0035] Reading the stored data of the knowledge base corresponding to the first account, and performing deduplication processing on the vector key-value pair and the stored data to obtain updated stored data;

[0036] Based on the updated stored data, the stored data of the knowledge base corresponding to the first account is modified to generate an updated knowledge base.

[0037] Optionally, in a fifth implementation of the first aspect of the present invention, determining whether the second account has corresponding historical question and answer data includes:

[0038] Determine whether the second account has corresponding historical question and answer data within the set validity period.

[0039] Optionally, in a sixth implementation of the first aspect of the present invention, the receiving the file to be quantized uploaded by the first account includes:

[0040] A CSV file uploaded by a first account is received, wherein the CSV file includes: a question field and an answer field corresponding to the question field.

[0041] Optionally, in a seventh implementation of the first aspect of the present invention, after searching an external database according to the memory question data to obtain a knowledge answer, the method further includes:

[0042] Send the supplementary reminder information corresponding to the question data to the preset management port.

[0043] A second aspect of the present invention provides a large language model question-answering device based on word vectors, comprising: a memory and at least one processor, wherein instructions are stored in the memory, and the memory and the at least one processor are interconnected via lines; the at least one processor calls the instructions in the memory so that the large language model question-answering device based on word vectors executes the above-mentioned large language model question-answering method based on word vectors.

[0044] A third aspect of the present invention provides a computer-readable storage medium, which stores instructions that, when executed on a computer, enable the computer to execute the above-mentioned large language model question-answering method based on word vectors.

[0045] In an embodiment of the present invention, a vectorized file of a knowledge base is uploaded through a user account, and the knowledge base is adjusted so that each user account has a specific analysis question and answer result, thereby achieving the effect of adapting the large language model to a specific field without directly modifying the internal training corpus and the internal network framework of the large language model. Each user can ask questions and get the corresponding complete response results quickly and accurately, thereby saving the human resource expenditure for answering routine questions in specific fields, and solving the technical problem that the current large language model is too costly to change directly from the internal corpus and network framework and cannot adapt to the needs of specific fields. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 This is a schematic diagram of a first embodiment of a large language model question answering method based on word vectors in an embodiment of the present invention;

[0047] Figure 2 102 is a schematic diagram of a specific embodiment of the large language model question answering method based on word vectors in an embodiment of the present invention;

[0048] Figure 3 107 is a schematic diagram of a specific embodiment of the large language model question answering method based on word vectors in an embodiment of the present invention;

[0049] Figure 4 108 is a schematic diagram of a specific embodiment of the large language model question answering method based on word vectors in an embodiment of the present invention;

[0050] Figure 5 Schematic diagram of an embodiment of a large language model question-answering device based on word vectors in an embodiment of the present invention. DETAILED DESCRIPTION

[0051] Embodiments of the present invention provide a large language model question answering method, device and storage medium based on word vectors.

[0052] The embodiments disclosed in the present invention will be described in more detail below with reference to the accompanying drawings. Although certain embodiments disclosed in the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present invention. It should be understood that the drawings and embodiments disclosed in the present invention are only for exemplary purposes and are not intended to limit the scope of protection disclosed in the present invention.

[0053] In the description of the embodiments disclosed in the present invention, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may also be included below.

[0054] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 , an embodiment of the large language model question answering method based on word vectors in the embodiment of the present invention includes:

[0055] 101. Receive a file to be vectorized uploaded by a first account, and perform dense vectorization processing on the file to be vectorized according to a preset vectorization algorithm to obtain a dense matrix;

[0056] In this embodiment, the user of the first account can upload the question and answer data to be specified to the cloud or cache it in the local memory, waiting for subsequent vectorization. The specified question and answer data contains text data that can be vectorized, such as line numbers, questions, answers, etc., and each line of the question and answer data can have corresponding questions and answer data, so that after the question and answer data file is vectorized, a dense matrix can be generated.

[0057] Specifically, the following specific embodiments are included in “receiving the file to be quantized uploaded by the first account”:

[0058] 1011. Receive a CSV file uploaded by a first account, wherein the CSV file includes: a question field and an answer field corresponding to the question field.

[0059] In step 1011, the file type uploaded by the user of the first account is a CSV file. The CSV file contains multiple rows, each of which has a question field and an answer field corresponding to the question field, and can be stored in the server according to the account name.

[0060] 102. Based on the first account, decompose and merge the dense matrix and store it in a preset knowledge base to obtain an updated knowledge base;

[0061] In this embodiment, the question column of the uploaded csv file is numerically encoded, and the dense vector obtained by matrix operation is vectorized and stored according to user dimension and file granularity. The previous vectorized file under the user account is read and merged into this vector to obtain the full knowledge base vector of the user account. The knowledge base in the memory is updated according to the user account identifier, and a copy is persisted on the server.

[0062] For details, please refer to Figure 2 , Figure 2 This is a schematic diagram of a specific embodiment of step 102 of the large language model question answering method based on word vectors in an embodiment of the present invention. Step 102 includes the following specific implementation methods:

[0063] 1021. Determine whether the first account has a storage task to be executed;

[0064] 1022. When there is no storage task to be executed, the dense matrix is ​​decomposed into a question-answer matrix according to the numerical code of the file to be vectorized to obtain a vector key-value pair, wherein the vector key-value pair includes: a question vector and an answer vector corresponding to the question vector;

[0065] 1023. Read the storage data of the knowledge base corresponding to the first account, and perform deduplication processing on the vector key-value pair and the storage data to obtain updated storage data;

[0066] 1024. Based on the updated stored data, modify the stored data of the knowledge base corresponding to the first account to generate an updated knowledge base.

[0067] In steps 1021-1024, when the knowledge base corresponding to the first account needs to be updated, it is necessary to first analyze whether there is a storage task being executed by the first account in the processing task queue. If there is a storage task being executed, it is necessary to wait for the current task to be completed and determine whether there is a storage task being executed by the first account at a certain interval. When there is no storage task being executed, the dense matrix is ​​decomposed to generate vector key-value pairs.

[0068] In a decomposition embodiment, the transformed dense matrix V, V=W*H, after decomposition, W is the key vector of the question vector, H is the value vector of the answer vector, and the key-value pairs of W:H are stored in the knowledge base corresponding to the first account.

[0069] In another decomposition implementation, the conversion process of the dense matrix begins by converting the question data into a W vector and the answer data into an H vector, which are combined into [W:H]. During the storage process, the matrix is ​​split and deduplication is performed on the server based on the W vector. Finally, all the question and answer data contained in the dense matrix are written into the knowledge base to obtain an updated and stored knowledge base.

[0070] 103. Receive question data from a second account, and determine whether the second account has corresponding historical question and answer data;

[0071] In this embodiment, the first account and the second account can be the same account or different accounts. Based on user needs, the first account can upload question and answer data in a specific field, and the second account can be bound to the knowledge base uploaded by the first account as adaptation data for the specific field. The specific processing method is not limited here.

[0072] After receiving the question data sent by the second account, you can first query whether the second account has historical question and answer data. The historical question and answer data can be provided to the knowledge base and the large language model as memory data and question data for training and analysis.

[0073] Furthermore, step 103 also includes the following specific implementation methods:

[0074] 1031. Determine whether the second account has corresponding historical question and answer data within the set validity period.

[0075] In step 1031, the effective time can be set to 5 hours, and a determination is made as to whether there is any historical question and answer data of the second account within 5 hours added to the timestamp of the received question data, and the effective time is used to filter the historical question and answer data.

[0076] 104. When there is corresponding historical question and answer data, the historical question and answer data and the question data are combined and processed to generate memory question data;

[0077] In this embodiment, when historical question and answer data exists, the historical question and answer data and the question data are bundled to obtain the memory question data.

[0078] 105. When there is no corresponding historical question and answer data, the question data is determined as memory question data;

[0079] In this embodiment, if there is no valid historical question and answer data, the question data is determined to be memory question data, and the next processing step is entered.

[0080] 106. Perform encoding vectorization processing on the memory question data to obtain a question vector;

[0081] In this embodiment, the memory question data is lexicalized, and the lexical vectorization can be based on the BERT model to perform overall vectorization of the preceding and following sentences, or it can be concatenated by single lexical vectorization, which is not limited here.

[0082] 107. Determine whether the second account has a corresponding update knowledge base;

[0083] In this embodiment, it is determined whether there is an updated knowledge base in the second account. The updated knowledge base may be a knowledge base bound to the first account, or the second account is the same as the first account and is updated in steps 101-102.

[0084] For details, please refer to Figure 3 , Figure 3 This is a schematic diagram of a specific embodiment of step 107 of the large language model question answering method based on word vectors in an embodiment of the present invention. Step 107 includes the following specific implementation methods:

[0085] 1071. Determine whether there is an update knowledge base corresponding to the second account in the preset service memory;

[0086] 1072. When the update knowledge base corresponding to the second account does not exist in the preset service memory, determining whether the update knowledge base corresponding to the second account exists in the preset cloud server;

[0087] 1073. When an updated knowledge base corresponding to the second account exists in the preset cloud server, the updated knowledge base corresponding to the second account in the preset cloud server is written into the preset service memory.

[0088] In steps 1071-1073, the updated knowledge base can be recorded in the local service memory or stored persistently in the cloud server. When determining whether the second account has an updated knowledge base, first query the service memory to see whether there is an updated knowledge base corresponding to the second account. If the updated knowledge base does not exist in the local service memory, query the cloud server to see whether there is persistently stored knowledge base data. If there is persistently stored knowledge base data in the cloud server, write the updated knowledge base into the service memory. If the updated knowledge base does not exist in the cloud server, a reminder message can be sent to the second account, and the second account can be required to upload the file to be quantized, that is, return to step 101 to complete the adaptive adjustment of the large language model.

[0089] 108. If there is a corresponding updated knowledge base, calculate the similarity value between the question vector and the key vector in the updated knowledge base corresponding to the second account;

[0090] In this embodiment, the question vector and each key vector in the updated knowledge base can be analyzed in turn to perform similarity calculation to obtain a similarity value, and then the similarity value is compared with a set threshold to determine whether the question vector has a record in the updated knowledge base based on the comparison result.

[0091] For details, please refer to Figure 4 , Figure 4 This is a specific embodiment of step 108 of the large language model question answering method based on word vectors in an embodiment of the present invention, and step 108 includes the following specific implementation methods:

[0092] 1081. Based on the preset database index, extract the key vector in the knowledge base corresponding to the second account;

[0093] 1082. Calculate the cosine similarity value between the question vector and the key vector;

[0094] 1083. Analyze the number of intersection elements between the question vector and the key vector, and analyze the number of union elements between the question vector and the key vector;

[0095] 1084. Calculate the quotient of the number of elements in the intersection and the number of elements in the union to obtain a set similarity value;

[0096] 1085. Input the set similarity value and the cosine similarity value into a preset numerical combination formula to obtain a similarity value.

[0097] In steps 1081-1085, the database index is an encoding of multiple data, a number given during the database storage process, and a key vector for updating the knowledge base, that is, the question vector, is extracted by traversing from the beginning to the end of the number.

[0098] First, calculate the cosine similarity value X between the key vector and the question vector. Then calculate the number of elements in the intersection between the question vector and the key vector, such as the number of elements in the intersection {U, P} between A={S, T, U, P, R} and B={U, P, E, D, F} is 2. Then calculate the number of elements in the union between the question vector and the key vector, such as the number of elements in the union {U, P, S, T, R, E, D, F} between A={S, T, U, P, R} and B={U, P, E, D, F} is 8. The quotient of the number of elements in the intersection 2 divided by the number of elements in the union 8 gives a set similarity value of 0.25. Finally, the cosine similarity value X and the set similarity value Y are input into the formula to obtain the similarity value Z.

[0099] In one embodiment, Z=(aX+bY) / (a+b), where X is the cosine similarity value, Y is the set similarity value, Z is the similarity value, and a and b are merging proportional constants.

[0100] Specifically, step 1085 includes the following specific implementation methods:

[0101] 10851. Z = min (X, Y) + max (0, XY), where Z is the similarity value, X is the cosine similarity value, and Y is the set similarity value.

[0102] In step 10851, the similarity value Z can be processed by first taking the minimum value between the cosine similarity value X and the set similarity value Y, then taking the maximum value between 0 and XY, and summing the two values ​​to obtain the similarity value Z.

[0103] 109. Determine whether the similarity value is greater than a preset matching threshold;

[0104] In this embodiment, it is analyzed whether the similarity value is greater than the matching threshold. If it is greater than the matching threshold, it means that the similarity is high, and the value vector corresponding to the key vector is determined to be the answer data that matches the question data corresponding to the similarity value.

[0105] 110. When the value is greater than a preset matching threshold, the value vector of the similarity value matching in the updated knowledge base corresponding to the second account is parsed to obtain a knowledge answer;

[0106] In this embodiment, when the similarity value is greater than the matching threshold, the query similarity value is matched to the value vector corresponding to the key vector, and the value vector is devectorized to obtain the knowledge answer.

[0107] 111. When the value is not greater than a preset matching threshold, searching an external database according to the memory question data to obtain a knowledge answer;

[0108] In this embodiment, when there is no key vector greater than the matching threshold in the updated knowledge base, the required knowledge answer is obtained by querying from the external database according to the memorized question data.

[0109] Specifically, after step 111, the following specific implementation methods are also included:

[0110] 1111. Send the supplementary reminder information corresponding to the question data to the preset management port.

[0111] In step 1111, if the relevant reply data does not exist in the knowledge base, a reminder message indicating that the question needs to be supplemented may be sent to a preset management port so that an administrator such as the first account can supplement the reply data into the knowledge base.

[0112] 112. Assembling the memory question data and the knowledge answer into a prompt word;

[0113] In this embodiment, the memory question data and the knowledge answer are combined or keywords are extracted to form prompt words.

[0114] 113. Transmit the prompt word to a preset large language model, obtain a reply result fed back by the large language model, and send the reply result to the second account.

[0115] In this embodiment, the prompt words are sent to the large language model, which expands and polishes the prompt words to generate a reasonable reply result, and sends the reply result to the second account to complete the entire question and answer processing process.

[0116] In an embodiment of the present invention, a vectorized file of a knowledge base is uploaded through a user account, and the knowledge base is adjusted so that each user account has a specific analysis question and answer result, thereby achieving the effect of adapting the large language model to a specific field without directly modifying the internal training corpus and the internal network framework of the large language model. Each user can ask questions and get the corresponding complete response results quickly and accurately, thereby saving the human resource expenditure for answering routine questions in specific fields, and solving the technical problem that the current large language model is too costly to change directly from the internal corpus and network framework and cannot adapt to the needs of specific fields.

[0117] Figure 5 It is a structural diagram of a large language model question-answering device based on word vectors provided by an embodiment of the present invention. The large language model question-answering device 500 based on word vectors may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 510 (for example, one or more processors) and a memory 520, and one or more storage media 530 (for example, one or more massive storage devices) storing application programs 533 or data 532. Among them, the memory 520 and the storage medium 530 can be short-term storage or permanent storage. The program stored in the storage medium 530 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the large language model question-answering device 500 based on word vectors. Furthermore, the processor 510 may be configured to communicate with the storage medium 530 to execute a series of instruction operations in the storage medium 530 on the large language model question-answering device 500 based on word vectors.

[0118] The word vector-based large language model question answering device 500 may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input and output interfaces 560, and / or one or more operating systems 531, such as Windows Serve, Mac OS X, Unix, Linux, Free BSD, etc. Those skilled in the art will appreciate that Figure 5 The structure of the word vector-based large language model question-answering device shown does not constitute a limitation on the word vector-based large language model question-answering device, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.

[0119] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the steps of the large language model question-answering method based on word vectors.

[0120] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0121] In addition, although each operation is described in a specific order, this should be understood as requiring such operation to be performed in the specific order shown or in a sequential order, or requiring that all illustrated operations should be performed to obtain desired results. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single implementation in combination. On the contrary, the various features described in the context of a single implementation can also be implemented in multiple implementations individually or in any suitable sub-combination mode.

[0122] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

Claims

1. A large language model question answering method based on word vectors, characterized in that: Includes steps: Receiving a file to be vectorized uploaded by a first account, and performing dense vectorization processing on the file to be vectorized according to a preset vectorization algorithm to obtain a dense matrix; Based on the first account, the dense matrix is ​​decomposed, merged and stored in a preset knowledge base to obtain an updated knowledge base; receiving question data from a second account, and determining whether corresponding historical question and answer data exists for the second account; When there is corresponding historical question and answer data, the historical question and answer data and the question data are combined and processed to generate memory question data; When there is no corresponding historical question-and-answer data, the question data is determined as memory question data; Performing encoding vectorization processing on the memory question data to obtain a question vector; Determine whether a corresponding update knowledge base exists for the second account; If there is a corresponding updated knowledge base, calculating a similarity value between the question vector and a key vector in the updated knowledge base corresponding to the second account; Determine whether the similarity value is greater than a preset matching threshold; When it is greater than a preset matching threshold, the value vector of the similarity value matching in the updated knowledge base corresponding to the second account is parsed to obtain a knowledge answer; When it is not greater than a preset matching threshold, the external database is searched according to the memory question data to obtain the knowledge answer; Assembling the memory question data and the knowledge answer into a prompt word; Transmitting the prompt word to a preset large language model, obtaining a reply result fed back by the large language model, and sending the reply result to the second account; The calculating of the similarity value between the question vector and the key vector in the updated knowledge base corresponding to the second account includes: Based on the preset database index, extract the key vector in the knowledge base corresponding to the second account; Calculating a cosine similarity value between the question vector and the key vector; Analyzing the number of intersection elements between the question vector and the key vector, and analyzing the number of union elements between the question vector and the key vector; Calculate the quotient of the number of elements in the intersection and the number of elements in the union to obtain a set similarity value; Input the set similarity value and the cosine similarity value into a preset numerical combination formula to obtain a similarity value; The step of inputting the set similarity value and the cosine similarity value into a preset numerical combination formula to obtain a similarity value includes: Z=min(X,Y)+max(0,XY), where Z is the similarity value, X is the cosine similarity value, Y is the set similarity value, min(A,B) is the function that takes the minimum value of A and B, and max(A,B) is the function that takes the maximum value of A and B; The step of decomposing, merging and storing the dense matrix in a preset knowledge base based on the first account to obtain an updated knowledge base includes: Determine whether there is a storage task executed by the first account; When there is no storage task to be executed, the dense matrix is ​​decomposed into a question-answer matrix according to the numerical encoding of the file to be vectorized to obtain a vector key-value pair, wherein the vector key-value pair includes: a question vector and an answer vector corresponding to the question vector; Reading the stored data of the knowledge base corresponding to the first account, and performing deduplication processing on the vector key-value pair and the stored data to obtain updated stored data; Based on the updated stored data, the stored data of the knowledge base corresponding to the first account is modified to generate an updated knowledge base.

2. The large language model question answering method based on word vector according to claim 1 is characterized in that: The determining whether the second account has a corresponding update knowledge base includes: Determining whether there is an updated knowledge base corresponding to the second account in the preset service memory; When the updated knowledge base corresponding to the second account does not exist in the preset service memory, determining whether the updated knowledge base corresponding to the second account exists in the preset cloud server; When the updated knowledge base corresponding to the second account exists in the preset cloud server, the updated knowledge base corresponding to the second account in the preset cloud server is written into the preset service memory.

3. The large language model question answering method based on word vector according to claim 1 is characterized in that: The determining whether the second account has corresponding historical question-and-answer data includes: Determine whether the second account has corresponding historical question and answer data within the set validity period.

4. The large language model question answering method based on word vector according to claim 1 is characterized in that: The receiving of the to-be-quantized file uploaded by the first account includes: A CSV file uploaded by a first account is received, wherein the CSV file includes: a question field and an answer field corresponding to the question field.

5. The large language model question answering method based on word vector according to claim 1, characterized in that: After searching the external database according to the memory question data to obtain the knowledge answer, the method further includes: Send the supplementary reminder information corresponding to the question data to the preset management port.

6. A large language model question-answering device based on word vectors, characterized in that: The word vector-based large language model question-answering device comprises: a memory and at least one processor, the memory stores instructions, and the memory and the at least one processor are interconnected via a line; The at least one processor calls the instructions in the memory so that the word vector-based large language model question answering device executes the word vector-based large language model question answering method as described in any one of claims 1-5.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the large language model question answering method based on word vectors as described in any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Answerer recommendation model training method, answerer recommendation method and electronic equipment

    CN111881282A

  • Open domain natural language reasoning question-answering system and method driven by large language model

    CN116932708A