A tool call semantic parsing method and system for low-resource data environment
By using a semantic analytical method based on context-free grammar in a low-resource environment, combined with self-training and recall models, the problem of poor performance of the existing technology in a low-resource environment is solved, and efficient and accurate semantic analytical effect is achieved.
Patent Information
- Application Number
- CN202510169480.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-17
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2045-02-17
AI Technical Summary
The existing semantic analytical technology performs poorly in low-resource environments, mainly due to its dependence on a large amount of labeled data, which leads to high data acquisition and labeling costs, and lacks flexibility and adaptability in the face of complex semantic and cross-domain tasks.
Logical expressions of the tool are constructed based on context-independent grammar (CFG) and combined with prompt word engineering and large language models to generate initial training data. Then, the pre-configured semantic analytical model is iteratively trained through the self-training method to optimize the model performance. At the same time, a recall model was introduced to calculate the similarity of the tool candidate data and training data, and filter out tools that do not conform to user semantics to obtain the final semantic analytical model.
Effectively expand the ability of semantic analysis in a low-resource environment, reduce the cost and time consumption of data annotation, and improve the efficiency and accuracy of the model when facing diversified tool scenarios.
Smart Images

Figure CN119623478B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of semantic parsing technology, and in particular to a tool call semantic parsing method and system for low-resource data environments. Background Art
[0002] With the rapid development of artificial intelligence and natural language processing technologies, intelligent dialogue systems have been widely used in various human-computer interaction scenarios. Through semantic parsing, dialogue systems convert the natural language input by users into semantic representations that can be understood by machines, and then perform various tasks. Such systems have demonstrated significant application value in the fields of intelligent customer service, virtual assistants, knowledge graph question and answer, etc. However, the current semantic parsing technology faces many challenges in low-resource environments, resulting in limited performance in practical applications.
[0003] Traditional semantic parsing methods are highly dependent on large-scale annotated data. In order to build an efficient parser, a large amount of training data is needed to annotate user intent, entities, relationships and other information. However, data acquisition and annotation are costly, especially in cross-domain applications. Different scenarios require different semantic labels and mapping rules, which further increases the difficulty of annotation. In addition, data diversity and consistency are difficult to guarantee in complex scenarios, and manual annotation is time-consuming and difficult to meet requirements. These factors have led to a significant decline in semantic parsing effects in low-resource environments, severely limiting the scalability and applicability of dialogue systems.
[0004] At present, the industry can generally be divided into two main approaches to introduce tools into intelligent systems. The first approach is to train semantic parsers in downstream scenarios in task-based dialogue systems to parse user-provided sentences into corresponding intents and slot values. The first approach has achieved certain results in the early stages, but is often limited by rule coverage when dealing with complex semantics. Although it can ensure grammatical accuracy through symbolic methods, it lacks sufficient flexibility and adaptability and is difficult to cope with changing natural languages. The second approach provides currently supported tooltips to large models, using advanced language models and specific prompt word mechanisms to enable large models to better understand and utilize various tools. The second approach is highly dependent on sophisticated prompt design, and when faced with multi-step reasoning, cross-domain tasks, or dynamically changing requirements, it often lacks sufficient flexibility and adaptability, and requires frequent adjustments to prompts and tool call logic, increasing development and maintenance costs.
[0005] Currently, no effective solution has been proposed for the problems in the related technologies. Summary of the invention
[0006] In view of the problems in the related art, the present invention proposes a tool call semantic parsing method and system for a low-resource data environment to overcome the above-mentioned technical problems existing in the existing related art.
[0007] To this end, the specific technical solution adopted by the present invention is as follows:
[0008] According to one aspect of the present invention, a tool call semantic parsing method for a low-resource data environment is provided, and the tool call semantic parsing method for a low-resource data environment comprises the following steps:
[0009] S1. Based on context-free grammar, construct logical expressions for each tool, and combine prompt word engineering and large language models to generate initial training data;
[0010] S2. Based on the acquired training data, the pre-configured semantic parsing model is iteratively trained in combination with a self-training method to obtain an optimized semantic parsing model;
[0011] S3. Through the recall model, the similarity between the tool candidate data and the training data is calculated to obtain the vector scores of the tool candidate data and the training data, and the tools that do not conform to the user semantics are screened out to obtain the final semantic parsing model.
[0012] Furthermore, based on the context-free grammar, logical expressions of various tools are constructed, and combined with the prompt word engineering and the large language model, the initial training data is generated, including the following steps:
[0013] S11. Based on context-free grammar, define basic units and operators;
[0014] S12, constructing terms based on basic units and operators, and using the constructed terms to build logical expressions of various tools;
[0015] S13. Based on the pre-built prompt word template and combined with the text generation capability of the large language model, the constructed logical expression is converted into a natural sentence to obtain the initial training data.
[0016] Furthermore, for the acquired training data, combined with the self-training method, the pre-configured semantic parsing model is iteratively trained to obtain the optimized semantic parsing model, including the following steps:
[0017] S21, labeling the acquired training data to obtain a labeled data set and an unlabeled data set;
[0018] S22, using the annotated data set, initializing the semantic parsing model for training, to obtain an initialized semantic parsing model;
[0019] S23. Based on the initialized semantic parsing model, the unlabeled dataset is iteratively optimized to obtain an optimized semantic parsing model.
[0020] Furthermore, for the acquired training data, combined with the self-training method, the pre-configured semantic parsing model is iteratively trained to obtain the optimized semantic parsing model, including the following steps:
[0021] S231, by initializing the semantic parsing model, predicting the unlabeled data set, and generating a candidate parsing set;
[0022] S232, based on the candidate analysis set, calculating the confidence score of each candidate analysis;
[0023] S233. Weight each candidate parsing in the candidate parsing set according to the confidence score, perform iterative optimization on the semantic parsing model, and obtain an optimized semantic parsing model.
[0024] Furthermore, the confidence score of each candidate solution is calculated as:
[0025] ;
[0026] In the formula, For each candidate data i Candidate parse vector j Probability scores on dimensions; represents the confidence score of each candidate parse; k Indicates the number of candidate resolutions in the candidate resolution set.
[0027] Furthermore, the calculation formula for iterative optimization of the semantic parsing model is:
[0028] ;
[0029] In the formula, Indicated in t The loss value at the iteration; Indicates i The score vector of candidate parsing vectors; represents the cross entropy loss function; Indicates this i Candidate analysis; Represents the prediction result of the semantic parsing model for the input unlabeled data; k Indicates the number of candidate resolutions in the candidate resolution set.
[0030] Furthermore, the recall model is used to calculate the similarity between the tool candidate data and the training data, obtain the vector scores of the tool candidate data and the training data, and filter out the tools that do not conform to the user's semantics. The final semantic parsing model includes the following steps:
[0031] S31, converting the unlabeled data into unlabeled data in vector form through the recall model;
[0032] S32, using the maximum similarity method, similarity measurement is performed on all vectors of the unlabeled data in vector form and the tool candidate data to obtain vector scores of the unlabeled data and the tool candidate data;
[0033] S33. Based on a pre-set similarity score threshold, select tools whose vector scores exceed the threshold to obtain a final semantic parsing model.
[0034] Furthermore, the calculation formula for the vector score of unlabeled data and tool candidates is:
[0035] ;
[0036] In the formula, Represents the unlabeled data i vectors; Indicates the candidate of tool j vectors; The number of vectors representing unlabeled data; The vector scores representing the candidate sets of unlabeled data and tools;
[0037] in, The calculation formula is:
[0038] ;
[0039] ;
[0040] ;
[0041] In the formula, Represents the cosine similarity formula; express The components of a vector; express The components of a vector; Represents the dimension of the vector.
[0042] According to another aspect of the present invention, a tool call semantic parsing system for a low-resource data environment is provided, the tool call semantic parsing system for a low-resource data environment comprising: a training data acquisition module, a semantic parsing model optimization module and a semantic parsing model determination module;
[0043] The training data acquisition module is used to construct the logical expressions of each tool based on the context-free grammar, and generate the initial training data by combining the prompt word engineering and the large language model;
[0044] The semantic parsing model optimization module is used to iteratively train the pre-configured semantic parsing model based on the acquired training data in combination with the self-training method to obtain an optimized semantic parsing model;
[0045] The semantic parsing model determination module is used to calculate the similarity between the tool candidate data and the training data through the recall model, obtain the vector scores of the tool candidate data and the training data, and filter out the tools that do not conform to the user semantics to obtain the final semantic parsing model.
[0046] The beneficial effects of the present invention are:
[0047] 1. The present invention enhances the parsing ability of the model by constructing an initial parsing data set based on the context-free text (CFG) method and combining it with a self-training strategy. By automatically generating pseudo labels, the model can improve its performance in a low-resource environment with the support of unlabeled data based on limited labeled data. This method can not only effectively expand the ability of semantic parsing, but also deeply optimize the model training mechanism, making it perform better in the face of flexible and diverse tool scenarios.
[0048] 2. In order to solve the challenges in low-resource semantic parsing, the present invention adopts a method based on CFG and self-training mechanism; combines grammatical rules to construct a data set, and uses a self-training strategy to enhance the semantic parsing ability of the model on the basis of unlabeled data; compared with the existing technology, it has unique advantages; first, there is no need for a large amount of manual annotation of data, but through automatic data generation and self-training mechanism, the cost and time consumption of data annotation are effectively reduced; this enables the system to iterate quickly and improve performance in a low-resource environment; in addition, it has unique advantages when processing a large tool library; by introducing a recall model in the self-training process to guide the generation of pseudo-labels, it can ensure that the pseudo-labels will not deviate from the correct labels to a large extent, thereby improving the performance in the self-training process; it ensures that the system maintains efficient and accurate parsing performance when facing a variety of tool scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] 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 will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0050] Figure 1 is a flow chart of a tool call semantic parsing method for a low-resource data environment according to an embodiment of the present invention;
[0051] Figure 2is a system block diagram of a tool call semantic parsing system for a low-resource data environment according to an embodiment of the present invention;
[0052] Figure 3 is a self-training semantic parsing flow chart in a tool-invoked semantic parsing method for a low-resource data environment according to an embodiment of the present invention;
[0053] Figure 4 is a recall model architecture diagram in a tool call semantic parsing method for a low-resource data environment according to an embodiment of the present invention;
[0054] Figure 5 A technical roadmap for iterative optimization of a semantic parsing model in a tool-calling semantic parsing method for a low-resource data environment according to an embodiment of the present invention.
[0055] In the figure:
[0056] 1. Training data acquisition module; 2. Semantic parsing model optimization module; 3. Semantic parsing model determination module. DETAILED DESCRIPTION
[0057] To further illustrate each embodiment, the present invention provides drawings, which are part of the disclosure of the present invention and are mainly used to illustrate the embodiments. They can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. With reference to these contents, ordinary technicians in this field should be able to understand other possible implementation methods and advantages of the present invention.
[0058] According to an embodiment of the present invention, a tool call semantic parsing method and system for a low-resource data environment are provided.
[0059] The present invention is further described with reference to the accompanying drawings and specific embodiments. Figure 1 As shown, according to one embodiment of the present invention, a tool call semantic parsing method for a low-resource data environment is provided, and the tool call semantic parsing method for a low-resource data environment includes the following steps:
[0060] S1. Based on context-free grammar, construct logical expressions for each tool, and combine prompt word engineering and large language models to generate initial training data.
[0061] Specifically, based on context-free grammar, logical expressions of various tools are constructed, and the initial training data is generated by combining prompt word engineering and large language models. The following steps are included:
[0062] S11. Based on context-free grammar, define basic units and operators;
[0063] S12, constructing terms based on basic units and operators, and using the constructed terms to build logical expressions of various tools;
[0064] S13. Based on the pre-built prompt word template and combined with the text generation capability of the large language model, the constructed logical expression is converted into a natural sentence to obtain the initial training data.
[0065] It should be noted that in conversation scenarios, the data collection and annotation process is time-consuming and expensive, especially when faced with a large tool set. To solve this problem, this paper proposes to use a context-free grammar (CFG)-based method to construct the logical expression of the tool, and combines prompt word engineering and a large language model to generate high-quality training data.
[0066] The specific steps of using the CFG method to construct a logical expression step by step are as follows: first, define the basic unit (Individual), such as one, True, False, etc.; secondly, define the operator (Operator), such as GDP, Population and other functions; then use the operator to combine the basic unit or sub-term to construct the term (Term), in the form of Operator (Term1, Term2, ...); finally, construct through equation (Assertion), in the form of Term=Term (such as GDP(one,True)=True).
[0067] It should be noted that the specific steps of constructing a suitable prompt word template and using the text generation capability of the existing large language model to translate the logical expression into a natural sentence that conforms to human language habits are as follows: first, add a task description, that is, clearly state the task requirements, including inputting an expression, and obtaining a natural sentence; second, add examples, that is, input an expression in the prompt word, such as industry concentration status (department store retail, March 2005) = high; finally, the model outputs, such as in March 2005, the concentration of the department store retail industry was at a high level; in March 2005, the department store retail industry showed a high concentration; the concentration of the department store retail industry in March 2005 was high.
[0068] S2. Based on the acquired training data, the pre-configured semantic parsing model is iteratively trained in combination with the self-training method to obtain an optimized semantic parsing model. It should be noted that although the data constructed based on CFG can provide preliminary training materials for semantic parsing, due to the difference between these data and the real dialogue text, the model may produce inaccurate parsing results; therefore, a self-training mechanism is further introduced to further improve the accuracy of the model, especially under low-resource or zero-sample conditions.
[0069] The self-training process includes initializing the model, generating a preliminary candidate set, calculating the confidence of the candidate annotations, and finally updating the training data and weights.
[0070] Specifically, for the acquired training data, combined with the self-training method, the pre-configured semantic parsing model is iteratively trained to obtain the optimized semantic parsing model, including the following steps:
[0071] S21, labeling the acquired training data to obtain a labeled data set and an unlabeled data set;
[0072] S22, using the annotated data set, initializing the semantic parsing model for training, to obtain an initialized semantic parsing model;
[0073] S23, based on the initialized semantic parsing model, iteratively optimize the unlabeled data set to obtain an optimized semantic parsing model. In the self-training process, a small amount of labeled data is first used to initialize the model for training, and then the unlabeled data is used for iterative optimization.
[0074] It should be noted that the calculation formula for initializing the semantic parsing model is:
[0075] ;
[0076] In the formula, g0 represents the initialization semantic parsing model; L Represents a labeled dataset; Train Indicates pre-training of the initialized semantic parsing model.
[0077] It should be noted that here Train It means to pre-train the initialization semantic parsing model, that is, to use a small amount of labeled data set to perform gradient descent on the parameters of the pre-trained initialization semantic parsing model, minimize the cross entropy loss to tune the model parameters, and obtain the initialization semantic parsing model; the calculation formula of the initialization semantic parsing model means that according to the labeled data set L And the pre-trained language model, through the gradient descent algorithm training to get a neural network model g0 that initializes the semantic parsing model; that is, input with annotated data set L Contains n samples, L Used for supervised learning of the model; the pre-trained language model provides initial weights; the algorithm uses the gradient descent method (here the AdamW optimization algorithm is used) to optimize the model parameters and minimize the loss function (here the cross entropy loss is used); outputs the trained initialized semantic parsing model.
[0078] Specifically, for the acquired training data, combined with the self-training method, the pre-configured semantic parsing model is iteratively trained to obtain the optimized semantic parsing model, including the following steps:
[0079] S231, by initializing the semantic parsing model, predicting the unlabeled data set, and generating a candidate parsing set;
[0080] S232, based on the candidate analysis set, calculating the confidence score of each candidate analysis;
[0081] S233. Weight each candidate parsing in the candidate parsing set according to the confidence score, perform iterative optimization on the semantic parsing model, and obtain an optimized semantic parsing model.
[0082] It should be noted that the iterative training of the pre-configured semantic parsing model is specifically performed by looping the following process on the initialized semantic parsing model: using the initialized semantic parsing model to predict the unlabeled dataset to obtain the label and confidence score corresponding to each data; then using the candidate parsing set predicted by the unlabeled dataset, that is, the labeled dataset, to train the initialized semantic parsing model to obtain the semantic parsing model of this round, and then repeating the above process with the semantic parsing model obtained in this round to obtain the initialized semantic parsing model of the next round, followed by the semantic parsing model obtained in the previous round in this iteration. The specific iterative termination condition is the iterative termination condition set here for a given round of 10, which allows the model to cycle 10 times. The number of times can be changed.
[0083] It should be noted that the candidate parsing set is specifically a label corresponding to each piece of data obtained by predicting the unlabeled data set.
[0084] It should be noted that generating a preliminary candidate set is to use the trained model to predict the unlabeled dataset U and generate k The best candidate solution.
[0085] ;
[0086] In the formula, Indicates that for the unlabeled dataset i Candidate annotation set of data items; Indicates the corresponding j Candidate annotations.
[0087] It should be noted that in order to calculate the confidence of the candidate annotations, in order to ensure that the candidate parsing can be weighted according to its quality during the training process, it is necessary to calculate the confidence of each candidate parsing, including outputting a raw score for each candidate parsing through the semantic parsing model; these scores are normalized on each dimension of the vector through a normalization function to obtain the confidence score of each candidate parsing.
[0088] Specifically, the confidence score of each candidate solution is calculated as follows:
[0089] ;
[0090] In the formula, For each candidate data i Candidate parse vector j Probability scores on dimensions; represents the confidence score of each candidate parse; k Represents the number of candidate parsing in the candidate parsing set. It should be noted that the training data and weights are updated, that is, in each round of training, the confidence scores of each candidate parsing are used to weight each parsing label in the candidate set, thereby training the semantic parsing model.
[0091] Specifically, the calculation formula for iterative optimization of the semantic parsing model is:
[0092] ;
[0093] In the formula, Indicated in t The loss value at the iteration; Indicates i The score vector of candidate parsing vectors; represents the cross entropy loss function; Indicates this i Candidate analysis; Represents the prediction result of the semantic parsing model for the input unlabeled data; k Indicates the number of candidate resolutions in the candidate resolution set.
[0094] It should be noted that Indicates this i candidate parses, corresponding to the previous .
[0095] It should be noted that the specific self-training process (such as Figure 3 ), Figure 3 The upper left box in the middle uses context-free grammar to construct logical expressions of various tools, and combines prompt word engineering and large language models to generate initial training data to construct labeled data for supervised training of the model. The semantic parsing model on the right is the parsing model after the training on the left is completed (that is, the optimized semantic parsing model); unlabelleddata is an unlabeled data set; initialcandidates is the candidate annotation set obtained after the model annotates the unlabeled data; updatemodel is the use of initialcandidates to perform the above-mentioned calculation on the model, the confidence of the candidate annotations, the loss calculation of updating the training data and weights, and the update of the model.
[0096] S3. Through the recall model, the similarity between the tool candidate data and the training data is calculated to obtain the vector scores of the tool candidate data and the training data, and the tools that do not conform to the user semantics are screened out to obtain the final semantic parsing model.
[0097] It should be noted that when model recall is introduced in self-training, due to the large number of tools and the zero-sample semantic parsing method, the self-training process may have serious misjudgments in intent recognition, thus affecting the algorithm effect. Therefore, a recall model based on similarity calculation is used. The semantic similarity of the tool name and user input is calculated, and the correlation between the tool and user input is measured by using methods such as cosine similarity. Some tools that do not meet the user's intention are filtered out, thereby reducing the number of matching tools and improving the effect of self-training.
[0098] During the self-training process, the recall model needs to vectorize the input data and use the recall model to perform semantic retrieval on the vector database that the toolset has prepared offline in advance. The recall model result of the dual-encoder is used here, which has the advantage of faster retrieval efficiency.
[0099] Specifically, the recall model is used to calculate the similarity between the tool candidate data and the training data, obtain the vector scores of the tool candidate data and the training data, and filter out the tools that do not conform to the user's semantics. The final semantic parsing model includes the following steps:
[0100] S31, converting the unlabeled data into unlabeled data in vector form through the recall model;
[0101] S32, using the maximum similarity method, similarity measurement is performed on all vectors of the unlabeled data in vector form and the tool candidate data to obtain vector scores of the unlabeled data and the tool candidate data;
[0102] S33. Based on a pre-set similarity score threshold, select tools whose vector scores exceed the threshold to obtain a final semantic parsing model.
[0103] It should be noted that the calculation formula for converting unlabeled data into vector representation through the recall model is:
[0104] ;
[0105] In the formula, A vector representation of the data; Indicates unlabeled data; Represents the recall model.
[0106] It should be noted that the similarity is calculated for each tool candidate in the vector library and the unlabeled data respectively; the similarity measurement method adopts the maximum similarity (MaxSim) method, and the cosine similarity is calculated for each vector of the unlabeled data and all the vectors of the tool candidates respectively, and the maximum value is taken as the score of this vector for the tool candidate, and the sum of all scores of each vector of the unlabeled data is taken as the score of the unlabeled data and the tool candidate.
[0107] Specifically, the calculation formula for the vector score of unlabeled data and tool candidates is:
[0108] ;
[0109] In the formula, Represents the unlabeled data i vectors; Indicates the candidate tool j vectors; The number of vectors representing unlabeled data; The vector scores representing the candidate sets of unlabeled data and tools;
[0110] in, The calculation formula is:
[0111] ;
[0112] ;
[0113] ;
[0114] In the formula, Represents the cosine similarity formula; express The components of a vector; express The components of a vector; Represents the dimension of the vector.
[0115] It should be noted that, according to the set similarity score threshold, tools whose vector scores exceed the threshold are screened out; the vocabulary numbers corresponding to these tools are used as the restriction conditions for the prediction tools in the self-training process (such as Figure 4 as shown).
[0116] The formula for filtering out vectors with scores exceeding the threshold is:
[0117] ;
[0118] In the formula, represents the similarity score threshold, which is set to negative three here.
[0119] In summary, the core innovation of the present invention lies in the combination of context-free grammar (CFG) and self-training method, which trains weak semantic parser (specifically, semantic parsing model) through generative model framework to reduce the dependence on labeled data; the self-training method uses unlabeled data for iterative optimization to gradually improve the model performance; at the same time, the introduction of recall model effectively solves the problem of unstable self-training effect caused by the large amount of tools and improves the accuracy of parsing; the specific implementation steps are as follows: Figure 5 As shown, first build CFG expressions for each tool, then select a suitable large model (such as GPT3.5) to generate a labeled dataset, then select a suitable model architecture to train the weak semantic parser, and finally determine whether the semantic parser has reached the set threshold or completed the self-training iteration process. If so, output the final semantic parser, otherwise continue self-training (Sel-Train), put the unlabeled data into the recall model to filter the tool intent, and put the unlabeled data and restricted tool intent into the weak semantic parser to predict the Top-K pseudo labels, and use the top-k labels to train the weak semantic parser again.
[0120] like Figure 2 As shown, according to another embodiment of the present invention, a tool call semantic parsing system for a low-resource data environment is provided, the tool call semantic parsing system for a low-resource data environment comprises: a training data acquisition module, a semantic parsing model optimization module and a semantic parsing model determination module;
[0121] The training data acquisition module 1 is used to construct the logical expressions of each tool based on the context-free grammar, and generate the initial training data by combining the prompt word engineering and the large language model;
[0122] The semantic parsing model optimization module 2 is used to iteratively train the pre-configured semantic parsing model based on the acquired training data in combination with the self-training method to obtain an optimized semantic parsing model;
[0123] The semantic parsing model determination module 3 is used to calculate the similarity between the tool candidate data and the training data through the recall model, obtain the vector scores of the tool candidate data and the training data, and filter out the tools that do not conform to the user semantics to obtain the final semantic parsing model.
[0124] In summary, with the help of the above technical solutions of the present invention, the present invention enhances the parsing ability of the model by constructing an initial parsing data set based on the context-free text (CFG) method and combining it with a self-training strategy; by automatically generating pseudo labels, the model can improve its performance in a low-resource environment with the support of unlabeled data on the basis of limited labeled data; this method can not only effectively expand the ability of semantic parsing, but also deeply optimize the model training mechanism, so that it performs better in the face of flexible and diverse tool scenarios; in order to solve the challenges in low-resource semantic parsing, the present invention uses a method based on CFG and a self-training mechanism; combines grammatical rules to construct a data set, and The self-training strategy is used to enhance the semantic parsing ability of the model based on unlabeled data. Compared with existing technologies, it has unique advantages. First, there is no need for a large amount of manual annotation of data. Instead, the cost and time consumption of data annotation are effectively reduced through automatic data generation and self-training mechanism. This enables the system to iterate quickly and improve performance in a low-resource environment. In addition, it has unique advantages when dealing with a large tool library. By introducing a recall model to guide the generation of pseudo-labels during the self-training process, it can ensure that the pseudo-labels will not deviate from the correct labels to a large extent, thereby improving the performance of the self-training process. This ensures that the system maintains efficient and accurate parsing performance when facing a variety of tool scenarios.
[0125] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A tool call semantic parsing method for a low-resource data environment, characterized in that: The tool call semantic parsing method for low-resource data environment comprises the following steps: S1. Based on context-free grammar, construct logical expressions for each tool, and combine prompt word engineering and large language models to generate initial training data; S2. Based on the acquired training data, the pre-configured semantic parsing model is iteratively trained in combination with a self-training method to obtain an optimized semantic parsing model; S3. Use the recall model to calculate the similarity between the tool candidate data and the training data, obtain the vector scores of the tool candidate data and the training data, and filter out the tools that do not conform to the user's semantics to obtain the final semantic parsing model. The method of iteratively training the pre-configured semantic parsing model based on the acquired training data and combining the self-training method to obtain the optimized semantic parsing model includes the following steps: S21, labeling the acquired training data to obtain a labeled data set and an unlabeled data set; S22, using the annotated data set, initializing the semantic parsing model for training, to obtain an initialized semantic parsing model; S23, iteratively optimizing the unlabeled data set according to the initialized semantic parsing model to obtain an optimized semantic parsing model; The method of calculating the similarity between the tool candidate data and the training data through the recall model, obtaining the vector scores of the tool candidate data and the training data, and filtering out the tools that do not conform to the user semantics to obtain the final semantic parsing model includes the following steps: S31, converting the unlabeled data into unlabeled data in vector form through the recall model; S32, using the maximum similarity method, similarity measurement is performed on all vectors of the unlabeled data in vector form and the tool candidate data to obtain vector scores of the unlabeled data and the tool candidate data; S33, based on a preset similarity score threshold, screening out tools whose vector scores exceed the threshold, and obtaining a final semantic parsing model; The calculation formula for the vector score of the unlabeled data and tool candidates is: In the formula, v i represents the i-th vector of unlabeled data; t j represents the jth vector of the tool candidate; M represents the number of vectors of unlabeled data; Score represents the vector score of the unlabeled data and the tool candidate set; Among them, the calculation formula of CosineSim is: Where CosineSim represents the cosine similarity formula; v i,l Indicates v i The components of the vector; t j,l Indicates t j The individual components of a vector; n represents the dimension of the vector.
2. A tool call semantic parsing method for a low-resource data environment according to claim 1, characterized in that: The process of constructing the logical expressions of each tool based on the context-free grammar and combining the prompt word engineering and the large language model to generate the initial training data includes the following steps: S11. Based on context-free grammar, define basic units and operators; S12, constructing terms based on basic units and operators, and using the constructed terms to build logical expressions of various tools; S13. Based on the pre-built prompt word template and combined with the text generation capability of the large language model, the constructed logical expression is converted into a natural sentence to obtain the initial training data.
3. The tool call semantic parsing method for low-resource data environment according to claim 1, characterized in that: The method of iteratively training the pre-configured semantic parsing model based on the acquired training data and combining the self-training method to obtain the optimized semantic parsing model includes the following steps: S231, by initializing the semantic parsing model, predicting the unlabeled data set, and generating a candidate parsing set; S232, based on the candidate analysis set, calculating the confidence score of each candidate analysis; S233. Weight each candidate parsing in the candidate parsing set according to the confidence score, perform iterative optimization on the semantic parsing model, and obtain an optimized semantic parsing model.
4. The tool call semantic parsing method for low-resource data environment according to claim 3, characterized in that: The calculation formula for the confidence score of each candidate analysis is: In the formula, score i,j Indicates the probability score of the jth dimension of the i-th candidate parsing vector for each candidate data; transition_score i,j represents the confidence score of each candidate analysis; k represents the number of candidate analysis in the candidate analysis set.
5. The tool call semantic parsing method for low-resource data environment according to claim 3, characterized in that: The calculation formula for iterative optimization of the semantic parsing model is: Where, L t Indicates the loss value at the tth iteration; transition_score i represents the score vector of the i-th candidate parsing vector; loss represents the cross entropy loss function; y i represents the i-th candidate analysis; y represents the prediction result of the semantic analysis model for the input unlabeled data; k represents the number of candidate analysis in the candidate analysis set.
6. A tool call semantic parsing system for a low-resource data environment, used to implement the tool call semantic parsing method for a low-resource data environment as claimed in any one of claims 1 to 5, characterized in that: The tool call semantic parsing system for low-resource data environment includes: a training data acquisition module, a semantic parsing model optimization module and a semantic parsing model determination module; The training data acquisition module is used to construct the logical expressions of each tool based on the context-free grammar, and generate initial training data in combination with the prompt word engineering and the large language model; The semantic parsing model optimization module is used to iteratively train the pre-configured semantic parsing model based on the acquired training data in combination with a self-training method to obtain an optimized semantic parsing model; The semantic parsing model determination module is used to calculate the similarity between the tool candidate data and the training data through the recall model, obtain the vector scores of the tool candidate data and the training data, and screen out the tools that do not conform to the user semantics to obtain the final semantic parsing model.
Citation Information
Patent Citations
Unsupervised semantic analysis method and device based on data generation and iterative improvement
CN115130477A
AUPR511301A0