Large language data set construction method and system based on comparative learning

Through the large language data set construction system based on contrastive learning, strong features and weak features are identified, and filtered training sets and verification sets are formed. This solves the problem of insufficient repetitive semantic filtering in the construction of large language data sets and improves the training effect and generalization of the model. ization capabilities, ensuring the prediction accuracy of the model and the connectivity of entity relationship decoding.

CN118734069AActive Publication Date: 2024-10-01ZHENGZHOU FENGJIA TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202410773687.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-14
Publication Date
2024-10-01
Estimated Expiration
2044-06-14

AI Technical Summary

Technical Problem

In the construction process of existing large language data sets, the filtering step has insufficient repetitive semantic filtering, which leads to model prediction deviation and inability to achieve accurate extraction results. Moreover, the connection between entity and relationship decoding in text is weak, especially when local word meanings and data enhancement of Chinese sentences are performed. There is the problem of artificial features being added.

Method used

A large language data set based on contrastive learning is used to build the system, including an encoder, extraction module, language recognition module, semantic recognition module, annotation module and comparison module. By identifying strong and weak features, independent annotation and differential comparison are performed. Form a filtered training set and validation set, use a part-of-speech tagger to generate a part-of-speech filtering matrix, and optimize the loss function to improve data quality and model generalization ability.

Benefits of technology

By setting strong features and weak features, redundant information interference is reduced, the training effect and generalization ability of the model are improved, the quality of training data is ensured, over-fitting is prevented, and the prediction accuracy and entity relationship decoding connectivity of the model are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure BDA0004894900590000031
    Figure BDA0004894900590000031
  • Figure BDA0004894900590000061
    Figure BDA0004894900590000061
  • Figure BDA0004894900590000062
    Figure BDA0004894900590000062
Patent Text Reader

Abstract

The invention discloses a big language data set construction method and system based on comparative learning, which can realize the accuracy of big language model prediction, improve the accuracy of an extraction result, synchronously decode entities and relationships in characters, and increase the relation between subjects and objects of the entities. By setting the strong features and the weak features, the problems that sentence embedding generated by a current language model has isotropy and semantic similarity between different texts is high can be solved, by setting the annotation module for independent annotation, difference values and equivalence can be formed during later differential comparison, and the semantic similarity between different texts can be improved. And respectively classifying to form a filtering training set and a verification set.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computers, and in particular, relates to a method and system for constructing a large language data set based on contrastive learning. Background Art

[0002] "Big language datasets" generally refer to datasets containing a large amount of text data, which are used to train and evaluate natural language processing (NLP) models. They can not only generate natural language text, but also deeply understand the meaning of the text and handle various natural language tasks such as text summarization, question answering, translation, etc. These datasets are often used for various NLP tasks such as text classification, named entity recognition, sentiment analysis, machine translation, etc.

[0003] Large language models and their applications in the field of artificial intelligence have become a hot topic in global scientific research. Their growth in scale is particularly eye-catching, with the number of parameters jumping from the initial billions to one trillion today. The increase in the number of parameters enables the model to capture the subtleties of human language more finely and understand the complexity of human language more deeply. In the past year, large language models have made significant improvements in absorbing new knowledge, decomposing complex tasks, and aligning images and text. As the technology continues to mature, it will continue to expand its scope of application, provide humans with more intelligent and personalized services, and further improve people's lives and production methods.

[0004] Building a large language dataset is a complex and time-consuming process, which usually involves the following steps: first, you need to determine the type and field of the dataset to be built; once the data type and field are determined, you need to start collecting data; the collected raw data often contains noise, errors and inconsistencies, so before building the dataset, preprocessing is required, including removing duplicate data, standardizing text formats, processing missing values, filtering irrelevant text, etc.; adding labels to the dataset; and publishing and sharing the formed dataset.

[0005] However, for the current large language dataset construction process, the filtering step is mostly to filter out repeated semantics, especially for Chinese. The local meaning of the sentence, the features artificially added during data enhancement, etc. These minor changes may directly lead to the deviation of the final prediction of the model and fail to achieve a more accurate extraction result. At the same time, the simultaneous decoding of entities and relationships in the text will lead to the problem of weak connection between the subject and object of the entity. Summary of the invention

[0006] In view of the above defects, the present invention provides a large language dataset construction system based on contrastive learning, including an encoder for text recognition, an extraction module for triple information extraction, a language recognition module for text language recognition, a semantic recognition module for semantic feature recognition, an annotation module for annotation, a correction module for correcting the annotated text, a comparison module for semantic differentiation comparison, and a filtered training set and a verification set for collecting differentiation results.

[0007] Furthermore, the extraction module includes an entity recognizer for identifying entities in text, a relationship classifier for classifying each entity, a feature extractor for extracting features in the relationship classification process, and a rule engine for verifying grammatical rules.

[0008] Furthermore, the semantic recognition module is used to identify strong features and weak features in semantics:

[0009] Weak features include: semantics with low similarity obtained by the semantic recognition module, keywords with weak associations identified by the entity recognizer, and features with low matching degree with entities and relations in the knowledge base;

[0010] Strong features include: semantics with high similarity obtained through the semantic recognition module, keywords with strong relevance identified by the entity identifier, and features with a high degree of matching with entities and relationships in the knowledge base.

[0011] Furthermore, the annotation module extracts annotation information through a social annotation tool and then annotates independent strong features.

[0012] Furthermore, the present invention also discloses a method for constructing a large language dataset based on contrastive learning, including the above-mentioned large language dataset construction system based on contrastive learning, and further including the following steps:

[0013] S1, recognize the text through the encoder, and extract triple information through the extraction module;

[0014] S1-1, after being identified by the language identification module, the pre-processed semantic data X is obtained by combining the existing large language data set;

[0015] S1-2, after being identified by the language identification module, semantic feature identification is performed by the semantic identification module;

[0016] S1-3, annotate the semantic features identified in step S1-2 in their corresponding languages ​​independently through the annotation module (the annotations may be entity annotations, relationship annotations, sentiment annotations, etc., depending on the task and purpose of the dataset);

[0017] S2, correcting the subject and object corresponding to the independent annotation content through the correction module to obtain processed semantic data Y;

[0018] S3, performing differential comparison between the processed semantic data Y obtained in step S2 and the pre-processed semantic data X obtained in step S1-1 through a comparison module to obtain a difference value λ and an equivalent value γ;

[0019] S3, collecting the difference λ and forming a filtered training set;

[0020] S4, collect the equivalent γ and form a validation set;

[0021] S5. Publish and share the data set formed by step S3 and step S4.

[0022] Furthermore, the filtered training set is formed by a part-of-speech filtering matrix generated by a part-of-speech tagger, and the loss function of the algorithm in the part-of-speech filtering matrix includes entity loss, relationship loss and grammatical loss.

[0023] Furthermore, the formula of the loss function is:

[0024]

[0025] In the above formula, L rel is the relationship loss, L ent is the entity loss, L fl is the grammatical loss, nr is the number of relation types, ne is the length of the sentence, i and j represent the rows and columns of the matrix, Ki, j is the true value of the matrix, and L rel , L ent and L fl The final loss function is obtained after addition.

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

[0027] 1. By setting strong and weak features, we can solve the problem that the sentence embedding generated by the current language model is isotropic and the semantic similarity between different texts is high. We can achieve data enhancement by marking repeated joint MLM to construct weak semantic samples and reduce redundant information interference.

[0028] 2. By setting up the annotation module for independent annotation, the difference and equal value can be formed when performing differential comparison later, so as to be classified into the filtered training set and the validation set respectively;

[0029] Filtering the training set can help ensure the quality and reliability of the training data, exclude these low-quality data, improve the training effect of the model, and remove the biased data, adjust the data distribution to make it more balanced, which helps to improve the generalization ability of the model, improve the model efficiency, prevent overfitting, and improve the generalization ability of the model;

[0030] The validation set can be used to tune the model's hyperparameters, select the best model architecture, implement early stopping strategies, and ultimately evaluate the model's performance. By effectively using the validation set, the model's training efficiency and performance can be improved, and the model can be ensured to have good generalization capabilities in practical applications.

[0031] 3. This method combined with the system can achieve accurate prediction of large language models, improve the accuracy of extraction results, synchronously decode entities and relationships in text, and increase the connectivity between entities and objects. DETAILED DESCRIPTION

[0032] In order to facilitate the understanding of the present invention, the device of the present invention will be described more fully below with reference to the relevant drawings. Embodiments of the device are given in the drawings. However, the device can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive.

[0033] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "set" should be understood in a broad sense, for example, they can be fixedly connected or set, or detachably connected or set, or integrally connected or set. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0034] Example

[0035] The present embodiment provides a method and system for constructing a large language dataset based on contrastive learning, wherein the system for constructing a large language dataset based on contrastive learning includes an encoder for text recognition, an extraction module for extracting triple information, a language recognition module for identifying the language of the text, a semantic recognition module for identifying semantic features, an annotation module for annotation, a correction module for correcting the annotated text, a comparison module for semantic differentiation comparison, and a filtered training set and a validation set for collecting differentiation results;

[0036] Combining the above method used to build a system based on contrastive learning of large language datasets, the specific steps are as follows:

[0037] S1. Recognize the text through the LLaMA encoder and extract triple information through the extraction module, where the extraction module specifically includes:

[0038] Entity recognizer: used to identify entities in text, that is, to use named entity recognition (NER) technology to identify entities from text, including names of people, places, organizations and other entities with specific meanings. Before entity recognition, the original text is broken down into smaller units through word segmentation tools, such as NLTK, spaCy and other tools;

[0039] Relationship classifier: classify each entity, that is, for the identified entity pairs, use the relationship classifier to determine the type of relationship between them;

[0040] Feature extractor: Extract features during the relationship classification process. When classifying relationships, various features can be used to represent entity pairs and their contextual information, such as part-of-speech tagging, syntactic analysis, word vector representation, etc. After obtaining the encoder's feature vector hi, it is input into the relationship extraction module. A sentence may contain multiple relationships, so relationship extraction can be considered a multi-classification task. The self-attention mechanism is used to enhance the degree of association between entities and enhance information sharing between relationships and entities. Then, average pooling is used to generalize to the entire sentence. The specific formula is:

[0041] E = Avgpoll(Softmax((W q h i W k )(h i ) T )W v h i );

[0042] h avg =Avgpoll(h i );

[0043] P rel =ReLu(Wr·[h avg ; E]+b r );

[0044] Where Wq, Wk, Wv, Wr and br are trainable weight matrices, h avg Refers to the information vector of the entire sentence, P rel It refers to the probability that the correct answer is a certain relationship, hi is the feature vector obtained by the encoder, and E refers to the overall simulated entity information vector;

[0045] Rule engine: used to verify grammatical rules to verify whether the extracted triples conform to specific grammatical rules or constraints;

[0046] S1-1, after being identified as the corresponding language by the language identification module, the pre-processed semantic data X is obtained by combining the existing large language datasets, wherein the existing large language datasets include Wikipedia, CommonCrawl, GutenbergProject, Reddit, etc.;

[0047] S1-2. After being identified by the language identification module, the semantic feature recognition is performed by the semantic recognition module, where the semantic recognition module is used to identify strong and weak features in the semantics:

[0048] Weak features include: semantics with low similarity obtained by the semantic recognition module. Common semantic similarity measurement methods include word vector-based methods (such as cosine similarity), semantic graph-based methods (such as WordNet or knowledge graphs), and deep learning-based methods (such as Siamese networks), etc., and entities recognize keywords with weak correlation and low matching degree with entities and relationships in the knowledge base through entity identifiers. This embodiment adopts the cosine similarity method and uses a model to predict the cosine similarity of each text pair to evaluate semantic similarity. The text sequences are arranged in descending order according to cosine similarity and label to form sets X and Y. The Spearman correlation coefficient of sets X and Y is used to measure the correlation between the two sets of values ​​to evaluate the model's recognition ability for semantically similar texts. The Spearman correlation coefficient is solved according to the sorting position of the original data, and the formula is as follows:

[0049]

[0050] Where: xi, yi are the positions of the i-th text pair in the sets X and Y respectively, and n is the number of text pairs in the dataset;

[0051] Strong features include: semantics with high similarity obtained by the semantic recognition module, keywords with strong relevance identified by the entity recognizer, and features with high matching degree with entities and relations in the knowledge base;

[0052] Its role is to solve the problem that the sentence embedding generated by the current language model is isotropic and the semantic similarity between different texts is high. It achieves data enhancement by marking repeated joint MLM to construct weak semantic samples and reduce redundant information interference.

[0053] S1-3, annotate the semantic features identified in step S1-2 in their corresponding languages ​​independently through the annotation module (the annotations may be entity annotations, relationship annotations, sentiment annotations, etc., depending on the task and purpose of the dataset);

[0054] S2, correcting the subject and object corresponding to the independent annotation content through the correction module to obtain processed semantic data Y;

[0055] S3, performing differential comparison between the processed semantic data Y obtained in step S2 and the pre-processed semantic data X obtained in step S1-1 through a comparison module to obtain a difference λ and an equivalent value γ. For example, the difference obtained by differentially comparing the entity semantics after annotation with the entity semantics before annotation is the difference λ, and the same semantics is the equivalent value γ;

[0056] S3. Collect the difference λ and form a filtered training set. The filtered training set is formed by the part-of-speech filter matrix generated by the part-of-speech tagger. The loss function of the algorithm in the part-of-speech filter matrix includes entity loss, relationship loss and grammatical loss. The formula of the loss function is:

[0057]

[0058] In the above formula, L rel is the relationship loss, L ent is the entity loss, L fl is the grammatical loss, nr is the number of relation types, ne is the length of the sentence, i and j represent the rows and columns of the matrix, Ki, j is the true value of the matrix, and L rel , L ent and L fl The final loss function is obtained after addition;

[0059] S4. Collect the equivalent γ and form a validation set. As the frequency of use increases, the data in the validation set will become more and more complete and used for subsequent model training.

[0060] S5. Publishing and sharing the data set formed by step S3 and step S4, which has the following functions:

[0061] The filtered training set is used to filter the collected same difference λ in the subsequent use process, which can help ensure the quality and reliability of the training data. When the original training data set contains errors, noise or inaccurate information, it will have a negative impact on the learning of the model. By filtering the training set, these low-quality data can be excluded, the training effect of the model can be improved, and the biased data can be removed (there may be some deviations in the training data, such as more text in a specific field and less text in other fields, or the number of text samples in some categories far exceeds that of other categories. Such deviations may cause the model to be biased towards frequently appearing categories or fields when predicting). By filtering the training set, the data distribution can be adjusted to make it more balanced, which helps to improve the generalization ability of the model and improve the model efficiency. Filtering the training set can also reduce the computing cost and time consumption in the training process. Large language models usually require a lot of computing resources and time to train. By filtering out some redundant or low-quality data, the size of the training set can be reduced, thereby improving training efficiency. Finally, overfitting can be prevented. There is a lot of noise or irrelevant information in the training data. The model may over-learn this data and ignore the truly useful features. By filtering the training set, the risk of overfitting can be reduced and the generalization ability of the model can be improved.

[0062] The validation set can be used to tune the model's hyperparameters, select the best model architecture, implement early stopping strategies, and finally evaluate the model's performance. By effectively using the validation set, the model's training efficiency and performance can be improved, and the model can be ensured to have good generalization capabilities in practical applications.

[0063] It should be noted that the structure described in the present invention can be implemented in a variety of different forms and is not limited to the described embodiments. Any equivalent transformations made by ordinary technicians in this field using the contents of the present invention description and drawings, or directly or indirectly applied to other related technical fields, such as the loading and unloading of other items, are included in the protection scope of the present invention.

Claims

1. A system for building large language datasets based on contrastive learning, Features: It includes an encoder for text recognition, an extraction module for triple information extraction, a language recognition module for text language recognition, a semantic recognition module for semantic feature recognition, an annotation module for annotation, a correction module for correcting the annotated text, a comparison module for semantic differentiation comparison, and a filtered training set and a verification set for collecting differentiation results.

2. A system for constructing a large language dataset based on contrastive learning as claimed in claim 1, Features: The extraction module includes an entity recognizer for recognizing entities in text, a relationship classifier for classifying each entity, a feature extractor for extracting features in the relationship classification process, and a rule engine for verifying grammatical rules.

3. A system for constructing a large language dataset based on contrastive learning as claimed in claim 2, Features: The semantic recognition module is used to identify strong features and weak features in semantics: Weak features include: semantics with low similarity obtained by the semantic recognition module, keywords with weak associations identified by the entity recognizer, and features with low matching degree with entities and relations in the knowledge base; Strong features include: semantics with high similarity obtained through the semantic recognition module, keywords with strong relevance identified by the entity identifier, and features with a high degree of matching with entities and relationships in the knowledge base.

4. A system for constructing a large language dataset based on contrastive learning as claimed in claim 3, Features: The annotation module independently annotates independent strong features after extracting annotation information.

5. A method for constructing a large language dataset based on contrastive learning, Features: A system for constructing a large language data set based on contrastive learning according to any one of claims 1 to 4, further comprising the following steps: S1, recognize the text through the encoder, and extract triple information through the extraction module; S1-1, after being identified by the language identification module, the pre-processed semantic data X is obtained by combining the existing large language data set; S1-2, after being identified by the language identification module, semantic feature identification is performed by the semantic identification module; S1-3, independently annotating the corresponding language of the semantic features identified in step S1-2 through an annotation module; S2, correcting the subject and object corresponding to the independent annotation content through the correction module to obtain processed semantic data Y; S3, performing differential comparison between the processed semantic data Y obtained in step S2 and the pre-processed semantic data X obtained in step S1-1 through a comparison module to obtain a difference value λ and an equivalent value γ; S3, collecting the difference λ and forming a filtered training set; S4, collect the equivalent γ and form a validation set; S5. Publish and share the data set formed by step S3 and step S4.

6. A method for constructing a large language dataset based on contrastive learning as claimed in claim 5, Features: The filtering training set is formed by a part-of-speech filtering matrix generated by a part-of-speech tagger, and the loss function of the algorithm in the part-of-speech filtering matrix includes entity loss, relationship loss and grammatical loss.

7. A method for constructing a large language dataset based on contrastive learning as claimed in claim 6, Features: The formula of the loss function is: In the above formula, L rel is the relationship loss, L ent is the entity loss, L f1 is the grammatical loss, nr is the number of relation types, ne is the length of the sentence, i and j represent the rows and columns of the matrix, Ki, j is the true value of the matrix, and L rel , L ent and L f1 The final loss function is obtained after addition.

Citation Information

Patent Citations

  • Intelligent question and answer method, device and equipment and storage medium

    CN114416927A

  • Table entity and type annotation method for joint text enhancement based on graph convolutional network

    CN116127099A

  • Cross-domain small sample relation extraction method and device for learning discriminative semantics and multi-view context

    CN117852523A

  • Trusted text semantic detection method based on data enhancement

    CN117875332A

  • Robot interaction method based on large language model

    CN118013010A