Method and system for realizing infinite-length context continuous dialogue of large language model
By building structured data tables and utilizing text semantic similarity calculations of large language models, the length limitation and data omission problems of large language models when dealing with continuous context dialogues are solved, and lossless structured data recording and recovery are achieved, ensuring that The completeness and accuracy of the conversation.
Patent Information
- Application Number
- CN202411211059.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-12-27
AI Technical Summary
Existing large language models have length limitations when handling continuous context conversations, resulting in data omissions or loss of semantic information, especially when processing structured data, inability to record and restore previous data processing steps results without loss.
By building a structured data table, save sub-problems and related result information of each user requirement, and use a large language model to calculate text semantic similarity, select helpful data for storage and output, ensuring lossless recording and recovery of data processing steps result.
The lossless storage and extraction of infinitely long context continuous dialogues of large language models is realized, avoiding data omissions and semantic information loss, and is suitable for complete meaning records of structured data.
Smart Images

Figure CN119202160A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of human-intelligence interaction technology, and in particular, relates to a method and system for realizing continuous dialogue with infinite context of a large language model. Background Art
[0002] The continuous context dialogue of the large language model has a length limit, which is generally 4096 tokens. A small number of large language models can reach 100,000 tokens. If the data exceeds the token length limit and needs to be input into the large language model, it must be processed in some way.
[0003] Currently, there are two methods. One is to directly intercept the part of the input text data that exceeds the limit, and then input the remaining text into the large model; this is also the way most large language models automatically process super-long texts. The other is to use each round of dialogue (prompt words, questions, and answers) as a group, and use the large model to summarize the dialogue groups whose total length exceeds 90% of the length limit of the large language model and the summary of the previous super-long text, and the output summary text length does not exceed 10%. In this way, the continuous "ask" dialogue will never exceed the length limit of the large language model.
[0004] However, both methods have defects. First, some of the automatically intercepted content is not directly or indirectly passed to the large language model, so there will be obvious data omissions, which makes the large language model incomplete in understanding the user's continuous context. Second, although the dialogue that exceeds the limit will be summarized each time a continuous dialogue is added, so that the text that exceeds the limit will not be lost directly, the relevant semantic information of summarizing a long text itself will be lost. If it is superimposed and summarized multiple times, the original relevant semantics will basically be lost in large quantities.
[0005] At the same time, both methods are not applicable to structured data. For structured data, every number (100, 0.78, etc.) or string (CH, 3U, Jiangsu and Zhejiang, etc.) must be accurate. If summarized, the numbers or characters of the original data will be changed. For example, "xxx company's mobile phone sales increased by 50%, computer sales increased by 30%, and communication equipment increased by 60%..." After summarization, it will become "xxx company's product sales increased greatly", so the required data information is completely deleted, and the contextual continuous dialogue with complete meaning cannot be realized.
[0006] At present, in the use of intelligent data mining platforms based on code generation, the number of data processing processes in various data analysis and mining aspects is quite large. In addition to the result data of the previous step, each data processing step is also likely to use the data of the previous steps. This requires that the large language model must be able to record the result data of all previous data processing steps without loss. Therefore, it is urgent to provide a method that can realize infinite length recording of continuous context structured information. Summary of the invention
[0007] In response to the above problems, the present invention proposes a method and system for realizing continuous conversation of infinite length context in a large language model. Through data conversion and storage, unlimited and lossless storage of the result data of each step of data processing is achieved, and it can also be losslessly extracted in subsequent steps for further processing.
[0008] To achieve the above object, the present invention discloses a method for realizing continuous dialogue with infinite context of a large language model, comprising:
[0009] Users upload data to be analyzed and mined, and create structured retrieval data tables;
[0010] Split the requirements first raised by the user into sub-questions to obtain one or more sub-questions;
[0011] Based on the data, the large language model outputs a text answer to each sub-question to the user, or outputs an executable program code, and outputs the data result obtained after execution to the user;
[0012] Each sub-question, the output of the sub-question, the user ID, and the effect tag corresponding to the output are stored in a structured retrieval data table to form a piece of data;
[0013] Based on the data, each subsequent requirement raised by the user is split into sub-questions, and for each of the split sub-questions, a large language model is used to calculate the text semantic similarity of the sub-questions in each piece of data in the structured retrieval data table;
[0014] According to the calculation results, the data with the highest similarity and the corresponding output effect marked as helpful is selected from the multiple data, and the data is used as the output of the sub-question and stored in the structured retrieval data table;
[0015] The answers to the multiple sub-questions split from each requirement are concatenated and returned to the user.
[0016] As a further improvement of the present invention, after the user uploads the data to be analyzed and mined, two data table link paths are created to store the data respectively, including the original data path to be processed and the address path where the original data copy is stored, and a structured retrieval data table is created under the address path where the original data copy is stored.
[0017] As a further improvement of the present invention, the data is obtained based on the original data path to be processed, a text answer is output to the user for each sub-question, or an executable program code is output, and the data result obtained after execution is output to the user.
[0018] As a further improvement of the present invention, the structured search data table also includes date and time, and output type;
[0019] Output the corresponding effect mark, including whether the answer is helpful or not.
[0020] As a further improvement of the present invention, according to the calculation results, data with the highest similarity and the output corresponding effect marked as helpful is selected from multiple data, and the data is used as the output of the sub-question and stored in the structured retrieval data table; including:
[0021] Under the condition that the output corresponding to the mark is helpful and the user ID is the same as the current user, the output with a similarity greater than or equal to the preset threshold and the maximum value is taken as the output of this sub-problem;
[0022] If the obtained output is empty, the sub-question is sent to the large language model to obtain a text answer or output executable program code and execute it, and then return the relevant data results.
[0023] The present invention also provides a system for realizing continuous dialogue with infinite context of a large language model, including: a data table creation module, a question splitting module, a model output module, a data table information storage module, a similarity calculation module, and a result selection and output module;
[0024] The data table creation module is used to:
[0025] Users upload data to be analyzed and mined, and create structured retrieval data tables;
[0026] The problem splitting module is used to:
[0027] Split the requirements first raised by the user into sub-questions to obtain one or more sub-questions;
[0028] Each subsequent requirement raised by the user is split into sub-questions to obtain one or more sub-questions;
[0029] The model output module is used to:
[0030] Based on the data, the large language model outputs a text answer to each sub-question to the user, or outputs an executable program code, and outputs the data result obtained after execution to the user;
[0031] The data table information storage module is used to:
[0032] Each sub-question, the output of the sub-question, the user ID, and the effect tag corresponding to the output are stored in a structured retrieval data table to form a piece of data;
[0033] The similarity calculation module is used to:
[0034] For each sub-question split from the requirements raised by the user, the large language model is used to calculate the text semantic similarity of the sub-question in each data in the structured retrieval data table;
[0035] The result selection and output module is used to:
[0036] According to the calculation results, the data with the highest similarity and the corresponding output effect marked as helpful is selected from the multiple data, and the data is used as the output of the sub-question and stored in the structured retrieval data table;
[0037] The answers to the multiple sub-questions split from each requirement are concatenated and returned to the user.
[0038] As a further improvement of the present invention, after the user uploads the data to be analyzed and mined, two data table link paths are created to store the data respectively, including the original data path to be processed and the address path where the original data copy is stored, and a structured retrieval data table is created under the address path where the original data copy is stored.
[0039] As a further improvement of the present invention, the data is obtained based on the original data path to be processed, a text answer is output to the user for each sub-question, or an executable program code is output, and the data result obtained after execution is output to the user.
[0040] As a further improvement of the present invention, the structured search data table also includes date and time, and output type;
[0041] Output the corresponding effect mark, including whether the answer is helpful or not.
[0042] As a further improvement of the present invention, according to the calculation results, data with the highest similarity and the output corresponding effect marked as helpful is selected from multiple data, and the data is used as the output of the sub-question and stored in the structured retrieval data table; including:
[0043] Under the condition that the output corresponding to the mark is helpful and the user ID is the same as the current user, the output with a similarity greater than or equal to the preset threshold and the maximum value is taken as the output of this sub-problem;
[0044] If the obtained output is empty, the sub-question is sent to the large language model to obtain a text answer or output executable program code and execute it, and then return the relevant data results.
[0045] Compared with the prior art, the present invention has the following beneficial effects:
[0046] The present invention constructs a structured data table. On the one hand, the sub-questions and related result information in each user demand are stored in the structured retrieval data table instead of the history of the large language model. Furthermore, as long as the input of each user demand and the decomposed sub-questions output by the large language model do not exceed the token limit, no matter how many rounds of interaction are experienced, the token limit will not be exceeded. At the same time, a historical memory of each round of dialogue is formed in the structured retrieval data table. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 A flow chart of a method for realizing a large language model with infinite context continuous dialogue disclosed in an embodiment of the present invention;
[0048] Figure 2 A schematic diagram of a system for realizing continuous dialogue with infinite context in a large language model disclosed in an embodiment of the present invention. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings 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.
[0050] The present invention is further described in detail below in conjunction with the accompanying drawings:
[0051] like Figure 1 As shown, the present invention discloses a method for realizing a large language model with infinite length context continuous dialogue, comprising:
[0052] S1. The user uploads the data to be analyzed and mined, and creates a structured retrieval data table;
[0053] in,
[0054] After the user uploads the data to be analyzed and mined, two data table link paths are created to store the data separately, including the original data path to be processed and the address path where the original data copy is stored, and a structured retrieval data table is created under the address path where the original data copy is stored.
[0055] Furthermore,
[0056] Before data processing begins, the data content in the link paths of the two data tables is exactly the same, but then the data is updated by operations such as null value filling and outlier processing, and only the original data copy is updated.
[0057] S2. Split the requirements first raised by the user into sub-questions to obtain one or more sub-questions;
[0058] Among them, namely:
[0059] Carry out the data processing input for the first data analysis and mining, split the requirements raised by the user into one or more sub-questions.
[0060] S3. Based on the data, the large language model outputs a text answer to each sub-question to the user, or outputs executable program code, and outputs the data results obtained after execution to the user;
[0061] in,
[0062] The data is obtained based on the original data path to be processed, and a text answer is output to the user for each sub-question, or an executable program code is output, and the data results obtained after execution are output to the user.
[0063] Furthermore,
[0064] Collect feedback from users on whether the answer was helpful.
[0065] S4, storing each sub-question, the output of the sub-question, the user ID, and the effect tag corresponding to the output into a structured retrieval data table to form a data entry;
[0066] in,
[0067] The feedback on whether the user's answer is helpful or not is used as the effect mark corresponding to the output;
[0068] Furthermore,
[0069] Output the corresponding effect mark, including whether the answer is helpful or not.
[0070] Furthermore,
[0071] The structured search data table also includes date and time, output type;
[0072] Program codes with line breaks must be converted to regular expressions before being stored in the structured information retrieval data table.
[0073] Specifically, the items of the structured search data table are shown in Table 1:
[0074] Table 1
[0075]
[0076] After each answer, the data example in the structured information retrieval data table is shown in Table 2:
[0077] Table 2
[0078]
[0079]
[0080] S5, based on the original data path to be processed, data is obtained, each subsequent requirement raised by the user is split into sub-questions, and for each of the split sub-questions, a large language model is used to calculate the text semantic similarity of the sub-questions in each data in the structured retrieval data table;
[0081] in,
[0082] That is, starting from the second interaction with the large language model, after splitting the user's demand question into sub-questions, the large language model is used to compare the text semantic similarity of the Input field of each data in the structured retrieval data table for each sub-question.
[0083] S6. According to the calculation results, select the data with the highest similarity and the corresponding output effect marked as helpful from the multiple data, use the data as the output of the sub-question, and store it in the structured retrieval data table;
[0084] Among them, include:
[0085] Under the condition that the output corresponding to the mark is helpful and the user ID is the same as the current user, the output with a similarity greater than or equal to the preset threshold and the maximum value is taken as the output of this sub-problem;
[0086] If the obtained output is empty, the sub-question is sent to the large language model to obtain a text answer or output executable program code and execute it, and then return the relevant data results.
[0087] Specifically,
[0088] With OutputOK=1and UserID=user's ID as conditions, take the Output with the maximum value of similarity of Input text content>=0.8 as the Output of the corresponding sub-problem.
[0089] Furthermore, with OutputOK=1and UserID=user's ID as conditions, the similarity of the Input text content is greater than or equal to 0.8, and the output is empty, the sub-question is sent to the large language model to re-output the corresponding text answer, or the executable program code is output and executed, and the relevant data results are returned.
[0090] S7. The answers to the multiple sub-questions split from each requirement are concatenated and returned to the user.
[0091] in,
[0092] If the user's needs can only be decomposed into one sub-problem, there will be no splicing task in this step.
[0093] like Figure 2 As shown, the present invention also provides a system for realizing continuous dialogue with infinite context of a large language model, including: a data table creation module, a question splitting module, a model output module, a data table information storage module, a similarity calculation module, and a result selection and output module;
[0094] Data table creation module for:
[0095] Users upload data to be analyzed and mined, and create structured retrieval data tables;
[0096] in,
[0097] After the user uploads the data to be analyzed and mined, two data table link paths are created to store the data separately, including the original data path to be processed and the address path where the original data copy is stored, and a structured retrieval data table is created under the address path where the original data copy is stored.
[0098] Furthermore,
[0099] Before data processing begins, the data content in the link paths of the two data tables is exactly the same, but then the data is updated by operations such as null value filling and outlier processing, and only the original data copy is updated.
[0100] Problem splitting module, used to:
[0101] The requirements first raised by the user are split into sub-problems to obtain one or more sub-problems; that is, the data processing input for the first data analysis and mining is performed, and the requirements raised by the user are split into sub-problems to obtain one or more sub-problems.
[0102] Each subsequent requirement raised by the user is split into sub-questions to obtain one or more sub-questions;
[0103] Model output module, used to:
[0104] Based on the data, the large language model outputs a text answer to each sub-question to the user, or outputs an executable program code, and outputs the data results obtained after execution to the user; wherein, based on the original data path to be processed, data is obtained, and a text answer is output to the user for each sub-question, or an executable program code is output, and the data results obtained after execution are output to the user. Furthermore, feedback is collected from the user on whether the answer is helpful.
[0105] Data table information storage module, used for:
[0106] Each sub-question, the output of the sub-question, the user ID, and the effect tag corresponding to the output are stored in the structured retrieval data table to form a data entry; wherein the user's feedback on whether the answer is helpful is used as the effect tag corresponding to the output; further, the effect tag corresponding to the output includes, the answer is helpful, the answer is not helpful. Furthermore, the structured retrieval data table also includes the date and time, the output type; the program code with line breaks must be regularized before being stored in the structured information retrieval data table.
[0107] Similarity calculation module, used for:
[0108] For each sub-question split from the user's subsequent needs, the large language model is used to calculate the text semantic similarity of the sub-questions in each data in the structured retrieval data table; that is, starting from the second interaction with the large language model, after the user's needs questions are split into sub-questions, the large language model is used to compare the text semantic similarity of the Input field of each data in the structured retrieval data table for each split sub-question.
[0109] Result selection and output module, used for:
[0110] According to the calculation results, the data with the highest similarity and the corresponding effect mark of the output as helpful is selected from multiple data, and the data is used as the output of the sub-question and stored in the structured retrieval data table; wherein, it includes: taking the output corresponding to the mark as helpful and the user ID being the same as the current user as the condition, taking the output with a similarity greater than or equal to the preset threshold and the maximum value as the output of the sub-question; if the obtained output is empty, the sub-question is sent to the large language model to obtain the text answer or output the executable program code and execute it, and then return the relevant data results. Specifically, taking OutputOK=1and UserID=user's ID as the condition, taking the similarity of the Input text content>=0.8 and the maximum value of the Output as the Output of the corresponding sub-question. Further, taking OutputOK=1and UserID=user's ID as the condition, the similarity of the Input text content>=0.8, and the output is empty, then the sub-question is sent to the large language model to re-output the corresponding text answer, or output the executable program code and execute it, and then return the relevant data results.
[0111] The answers to the multiple sub-questions split from each demand are concatenated and returned to the user. If the user demand can only be decomposed into one sub-question, this concatenation task does not exist.
[0112] Advantages of the present invention:
[0113] The present invention constructs a structured data table. On the one hand, the sub-questions and related result information in each user demand are stored in the structured retrieval data table instead of the history of the large language model. Furthermore, as long as the input of each user demand and the decomposed sub-questions output by the large language model do not exceed the token limit, no matter how many rounds of interaction are experienced, the token limit will not be exceeded. At the same time, a historical memory of each round of dialogue is formed in the structured retrieval data table.
[0114] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for realizing continuous dialogue with infinite context in a large language model, characterized in that: include: Users upload data to be analyzed and mined, and create structured retrieval data tables; Split the requirements first raised by the user into sub-questions to obtain one or more sub-questions; Based on the data, the large language model outputs a text answer to each sub-question to the user, or outputs an executable program code, and outputs the data result obtained after execution to the user; Each sub-question, the output of the sub-question, the user ID, and the effect tag corresponding to the output are stored in a structured retrieval data table to form a piece of data; Based on the data, each subsequent requirement raised by the user is split into sub-questions, and for each of the split sub-questions, a large language model is used to calculate the text semantic similarity of the sub-questions in each piece of data in the structured retrieval data table; According to the calculation results, the data with the highest similarity and the corresponding output effect marked as helpful is selected from the multiple data, and the data is used as the output of the sub-question and stored in the structured retrieval data table; The answers to the multiple sub-questions split from each requirement are concatenated and returned to the user.
2. The method for realizing continuous dialogue with infinite context of a large language model according to claim 1, characterized in that: After the user uploads the data to be analyzed and mined, two data table link paths are created to store the data respectively, including the original data path to be processed and the address path where the original data copy is stored, and a structured retrieval data table is created under the address path where the original data copy is stored.
3. The method for realizing continuous dialogue with infinite context of a large language model according to claim 2, characterized in that: The data is obtained based on the original data path to be processed, and a text answer is output to the user for each sub-question, or an executable program code is output, and the data result obtained after execution is output to the user.
4. The method for realizing continuous dialogue with infinite context of a large language model according to claim 1, characterized in that: The structured search data table also includes date and time, output type; Output the corresponding effect mark, Including: helpful answers and unhelpful answers.
5. The method for realizing continuous dialogue with infinite context of a large language model according to claim 1, characterized in that: According to the calculation results, the data with the highest similarity and the corresponding output effect marked as helpful is selected from the multiple data, and the data is used as the output of the sub-question and stored in the structured search data table; including: Under the condition that the output corresponding to the mark is helpful and the user ID is the same as the current user, the output with a similarity greater than or equal to the preset threshold and the maximum value is taken as the output of this sub-problem; If the obtained output is empty, the sub-question is sent to the large language model to obtain a text answer or output executable program code and execute it, and then return the relevant data results.
6. A system for realizing infinite-length continuous conversation of a large language model, realizing the method for realizing infinite-length continuous conversation of a large language model as claimed in any one of claims 1 to 5, characterized in that: include: Data table creation module, problem splitting module, model output module, data table information storage module, similarity calculation module, result selection and output module; The data table creation module is used to: Users upload data to be analyzed and mined, and create structured retrieval data tables; The problem splitting module is used to: Split the requirements first raised by the user into sub-questions to obtain one or more sub-questions; Each subsequent requirement raised by the user is split into sub-questions to obtain one or more sub-questions; The model output module is used to: Based on the data, the large language model outputs a text answer to each sub-question to the user, or outputs an executable program code, and outputs the data result obtained after execution to the user; The data table information storage module is used to: Each sub-question, the output of the sub-question, the user ID, and the effect tag corresponding to the output are stored in a structured retrieval data table to form a piece of data; The similarity calculation module is used to: For each sub-question split from the requirements raised by the user, the large language model is used to calculate the text semantic similarity of the sub-question in each data in the structured retrieval data table; The result selection and output module is used to: According to the calculation results, the data with the highest similarity and the corresponding output effect marked as helpful is selected from the multiple data, and the data is used as the output of the sub-question and stored in the structured retrieval data table; The answers to the multiple sub-questions split from each requirement are concatenated and returned to the user.
7. The system for realizing continuous dialogue with infinite context of a large language model according to claim 6, characterized in that: After the user uploads the data to be analyzed and mined, two data table link paths are created to store the data respectively, including the original data path to be processed and the address path where the original data copy is stored, and a structured retrieval data table is created under the address path where the original data copy is stored.
8. The system for realizing continuous dialogue with infinite context of a large language model according to claim 7, characterized in that: The data is obtained based on the original data path to be processed, and a text answer is output to the user for each sub-question, or an executable program code is output, and the data result obtained after execution is output to the user.
9. The system for realizing continuous dialogue with infinite context of a large language model according to claim 6, characterized in that: The structured search data table also includes date and time, output type; Output the corresponding effect mark, Including: helpful answers and unhelpful answers.
10. The system for realizing continuous dialogue with infinite context of a large language model according to claim 6, characterized in that: According to the calculation results, the data with the highest similarity and the corresponding output effect marked as helpful is selected from the multiple data, and the data is used as the output of the sub-question and stored in the structured search data table; including: Under the condition that the output corresponding to the mark is helpful and the user ID is the same as the current user, the output with a similarity greater than or equal to the preset threshold and the maximum value is taken as the output of this sub-problem; If the obtained output is empty, the sub-question is sent to the large language model to obtain a text answer or output executable program code and execute it, and then return the relevant data results.
