Ambiguity analysis and model training method and device, equipment, medium and program product
By constructing target ambiguity analysis samples and iteratively training the second language model, the problem of understanding deviation of large language models when dealing with natural language ambiguity is solved, and more accurate and diverse semantic analysis results are achieved.
Patent Information
- Application Number
- CN202411612357.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2025-04-18
AI Technical Summary
When large language models deal with ambiguity problems in natural language, it is difficult to generate multiple semantic analysis results, resulting in low accuracy of understanding bias and ambiguity analysis results.
By obtaining multiple text samples to be analyzed, inputting multiple first language models respectively to generate multiple semantic analysis results, constructing target ambiguity analysis samples, and iteratively training the second language model to generate a target language model that can handle text ambiguity.
It improves the ability of large language models to understand text ambiguity, generates more comprehensive and accurate semantic analysis results, improves model training efficiency and reduces excessive dependence on their own understanding ability.
Smart Images

Figure CN119848535A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of natural language processing technology, and in particular to an ambiguous analysis and model training method, device, equipment, medium and program product. Background Art
[0002] Currently, the field of Natural Language Processing (NLP) has been an active and challenging research field. It aims to enable computers to understand, interpret and generate human language. In the field of Natural Language Processing, Large Language Models (LLM) are used to identify text semantics. However, due to the inherent complexity and ambiguity of natural language, large language models will inevitably encounter text ambiguity problems in the process of understanding natural language.
[0003] In the prior art, when there is ambiguity in the text to be recognized, the general large language model can only infer the most likely intention of the text to be recognized when perceiving the semantics corresponding to the text to be recognized, and then output a unique semantic analysis result, because its underlying task is not explicitly trained on how to handle ambiguous text. Therefore, how to improve the ability of large language models to handle ambiguous problems has become an urgent problem to be solved. Summary of the invention
[0004] In order to solve the above technical problems, the embodiments of the present disclosure provide an ambiguous analysis and model training method, device, equipment, medium and program product.
[0005] In a first aspect, an embodiment of the present disclosure provides an ambiguity analysis and model training method, the method comprising:
[0006] Acquire a plurality of text samples to be subjected to ambiguity analysis; wherein the text samples correspond to at least one semantic meaning;
[0007] Input any of the text samples into a plurality of first language models respectively, and generate a plurality of first semantic parsing results of the text sample; wherein the first language model is pre-trained using an initial ambiguity analysis sample; the initial ambiguity analysis sample includes at least part of the text sample and at least one second semantic parsing result corresponding to the text sample;
[0008] A target ambiguous analysis sample is constructed based on the text sample and each of the first semantic analysis results, and a second language model is iteratively trained based on the target ambiguous analysis sample corresponding to each of the text samples to generate a target language model; wherein the model scale of the second language model is greater than the model scale of the first language model.
[0009] As an optional implementation of the embodiment of the present disclosure, before inputting any of the text samples into a plurality of first language models to generate a plurality of first semantic parsing results of the text sample, the method further includes:
[0010] Input any of the text samples into the second language model, generate at least one second semantic parsing result corresponding to the text sample, and construct the initial ambiguous analysis sample by the text sample and the second semantic parsing result;
[0011] Based on the initial ambiguous analysis samples, a third language model is iteratively trained in multiple batches to generate the first language models.
[0012] As an optional implementation of the embodiment of the present disclosure, the iterative training of the third language model in multiple batches based on the initial ambiguous analysis samples to generate the first language models includes:
[0013] According to a preset ratio, randomly extracting each of the initial ambiguous analysis samples a preset number of times to generate a sample set of the preset number of initial ambiguous analysis samples;
[0014] Iteratively training the third language model using any of the sample sets to generate the first language model corresponding to the sample set; wherein the number of the first language models is the preset number; and the preset number is determined based on the number of semantics possessed by the text to be subjected to ambiguity analysis.
[0015] As an optional implementation of the embodiment of the present disclosure, the third language model is a combination model of a pre-trained language representation model based on a transformer encoder structure and a conditional random field model; the suffix parameter in the text label of the third language model is determined based on a database query dimension.
[0016] As an optional implementation of the embodiment of the present disclosure, the step of inputting any of the text samples into a plurality of first language models to generate a plurality of first semantic parsing results of the text sample includes:
[0017] Input any of the text samples into each of the first language models, and output a plurality of third semantic parsing results of the text sample; wherein the number of the third semantic parsing results is consistent with the number of the first language models;
[0018] Deduplication processing is performed on each of the third semantic analysis results to generate each of the first semantic analysis results.
[0019] As an optional implementation of the embodiment of the present disclosure, after inputting any of the text samples into the first language models respectively and outputting a plurality of third semantic parsing results of the text samples, the method further includes:
[0020] Based on the second language model and the text sample, matching processing is performed on each of the third semantic analysis results to generate each of the first semantic analysis results.
[0021] As an optional implementation of the embodiment of the present disclosure, performing deduplication processing on each of the third semantic parsing results to generate each of the first semantic parsing results includes:
[0022] Deduplication processing is performed on each of the third semantic analysis results to generate a plurality of fourth semantic analysis results;
[0023] Based on the second language model and the text sample, matching processing is performed on each of the fourth semantic analysis results to generate each of the first semantic analysis results.
[0024] In a second aspect, the present disclosure provides another method for ambiguity analysis and model training, the method comprising:
[0025] Obtaining a target text to be subjected to ambiguity analysis;
[0026] The target text is input into a target language model for processing to generate a plurality of target semantic parsing results of the target text; wherein the target language model is pre-trained by the training method of the ambiguous analysis model described in the first aspect above.
[0027] In a third aspect, the present disclosure also provides a training device for an ambiguous analysis model, the device comprising:
[0028] A text sample acquisition unit, used to acquire a plurality of text samples to be subjected to ambiguity analysis; wherein the text samples correspond to at least one semantics;
[0029] A parsing result generating unit, configured to input any of the text samples into a plurality of first language models respectively, and generate a plurality of first semantic parsing results of the text sample; wherein the first language model is pre-trained using an initial ambiguous analysis sample; the initial ambiguous analysis sample includes at least part of the text sample and at least one second semantic parsing result corresponding to the text sample;
[0030] A language model generating unit is used to construct a target ambiguous analysis sample based on the text sample and each of the first semantic analysis results, and iteratively train a second language model based on the target ambiguous analysis sample corresponding to each of the text samples to generate a target language model; wherein the model scale of the second language model is greater than the model scale of the first language model.
[0031] As an optional implementation of the embodiment of the present disclosure, the language model generation unit is further used to input any of the text samples into the second language model, generate at least one second semantic parsing result corresponding to the text sample, and construct the initial ambiguous analysis sample by the text sample and the second semantic parsing result; based on each of the initial ambiguous analysis samples, perform multiple batches of iterative training on the third language model to generate each of the first language models.
[0032] As an optional implementation of the embodiment of the present disclosure, the language model generation unit is further used to randomly extract each of the initial ambiguous analysis samples a preset number of times according to a preset ratio to generate a sample set of the preset number of initial ambiguous analysis samples; iteratively train the third language model using any of the sample sets to generate the first language model corresponding to the sample set; wherein the number of the first language models is the preset number; and the preset number is determined based on the number of semantics possessed by the text to be ambiguous analyzed.
[0033] As an optional implementation of the embodiment of the present disclosure, the third language model is a combination model of a pre-trained language representation model based on a transformer encoder structure and a conditional random field model; the suffix parameter in the text label of the third language model is determined based on a database query dimension.
[0034] As an optional implementation of the embodiment of the present disclosure, the parsing result generating unit is specifically used to input any of the text samples into each of the first language models, and output multiple third semantic parsing results of the text sample; wherein the number of the third semantic parsing results is consistent with the number of the first language models; and deduplicate the third semantic parsing results to generate the first semantic parsing results.
[0035] As an optional implementation of the embodiment of the present disclosure, the parsing result generating unit is further used to perform matching processing on each of the third semantic parsing results based on the second language model and the text sample to generate each of the first semantic parsing results.
[0036] As an optional implementation of the embodiment of the present disclosure, the parsing result generating unit is specifically used to deduplicate each of the third semantic parsing results to generate multiple fourth semantic parsing results; based on the second language model and the text sample, match each of the fourth semantic parsing results to generate each of the first semantic parsing results.
[0037] In a fourth aspect, the present disclosure also provides an ambiguous analysis device, including:
[0038] A target text acquisition unit, used for acquiring a target text to be subjected to ambiguity analysis;
[0039] A parsing result generating unit is used to input the target text into a target language model for processing to generate a plurality of target semantic parsing results of the target text; wherein the target language model is pre-trained by the training method of the ambiguous analysis model described in the first aspect above.
[0040] In a fifth aspect, an embodiment of the present disclosure further provides an electronic device, the electronic device comprising:
[0041] Processor and memory;
[0042] The processor is used to execute the training method of an ambiguous analysis model or the ambiguous analysis method described in any embodiment of the present disclosure by calling the program or instruction stored in the memory.
[0043] The embodiments of the present disclosure also provide a computer-readable storage medium, which stores a program or instructions, and the program or the instructions enable a computer to execute the training method of an ambiguous analysis model or the ambiguous analysis method described in any embodiment of the embodiments of the present disclosure.
[0044] The embodiments of the present disclosure also provide a computer program product, which is used to execute the training method of an ambiguous analysis model or the ambiguous analysis method described in any embodiment of the present disclosure.
[0045] The embodiment of the present disclosure provides a technical solution for ambiguity analysis and model training, which obtains multiple text samples to be analyzed for ambiguity; then any of the text samples is input into multiple first language models to generate multiple first semantic parsing results of the text sample; then a target ambiguity analysis sample is constructed based on the text sample and each of the first semantic parsing results, and based on the target ambiguity analysis sample corresponding to each of the text samples, the second language model is iteratively trained to generate a target language model. The embodiment of the present disclosure uses multiple first language models with smaller model scales to quickly generate the first semantic parsing result of each text sample, so that each text sample corresponds to more, more comprehensive and more accurate semantic parsing results, and each text sample and its corresponding multiple first semantic parsing results constitute the target ambiguity analysis sample of the second language model with a larger model scale, so that the second language model learns multiple semantic parsing results corresponding to each text sample during the training process, which can not only improve the model training efficiency, but also avoid the second language model's excessive dependence on its own text ambiguity understanding ability, and greatly improve the training target language model's ability to understand the text ambiguity. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The accompanying drawings herein are incorporated in and constitute a part of the specification, illustrate embodiments consistent with the embodiments of the present disclosure, and together with the description, serve to explain the principles of the embodiments of the present disclosure.
[0047] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0048] Figure 1 A flowchart of an ambiguous analysis and model training method provided in an embodiment of the present disclosure;
[0049] Figure 2 A schematic diagram of the overall architecture of a third language model in an ambiguous analysis and model training method provided in an embodiment of the present disclosure;
[0050] Figure 3 A flowchart of another ambiguous analysis and model training method provided in an embodiment of the present disclosure;
[0051] Figure 4 A schematic diagram of a process for generating each of the first semantic parsing results in an ambiguous analysis and model training method provided in an embodiment of the present disclosure;
[0052] Figure 5A schematic diagram of a process for generating each of the first semantic parsing results in another ambiguous analysis and model training method provided in an embodiment of the present disclosure;
[0053] Figure 6 A flowchart of an ambiguous analysis method provided by an embodiment of the present disclosure;
[0054] Figure 7 A schematic diagram of the structure of a training device for an ambiguous analysis model provided in an embodiment of the present disclosure;
[0055] Figure 8 A schematic diagram of the structure of an ambiguous analysis device provided in an embodiment of the present disclosure;
[0056] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0057] In order to more clearly understand the above-mentioned purposes, features and advantages of the embodiments of the present disclosure, the scheme of the embodiments of the present disclosure will be further described in detail below. It should be noted that the embodiments of the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0058] In the following description, many specific details are set forth to facilitate a full understanding of the embodiments of the present disclosure, but the embodiments of the present disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0059] In the related art, when there is ambiguity in the text to be recognized, the general large language model (LLM) uses its own database to perform semantic recognition on the text to be recognized. However, due to the differences in the database's own entity grouping dimensions, or the lack of certain text records, or the presence of synonymous content in the current text sample, the LLM cannot identify the ambiguous problems in the text to be recognized, and thus the semantic understanding of the text to be recognized is biased.
[0060] In one implementation, in order to enable the LLM to understand the ambiguous problems existing in the text to be recognized as much as possible, the LLM's ability to generate ambiguous resolution results can be used to perform semantic recognition on the text to be recognized and output at least one ambiguous resolution result corresponding to the output, and then the at least one ambiguous resolution result constitutes a new training sample, and the LLM's ability to generate ambiguous resolution results is trained again in a self-loop manner to obtain the final LLM. Since this method overly relies on the model's ability to output ambiguous resolution results, the current LLM is not good at understanding the ambiguous problems of the text. Therefore, the LLM that has undergone self-loop training still has a weak ability to understand ambiguous problems, and the accuracy of outputting ambiguous resolution results is low.
[0061] In order to improve the model's ability to understand the ambiguity of text, the model of the embodiment of the present disclosure starts from the training perspective, and obtains more, more comprehensive and more accurate semantic analysis results for each text sample as much as possible, and then constructs a target ambiguous analysis sample at one time to train the second language model to obtain the target language model. During the training process, multiple semantic analysis results corresponding to each text sample can be learned, which can not only improve the model training efficiency, but also avoid the second language model's excessive dependence on its own text ambiguity understanding ability, and greatly improve the trained target language model's ability to understand the ambiguity of text.
[0062] The training method of the ambiguous analysis model provided in the embodiments of the present disclosure is mainly applicable to the scenario of training a large language model capable of outputting ambiguous solutions.
[0063] The training method of the ambiguous analysis model provided in the embodiment of the present disclosure can be executed by a training device for the ambiguous analysis model, which can be implemented by software and / or hardware, and can be integrated in an electronic device with a model training function, such as a laptop or desktop computer.
[0064] Figure 1 is a flow chart of an ambiguous analysis and model training method provided by an embodiment of the present disclosure. Figure 1 As shown, the training method of the ambiguity analysis model specifically includes:
[0065] S110: Acquire multiple text samples to be subjected to ambiguity analysis.
[0066] Among them, this sample corresponds to at least one semantics.
[0067] When a text sample is subjected to semantic reasoning through a large language model of related technology, it may occur that due to the existence of multiple semantics of a certain word, the large language model will have a biased understanding of the user's intention and will not be able to truly understand the user's intention, resulting in a poor user experience. Therefore, the disclosed embodiment constructs a target ambiguous analysis sample based on multiple text samples to be subjected to ambiguous analysis. Since the target ambiguous analysis sample includes the text sample and each of the first semantic analysis results, when the target language model is obtained through training with the target ambiguous analysis sample, the target language model has the ability to recognize the corresponding multiple ambiguous analysis results for the text, thereby improving the ability of the large language model to recognize ambiguous text and output ambiguous analysis results.
[0068] In some embodiments, the text samples to be subjected to ambiguity analysis may be question texts that a user would actually input into a larger-scale language model. In the training of the large language model, the multiple text samples to be subjected to ambiguity analysis will participate in the model training in the form of queries, wherein queries, as a form of text samples, provide the model with a variety of different language expressions and question descriptions to facilitate subsequent model training.
[0069] It should be noted that in order to ensure that corresponding semantic analysis results can be obtained according to a plurality of text samples to be subjected to ambiguity analysis, the text samples need to have at least one semantic meaning.
[0070] Exemplarily, the multiple text samples to be subjected to ambiguity analysis may be query requests, data retrieval requests, etc. that users may actually send to the large language model. For example, when a user wants to obtain the proportion of house transactions in each month of a certain year in a target region on a certain platform, the user may give "the proportion of house transactions in each month of a certain year in a target region on a certain platform" as a query text to the large language model, and wait for the query result of the large language model. Furthermore, in the disclosed embodiment, a large number of query texts that users may actually input into the large language model are collected in advance and used as the multiple text samples to be subjected to ambiguity analysis, so as to further construct the target ambiguity analysis sample through the multiple text samples to be subjected to ambiguity analysis.
[0071] S120: Input any text sample into a plurality of first language models respectively to generate a plurality of first semantic parsing results of the text sample.
[0072] The first language model is a model used to perform semantic recognition on any text sample. Any text sample is input into the first language model, and after the first language model performs semantic recognition on the text sample, a first semantic analysis result corresponding to the text sample can be obtained.
[0073] Specifically, the first language model can be a weak learner model that is pre-trained using initial ambiguous analysis samples. The scale of a single weak learner model is small, but it still has a certain self-learning ability. By repeatedly learning the training data and adjusting parameters, it can also gradually improve its prediction ability for specific tasks.
[0074] In an embodiment of the present disclosure, the first language model may be obtained by pre-training a named entity recognition model (NER) architecture using an initial ambiguous analysis sample. The architecture of the first language model may be composed of a pre-trained language model based on a Transformer architecture (Bidirectional Encoder Representations from Transformers, BERT) and a conditional random field model (CRF). The pre-trained language model based on the Transformer architecture has a powerful ability to extract text semantic information and the conditional random field model can capture and model the dependency relationship between semantic labels according to text features, so that the first language model can more accurately output the first semantic parsing result.
[0075] In one implementation, the first language model may also be a model with semantic recognition function obtained by training based on other model frameworks such as Hidden Markov Model (HMM) and Recurrent Neural Network (RNN).
[0076] Furthermore, the semantic parsing result can be understood as the semantic recognition of the text sample, and the label corresponding to the semantic recognition result is obtained, which is used to mark the semantics corresponding to different entities and other texts in the text sample in the form of labels; for example, when the text sample includes the specific time "May 3, 2023", then its semantic parsing result can be "time", and then the "May 3, 2023" field in the current text sample will be marked as "time". In the embodiment of the present application, the first semantic parsing result is the same, but it should be noted that the first semantic parsing result is obtained by the first language model performing semantic recognition on the text sample. It should be noted that due to the differences in the database knowledge system corresponding to each model, different labels may be marked for the same entity when performing semantic recognition.
[0077] Among them, when the initial ambiguous analysis sample is used to train the first language model in advance, it is necessary to first construct the initial ambiguous analysis sample, which includes at least part of the text sample and at least one second semantic analysis result corresponding to the text sample, that is, each initial ambiguous analysis sample is composed of a part of the multiple text samples to be ambiguous analyzed in S110, and all the second semantic analysis results corresponding to this part of the text sample. Specifically, the at least one second semantic analysis result corresponding to the text sample can be obtained by manually annotating the intent to obtain the at least one second semantic analysis result corresponding to each text sample; or the at least one second semantic analysis result corresponding to the text sample can be obtained by analyzing and reasoning using a pre-trained large language model (LLM) that has not been specially trained for ambiguous understanding. It should be noted that when obtaining at least one second semantic analysis result of each text sample to be ambiguous analyzed by the above two methods, due to the limited manual annotation energy and the lack of ability of the pre-trained large language model that has not been specially trained for ambiguous understanding to understand ambiguous problems, the number of second semantic analysis results will be small and there will be certain understanding deviations. Furthermore, in the embodiments of the present disclosure, in order to improve the target language model's ability to understand the ambiguity of the text, it is necessary to adopt as many, comprehensive and accurate semantic parsing results as possible during training. Furthermore, when training to obtain the target language model, the target ambiguous analysis sample composed of multiple semantic parsing results corresponding to text samples obtained by multiple first language models is more comprehensive and accurate than the second semantic parsing result.
[0078] Based on the above method, at least one second semantic analysis result is obtained for each text sample to be subjected to ambiguity analysis. Since the first language model is essentially a weak learner model and its scale is small, it is unable to learn a large number of text samples during training. Therefore, some text samples and their corresponding at least one second semantic analysis result can be selected from the text samples to form an initial ambiguity analysis sample. That is to say, the number of samples in the initial ambiguity analysis sample is the number of samples that the weak learner model can carry, so as to be used for training to obtain the first language model.
[0079] In the disclosed embodiment, the multiple first semantic parsing results of the text sample can be understood as all possible ambiguous parsing results corresponding to the text sample, that is, multiple first semantic parsing results. The text sample and the multiple first semantic parsing results corresponding to the text sample are then used to construct a target ambiguous analysis sample, and the second language model is then trained using the target ambiguous analysis sample, so that the target language model finally obtained has the ability to output the ambiguous parsing results corresponding to the text.
[0080] Furthermore, in order to simultaneously obtain multiple first semantic parsing results corresponding to each text sample, the embodiment of the present disclosure will pre-train multiple first language models, and then input the above text samples into each first language model at the same time, thereby improving the efficiency of obtaining the parsing results of the text samples.
[0081] Exemplarily, when there are 100 first language models, in this step, any one of the multiple text samples to be subjected to ambiguity analysis is input into the 100 first language models respectively, and 100 first semantic analysis results are obtained.
[0082] In an embodiment of the present application, the second semantic parsing result may be output in a preset domain specific language (Domain Specific Language, DSL). Specifically, DSL is a language specifically used to describe and process user intent, and is often used in fields that require precise, structured queries or instructions, especially when processing complex data, performing specific tasks, or interacting with specific systems. In these cases, converting natural language queries into DSL can help ensure the accuracy and efficiency of queries, because DSL is often designed to be tightly integrated with back-end systems and can be directly mapped to the system's operations or data models. For example, in an embodiment of the present disclosure, the format of DSL can be set to an object, and the format of the object can be, for example: {"Table i":{"Time":["XX"],"Constraint":["XX"],"Group":["XX"],"Table":["XX"]}, where "Table i": represents a specific naming identifier used to refer to a specific analysis intent or report object. It can be given a meaningful name according to specific business needs, such as "sales data table", "user analysis table", etc. "Time": can be the time range involved in the text sample intent. It can be a specific date, such as "September 5, 2024"; it can also be "Constraints": contains the conditions for filtering data in the text sample intent. For example, "sales greater than 10,000 yuan", "customer age greater than 30 years old", etc. These constraints can help the model determine the data within a specific range. "Grouping": is the basis for grouping data in the text sample intent; for example, "by product category", "by customer region", "by order type", etc. By determining the grouping intent, it is easier for the model to find data on different dimensions; "Table": can be understood as the name of the original data table involved in the text sample intent; for example, "sales data table", "customer information table", "order data table", etc.
[0083] Exemplarily, when the text sample is "On a certain platform, the proportion of house transactions in each month in the target area in 20XX", after it is input into the large language model, the second semantic parsing result output in the domain-specific language DSL format can be: {"Table 1":{"Time":["20XX"],"Constraint":["certain platform","target area"],"Combination":["Month"],"Table":["Transaction proportion table"]}.
[0084] S130: construct a target ambiguous analysis sample based on the text sample and each first semantic analysis result, and iteratively train the second language model based on the target ambiguous analysis sample corresponding to each text sample to generate a target language model.
[0085] Among them, the target ambiguous analysis sample is constructed by the text sample and each first semantic analysis result. Since the first semantic analysis result of each text sample is quickly generated by multiple first language models with smaller model sizes, the target ambiguous analysis sample includes as many ambiguous analysis results as possible corresponding to any current text sample, so that the first analysis results of each text template in the target ambiguous analysis sample are as many as possible and more comprehensive and accurate.
[0086] Among them, the second language model can be a pre-trained large language model that has not undergone special ambiguous understanding training. Therefore, after the second language model is iteratively trained with the target ambiguous analysis sample, the second language model will deepen the learning of the ambiguous resolution results according to the first semantic resolution results corresponding to each text sample, so that the final target language model has the ability to identify ambiguous problems and output multiple ambiguous resolution results.
[0087] In some embodiments, since the target ambiguous analysis sample is constructed based on the text sample and each first semantic analysis result, when the second language model is iteratively trained through the target ambiguous analysis samples corresponding to each text sample, the second language model can learn multiple first semantic analysis results corresponding to each text sample in each target ambiguous analysis sample, thereby enabling the trained target language model to have the ability to output multiple semantic analysis results for one input text, that is, to output an ambiguous analysis result.
[0088] It should be noted that, since the first language model is trained using part of the text samples and at least one second semantic analysis result corresponding to the text samples, and when iteratively training the second language model, target ambiguous analysis samples corresponding to each text sample are used, there is an obvious difference in the number of samples. Therefore, the model scale of the second language model is larger than that of the first language model.
[0089] The embodiment of the present disclosure provides a technical solution for ambiguity analysis and model training, which obtains multiple text samples to be analyzed for ambiguity; then any of the text samples is input into multiple first language models to generate multiple first semantic parsing results of the text sample; then a target ambiguity analysis sample is constructed based on the text sample and each of the first semantic parsing results, and based on the target ambiguity analysis sample corresponding to each of the text samples, the second language model is iteratively trained to generate a target language model. The embodiment of the present disclosure uses multiple first language models with smaller model scales to quickly generate the first semantic parsing result of each text sample, so that each text sample corresponds to more, more comprehensive and more accurate semantic parsing results, and each text sample and its corresponding multiple first semantic parsing results constitute the target ambiguity analysis sample of the second language model with a larger model scale, so that the second language model learns multiple semantic parsing results corresponding to each text sample during the training process, which can not only improve the model training efficiency, but also avoid the second language model's excessive dependence on its own text ambiguity understanding ability, and greatly improve the training target language model's ability to understand the text ambiguity.
[0090] In some embodiments, before the above S120 "inputting any of the text samples into multiple first language models to generate multiple first semantic parsing results of the text samples", the multiple first language models may also be generated. Specifically, the specific steps of generating each of the first language models include the following steps A and B:
[0091] Step A: input any text sample into the second language model, generate at least one second semantic parsing result corresponding to the text sample, and construct an initial ambiguous analysis sample based on the text sample and the second semantic parsing result.
[0092] In some embodiments, the second language model may be a large language model represented by a large-scale multimodal model GPT4 (Generative Pre-trained Transformer 4), which is mainly used to perform intent analysis on the text sample to obtain at least one of the second semantic parsing results corresponding to the text sample.
[0093] Specifically, for the same text sample, when the large language model performs intent inference on the text sample, there may be multiple different grouping dimensions used when performing semantic segmentation on the text sample. At this time, the large language model may output more than one semantic parsing result, namely, at least one of the second semantic parsing results, thereby forming multiple ambiguous parsing results.
[0094] Exemplarily, when the text content corresponding to the text sample is "the second-hand housing transaction volume in a certain place in a certain platform operation area in May this year", after the above text content is input into the large language model, when the intention of the above text content is inferred according to the database knowledge of the large language model, the part that is prone to ambiguity is: "a certain platform operation" is divided into constraints, and "region" is divided into grouping dimensions; "a certain platform" can also be divided into constraints, and "operation region" is divided into grouping dimensions; then, when the constraints and grouping dimensions are different, two different second semantic analysis results can be obtained. The first type of the second semantic analysis result is: what the user needs to get is the second-hand housing transaction volume in a certain place in each operation region of a certain platform in May this year; the second type of the second semantic analysis result is: what the user needs to get is the second-hand housing transaction volume in each region of a certain place that has been operated and processed by a certain platform in May this year.
[0095] The initial ambiguous analysis sample constructed based on the text sample and the second semantic analysis result can be: a text sample + at least one of the second semantic analysis results. According to the above embodiment, it can be: "the second-hand housing transaction volume of a certain place in a certain platform operation area in May this year" + what the user needs to obtain is the second-hand housing transaction volume of a certain place in each platform operation area in May this year; and: "the second-hand housing transaction volume of a certain place in a certain platform operation area in May this year" + what the user needs to obtain is the second-hand housing transaction volume of each area of a certain place that has been operated and processed by a certain platform in May this year.
[0096] Step B: Based on each initial ambiguous analysis sample, the third language model is iteratively trained in multiple batches to generate each first language model.
[0097] Specifically, since the first language model can be a weak learner model obtained by training the third language model, the third language model can also be obtained based on the framework of the named entity recognition model (Named Entity Recognition, NER), wherein the named entity recognition model is an important technology in natural language processing, which is used to identify entities with specific meanings from texts, such as names of people, places, and names of organizations, etc. At the same time, the third language model is a combination model of a pre-trained language model based on the Transformer architecture (Bidirectional Encoder Representations from Transformers, BERT) and a conditional random field model (Conditional Random Field, CRF).
[0098] Further, based on the text sample and the second semantic analysis result, each initial ambiguous analysis sample is first constructed, and the third language model is iteratively trained in multiple batches through each initial ambiguous analysis sample to generate each of the first language models, and then, the third language model is iteratively trained in multiple batches using an initial ambiguous analysis sample until the preset training end condition is reached, and then a third language model is generated, and then multiple third language models are obtained through the above method. The purpose of using each initial ambiguous analysis sample to iteratively train the third language model in multiple batches is to strengthen the learning ability of the third language model for the initial ambiguous analysis sample through continuous iterative training, thereby improving the semantic recognition ability of the first language model and improving the model output accuracy.
[0099] In the embodiment of the present disclosure, the overall architecture of the third language model is as follows: Figure 2 As shown, it is a combined model consisting of a pre-trained language representation model 21 based on a transformer encoder structure and a conditional random field model 22.
[0100] Among them, the pre-trained language representation model 21 based on the transformer encoder structure is a pre-trained language model based on the Transformer architecture (Bidirectional Encoder Representations from Transformers, BERT). This model can classify the input text, perform named entity recognition, semantic role labeling, etc., and then understand the sentence structure and semantic relationship of the input text, and provide accurate representation for semantic labeling.
[0101] The Conditional Random Field (CRF) model22 is a probabilistic graphical model for sequence labeling tasks. The CRF model can fully consider the contextual information of the input sequence to better label the sequence. It can use the features of the previous and next contexts to determine the label at the current position, improve the accuracy of the labeling, and also model the dependencies between the labels.
[0102] In the embodiment of the present disclosure, Figure 2 As shown, through the pre-trained language representation model 21 based on the transformer encoder structure, the text sample is first converted into a corresponding sequence and mapped to the word vector representation of the pre-trained language representation model 21 based on the transformer encoder structure. The above process utilizes the powerful language representation ability of BERT to extract the semantic information of the sentence.
[0103] Then, the output of the pre-trained language representation model 21 based on the transformer encoder structure is input as a feature into the conditional random field model 22. The conditional random field model 22 uses these features to establish dependencies between labels and performs label prediction by maximizing conditional probabilities, effectively combining the semantic representation capabilities of the BERT model and the CRF's ability to model label dependencies.
[0104] Finally, after reasoning with the third language model, the label corresponding to each word in the input text sample can be derived. It should be noted that in the embodiment of the present disclosure, different letters are used to represent the application of each label pair, among which the prefix letter BIOES parameter means: B, i.e. Begin, indicating the beginning; I, i.e. Intermediate, indicating the middle; E, i.e. End, indicating the end; S, i.e. Single, indicating a single character; O, i.e. Other, indicating other, used to mark irrelevant characters. The meaning of the suffix letter BIOES parameter can be customized according to the query dimension determined by the database query dimension in the application scenario. For example, in the above-mentioned business query scenario, T means time; Y means constraint; Z means grouping; I means indicator.
[0105] Combination Figure 2 As shown in the figure, when the input text sample is: "The number of second-hand housing transactions in each store in XX city this year", the final output is the label corresponding to each character. For example, the output label corresponding to "today" is "BT", which means the starting position of the text content corresponding to the time. For another example, the output label corresponding to "house" is "EY", which means the end position of the text content corresponding to the constraint item "second-hand house". The output labels corresponding to other characters in the text sample are similar, and no examples are given here one by one.
[0106] In some embodiments, based on the above technical solution, the specific implementation method of the above step B (based on each initial ambiguous analysis sample, performing multiple batches of iterative training on the third language model to generate each first language model) includes the following steps 1 and 2:
[0107] Step 1: randomly extract each initial ambiguous analysis sample a preset number of times according to a preset ratio to generate a sample set of a preset number of initial ambiguous analysis samples.
[0108] Specifically, the size of the preset number of random draws is related to the business scenario. For example, if the context database / query database in a certain business scenario makes most of the input query text query have 20 semantic parsing results, then the preset number is at least set to be greater than 20; the larger the preset number, the more comprehensive the ambiguous solution that the model can obtain, the higher the accuracy, and the training cost will increase accordingly.
[0109] Exemplarily, after 10,000 initial ambiguous analysis samples are constructed by the text sample and the second semantic analysis result, 1,000 initial ambiguous analysis samples can be randomly selected from the 10,000 initial ambiguous analysis samples at a preset ratio of 10% to form a sample set of initial ambiguous analysis samples, and then the above process is repeated for a preset number of random selections to obtain a sample set of a preset number of initial ambiguous analysis samples.
[0110] Step 2: Iteratively train the third language model using any sample set to generate the first language model corresponding to the sample set.
[0111] The number of the first language models is the preset number; the preset number is determined based on the number of semantics possessed by the text to be subjected to ambiguity analysis.
[0112] In combination with the embodiment of step 21, after 100 random draws, 100 sample sets of initial ambiguous analysis samples can be obtained, and each sample set will include 1000 initial ambiguous analysis samples; then, the sample sets of 100 initial ambiguous analysis samples will be used to iteratively train the third language model, and then the corresponding 100 first language models can be obtained. Therefore, since the samples drawn when training the third language model cannot be exactly the same, the trained first language model will output different semantic analysis results even when targeting the same input text.
[0113] Figure 3 It is a flowchart of another method for training an ambiguous analysis model provided by an embodiment of the present disclosure, in which the explanations of the terms that are the same or corresponding to the above embodiments are not repeated here.
[0114] See also Figure 3 , the training method of the ambiguity analysis model includes:
[0115] S310: Obtain multiple text samples to be subjected to ambiguity analysis.
[0116] The text sample corresponds to at least one semantics.
[0117] S320: Input any text sample into the second language model, generate at least one second semantic parsing result corresponding to the text sample, and construct an initial ambiguous analysis sample based on the text sample and the second semantic parsing result.
[0118] S330: Based on each of the initial ambiguous analysis samples, perform multiple batches of iterative training on the third language model to generate each of the first language models.
[0119] S340: Input any text sample into each of the first language models, and output a plurality of third semantic analysis results of the text sample.
[0120] The number of the third semantic parsing results is consistent with the number of the first language models.
[0121] In an embodiment of the present disclosure, when the number of the first language models is 100, 100 third semantic parsing results will be output, for example, they can be expressed as: r1, r2...r100. For the same text sample, under normal circumstances, it is almost impossible to obtain 100 ambiguous parsing results, and multiple repeated parsing results are often obtained. Therefore, it is necessary to deduplicate the 100 third semantic parsing results r1, r2...r100 to obtain the first semantic parsing result mentioned in the above embodiment. It should be noted that the third semantic parsing result can be a weak learner model, that is, the intent label corresponding to each semantic parsing result directly output by each first language model, or the intent label can be converted into the intent DLS format.
[0122] S350: De-duplicate the third semantic analysis results to generate first semantic analysis results.
[0123] Specifically, after obtaining the third semantic parsing result output by each first language model, any method may be used to perform deduplication processing on each of the third semantic parsing results, and the embodiments of the present disclosure do not impose any limitation on this.
[0124] S360: construct a target ambiguous analysis sample based on the text sample and each first semantic analysis result, and iteratively train the second language model based on the target ambiguous analysis sample corresponding to each text sample to generate a target language model.
[0125] The model scale of the second language model is larger than the model scale of the first language model.
[0126] In the disclosed embodiment, by inputting any text sample into each of the first language models respectively, outputting multiple third semantic parsing results of the text sample, and then performing deduplication processing on each of the third semantic parsing results to generate each first semantic parsing result; the repetition rate of the first semantic parsing results obtained by multiple first language models can be greatly reduced, thereby improving the efficiency of subsequent training of the second language model based on the first semantic parsing results.
[0127] As an extension and refinement of the above embodiment, refer to Figure 4 The specific implementation method of "inputting any of the text samples into multiple first language models respectively to generate multiple first semantic parsing results of the text sample" includes the following S410 and S420:
[0128] S410: Input any text sample into each first language model respectively, and output a plurality of third semantic parsing results of the text sample.
[0129] The number of the third semantic analysis results is consistent with the number of the first language models.
[0130] In the embodiment of the present disclosure, the description of this step can refer to the above S410 and will not be repeated here.
[0131] S420: Based on the second language model and the text sample, match each third semantic analysis result to generate each first semantic analysis result.
[0132] Referring to the above S121, the second language model can also obtain at least one second semantic parsing result corresponding to the text sample. For example, for text sample A, the second language model outputs 3 semantic parsing results, and the current first language model has 100. Then, the 3 semantic parsing results output by the second language model are matched with the semantic parsing results output by the 100 first language models. Only the successfully matched semantic parsing results can be used as the final first semantic parsing results. Then, through the cooperation of the first language model and the second language model, a semantic parsing result with higher credibility and rationality is obtained, thereby improving the accuracy when training the model.
[0133] As an extension and refinement of the above embodiment, refer to Figure 5 The specific implementation method of "inputting any of the text samples into multiple first language models respectively to generate multiple first semantic parsing results of the text sample" includes the following S510 to S530:
[0134] S510: Input any text sample into each first language model respectively, and output a plurality of third semantic analysis results of the text sample.
[0135] The number of the third semantic parsing results is consistent with the number of the first language models.
[0136] In the embodiment of the present disclosure, the description of this step can refer to the above S410 and will not be repeated here.
[0137] S520: De-duplicate the third semantic analysis results to generate a plurality of fourth semantic analysis results.
[0138] S530: Based on the second language model and the text sample, match each fourth semantic analysis result to generate each first semantic analysis result.
[0139] In the disclosed embodiment, the third semantic parsing result is first deduplicated to reduce the repetition rate of the third semantic parsing result, and then the deduplicated third semantic parsing result is matched with at least one semantic parsing result of the text sample obtained by the second model, thereby not only reducing the repetition rate of each first semantic parsing result but also improving the rationality and credibility of each first semantic parsing result, thereby improving the efficiency of subsequent training of the second language model according to each first semantic parsing result, and also improving the output accuracy of the target language model obtained by training the second language model according to each first semantic parsing result.
[0140] The present disclosure also provides an ambiguity analysis method, referring to Figure 6 As shown, the model training is mainly carried out by the training method of the above-mentioned ambiguity analysis model, which specifically includes:
[0141] S610: Obtain a target text for which ambiguity analysis is to be performed.
[0142] S620: Input the target text into the target language model for processing to generate multiple target semantic parsing results of the target text.
[0143] The target language model is pre-trained using the training method of the ambiguous analysis model.
[0144] After obtaining the corresponding target language model through the training method of the ambiguous analysis model, the user can input the query text that the user wants to query, that is, the target text, into the target language model through a preset method, and the target language model can output multiple target semantic parsing results of the target text through reasoning analysis.
[0145] The above-mentioned technical scheme of the embodiment of the present disclosure obtains the target text to be subjected to ambiguous analysis. The target text is input into the target language model for processing, and multiple target semantic parsing results of the target text are generated; wherein the target language model is pre-trained by the training method of the ambiguous analysis model. The embodiment of the present disclosure constructs a target ambiguous analysis sample through multiple first semantic parsing results of text samples, so that the target ambiguous analysis sample includes each text sample and multiple first semantic parsing results corresponding to each text sample, and then when the second language model is trained by the target ambiguous analysis sample to obtain the target language model, the second language model will learn multiple semantic parsing results corresponding to each text sample during the training process, and the target language model finally obtained will have the ability to recognize multiple semantic parsing results corresponding to the text, that is, it can output ambiguous parsing results, thereby improving the ability of the large language model to recognize ambiguous text and output ambiguous parsing results.
[0146] Figure 7A schematic diagram of the structure of a training device for an ambiguous analysis model provided in an embodiment of the present disclosure. Figure 7 As shown, the training device 700 of the ambiguity analysis model includes:
[0147] The text sample acquisition unit 710 is used to acquire a plurality of text samples to be subjected to ambiguity analysis; wherein the text samples correspond to at least one semantics;
[0148] The parsing result generating unit 720 is used to input any of the text samples into a plurality of first language models respectively, and generate a plurality of first semantic parsing results of the text sample; wherein the first language model is pre-trained using an initial ambiguity analysis sample; the initial ambiguity analysis sample includes at least part of the text sample and at least one second semantic parsing result corresponding to the text sample;
[0149] The language model generating unit 730 is used to construct a target ambiguous analysis sample based on the text sample and each of the first semantic analysis results, and iteratively train a second language model based on the target ambiguous analysis sample corresponding to each of the text samples to generate a target language model; wherein the model scale of the second language model is greater than the model scale of the first language model.
[0150] A training device for an ambiguous analysis model provided by an embodiment of the present disclosure obtains a plurality of text samples to be subjected to ambiguous analysis; then any of the text samples is input into a plurality of first language models respectively to generate a plurality of first semantic parsing results of the text sample; then a target ambiguous analysis sample is constructed based on the text sample and each of the first semantic parsing results, and based on the target ambiguous analysis sample corresponding to each of the text samples, the second language model is iteratively trained to generate a target language model. The embodiment of the present disclosure constructs a target ambiguous analysis sample through a plurality of first semantic parsing results of the text sample, so that the target ambiguous analysis sample includes each text sample and a plurality of first semantic parsing results corresponding to each text sample, and then when the second language model is trained to obtain the target language model through the target ambiguous analysis sample, the second language model will learn the plurality of semantic parsing results corresponding to each text sample during the training process, and the target language model finally obtained will have the ability to recognize the plurality of semantic parsing results corresponding to the text, that is, it can output the ambiguous parsing result, and then it can improve the ability of the large language model to recognize ambiguous text and output the ambiguous parsing result.
[0151] As an optional implementation of the embodiment of the present disclosure, the language model generation unit 730 is further used to input any of the text samples into the second language model, generate at least one second semantic parsing result corresponding to the text sample, and construct the initial ambiguous analysis sample by the text sample and the second semantic parsing result; based on each of the initial ambiguous analysis samples, perform multiple batches of iterative training on the third language model to generate each of the first language models.
[0152] As an optional implementation of the embodiment of the present disclosure, the language model generation unit 730 is further used to randomly extract each of the initial ambiguous analysis samples a preset number of times according to a preset ratio to generate a sample set of the preset number of initial ambiguous analysis samples; iteratively train the third language model using any of the sample sets to generate the first language model corresponding to the sample set; wherein the number of the first language models is the preset number; and the preset number is determined based on the number of semantics possessed by the text to be ambiguous analyzed.
[0153] As an optional implementation of the embodiment of the present disclosure, the third language model is a combination model of a pre-trained language representation model based on a transformer encoder structure and a conditional random field model; the suffix parameter in the text label of the third language model is determined based on a database query dimension.
[0154] As an optional implementation of the embodiment of the present disclosure, the parsing result generating unit 720 is specifically used to input any of the text samples into each of the first language models, and output multiple third semantic parsing results of the text sample; wherein the number of the third semantic parsing results is consistent with the number of the first language models; and deduplicate the third semantic parsing results to generate the first semantic parsing results.
[0155] As an optional implementation of the embodiment of the present disclosure, the parsing result generating unit 720 is further used to perform matching processing on each of the third semantic parsing results based on the second language model and the text sample to generate each of the first semantic parsing results.
[0156] As an optional implementation of the embodiment of the present disclosure, the parsing result generating unit 720 is specifically used to deduplicate each of the third semantic parsing results to generate multiple fourth semantic parsing results; based on the second language model and the text sample, match each of the fourth semantic parsing results to generate each of the first semantic parsing results.
[0157] The training device for the ambiguous analysis model provided in the embodiments of the present disclosure can execute the training method for the ambiguous analysis model provided in any embodiment of the embodiments of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
[0158] It is worth noting that in the embodiment of the training device for the above-mentioned ambiguous analysis model, the various units included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the various functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present disclosure.
[0159] Figure 8 The following is a schematic diagram of the structure of an ambiguous analysis device provided by an embodiment of the present disclosure. Figure 8 As shown, the ambiguity analysis device 800 includes:
[0160] A target text acquisition unit 810 is used to acquire a target text to be subjected to ambiguity analysis;
[0161] The parsing result generating unit 820 is used to input the target text into the target language model for processing to generate multiple target semantic parsing results of the target text; wherein the target language model is pre-trained by the training method of the ambiguous analysis model described in the first aspect above.
[0162] The ambiguity analysis device provided in the embodiments of the present disclosure can execute the ambiguity analysis method provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
[0163] It is worth noting that in the embodiment of the above-mentioned ambiguous analysis device, the various units included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present disclosure.
[0164] The embodiment of the present disclosure also provides an electronic device, comprising: one or more processors and a memory; wherein the memory is used to store one or more programs or instructions. When the one or more programs or instructions are executed by the one or more processors, the one or more processors implement the training method of the ambiguous analysis model and / or the ambiguous analysis method provided in any embodiment of the present disclosure.
[0165] Fig. 9 The structure diagram of an electronic device provided by the embodiment of the present disclosure is shown in FIG. Fig. 9As shown, the electronic device 900 includes a processor 901, a memory 902, an input device 903 and an output device 904, and these components are interconnected through a bus system and / or other forms of connection mechanisms (not shown). The number of the processor 901 and the memory 902 can be one or more. Fig. 9 In the figure, a processor 901 and a memory 902 are taken as an example.
[0166] The processor 901 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 900 to perform desired functions.
[0167] The memory 902 may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. In some embodiments, the memory 902 may further include a memory remotely arranged relative to the processor 901, and these remote memories may be connected to the electronic device 900 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. One or more computer programs or instructions may be stored in the above-mentioned memory 902, and the processor 901 may run these programs or instructions to implement the training method of the ambiguous analysis model, the ambiguous analysis method, and / or other desired functions described in any embodiment of the present disclosure. Various contents such as text samples of ambiguous analysis, multiple first language models, etc. may also be stored in the above-mentioned memory 902.
[0168] The input device 903 may include, for example, a keyboard, a mouse, etc. The output device 904 may output various information to the outside, and may include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, etc.
[0169] Understandably, for simplicity, Fig. 9 Only some of the components related to the embodiments of the present disclosure in the electronic device 900 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application scenarios, the electronic device 900 may also include any other appropriate components.
[0170] In addition to the above-mentioned methods and devices, the training method of the ambiguous analysis model or the ambiguous analysis method in any embodiment of the present disclosure can also be implemented as a computer software program. For example, an embodiment of the present disclosure also includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a memory. When the computer program is executed by a processor, the processor executes the training method of the ambiguous analysis model and / or the ambiguous analysis method provided in any embodiment of the present disclosure.
[0171] The computer program product may be written in any combination of one or more programming languages to write program code for performing the operations of the disclosed embodiments, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0172] In addition, an embodiment of the present disclosure also provides a computer-readable storage medium on which a computer program or instructions are stored. When the computer program or instructions are executed by a processor, the processor executes the training method of the ambiguous analysis model and / or the ambiguous analysis method provided by the embodiment of the present disclosure.
[0173] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0174] It should be noted that the terms used in the embodiments of the present disclosure are only for describing specific embodiments, rather than limiting the scope of the embodiments of the present disclosure. As shown in the specification and claims of the embodiments of the present disclosure, unless the context clearly indicates an exception, the words "one", "a", "a kind of" and / or "the" do not specifically refer to the singular, but may also include the plural. The term "and / or" includes any and all combinations of one or more related listed items. Relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. The terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method or device. In the absence of more restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method or device including the elements.
[0175] The above description is only a specific implementation of the embodiments of the present disclosure, so that those skilled in the art can understand or implement the embodiments of the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the embodiments of the present disclosure. Therefore, the embodiments of the present disclosure will not be limited to the embodiments described herein, but will conform to the widest range consistent with the principles and novel features disclosed herein.
Claims
1. A training method for an ambiguous analysis model, characterized in that: include: Acquire a plurality of text samples to be subjected to ambiguity analysis; wherein the text samples correspond to at least one semantic meaning; Inputting any of the text samples into a plurality of first language models respectively, generating a plurality of first semantic parsing results of the text sample; wherein the first language model is pre-trained using an initial ambiguity analysis sample; the initial ambiguity analysis sample includes at least part of the text sample and at least one second semantic parsing result corresponding to the text sample; A target ambiguous analysis sample is constructed based on the text sample and each of the first semantic analysis results, and a second language model is iteratively trained based on the target ambiguous analysis sample corresponding to each of the text samples to generate a target language model; wherein the model scale of the second language model is greater than the model scale of the first language model.
2. The method according to claim 1, characterized in that Before inputting any of the text samples into a plurality of first language models to generate a plurality of first semantic parsing results of the text samples, the method further includes: Input any of the text samples into the second language model, generate at least one second semantic parsing result corresponding to the text sample, and construct the initial ambiguous analysis sample by the text sample and the second semantic parsing result; Based on the initial ambiguous analysis samples, a third language model is iteratively trained in multiple batches to generate the first language models.
3. The method according to claim 2, characterized in that The step of performing multiple batches of iterative training on the third language model based on each of the initial ambiguous analysis samples to generate each of the first language models includes: According to a preset ratio, randomly extracting each of the initial ambiguous analysis samples a preset number of times to generate a sample set of the preset number of initial ambiguous analysis samples; Iteratively training the third language model using any of the sample sets to generate the first language model corresponding to the sample set; wherein the number of the first language models is the preset number; and the preset number is determined based on the number of semantics possessed by the text to be subjected to ambiguity analysis.
4. The method according to claim 2 or 3, characterized in that: The third language model is a combination model of a pre-trained language representation model based on a transformer encoder structure and a conditional random field model; the suffix parameter in the text label of the third language model is determined based on a database query dimension.
5. The method according to claim 1, characterized in that The step of inputting any of the text samples into a plurality of first language models to generate a plurality of first semantic parsing results of the text sample comprises: Input any of the text samples into each of the first language models, and output a plurality of third semantic parsing results of the text sample; wherein the number of the third semantic parsing results is consistent with the number of the first language models; Deduplication processing is performed on each of the third semantic analysis results to generate each of the first semantic analysis results.
6. The method according to claim 5, characterized in that After inputting any of the text samples into the first language models respectively and outputting a plurality of third semantic parsing results of the text samples, the method further includes: Based on the second language model and the text sample, matching processing is performed on each of the third semantic analysis results to generate each of the first semantic analysis results.
7. The method according to claim 5, characterized in that The performing deduplication processing on each of the third semantic parsing results to generate each of the first semantic parsing results includes: Deduplication processing is performed on each of the third semantic analysis results to generate a plurality of fourth semantic analysis results; Based on the second language model and the text sample, matching processing is performed on each of the fourth semantic analysis results to generate each of the first semantic analysis results.
8. An ambiguity analysis method, characterized in that: include: Obtaining a target text to be subjected to ambiguity analysis; The target text is input into a target language model for processing to generate multiple target semantic parsing results of the target text; wherein the target language model is pre-trained by the training method of the ambiguous analysis model described in any one of claims 1 to 7.
9. An electronic device, characterized in that: The electronic device comprises: Processor and memory; The processor is used to execute the training method of the ambiguous analysis model as described in any one of claims 1 to 7, or execute the ambiguous analysis method as described in claim 8, by calling the program or instruction stored in the memory.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program or instruction, and the program or instruction enables a computer to execute the training method of an ambiguity analysis model as described in any one of claims 1 to 7, or execute the ambiguity analysis method as described in claim 8.
11. A computer program product, characterized in that The computer program product is used to implement the training method of the ambiguity analysis model as described in any one of claims 1 to 7, or to implement the ambiguity analysis method as described in claim 8.