A system and method for comparing institutions based on multi-granularity large language model

Through the institutional comparison method based on a multi-grained large language model, the problem that existing technology is difficult to capture complex semantic associations is solved, and accurate comparison and difference analysis of institutional texts are realized, and clear comparison results are generated.

CN119513621BActive Publication Date: 2025-03-28GUANGZHOU CIVIL AVIATION INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510081364.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-20
Publication Date
2025-03-28
Estimated Expiration
2045-01-20

AI Technical Summary

Technical Problem

The existing institutional comparison system is difficult to effectively capture complex semantic associations and implicit relationships, and deep learning methods are limited to the sentence level and lack clear explanations for contrasting points and differences.

Method used

The institutional comparison method based on a multi-grained large language model is adopted. By performing multi-grained splitting of the documents to be compared, text vectors of different granularities are extracted, vector distance is calculated to determine the similarity score, and semantic differences analysis is performed using the preset large model to generate comparison results.

Benefits of technology

It realizes a comprehensive capture of the details of institutional text and global semantic features, generates more accurate comparison results, which can effectively explain comparison results, and helps users understand and make decisions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119513621B_ABST
    Figure CN119513621B_ABST
Patent Text Reader

Abstract

The present invention provides a system and method for comparing institutions based on a multi-granularity large language model, including: performing multi-granularity splitting processing on documents to be compared to obtain contents to be compared at multiple granularities; extracting text vectors corresponding to the contents to be compared at each granularity respectively; determining similarity scores between institutional texts based on the vector distance between the text vectors of each granularity and institutional text vectors in a preset knowledge base; performing semantic difference analysis on documents to be compared and institutional text vectors in a preset knowledge base using a preset large model to obtain difference analysis results between institutional texts; and determining institutional comparison results based on the similarity scores and difference analysis results between institutional texts. The present invention performs multi-granularity splitting processing on documents to be compared, performs comprehensive comparison and semantic difference analysis of institutional texts at three levels, namely, sentences, paragraphs, and full texts, comprehensively captures the details and global semantic features of institutional texts, and generates more accurate comparison results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a system and method for comparing systems based on a multi-granularity large language model. Background Art

[0002] Due to various reasons, there may be inconsistencies, conflicts or contradictions between the old and new institutional texts. The Institutional Comparison System helps people better understand and evaluate these contradictions by comparing and analyzing the differences and similarities between the old and new institutional texts.

[0003] At present, common solutions mainly include traditional methods, machine learning-based methods and deep learning-based methods. Among them, traditional methods use methods such as keyword extraction, TF-IDF, word frequency analysis, etc. to compare systems, and judge similarity by calculating the vocabulary overlap of texts. It is simple and fast to implement, but can only handle simple vocabulary matching and it is difficult to capture complex semantic associations and implicit relationships. In addition, machine learning-based methods use traditional machine learning models such as support vector machines (SVM) and KNN to classify or regress the extracted text features to judge the similarity of systems. They can capture certain semantic relationships and are more intelligent than traditional text methods. However, they rely on manual feature extraction and improper feature selection may lead to a decrease in comparison accuracy. Deep learning-based methods use deep learning models (such as Word2Vec, BERT, etc.) to convert text into vector representations. By calculating the similarity between vectors for comparison, they can capture deeper semantic features and improve comparison accuracy. However, existing deep learning methods are mostly limited to semantic comparison at the sentence level. In addition, the results generated by deep learning methods often only provide similarity scores, lack clear explanations of comparison points and differences, and are not conducive to user understanding and decision-making. Summary of the invention

[0004] The present invention provides a system and method for comparing systems based on a multi-granularity large language model, aiming to solve at least one of the above-mentioned technical problems.

[0005] The present invention provides a system comparison method based on a multi-granularity large language model, comprising:

[0006] The system text in the document to be compared is split into multiple granularities to obtain the content to be compared at multiple granularities;

[0007] Extract text vectors corresponding to the contents to be compared at different granularities respectively;

[0008] Determine the similarity scores between institutional texts based on the vector distance between the text vector at each granularity and each institutional text vector in the preset knowledge base;

[0009] Using a preset large model, a semantic difference analysis is performed on the document to be compared and the institutional text vector in the preset knowledge base to obtain a difference analysis result between the institutional texts;

[0010] Based on the similarity scores and difference analysis results between the institutional texts, the institutional comparison results are determined.

[0011] According to a system comparison method based on a multi-granularity large language model provided by the present invention, the similarity scores between system texts are determined based on the vector distance between the text vector at each granularity and each system text vector in a preset knowledge base, including:

[0012] For each granularity: based on the text vector at the granularity and each institutional text vector at the granularity in the preset knowledge base, determining the vector distance between the text vector and any institutional text vector;

[0013] Inputting the vector distance at each granularity into the input layer of the pre-built target model, so as to perform nonlinear transformation on the vector distance at each granularity through the hidden layer in the target model;

[0014] Mapping the output results of the hidden layer to dynamic weights corresponding to different granularities through the output layer in the target model;

[0015] Based on the dynamic weights of the different granularities, the vector distances of the different granularities are weighted to obtain the similarity scores between the institutional texts.

[0016] According to a system comparison method based on a multi-granularity large language model provided by the present invention, the target model is trained based on the following steps:

[0017] Obtaining a number of pairs of samples to be trained, wherein each pair of samples to be trained includes two system contents to be trained;

[0018] For any pair of samples to be trained:

[0019] Input the contents of each of the to-be-trained systems into the preset large model, and obtain similarity prediction results between the to-be-trained sample pairs output by the preset large model;

[0020] Perform multi-granularity analysis on the contents of each system to be trained respectively, so as to extract text vectors corresponding to the contents to be trained with different granularities;

[0021] Based on the text vectors corresponding to the to-be-trained parsed contents of different granularities in the training sample pairs, determining the distances of the to-be-trained vectors at different granularities;

[0022] The distances of the vectors to be trained at different granularities are input into the target model to calculate the comprehensive similarity scores between the pairs of samples to be trained;

[0023] The target model is trained based on the similarity prediction result and the comprehensive similarity score.

[0024] According to a system comparison method based on a multi-granularity large language model provided by the present invention, the preset large model is used to perform semantic difference analysis on the system text vectors in the document to be compared and the preset knowledge base to obtain the difference analysis results between the system texts, including:

[0025] Based on the vector distance between the text vector at each granularity and each system text vector in the preset knowledge base, screen out text vectors whose vector distance is greater than a preset distance threshold;

[0026] Based on the text vector and each institutional text vector in the preset knowledge base, the preset large model is used to perform semantic analysis to obtain difference analysis results between the institutional texts.

[0027] According to a system comparison method based on a multi-granularity large language model provided by the present invention, the system comparison result is determined based on the similarity score and difference analysis results between the system texts, including:

[0028] Sorting the similarity scores between the institutional texts to obtain a score sorting result;

[0029] Based on the scoring ranking results and difference analysis results between the institutional texts, the institutional comparison results are generated.

[0030] According to a system comparison method based on a multi-granularity large language model provided by the present invention, the document to be compared is split into multiple granularities to obtain the content to be compared at multiple granularities, including:

[0031] The document to be compared is split according to multiple granularities of sentence, paragraph and full text to obtain split contents of multiple granularities;

[0032] The split contents of the multiple granularities are preprocessed respectively to obtain the contents to be compared of the multiple granularities.

[0033] According to a system comparison method based on a multi-granularity large language model provided by the present invention, before determining the similarity scores between system texts based on the vector distance between the text vector at each granularity and each system text vector in a preset knowledge base, the method further includes:

[0034] Acquire historical documents, and parse the historical documents according to multiple granularities of sentence, paragraph, and full text to obtain parsed contents of different granularities;

[0035] Performing filtering processing on the parsed contents of different granularities respectively;

[0036] The processed parsed content is converted into a system text vector and stored in the preset knowledge base.

[0037] The present invention also provides a system comparison system based on a multi-granularity large language model, comprising:

[0038] A splitting module is used to split the document to be compared into multiple granularities to obtain the content to be compared at multiple granularities;

[0039] A vector extraction module is used to extract text vectors corresponding to the content to be compared at different granularities;

[0040] A first determination module is used to determine the similarity scores between institutional texts based on the vector distance between the text vector at each granularity and each institutional text vector in the preset knowledge base;

[0041] A difference analysis module, used to perform semantic difference analysis on the document to be compared and the institutional text vector in the preset knowledge base using a preset large model, and obtain a difference analysis result between the institutional texts;

[0042] The second determination module is used to determine the system comparison result based on the similarity scores and difference analysis results between the system texts.

[0043] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the system comparison method based on a multi-granularity large language model as described above is implemented.

[0044] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the system comparison method based on a multi-granularity large language model as described in any one of the above is implemented.

[0045] The present invention provides a system and method for comparing institutions based on a multi-granularity large language model, including: performing multi-granularity splitting processing on the document to be compared to obtain contents to be compared at multiple granularities; extracting text vectors corresponding to the contents to be compared at different granularities respectively; determining the similarity scores between the institutional texts based on the vector distance between the text vector at each granularity and each institutional text vector in a preset knowledge base; performing semantic difference analysis on the document to be compared and the institutional text vector in the preset knowledge base using a preset large model to obtain a difference analysis result between the institutional texts; and determining the institutional comparison result based on the similarity score and difference analysis result between the institutional texts. By performing multi-granularity splitting processing on the document to be compared, a comprehensive comparison and semantic difference analysis of the institutional texts are performed from three levels: sentences, paragraphs, and full texts, the details and global semantic features of the institutional texts are comprehensively captured to generate more accurate comparison results. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced one by one below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0047] Figure 1 It is a flow chart of the system comparison method based on the multi-granularity large language model provided by the present invention;

[0048] Figure 2 It is a structural schematic diagram of a system comparison system based on a multi-granularity large language model provided by the present invention;

[0049] Figure 3 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0050] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings 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.

[0051] The terms used in one or more embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present invention. The singular forms of "a", "said" and "the" used in one or more embodiments of the present invention are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of the present invention refers to and includes any or all possible combinations of one or more associated listed items.

[0052] It should be understood that, although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present invention, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present invention, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "when..." or "when...".

[0053] Figure 1 FIG. 1 is a flow chart of the system comparison method based on the multi-granularity large language model provided by the present invention. Figure 1 As shown, the system comparison method based on the multi-granularity large language model includes:

[0054] Step S11, splitting the document to be compared into multiple granularities to obtain contents to be compared at multiple granularities;

[0055] It should be noted that the document to be compared refers to the institutional text document that is modified from the old institutional text, and the document can be in various formats, such as text files, PDF files, etc. Specifically, the institutional text in the document to be compared is split and processed according to multiple granularities such as sentences, paragraphs, and full texts. That is, taking sentences as the splitting units, the document to be compared is split according to sentences to obtain multiple sentence texts; taking paragraphs as the splitting units, the document to be compared is split according to paragraphs to obtain multiple paragraph texts, and the entire document to be compared is used as the content to be compared at the full-text granularity. Then, the split contents of multiple granularities are preprocessed respectively to obtain the content to be compared of the multiple granularities, for example, useless words that do not affect the semantics, such as stop words, terms, etc., are eliminated to improve the accuracy of the vector representation.

[0056] Step S12, respectively extracting text vectors corresponding to the to-be-compared contents of different granularities;

[0057] Specifically, the text vectors corresponding to the content to be compared of different granularities can be extracted through methods such as bag of words model (Bag of Words or BoW model, etc.), TF-IDF, word embedding (such as Word2Vec model, etc.), pre-trained language model (such as BERT or RoBERTa model, etc.). Optionally, in a specific embodiment, each sentence in the document to be compared is converted into a vector, and the text vector corresponding to the sentence granularity can be obtained. A vector array can be formed based on the text vectors of all sentences at the sentence granularity. The text vectors of all sentences in each paragraph are merged to obtain the text vector corresponding to the paragraph granularity, and a vector array is formed based on the text vectors of all paragraphs at the paragraph granularity. The text vectors of all sentences in the entire document to be compared are averaged to obtain the text vector corresponding to the full-text granularity.

[0058] Step S13, determining the similarity scores between institutional texts based on the vector distances between the text vectors at each granularity and the institutional text vectors in the preset knowledge base;

[0059] It should be noted that historical documents are obtained. In the system comparison scenario, historical documents are the original documents before the system text is modified. In one embodiment, the historical documents are parsed according to multiple granularities of sentences, paragraphs and full texts to obtain parsed contents of different granularities, which is convenient for fine-grained comparison; and then the parsed contents of different granularities are filtered and processed respectively, and irrelevant words (such as years, fixed terms, company names, names or references of systems, etc.) are eliminated to ensure that the saved vectors are more focused on the semantic core. Further, the parsed contents of different granularities after processing are converted into system text vectors and stored in a preset knowledge base. In other embodiments, the preset knowledge base can also store system text vectors of different granularities in multiple old versions of system texts. Optionally, the LangChain framework is used to read historical documents, and sentences, paragraphs and full texts are converted into Document objects, which are stored in the preset knowledge base through the FAISS module.

[0060] Specifically, for the text vector at each granularity: based on the text vector and each institutional text vector in the preset knowledge base, determine the vector distance between the text vector and any institutional text vector, where the vector distance can be the Euclidean distance or other similarity measurement, so as to obtain the vector distance corresponding to the sentence granularity, paragraph granularity and full-text granularity. Then, according to the vector distance corresponding to the institutional text in the document to be compared and each institutional text in the preset knowledge base at the sentence granularity, paragraph granularity and full-text granularity, a weighted fusion calculation is performed to obtain the similarity score between the institutional text in the document to be compared and each institutional text in the preset knowledge base.

[0061] In order to improve the accuracy of the similarity score, in one embodiment, the vector distances of multiple granularities are comprehensively evaluated through a dynamic weight fusion mechanism to generate a unified similarity score. Specifically, the vector distance at each granularity is input into the input layer of the pre-constructed target model, so that the vector distance at each granularity is nonlinearly transformed through the hidden layer in the target model; and then the output result of the hidden layer is mapped to the dynamic weight corresponding to different granularities through the output layer in the target model; further, according to the vector distances corresponding to the sentence granularity, paragraph granularity and full-text granularity of the institutional text in the document to be compared and each institutional text in the preset knowledge base, weighted fusion is performed according to the dynamic weights corresponding to different granularities to obtain the similarity score between the institutional texts, wherein the lower the similarity score, the more similar the two institutional texts are, and the higher the similarity score, the less similar the two institutional texts are.

[0062] Step S13, using a preset large model to perform semantic difference analysis on the document to be compared and the institutional text vector in the preset knowledge base, to obtain a difference analysis result between the institutional texts;

[0063] Specifically, a preset large model is used to perform semantic difference analysis on text vectors corresponding to contents to be compared of different granularities in the compared document and institutional text vectors in the preset knowledge base to obtain a difference analysis result between the institutional texts.

[0064] Optionally, a prompt template corresponding to the multi-granularity comparison is pre-constructed to guide the large language model to judge the semantic similarity of texts with far vector distances. In the construction stage of the prompt template, it is necessary to clarify the criteria for evaluating text similarity, such as semantic similarity, structural similarity, lexical similarity, etc. It is also necessary to guide the generation of differentiated understanding and evaluation of the two sentences so that users can refer to them. For example, the reference prompt template is as follows: Please analyze whether the meanings of the following two sentences are different and explain: 1. {text1}; 2. {text2}.

[0065] In other embodiments, for text segments with a large vector distance, a large language model is used to further determine whether the semantics are similar. More specifically: based on the vector distance between the text vector at each granularity and each institutional text vector in the preset knowledge base, a text vector with a vector distance greater than a preset distance threshold is screened, and then based on the text vector and each institutional text vector in the preset knowledge base, a semantic analysis is performed using the preset large model to obtain a difference analysis result between the institutional texts. Optionally, the content to be compared corresponding to the text vector with a vector distance greater than the preset distance threshold is determined, and the content to be compared is semantically identified with the historical documents in the preset knowledge base to obtain a difference analysis result between the institutional texts. Thus, by utilizing the generation capability of the large language model, useful information can be automatically extracted from the text, and it can be found whether there are differences in the meanings between different institutions, and difference analysis and explanation can be provided for sentences with low similarity, thereby reducing the error caused by measuring the text distance and improving the accuracy of text comparison.

[0066] Step S14, determining the system comparison result based on the similarity scores and difference analysis results between the system texts.

[0067] Specifically, the similarity scores between the system texts are then sorted to obtain a score sorting result; this allows the user to more intuitively understand the similarity of the systems. In other embodiments, the similarity scores between the system texts are filtered according to a preset similarity threshold. For example, based on the similarity scores between the system texts in the document to be compared and each system text in the preset knowledge base, similarity scores less than the preset similarity threshold are screened. Based on the score sorting results and difference analysis results between the system texts, the system comparison results are generated so that the user can clearly understand the similarity scores between the system texts and the semantic differences between the texts.

[0068] The embodiment of the present invention, through the above scheme, includes: performing multi-granularity splitting processing on the document to be compared to obtain content to be compared at multiple granularities; extracting text vectors corresponding to the content to be compared at different granularities respectively; determining the similarity score between the institutional texts based on the vector distance between the text vector at each granularity and each institutional text vector in the preset knowledge base; performing semantic difference analysis on the document to be compared and the institutional text vector in the preset knowledge base using a preset large model to obtain a difference analysis result between the institutional texts; determining the institutional comparison result based on the similarity score and difference analysis result between the institutional texts. By performing multi-granularity splitting processing on the document to be compared, a comprehensive comparison and semantic difference analysis of the institutional texts are performed from three levels: sentences, paragraphs, and full texts, and the details and global semantic features of the institutional texts are comprehensively captured to obtain a more accurate comparison result.

[0069] In one embodiment of the present invention, based on the vector distance between the text vector at each granularity and each institutional text vector in the preset knowledge base, the similarity score between institutional texts is determined, including:

[0070] For each granularity: based on the text vector at the granularity and each institutional text vector at the granularity in the preset knowledge base, determine the vector distance between the text vector and any institutional text vector; input the vector distance at each granularity into the input layer of the pre-constructed target model, so as to perform a nonlinear transformation on the vector distance at each granularity through the hidden layer in the target model; map the output result of the hidden layer to dynamic weights corresponding to different granularities through the output layer in the target model; based on the dynamic weights of the different granularities, weight the vector distances of the different granularities to obtain the similarity scores between the institutional texts.

[0071] Specifically, taking sentence, paragraph and full-text granularity as examples, for sentence granularity: based on the text vector of each content to be compared at the sentence granularity and each institutional text vector of the institutional text at the sentence granularity in the preset knowledge base, determine the vector distance between the text vector of each sentence and any institutional text vector. For paragraph granularity: based on the text vector of each content to be compared at the paragraph granularity and each institutional text vector at the paragraph granularity in the preset knowledge base, determine the vector distance between the text vector of each paragraph and any institutional text vector. For full-text granularity: based on the text vector of the full-text granularity and the institutional text vector at the full-text granularity in the preset knowledge base, determine the vector distance between the text vector of the full text and the institutional text vector.

[0072] Furthermore, the vector distances corresponding to the three granularities are input into the input layer of the pre-built target model, and the relationship between different granularities is learned through the hidden layer of the target model using nonlinear transformation. , where W is the weight matrix, b is the bias vector, is the ReLU activation function. The output layer of the model uses the Softmax function to map the hidden layer output to dynamic weights of three granularities. The dynamic weight calculation formula is as follows:

[0073]

[0074] Among them, w i Indicates The dynamic weight of the granularity, h i represents the output of the i-th neuron in the hidden layer, h jRepresents the output of other neurons in the hidden layer (there are 3 neurons in total, corresponding to three granularities: sentence, paragraph and full text), and the cumulative sum of the dynamic weights of the three granularities is equal to 1: Further, according to the vector distances corresponding to the sentence granularity, paragraph granularity and full text granularity of the institutional text in the document to be compared and each institutional text in the preset knowledge base, weighted fusion is performed according to the dynamic weights corresponding to different granularities to obtain the similarity score between the institutional texts. The calculation formula of the similarity score is as follows:

[0075]

[0076] Among them, S 综合 represents the similarity score, w i Indicates The dynamic weight of the granularity, S i Indicates The vector distance of the granularity.

[0077] Through the above scheme, the embodiment of the present invention realizes the use of a dynamic weight fusion mechanism to weight the vector distances at the sentence granularity, paragraph granularity and full-text granularity to obtain the final similarity score, which can comprehensively capture the details and global semantic features of the institutional text, thereby improving the accuracy of text comparison.

[0078] In one embodiment of the present invention, the target model is trained based on the following steps:

[0079] Acquire a number of pairs of samples to be trained, wherein each pair of samples to be trained includes two system contents to be trained; for any pair of samples to be trained: input each system content to be trained into the preset large model to obtain the similarity prediction result between the pairs of samples to be trained output by the preset large model; perform multi-granularity analysis on each system content to be trained respectively to extract text vectors corresponding to the analyzed contents to be trained at different granularities; determine the distance of the vectors to be trained at different granularities based on the text vectors corresponding to the analyzed contents to be trained at different granularities in the training sample pairs; input the distance of the vectors to be trained at different granularities into the target model to calculate the comprehensive similarity score between the pairs of samples to be trained; and train the target model based on the similarity prediction result and the comprehensive similarity score.

[0080] Specifically, a plurality of pairs of samples to be trained are obtained, wherein each pair of samples to be trained includes two system contents to be trained; and the following operations are performed for any pair of samples to be trained:

[0081] The two pieces of system content to be trained are input into the preset big model so that the preset big model can perform semantic analysis on the two pieces of system content to be trained, and obtain the similarity prediction result between the two pieces of system content to be trained output by the preset big model, that is, let the preset big model generate a semantic similarity score (between 0 and 1), and the generated score is used as the target value for training.

[0082] In addition, the two system contents to be trained are respectively analyzed at multiple granularities according to sentences, paragraphs, and full texts to obtain the different granularities of the to-be-trained analytical contents corresponding to the two system contents to be trained, and then the text vectors corresponding to the different granularities of the to-be-trained analytical contents are respectively extracted. Further, based on the text vectors corresponding to the different granularities of the to-be-trained analytical contents in the training sample pair, the distances of the to-be-trained vectors of the two system contents to be trained at different granularities are respectively calculated. Further, the distances of the to-be-trained vectors of the two system contents to be trained at different granularities are input into the target model, so that the distances of the to-be-trained vectors at each granularity are nonlinearly transformed through the hidden layer in the target model; finally, the output results of the hidden layer are mapped to weights corresponding to different granularities, and then the distances of the to-be-trained vectors corresponding to different granularities are weighted according to the weights corresponding to different granularities to obtain the comprehensive similarity score between the to-be-trained sample pairs, wherein the calculation process of the weights corresponding to different granularities and the comprehensive similarity score is similar to the calculation process of the above-mentioned dynamic weights and similarity scores, which will not be repeated here.

[0083] Furthermore, based on the similarity prediction result and the comprehensive similarity score, a loss function is used to calculate a model loss value, and then the target model is trained in combination with the model loss value. Optionally, the loss function uses mean square error (MSE) and Adam optimizer to minimize the gap between the comprehensive similarity score and the similarity prediction result. The loss function is as follows:

[0084]

[0085] Among them, L represents the model loss value, N represents the number of training sample pairs, It is The comprehensive similarity score of the pairs of samples to be trained, It is The similarity prediction results of the pairs of samples to be trained.

[0086] The embodiment of the present invention trains the target model by using the similarity prediction results generated by the large language model prediction and the comprehensive similarity score determined by the target model, thereby obtaining weights at different granularities according to the prediction calculations of the trained target model, and adopts a dynamic weight fusion mechanism to weight the vector distances at the sentence granularity, paragraph granularity and full-text granularity to obtain the final similarity score, which can comprehensively capture the details and global semantic features of the institutional text, thereby improving the accuracy of text comparison.

[0087] In one embodiment of the present invention, a preset large model is used to perform semantic difference analysis on the document to be compared and the system text vector in the preset knowledge base to obtain a difference analysis result between the system texts, including:

[0088] Based on the vector distance between the text vector at each granularity and each institutional text vector in the preset knowledge base, the text vector whose vector distance is greater than the preset distance threshold is screened out; based on the text vector and each institutional text vector in the preset knowledge base, the preset large model is used to perform semantic analysis to obtain the difference analysis results between the institutional texts.

[0089] Specifically, for each text vector: based on the vector distance between the text vector and each institutional text vector of the corresponding granularity in the preset knowledge base, the text vectors with vector distance greater than the preset distance threshold are screened, and then the content to be compared with the longer vector distance is determined. Then, the content to be compared corresponding to the vector distance greater than the preset distance threshold and each institutional text in the preset knowledge base are input into the preset large model for semantic analysis to further determine whether the text semantics are similar, that is, the large model is used to determine whether the meaning of the sentence with a longer vector distance is similar to the sentence in the knowledge base, thereby utilizing the generation capability of the large language model to provide difference analysis and explanation for sentences with low similarity.

[0090] The system comparison system based on a multi-granularity large language model provided by the present invention is described below. The system comparison system based on a multi-granularity large language model described below and the system comparison method based on a multi-granularity large language model described above can be referenced to each other.

[0091] Figure 2 is a schematic diagram of the structure of the system comparison system based on the multi-granularity large language model provided by the present invention, such as Figure 2 As shown, a system comparison system based on a multi-granularity large language model according to an embodiment of the present invention includes:

[0092] The splitting module 21 is used to split the document to be compared into multiple granularities to obtain the content to be compared at multiple granularities;

[0093] A vector extraction module 22, used to extract text vectors corresponding to the to-be-compared contents of different granularities respectively;

[0094] A first determination module 23, configured to determine similarity scores between institutional texts based on vector distances between text vectors at each granularity and each institutional text vector in a preset knowledge base;

[0095] A difference analysis module 24 is used to perform semantic difference analysis on the document to be compared and the system text vector in the preset knowledge base using a preset large model to obtain a difference analysis result between the system texts;

[0096] The second determination module 25 is used to determine the system comparison result based on the similarity scores and difference analysis results between the system texts.

[0097] The first determining module 23 is further used for:

[0098] For each granularity: based on the text vector at the granularity and each institutional text vector at the granularity in the preset knowledge base, determining the vector distance between the text vector and any institutional text vector;

[0099] Inputting the vector distance at each granularity into the input layer of the pre-built target model, so as to perform nonlinear transformation on the vector distance at each granularity through the hidden layer in the target model;

[0100] Mapping the output results of the hidden layer to dynamic weights corresponding to different granularities through the output layer in the target model;

[0101] Based on the dynamic weights of the different granularities, the vector distances of the different granularities are weighted to obtain the similarity scores between the institutional texts.

[0102] The system comparison system based on the multi-granularity large language model also includes:

[0103] Obtaining a number of pairs of samples to be trained, wherein each pair of samples to be trained includes two system contents to be trained;

[0104] For any pair of samples to be trained:

[0105] Input the contents of each of the to-be-trained systems into the preset large model, and obtain similarity prediction results between the to-be-trained sample pairs output by the preset large model;

[0106] Perform multi-granularity analysis on the contents of each system to be trained respectively, so as to extract text vectors corresponding to the contents to be trained with different granularities;

[0107] Based on the text vectors corresponding to the to-be-trained parsed contents of different granularities in the training sample pairs, determining the distances of the to-be-trained vectors at different granularities;

[0108] The distances of the vectors to be trained at different granularities are input into the target model to calculate the comprehensive similarity scores between the pairs of samples to be trained;

[0109] The target model is trained based on the similarity prediction result and the comprehensive similarity score.

[0110] The difference analysis module 24 is also used for:

[0111] Based on the vector distance between the text vector at each granularity and each system text vector in the preset knowledge base, screen out text vectors whose vector distance is greater than a preset distance threshold;

[0112] Based on the text vector and each institutional text vector in the preset knowledge base, the preset large model is used to perform semantic analysis to obtain difference analysis results between the institutional texts.

[0113] The second determination module 25 also includes:

[0114] Sorting the similarity scores between the institutional texts to obtain a score sorting result;

[0115] Based on the scoring ranking results and difference analysis results between the institutional texts, the institutional comparison results are generated.

[0116] The splitting module 21 is also used for:

[0117] The document to be compared is split according to multiple granularities of sentence, paragraph and full text to obtain split contents of multiple granularities;

[0118] The split contents of the multiple granularities are preprocessed respectively to obtain the contents to be compared of the multiple granularities.

[0119] The system comparison system based on the multi-granularity large language model also includes:

[0120] Acquire historical documents, and parse the historical documents according to multiple granularities of sentence, paragraph, and full text to obtain parsed contents of different granularities;

[0121] Performing filtering processing on the parsed contents of different granularities respectively;

[0122] The processed parsed content is converted into a system text vector and stored in the preset knowledge base.

[0123] It should be noted here that the above-mentioned system provided by the embodiment of the present invention can implement all the method steps implemented by the above-mentioned method embodiment, and can achieve the same technical effect. The parts and beneficial effects that are the same as the method embodiment in this embodiment will not be described in detail here.

[0124] Figure 3 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 3 As shown, the electronic device may include: a processor 310, a memory 320, a communication interface 330 and a communication bus 340, wherein the processor 310, the memory 320 and the communication interface 330 communicate with each other through the communication bus 340. The processor 310 may call the logic instructions in the memory 320 to execute the system comparison method based on the multi-granularity large language model.

[0125] In addition, the logic instructions in the above-mentioned memory 320 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0126] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the system comparison method based on a multi-granularity large language model provided by the above-mentioned methods.

[0127] The system embodiment described above is merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art may understand and implement it without creative work.

[0128] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0129] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A system comparison method based on a multi-granularity large language model, characterized in that: include: The system text in the document to be compared is split into multiple granularities to obtain the content to be compared at multiple granularities; Extract text vectors corresponding to the contents to be compared at different granularities respectively; Determine the similarity scores between institutional texts based on the vector distance between the text vector at each granularity and each institutional text vector in the preset knowledge base; Using a preset large model, a semantic difference analysis is performed on the document to be compared and the institutional text vector in the preset knowledge base to obtain a difference analysis result between the institutional texts; Determine the system comparison results based on the similarity scores and difference analysis results between the system texts; The determining of the similarity scores between the institutional texts based on the vector distance between the text vector at each granularity and each institutional text vector in the preset knowledge base includes: For each granularity: based on the text vector at the granularity and each institutional text vector at the granularity in the preset knowledge base, determining the vector distance between the text vector and any institutional text vector; Inputting the vector distance at each granularity into an input layer of a pre-built target model, so as to perform a nonlinear transformation on the vector distance at each granularity through a hidden layer in the target model; Mapping the output results of the hidden layer to dynamic weights corresponding to different granularities through the output layer in the target model; Based on the dynamic weights of the different granularities, the vector distances of the different granularities are weighted to obtain the similarity scores between the institutional texts; The determination of the system comparison result based on the similarity score and difference analysis results between the system texts includes: Sorting the similarity scores between the institutional texts to obtain a score sorting result; Based on the scoring ranking results and difference analysis results between the institutional texts, the institutional comparison results are generated.

2. The system comparison method based on multi-granularity large language model according to claim 1 is characterized in that: The target model is trained based on the following steps: Obtaining a number of pairs of samples to be trained, wherein each pair of samples to be trained includes two system contents to be trained; For any pair of samples to be trained: Input the contents of each of the to-be-trained systems into the preset large model, and obtain similarity prediction results between the to-be-trained sample pairs output by the preset large model; Perform multi-granularity analysis on the contents of each system to be trained respectively, so as to extract text vectors corresponding to the contents to be trained with different granularities; Determine the distances of the vectors to be trained at different granularities based on the text vectors corresponding to the to-be-trained parsed contents at different granularities in the training sample pairs; The distances of the vectors to be trained at different granularities are input into the target model to calculate the comprehensive similarity scores between the pairs of samples to be trained; The target model is trained based on the similarity prediction result and the comprehensive similarity score.

3. The system comparison method based on multi-granularity large language model according to claim 1 is characterized in that: The method of using the preset large model to perform semantic difference analysis on the document to be compared and the system text vector in the preset knowledge base to obtain a difference analysis result between the system texts includes: Based on the vector distance between the text vector at each granularity and each system text vector in the preset knowledge base, screen out text vectors whose vector distance is greater than a preset distance threshold; Based on the text vector and each institutional text vector in the preset knowledge base, the preset large model is used to perform semantic analysis to obtain difference analysis results between the institutional texts.

4. The system comparison method based on multi-granularity large language model according to claim 1 is characterized in that: The step of performing multi-granularity splitting processing on the document to be compared to obtain content to be compared at multiple granularities includes: The document to be compared is split according to multiple granularities of sentence, paragraph and full text to obtain split contents of multiple granularities; The split contents of the multiple granularities are preprocessed respectively to obtain the contents to be compared of the multiple granularities.

5. The system comparison method based on multi-granularity large language model according to claim 1 is characterized in that: Before determining the similarity scores between institutional texts based on the vector distances between the text vectors at each granularity and each institutional text vector in the preset knowledge base, the method further includes: Acquire historical documents, and parse the historical documents according to multiple granularities of sentence, paragraph, and full text to obtain parsed contents of different granularities; Performing filtering processing on the parsed contents of different granularities respectively; The processed parsed content is converted into a system text vector and stored in the preset knowledge base.

6. A system comparison system based on a multi-granularity large language model, characterized in that: include: A splitting module is used to split the document to be compared into multiple granularities to obtain the content to be compared at multiple granularities; A vector extraction module is used to extract text vectors corresponding to the content to be compared at different granularities; A first determination module is used to determine the similarity scores between institutional texts based on the vector distance between the text vector at each granularity and each institutional text vector in the preset knowledge base; A difference analysis module, used to perform semantic difference analysis on the document to be compared and the institutional text vector in the preset knowledge base using a preset large model, and obtain a difference analysis result between the institutional texts; A second determination module is used to determine the system comparison result based on the similarity score and difference analysis results between the system texts; The determining of the similarity scores between the institutional texts based on the vector distance between the text vector at each granularity and each institutional text vector in the preset knowledge base includes: For each granularity: based on the text vector at the granularity and each institutional text vector at the granularity in the preset knowledge base, determining the vector distance between the text vector and any institutional text vector; Inputting the vector distance at each granularity into the input layer of the pre-built target model, so as to perform nonlinear transformation on the vector distance at each granularity through the hidden layer in the target model; Mapping the output results of the hidden layer to dynamic weights corresponding to different granularities through the output layer in the target model; Based on the dynamic weights of the different granularities, the vector distances of the different granularities are weighted to obtain the similarity scores between the institutional texts; The determination of the system comparison result based on the similarity score and difference analysis results between the system texts includes: Sorting the similarity scores between the institutional texts to obtain a score sorting result; Based on the scoring ranking results and difference analysis results between the institutional texts, the institutional comparison results are generated.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the program, the system comparison method based on the multi-granularity large language model as described in any one of claims 1 to 5 is implemented.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the system comparison method based on a multi-granularity large language model as described in any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Airport flight area rule monitoring method and system based on large model

    CN117475678A

  • Multi-granularity fusion model-based intelligent semantic chinese sentence matching method, and device

    WO2021164199A1