A method and system for arranging knowledge data of a large model

By constructing data sets, filtering and merging similarity operations, calculating the sensitivity distribution under the input length, optimizing the knowledge data arrangement, the problem of mismatch between the input problems and the knowledge base in the existing technology is solved, matching efficiency is improved, and more Accurate knowledge base query.

CN118627624BActive Publication Date: 2024-11-05EXCELLENCE INFORMATION TECH CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411095054.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-12
Publication Date
2024-11-05
Estimated Expiration
2044-08-12

AI Technical Summary

Technical Problem

In the knowledge base-based Q&A scenario, existing large language models fail to effectively consider the sensitivity differences between different input positions, resulting in the input problems that do not match the fields in the knowledge base, affecting the matching efficiency.

Method used

A large-model knowledge data arrangement method is proposed. By constructing data sets, filtering and merging similarity operations, the sensitivity distribution under different input lengths is calculated, and the arrangement of knowledge data is optimized to improve matching accuracy.

Benefits of technology

The problem of mismatch between the input problem and the fields in the knowledge base is overcome, the matching efficiency of the big data knowledge model is improved, and the best match between the input problem and the knowledge base is ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118627624B_ABST
    Figure CN118627624B_ABST
Patent Text Reader

Abstract

The present invention discloses a knowledge data arrangement method for a large model, and relates to the technical field of natural language processing. The method specifically comprises the steps of constructing a data set according to an input text, screening and merging the data set, obtaining a similarity set by similarity calculation, constructing a statistical model using the similarity set, calculating the sensitivity distribution under different input lengths, obtaining an input question, and obtaining an answer from a knowledge base after the knowledge data is arranged according to the input question. The present invention overcomes the matching problem of a large data knowledge model caused by the mismatch between the input question and the field in the knowledge base.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of natural language processing, and in particular to a knowledge data arrangement method and system for a large model. Background Art

[0002] In the field of natural language processing, models based on attention mechanisms have made significant breakthroughs. However, existing large language models are not equally sensitive to different positions of the input content. In knowledge-based question-answering scenarios, relevant background knowledge is usually sorted in descending order of relevance to the question and then input into the large model, without considering the differences in sensitivity at different positions. Summary of the invention

[0003] The purpose of the present invention is to propose a knowledge data arrangement method of a large model to solve one or more technical problems existing in the prior art and at least provide a beneficial choice or create conditions.

[0004] To achieve the above technical objectives, the technical solution of the present invention is as follows:

[0005] In a first aspect, the present invention provides a method for arranging knowledge data of a large model, the method comprising the following steps:

[0006] Step 1, build a data set based on the input text;

[0007] Step 2, filter and merge the data sets, and perform similarity calculation to obtain similarity-related sets;

[0008] Step 3, using similarity sets to build a statistical model and calculate the sensitivity distribution under different input lengths;

[0009] Step 4, obtain the input question, and get the answer from the knowledge base after the knowledge data is arranged according to the input question.

[0010] Furthermore, in step 1, the sub-steps of constructing a data set based on the input text are:

[0011] The input question field, the relevant background information field and the answer field are constructed into triples (q, i, a), and all the triples are recorded as the first data set as set SetA, SetA={(q1, i1, a1), (q2, i2, a2), (q3, i3, a3), ..., (qx, ix, ax)}, where qx, ix, ax are the input question field, the relevant background information field and the answer field with sequence number x in SetA, (qx, ix, ax) is any element in SetA, the value range of x is [1, X], and X is the size of SetA;

[0012] The second data set is denoted as SetB, SetB={d1,d2,d3,…}, and the elements in SetB are text segments;

[0013] The input of the large model is obtained as C, and C is divided into multiple segments by a preset length d. The divided segments constitute a third data set SetS={s1,s2,s3,...}.

[0014] Furthermore, in step 2, the data set is screened and merged, and the sub-steps of similarity calculation to obtain the similarity association set are:

[0015] A similarity operation is performed on each segment in the third data set and the first data set to construct a similar association set CAB corresponding to each element in the third data set, specifically:

[0016] Step 2.1, take the triple element (qx, ix, ax) in the first data set SetA, perform similarity calculations on the relevant background information field ix and the elements in the second data set SetB to obtain similarities. The higher the text similarity, the greater the similarity. And sort the elements in the second data set SetB in ascending order according to the obtained similarities.

[0017] Extract a set number of elements from the sorted second data set SetB in order to form a set B', and limit the difference between the total size of the field ix and any element in the set B' and the length of the sy segment to be less than 0.2d, and the size of the set B' is n;

[0018] Step 2.2, concatenate ix with all the fragments in B'x respectively, and the concatenated texts constitute the second merged text set, specifically:

[0019] Sequentially concatenate ix with the fragments in B'x to obtain a concatenated text set D, where the position of ix in the concatenated text is determined according to the semantics, and the number of concatenated texts is n+1, D={d1,d2,d3,……,dn+1};

[0020] According to the position of ix in the concatenated text, the first position set is formed, P={p1,p2,p3,…};

[0021] wherein the position in the text is expressed as a percentage;

[0022] Step 2.3, construct tuples corresponding to the elements in the first position set P and the elements in the concatenated text set D, and all tuples constitute the related information set Ix={(d1,p1),(d2,p2),(d3,p3),…};

[0023] Step 2.4, replace the ix fields in the triples of SetA with the elements in the related information set Ix to obtain the second merged text set Csx;

[0024] Step 2.5, perform similarity calculation on each segment in the third data set and the first data set in turn, construct a second merged text set corresponding to each element in the third data set, and all second merged text sets constitute a similar association set CAB={Csx}.

[0025] Furthermore, in step 3, the statistical model is constructed using the similarity-linked set, and the sub-steps for calculating the sensitivity distribution under different input lengths are:

[0026] Step 3.1, divide the position interval of the third data set SetS into multiple intervals according to a fixed or random percentage, and record all the obtained intervals as a set SetS'={s'1,s'2,s'3,...}; the size of the interval division is adjusted according to the length of the elements in the interval set SetS, the smaller the length, the larger the division granularity; the larger the length, the finer the division granularity;

[0027] Step 3.2, calculate the sensitivity distribution of each segment in the third data set SetS under inputs of different lengths based on the similarity association set CAB:

[0028] Traverse each element Csx in the similar association set CAB, extract the relevant information Ix field from the triple in Csx, add the two-tuple (dy, py) in the relevant information Ix field to the prompt template to construct the text content seqx, perform reasoning on the text content seqx in the input model to obtain the reasoning answer, compare the reasoning answer with the answer field in the triple of Csx, and obtain the similarity sim after comparison;

[0029] Step 3.3, obtain the similarity sim of the elements of all intervals in SetS', construct a similarity tuple (pi, simi) where pi is in interval s'i, and the similarity tuples obtained in the intervals constitute the set Ex; calculate the average value of all similarities in Ex Denoted as the sensitivity coefficient, the sensitivity distribution set is obtained ;

[0030] Step 3.4, calculate the similarity of all elements in the interval of SetS' in turn.

[0031] Preferably, every five percentage points are divided into an interval: (0%, 5%], (5%, 10%] ... (95%, 100%], and the third data set SetS is divided.

[0032] Furthermore, in step 4, the sub-steps of obtaining the input question and obtaining the answer from the knowledge base after the knowledge data is arranged according to the input question are:

[0033] Step 4.1, obtain an input question r, search for reference documents from a pre-stored knowledge base content database that supports text similarity retrieval according to the input question, calculate the relevance score between the reference document and the input question, sort the reference documents in descending order according to the corresponding relevance obtained, and construct a set R={[r1,score1],[r2,score2],[r3,score3],……,[rm,scorem]}, where r1 refers to the first reference document, score1 refers to the relevance corresponding to r1, and the size of the set R is m;

[0034] Step 4.2: Count the total length LR of the text in R, search for the interval sn closest to the length of LR from the third data set SetS, and obtain the sensitivity distribution data corresponding to the interval sn ;

[0035] Step 4.3, traverse all permutations of the text in the reference document in R, and for any permutation, calculate the position of the merged text in each reference document , all reference document locations obtained constitute the set ,in, for Position in the current arrangement;

[0036] According to the location from Get the corresponding sensitivity coefficient set ,in Based on from The sensitivity coefficient corresponding to the corresponding position interval is obtained, and the sensitivity score is calculated according to the sensitivity coefficient. The calculation formula is as follows:

[0037] ,

[0038] The arrangement of elements in R that corresponds to the highest score is the best arrangement for model input.

[0039] Preferably, all undefined variables in the present invention, if not clearly defined, can be manually set thresholds.

[0040] In a second aspect, the present invention provides a knowledge data arrangement system of a large model, the system comprising:

[0041] Data collection module: The data collection module is used to construct the input question field, related background information field and answer field into triples (q, i, a), and all the triples are recorded as the first data set as set SetA, SetA={(q1, i1, a1), (q2, i2, a2), (q3, i3, a3), ..., (qx, ix, ax)}, where qx, ix, ax are the input question field, related background information field and answer field with sequence number x in SetA, (qx, ix, ax) is any element in SetA, the value range of x is [1, X], and X is the size of SetA;

[0042] The second data set is denoted as SetB, SetB={d1,d2,d3,…}, and the elements in SetB are text segments;

[0043] The input of the large model is obtained as C, and C is divided into multiple segments with a preset length d, and the divided segments constitute a third data set SetS={s1,s2,s3,...};

[0044] Data processing module: used to filter and merge data sets, perform similarity calculations to obtain similarity sets; use similarity sets to build statistical models and calculate sensitivity distributions under different input lengths;

[0045] Question extraction operation module: used to obtain the input question and get the answer from the knowledge base after the knowledge data is arranged according to the input question;

[0046] Result output module: used to output the answer to the input question.

[0047] In a third aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the large-model knowledge data arrangement method provided in the first aspect of the present invention.

[0048] In a fourth aspect, the present invention provides an electronic device, comprising: a memory on which a computer program is stored; and a processor for executing the computer program in the memory to implement the steps of the large model knowledge data arrangement method provided by the present invention.

[0049] Compared with the prior art, the present invention has the following beneficial technical effects:

[0050] It overcomes the matching problem of big data knowledge model caused by the mismatch between the input questions and the fields in the knowledge base (such as the input questions are too long or too short). BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1A flow chart of a method for arranging knowledge data of a large model provided by the present invention;

[0052] Figure 2 The present invention is a block diagram showing the structure of a large-model knowledge data arrangement system according to an embodiment of the present invention. DETAILED DESCRIPTION

[0053] In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. The specific embodiments described here are only used to explain the present invention and are not used to limit the present invention.

[0054] It should also be understood that the following examples are only used to further illustrate the present invention and cannot be understood as limiting the scope of protection of the present invention. Some non-essential improvements and adjustments made by those skilled in the art based on the above content of the present invention belong to the scope of protection of the present invention. The specific process parameters and the like in the following examples are also only examples within a suitable range, that is, those skilled in the art can make a selection within a suitable range through the description herein, and are not limited to the specific values ​​​​exemplified below.

[0055] The following is an exemplary description of a large model knowledge data arrangement method provided by the present invention.

[0056] like Figure 1 The following is a flowchart of a method for arranging knowledge data of a large model. Figure 1 A method for arranging knowledge data of a large model according to an embodiment of the present invention is described below. The method comprises the following steps:

[0057] Step 1, build a data set based on the input text;

[0058] Step 2, filter and merge the data sets, and perform similarity calculation to obtain similarity-related sets;

[0059] Step 3, using similarity sets to build a statistical model and calculate the sensitivity distribution under different input lengths;

[0060] Step 4, obtain the input question, and get the answer from the knowledge base after the knowledge data is arranged according to the input question.

[0061] Furthermore, in step 1, the sub-steps of constructing a data set based on the input text are:

[0062] The input question field, the relevant background information field and the answer field are constructed into triples (q, i, a), and all the triples are recorded as the first data set as set SetA, SetA={(q1, i1, a1), (q2, i2, a2), (q3, i3, a3), ..., (qx, ix, ax)}, where qx, ix, ax are the input question field, the relevant background information field and the answer field with sequence number x in SetA, (qx, ix, ax) is any element in SetA, the value range of x is [1, X], and X is the size of SetA;

[0063] The second data set is denoted as SetB, SetB={d1,d2,d3,…}, and the elements in SetB are text segments;

[0064] The input of the large model is obtained as C, and C is divided into multiple segments by a preset length d. The divided segments constitute a third data set SetS={s1,s2,s3,...}.

[0065] Furthermore, in step 2, the data set is screened and merged, and the sub-steps of similarity calculation to obtain the similarity association set are:

[0066] A similarity operation is performed on each segment in the third data set and the first data set to construct a similar association set CAB corresponding to each element in the third data set, specifically:

[0067] Step 2.1, take the triple element (qx, ix, ax) in the first data set SetA, perform similarity calculations on the relevant background information field ix and the elements in the second data set SetB to obtain similarities. The higher the text similarity, the greater the similarity. And sort the elements in the second data set SetB in ascending order according to the obtained similarities.

[0068] Extract a set number of elements from the sorted second data set SetB in order to form a set B', and limit the difference between the total size of the field ix and any element in the set B' and the length of the sy segment to be less than 0.2d, and the size of the set B' is n;

[0069] Step 2.2, concatenate ix with all the fragments in B'x respectively, and the concatenated texts constitute the second merged text set, specifically:

[0070] Sequentially concatenate ix with the fragments in B'x to obtain a concatenated text set D, where the position of ix in the concatenated text is determined according to the semantics, and the number of concatenated texts is n+1, D={d1,d2,d3,……,dn+1};

[0071] According to the position of ix in the concatenated text, the first position set is formed, P={p1,p2,p3,…};

[0072] wherein the position in the text is expressed as a percentage;

[0073] Step 2.3, construct tuples corresponding to the elements in the first position set P and the elements in the concatenated text set D, and all tuples constitute the related information set Ix={(d1,p1),(d2,p2),(d3,p3),…};

[0074] Step 2.4, replace the ix fields in the triples of SetA with the elements in the related information set Ix to obtain the second merged text set Csx;

[0075] Step 2.5, perform similarity calculation on each segment in the third data set and the first data set in turn, construct a second merged text set corresponding to each element in the third data set, and all second merged text sets constitute a similar association set CAB={Csx}.

[0076] Furthermore, in step 3, the statistical model is constructed using the similarity-linked set, and the sub-steps for calculating the sensitivity distribution under different input lengths are:

[0077] Step 3.1, divide the position interval of the third data set SetS into multiple intervals according to a fixed or random percentage, and record all the obtained intervals as a set SetS'={s'1,s'2,s'3,...}; the size of the interval division is adjusted according to the length of the elements in the interval set SetS, the smaller the length, the larger the division granularity; the larger the length, the finer the division granularity;

[0078] Step 3.2, calculate the sensitivity distribution of each segment in the third data set SetS under inputs of different lengths based on the similarity association set CAB:

[0079] Traverse each element Csx in the similar association set CAB, extract the relevant information Ix field from the triple in Csx, add the two-tuple (dy, py) in the relevant information Ix field to the prompt template to construct the text content seqx, perform reasoning on the text content seqx in the input model to obtain the reasoning answer, compare the reasoning answer with the answer field in the triple of Csx, and obtain the similarity sim after comparison;

[0080] Step 3.3, obtain the similarity sim of the elements of all intervals in SetS', construct a similarity tuple (pi, simi) where pi is in interval s'i, and the similarity tuples obtained in the intervals constitute the set Ex; calculate the average value of all similarities in Ex Denoted as the sensitivity coefficient, the sensitivity distribution set is obtained ;

[0081] Step 3.4, calculate the similarity of all elements in the interval of SetS' in turn.

[0082] Preferably, every five percentage points are divided into an interval: (0%, 5%], (5%, 10%] ... (95%, 100%], and the third data set SetS is divided.

[0083] Furthermore, in step 4, the sub-steps of obtaining the input question and obtaining the answer from the knowledge base after the knowledge data is arranged according to the input question are:

[0084] Step 4.1, obtain an input question r, search for reference documents from a pre-stored knowledge base content database that supports text similarity retrieval according to the input question, calculate the relevance score between the reference document and the input question, sort the reference documents in descending order according to the corresponding relevance obtained, and construct a set R={[r1,score1],[r2,score2],[r3,score3],……,[rm,scorem]}, where r1 refers to the first reference document, score1 refers to the relevance corresponding to r1, and the size of the set R is m;

[0085] Step 4.2: Count the total length LR of the text in R, search for the interval sn closest to the length of LR from the third data set SetS, and obtain the sensitivity distribution data corresponding to the interval sn ;

[0086] Step 4.3, traverse all permutations of the text in the reference document in R, and for any permutation, calculate the position of the merged text in each reference document , all reference document locations obtained constitute the set ,in, for Position in the current arrangement;

[0087] According to the location from Get the corresponding sensitivity coefficient set ,in Based on from The sensitivity coefficient corresponding to the corresponding position interval is obtained, and the sensitivity score is calculated according to the sensitivity coefficient. The calculation formula is as follows:

[0088] ,

[0089] The arrangement of elements in R that corresponds to the highest score is the best arrangement for model input.

[0090] Preferably, all undefined variables in the present invention, if not clearly defined, can be manually set thresholds.

[0091] like Figure 2 The figure is a schematic block diagram of the structure of a large-model knowledge data arrangement system according to an embodiment of the present invention.

[0092] The present invention provides a knowledge data arrangement system of a large model, the system comprising:

[0093] Data collection module: The data collection module is used to construct the input question field, related background information field and answer field into triples (q, i, a), and all the triples are recorded as the first data set as set SetA, SetA={(q1, i1, a1), (q2, i2, a2), (q3, i3, a3), ..., (qx, ix, ax)}, where qx, ix, ax are the input question field, related background information field and answer field with sequence number x in SetA, (qx, ix, ax) is any element in SetA, the value range of x is [1, X], and X is the size of SetA;

[0094] The second data set is denoted as SetB, SetB={d1,d2,d3,…}, and the elements in SetB are text segments;

[0095] The input of the large model is obtained as C, and C is divided into multiple segments with a preset length d, and the divided segments constitute a third data set SetS={s1,s2,s3,...};

[0096] Data processing module: used to filter and merge data sets, perform similarity calculations to obtain similarity sets; use similarity sets to build statistical models and calculate sensitivity distributions under different input lengths;

[0097] Question extraction operation module: used to obtain the input question and get the answer from the knowledge base after the knowledge data is arranged according to the input question;

[0098] Result output module: used to output the answer to the input question. Specific embodiments

[0099] 1. Constructing the Dataset

[0100] Construct data set A: question, related information, answer triples, denoted as: A={( , , ),( , , )...};

[0101] Construct data set B: B consists of a large number of text segments, denoted as: B={ , , ,...};

[0102] Enter the maximum length of the large model according to a certain distance Divide into several intervals evenly, denoted as: S={ , , ,...};

[0103] Construct a data set C for each interval in S, such as Construct the dataset:

[0104]

[0105] The construction method is as follows:

[0106] Traverse the elements in set A, for the elements First, for , use any text similarity tool to select the same The lowest similarity elements constitute a set ,make sure and The total length of all texts and The difference between the upper bounds of the interval does not exceed 20% of the total.

[0107] Will and All the texts in the text are concatenated together, and a total of n+1 concatenated texts are constructed (n is The number of elements) is denoted as: ,in Indicates when splicing At the beginning of the concatenated text, express is the second paragraph of the concatenated text, and so on. express At the end of the concatenated text. The percentage of the center position in the concatenated text is collected ,Finally, construct the set by combining D and P elements , the final combination constitute The elements in .

[0108] Follow the same steps to construct , ...and other data sets.

[0109] 1. Statistical model sensitivity distribution

[0110] For each interval in S, the sensitivity distribution of the model under different input lengths is calculated. , using the corresponding To statistically analyze the model sensitivity distribution, the specific steps are as follows:

[0111] Traversal For the elements in , and then traverse For any element in ,Will and Add to the prompt template to construct text content , input the model for reasoning and get the answer ,calculate and Similarity ,combination and

[0112] After the traversal is completed, the collection is obtained

[0113] After the traversal is completed, merge all Get Collection

[0114] Divide the position interval into several intervals according to percentage, with each interval being five percentage points: (0%, 5%], (5%, 10%]... (95%, 100%], and we get The size of the interval partition is adjusted according to the length of the elements in the interval set S. If the length is small, the partition granularity can be larger; if the length is large, the partition granularity is finer.

[0115] Traversal , for which the elements , traverse the elements in E and get all ,in Located in the interval In the set .calculate middle The average , which is the sensitivity coefficient.

[0116] Finally, we get the sensitivity distribution set ;

[0117] 1. Arrange knowledge data

[0118] In the scenario based on knowledge question answering, the knowledge base content is usually stored in a database that supports text similarity retrieval, and the knowledge base content with high similarity is retrieved as a reference document based on the input question, which is recorded as: , where r is the document data in the knowledge base, and score is the relevance score. Generally, the larger the score, the higher the relevance (some algorithms are the opposite, but they can be equivalently converted through mathematical means). The usual practice is to merge all reference data from high to low scores, and then put the merged text and questions into the prompt template to get the input data of the model, and then input it into the model to let the model generate the answer.

[0119] After obtaining the model sensitivity distribution, we can place highly relevant texts in highly sensitive positions based on the model's sensitivity distribution. This can help the model better obtain information that is highly relevant to the question and generate more reasonable answers.

[0120] The specific arrangement method is as follows:

[0121] Count the total length of the text in R and find the interval with the closest length in S , based on this, the corresponding sensitivity distribution data is obtained .

[0122] Traverse all permutations of the text in R, and for any of them, calculate the position of each reference document center in the merged text , the locations of all documents constitute the set ,in, for Position in the current arrangement. Get the corresponding sensitivity coefficient set ,in Based on from Get the sensitivity coefficient corresponding to the corresponding position interval, and calculate the sensitivity score based on it. The calculation formula is as follows:

[0123] ,m is the total number of documents in R.

[0124] The arrangement of elements in R that corresponds to the highest score is the best arrangement for the model input.

[0125] The knowledge data arrangement system based on a large model can be run in computing devices such as desktop computers, laptops, PDAs and cloud servers. The system that can run the knowledge data arrangement system of a large model may include, but is not limited to, a processor and a memory. Those skilled in the art can understand that the example is only an example of a knowledge data arrangement system of a large model, and does not constitute a limitation on a knowledge data arrangement system of a large model. It may include more or fewer components than the example, or a combination of certain components, or different components. For example, the knowledge data arrangement system of a large model may also include input and output devices, network access devices, buses, etc.

[0126] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the large-scale knowledge data arrangement system operation system, and uses various interfaces and lines to connect the various parts of the entire large-scale knowledge data arrangement system operation system.

[0127] The memory can be used to store the computer program and / or module, and the processor realizes various functions of the large-model knowledge data arrangement system by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.). In addition, the memory can include a random access memory (RAM) and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0128] Although the description of the present invention has been quite detailed and has been described in particular with respect to several described embodiments, it is not intended to be limited to any of these details or embodiments or any particular embodiment, so as to effectively cover the intended scope of the present invention. In addition, the present invention is described above with the embodiments foreseeable by the inventors, and its purpose is to provide a useful description, and those non-substantial changes to the present invention that are not currently foreseen may still represent equivalent changes of the present invention.

[0129] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0130] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that many changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention.

Claims

1. A method for arranging knowledge data of a large model, characterized in that: The method comprises the following steps: Step 1, build a data set based on the input text; Step 2, filter and merge the data sets, and perform similarity calculation to obtain similarity-related sets; Step 3, using similarity sets to build a statistical model and calculate the sensitivity distribution under different input lengths; Step 4, obtaining an input question, and obtaining an answer from the knowledge base after the knowledge data is arranged according to the input question; In step 1, the sub-steps of building a dataset based on the input text are: The input question field, the relevant background information field and the answer field are constructed into triples (q, i, a), and all the triples are recorded as the first data set as set SetA, SetA={(q1, i1, a1), (q2, i2, a2), (q3, i3, a3), ..., (qx, ix, ax)}, where qx, ix, ax are the input question field, the relevant background information field and the answer field with sequence number x in SetA, (qx, ix, ax) is any element in SetA, the value range of x is [1, X], and X is the size of SetA; The second data set is denoted as SetB, SetB={d1,d2,d3,…}, and the elements in SetB are text segments; The input of the large model is obtained as C, and C is divided into multiple segments with a preset length d, and the divided segments constitute a third data set SetS={s1,s2,s3,...}; In step 2, the data set is screened and merged, and the sub-steps of similarity calculation to obtain similar joint sets are: A similarity operation is performed on each segment in the third data set and the first data set to construct a similar association set CAB corresponding to each element in the third data set, specifically: Step 2.1, take the triple element (qx, ix, ax) in the first data set SetA, perform similarity calculations on the relevant background information field ix and the elements in the second data set SetB to obtain similarities. The higher the text similarity, the greater the similarity. And sort the elements in the second data set SetB in ascending order according to the obtained similarities. Extract a set number of elements from the sorted second data set SetB in order to form a set B', and limit the difference between the total size of the field ix and any element in the set B' and the length of the sy segment to be less than 0.2d, and the size of the set B' is n; Step 2.2, concatenate ix with all the fragments in B'x respectively, and the concatenated texts constitute the second merged text set, specifically: Sequentially concatenate ix with the fragments in B'x to obtain a concatenated text set D, where the position of ix in the concatenated text is determined according to the semantics, and the number of concatenated texts is n+1, D={d1,d2,d3,……,dn+1}; According to the position of ix in the concatenated text, the first position set is formed, P={p1,p2,p3,…}; wherein the position in the text is expressed as a percentage; Step 2.3, construct tuples corresponding to the elements in the first position set P and the elements in the concatenated text set D, and all tuples constitute the related information set Ix={(d1,p1),(d2,p2),(d3,p3),…}; Step 2.4, replace the ix fields in the triples of SetA with the elements in the related information set Ix to obtain the second merged text set Csx; Step 2.5, perform similarity calculation on each segment in the third data set and the first data set in turn, construct a second merged text set corresponding to each element in the third data set, and all second merged text sets constitute a similar association set CAB={Csx}; In step 3, the statistical model is constructed using the similarity set, and the sub-steps for calculating the sensitivity distribution under different input lengths are: Step 3.1, divide the position interval of the third data set SetS into multiple intervals according to a fixed or random percentage, and record all the obtained intervals as a set SetS'={s'1,s'2,s'3,...}; the size of the interval division is adjusted according to the length of the elements in the interval set SetS, the smaller the length, the larger the division granularity; the larger the length, the finer the division granularity; Step 3.2, calculate the sensitivity distribution of each segment in the third data set SetS under inputs of different lengths based on the similarity association set CAB: Traverse each element Csx in the similar association set CAB, extract the relevant information Ix field from the triple in Csx, add the two-tuple (dy, py) in the relevant information Ix field to the prompt template to construct the text content seqx, perform reasoning on the text content seqx in the input model to obtain the reasoning answer, compare the reasoning answer with the answer field in the triple of Csx, and obtain the similarity sim after comparison; Step 3.3, obtain the similarity sim of the elements of all intervals in SetS', construct a similarity tuple (pi, simi) where pi is in interval s'i, and the similarity tuples obtained in the intervals constitute the set Ex; calculate the average value of all similarities in Ex Denoted as the sensitivity coefficient, the sensitivity distribution set is obtained ; Step 3.4, calculate the similarity of all elements in the interval of SetS' in turn; In step 4, the sub-steps of obtaining the input question and obtaining the answer from the knowledge base after the knowledge data is arranged according to the input question are: Step 4.1, obtain an input question r, search for reference documents from a pre-stored knowledge base content database that supports text similarity retrieval according to the input question, calculate the relevance score between the reference document and the input question, sort the reference documents in descending order according to the corresponding relevance obtained, and construct a set R={[r1,score1],[r2,score2],[r3,score3],……,[rm,scorem]}, where r1 refers to the first reference document, score1 refers to the relevance corresponding to r1, and the size of the set R is m; Step 4.2: Count the total length LR of the text in R, search for the interval sn closest to the length of LR from the third data set SetS, and obtain the sensitivity distribution data corresponding to the interval sn ; Step 4.3, traverse all permutations of the text in the reference document in R, and for any permutation, calculate the position of the merged text in each reference document , all reference document locations obtained constitute the set ,in, for Position in the current arrangement; According to the location from Get the corresponding sensitivity coefficient set ,in Based on from The sensitivity coefficient corresponding to the corresponding position interval is obtained, and the sensitivity score is calculated according to the sensitivity coefficient. The calculation formula is as follows: , The arrangement of elements in R that corresponds to the highest score is the best arrangement for model input.

2. A large-model knowledge data arrangement system, characterized in that: The system runs the steps of the knowledge data arrangement method of a large model as claimed in claim 1; The system comprises: Data collection module: The data collection module is used to construct the input question field, related background information field and answer field into triples (q, i, a), and all the triples are recorded as the first data set as set SetA, SetA={(q1, i1, a1), (q2, i2, a2), (q3, i3, a3), ..., (qx, ix, ax)}, where qx, ix, ax are the input question field, related background information field and answer field with sequence number x in SetA, (qx, ix, ax) is any element in SetA, the value range of x is [1, X], and X is the size of SetA; The second data set is denoted as SetB, SetB={d1,d2,d3,…}, and the elements in SetB are text segments; The input of the large model is obtained as C, and C is divided into multiple segments with a preset length d, and the divided segments constitute a third data set SetS={s1,s2,s3,...}; Data processing module: used to filter and merge data sets, perform similarity calculations to obtain similarity sets; use similarity sets to build statistical models and calculate sensitivity distributions under different input lengths; Question extraction operation module: used to obtain the input question and get the answer from the knowledge base after the knowledge data is arranged according to the input question; Result output module: used to output the answer to the input question.

3. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the large model knowledge data arrangement method described in claim 1 are implemented.

4. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor is used to execute the computer program in the memory to implement the steps of the knowledge data arrangement method of a large model as claimed in claim 1.