Entity mapping method and device, medium and electronic equipment
By training a large language model and performing multi-dimensional joint verification, the ambiguity problem in named entity recognition is solved, the efficiency and accuracy of entity mapping are improved, and efficient recognition and matching of entity information are achieved.
Patent Information
- Application Number
- CN202510846926.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-23
- Publication Date
- 2025-10-17
AI Technical Summary
Existing named entity recognition methods are inefficient when dealing with ambiguity issues, leading to inaccurate entity mapping and affecting entity extraction and API calls.
The basic large language model is trained using training sample data to generate an entity mapping model. Multi-dimensional joint verification technology, including intent labels, object labels, and enumeration value labels, is used to generate multi-dimensional semantic vectors and multi-dimensional evaluation information to improve the accuracy and reliability of entity recognition.
Improves the efficiency and accuracy of entity mapping, ensuring reliability and matching reliability when identifying entity information in natural language.
Smart Images

Figure CN120805908A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of natural language processing, and particularly relate to an entity mapping method, device, medium and electronic equipment. BACKGROUND
[0002] Named entity recognition and mapping is a method of identifying entity information required by a business from natural language and standardizing the entity. In the prior art, the named entity recognition method adopts a rule-based, machine learning and deep learning method, relies on a dictionary, template and regular expression, and cannot solve ambiguity problems. In actual business, due to incomplete entity expression, ambiguity can easily lead to recognition failure, which greatly disturbs the extraction of entities from user dialog and interface calling, and the efficiency of entity mapping is not high. How to improve the efficiency of entity mapping is of great significance. SUMMARY
[0003] Embodiments of the present application provide an entity mapping method, device, medium and electronic equipment, which can improve the efficiency of entity mapping when identifying entity information from natural language.
[0004] To achieve the above purpose, the technical scheme of the embodiments of the present application is as follows:
[0005] In a first aspect, the embodiments of the present application provide an entity mapping method, which comprises:
[0006] inputting the obtained user inputted to-be-processed sentence information into a trained entity mapping model to obtain candidate entity information corresponding to the to-be-processed sentence information; wherein the candidate entity information comprises intent information, candidate entity and candidate enumeration value; the entity mapping model is obtained by training a basic large language model using training sample data; the training sample data comprises sentence text with multi-dimensional labels; the multi-dimensional labels comprise intent labels, object labels and enumeration value labels;
[0007] converting the generated candidate entity, candidate enumeration value and reference enumeration value included in a preset enumeration value library into high-dimensional semantic vectors respectively to obtain multi-dimensional semantic vectors; the multi-dimensional semantic vectors comprise entity feature vectors, enumeration value feature vectors and contrast feature vectors corresponding to the candidate entity, candidate enumeration value and reference enumeration value respectively;
[0008] performing multi-dimensional joint verification based on the high-dimensional semantic vectors to generate multi-dimensional evaluation information; the multi-dimensional evaluation information represents the confidence degree of matching between the candidate entity and the candidate enumeration value;
[0009] outputting target entity and target enumeration value corresponding to the to-be-processed sentence information based on the candidate entity information and the generated multi-dimensional evaluation information.
[0010] The entity mapping method provided by the embodiments of the present application processes the to-be-processed sentence information based on the trained entity mapping model, obtains candidate entity information, and obtains multi-dimensional evaluation information through multi-dimensional joint verification, so as to realize accurate output of target entities and target enumeration values based on large model semantics and multi-dimensional joint verification. In this process, because the candidate entity information output by the trained entity mapping model contains identified intent information, and the multi-dimensional evaluation information generated through multi-dimensional joint verification is matched with the confidence evaluation, the accuracy of entity recognition and the reliability of entity and enumeration value matching can be improved when recognizing entity information from natural language, and the efficiency of entity mapping can be improved.
[0011] In a possible implementation, the training sample data further includes a guide instruction sample text; the guide instruction sample text corresponds to a same target domain type in the preset domain types corresponding to the sentence text; and the guide instruction sample text is prompt guide instruction information for the large language model.
[0012] The method of the embodiments can further embed domain knowledge of the target domain type in the training sample data in the process of training the basic large language model to obtain the trained entity mapping model, so as to improve the accuracy of entity recognition of the entity mapping model, enhance the effective matching of entities and enumeration values in the candidate entity information, and further improve the accuracy of entity recognition and the reliability of entity and enumeration value matching, thereby improving the efficiency of entity mapping.
[0013] In a possible implementation, in the process of obtaining the trained entity mapping model, the training includes the following steps:
[0014] Obtaining training sample data; the training sample data includes sentence text with multi-dimensional labels; the multi-dimensional labels include intent labels, object labels, and enumeration value labels;
[0015] Selecting sentence text from the training sample data to generate batch training materials;
[0016] Inputting the batch training materials into the to-be-trained basic large language model for training, and determining a mapping loss value of the to-be-trained basic large language model;
[0017] Determine whether the mapping loss value converges to a preset target value, if yes, end the training to obtain the trained entity mapping model, otherwise adjust the parameters of the to-be-trained basic large language model according to the determined mapping loss value and perform retraining.
[0018] In the method of this embodiment, the training sample data includes sentence texts with multi-dimensional labels; the multi-dimensional labels include an intent label, an object label and an enumeration value label; the sentence texts are selected from the training sample data to generate batch training materials; the batch training materials are input into the to-be-trained basic large language model for training, and the mapping loss value of the to-be-trained basic large language model is determined; whether the mapping loss value converges to a preset target value is determined, and finally the trained entity mapping model is obtained. This process can ensure that the candidate entity information output by the trained entity mapping model contains the identified intent information, which can improve the accuracy of entity recognition by the trained entity mapping model when identifying entity information from natural language, and more effectively improve the efficiency of entity mapping.
[0019] In a possible implementation, the multi-dimensional joint verification based on the high-dimensional semantic vector to generate multi-dimensional evaluation information includes:
[0020] The similarity between the entity feature vector and the contrast feature vector is calculated based on a preset rule to obtain a cross similarity value of the candidate entity and each reference enumeration value; the cross similarity value represents the semantic matching degree of the entity and the enumeration value;
[0021] According to the entity feature vector and the enumeration value feature vector, a matching prediction uncertainty of the candidate entity and the candidate enumeration value is obtained;
[0022] Based on the cross similarity value and the matching prediction uncertainty, the multi-dimensional evaluation information is generated.
[0023] In the method of this embodiment, the similarity between the entity feature vector and the contrast feature vector is calculated based on a preset rule to obtain a cross similarity value of the candidate entity and each reference enumeration value; the cross similarity value represents the semantic matching degree of the entity and the enumeration value; according to the entity feature vector and the enumeration value feature vector, a matching prediction uncertainty of the candidate entity and the candidate enumeration value is obtained; based on the cross similarity value and the matching prediction uncertainty, the multi-dimensional evaluation information is generated. A multi-dimensional evaluation mechanism combining interactive similarity retrieval and uncertainty evaluation is provided, which can realize dynamic matching analysis through the enumeration value library, optimize the process of entity mapping, and improve the efficiency of entity mapping.
[0024] In a possible implementation, the intention information includes an intention confidence corresponding to a target intention type; the target intention type is an intention type corresponding to the input sentence information recognized by the semantic understanding module; and the generating the multi-dimensional evaluation information based on the cross similarity value and the matching prediction uncertainty includes:
[0025] aggregating scores of the cross similarity value and the matching prediction uncertainty based on a preset comprehensive scoring rule to obtain a prediction comprehensive score;
[0026] obtaining the multi-dimensional evaluation information according to the prediction comprehensive score and the intention confidence.
[0027] The method of this embodiment includes that the intention information includes an intention confidence corresponding to a target intention type; the target intention type is an intention type corresponding to the input sentence information recognized by the semantic understanding module; and the generating the multi-dimensional evaluation information based on the cross similarity value and the matching prediction uncertainty includes: aggregating scores of the cross similarity value and the matching prediction uncertainty based on a preset comprehensive scoring rule to obtain a prediction comprehensive score; and obtaining the multi-dimensional evaluation information according to the prediction comprehensive score and the intention confidence, so as to generate the multi-dimensional evaluation information based on the cross similarity value, the matching prediction uncertainty and the intention confidence, provide a multi-dimensional evaluation mechanism fusing the intention confidence, and more accurately and comprehensively evaluate reliability and stability of matching of the candidate entity and the candidate enumeration value, and improve efficiency of entity mapping.
[0028] In a possible implementation, the obtaining the multi-dimensional evaluation information according to the prediction comprehensive score and the intention confidence includes:
[0029] constructing the prediction comprehensive score and the intention confidence into a multi-dimensional information pair to obtain the multi-dimensional evaluation information; the multi-dimensional evaluation information includes first evaluation element information and second evaluation element information; the first evaluation element information is obtained based on the prediction comprehensive score; and the second evaluation element information is obtained based on the intention confidence.
[0030] The method of this embodiment constructs the prediction comprehensive score and the intention confidence into a multi-dimensional information pair to obtain the multi-dimensional evaluation information; the multi-dimensional evaluation information includes first evaluation element information and second evaluation element information; the first evaluation element information is obtained based on the prediction comprehensive score; and the second evaluation element information is obtained based on the intention confidence, so as to reduce a calculation amount of multi-dimensional evaluation, save time consumption of entity mapping, and further improve efficiency of entity mapping based on construction of the multi-dimensional information pair.
[0031] In a second aspect, an entity mapping apparatus is further provided in the embodiments of the present application, and the apparatus includes:
[0032] A model docking unit is configured to input acquired user inputted to-be-processed sentence information into a trained entity mapping model to obtain candidate entity information corresponding to the to-be-processed sentence information; wherein the candidate entity information includes intent information, a candidate entity, and a candidate enumeration value; the entity mapping model is obtained by training a basic large language model using training sample data; the training sample data includes sentence texts with multi-dimensional labels; the multi-dimensional labels include intent labels, object labels, and enumeration value labels;
[0033] A vector conversion unit is configured to convert the generated candidate entity, the candidate enumeration value, and a reference enumeration value included in a preset enumeration value library into high-dimensional semantic vectors respectively to obtain multi-dimensional semantic vectors; the multi-dimensional semantic vectors include entity feature vectors, enumeration value feature vectors, and contrast feature vectors corresponding to the candidate entity, the candidate enumeration value, and the reference enumeration value respectively;
[0034] A multi-dimensional evaluation unit is configured to perform multi-dimensional joint verification based on the high-dimensional semantic vectors to generate multi-dimensional evaluation information; the multi-dimensional evaluation information represents a confidence degree of matching between the candidate entity and the candidate enumeration value;
[0035] An entity optimization unit is configured to output a target entity and a target enumeration value corresponding to the to-be-processed sentence information based on the candidate entity information and the generated multi-dimensional evaluation information.
[0036] In a possible implementation, the training sample data further includes a guide instruction sample text; the guide instruction sample text corresponds to a same target domain type in preset domain types as the sentence text; and the guide instruction sample text is prompt guide instruction information for the large language model.
[0037] In a possible implementation, the apparatus further includes a model training unit; the model training unit is configured to:
[0038] obtain training sample data; the training sample data includes sentence texts with multi-dimensional labels; the multi-dimensional labels include intent labels, object labels, and enumeration value labels;
[0039] select a sentence text from the training sample data to generate batch training materials;
[0040] input the batch training materials into a to-be-trained basic large language model to train the to-be-trained basic large language model and determine a mapping loss value of the to-be-trained basic large language model;
[0041] Determine whether the mapping loss value converges to a preset target value, if yes, end the training to obtain a trained entity mapping model, otherwise adjust the parameters of the to-be-trained base large language model according to the determined mapping loss value and perform retraining.
[0042] In a possible implementation, the multi-dimensional evaluation unit is specifically configured to:
[0043] Calculate the similarity between the entity feature vector and the contrast feature vector based on a preset rule to obtain a cross similarity value of the candidate entity and each reference enumeration value; the cross similarity value represents the semantic matching degree of the entity and the enumeration value;
[0044] According to the entity feature vector and the enumeration value feature vector, obtain a matching prediction uncertainty of the candidate entity and the candidate enumeration value;
[0045] Based on the cross similarity value and the matching prediction uncertainty, generate the multi-dimensional evaluation information.
[0046] In a possible implementation, the intent information includes an intent confidence corresponding to a target intent type; the target intent type is an intent type corresponding to the input sentence information recognized by the semantic understanding module; and the multi-dimensional evaluation unit is specifically configured to:
[0047] Based on a preset comprehensive scoring rule, aggregate the cross similarity value and the matching prediction uncertainty to obtain a predicted comprehensive score;
[0048] According to the predicted comprehensive score and the intent confidence, obtain the multi-dimensional evaluation information.
[0049] In a possible implementation, the multi-dimensional evaluation unit is specifically configured to:
[0050] Construct the predicted comprehensive score and the intent confidence into a multi-dimensional information pair to obtain the multi-dimensional evaluation information; the multi-dimensional evaluation information includes first evaluation element information and second evaluation element information; the first evaluation element information is obtained based on the predicted comprehensive score; and the second evaluation element information is obtained based on the intent confidence.
[0051] In a third aspect, the embodiments of the present application further provide a computer readable storage medium, the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the entity mapping method in the first aspect.
[0052] In a fourth aspect, the embodiments of the present application further provide an electronic device, comprising a memory and a processor, wherein the memory stores a computer program capable of running on the processor, and when the computer program is executed by the processor, the processor implements the entity mapping method of the first aspect.
[0053] The technical effects brought by any one of the implementation manners of the second aspect to the fourth aspect can refer to the technical effects brought by the corresponding implementation manners of the first aspect, which will not be described here. BRIEF DESCRIPTION OF DRAWINGS
[0054] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0055] Figure 1 An application scenario schematic diagram is provided for the embodiments of the present application.
[0056] Figure 2 A flowchart of an entity mapping method is provided for the embodiments of the present application.
[0057] Figure 3 A schematic diagram of the composition of the guidance instruction information of an entity mapping method is provided for the embodiments of the present application.
[0058] Figure 4 A flowchart of obtaining a trained entity mapping model through training of an entity mapping method is provided for the embodiments of the present application.
[0059] Figure 5 A flowchart of generating multi-dimensional evaluation information based on multi-dimensional joint verification of high-dimensional semantic vectors of an entity mapping method is provided for the embodiments of the present application.
[0060] Figure 6 A flowchart of generating multi-dimensional evaluation information based on cross-similarity values and matching prediction uncertainty of an entity mapping method is provided for the embodiments of the present application.
[0061] Figure 7 A flowchart of another entity mapping method is provided for the embodiments of the present application.
[0062] Figure 8 A structural schematic diagram of an entity mapping device is provided for the embodiments of the present application.
[0063] Figure 9 A structural schematic diagram of another entity mapping device is provided for the embodiments of the present application.
[0064] Figure 10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0065] To make the objectives, technical solutions, and advantages of this application more clear, this application will be further described in detail below with reference to the accompanying drawings. Obviously, the embodiments described are only some of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of this application.
[0066] It should be noted that the terms "including" and "having" and their variations involved in the documents of this application are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or are inherent to these processes, methods, products or devices.
[0067] The following are explanations of some of the words that appear in the text:
[0068] (1) Large Language Model (LLM): A deep learning model trained with large amounts of text data that can generate natural language text or understand the meaning of language text. These models can provide in-depth knowledge and language production on various topics by training on large datasets. The core idea is to learn the patterns and structure of natural language through large-scale unsupervised training, simulating the human language cognition and generation process to a certain extent.
[0069] (2) Named Entity Recognition and Mapping: Named Entity Recognition and Mapping is a method for identifying entity information required for business from natural language and standardizing the entities. Entity mapping in this application refers to the named entity recognition and mapping process.
[0070] (3) Guidance information: Guidance information, also known as prompts, refers to the input text or instructions provided by the user to the model to guide the model to generate a specific type of response. The prompt can be a question, a description, a task instruction, or even a portion of the conversation history. By designing and optimizing the prompt, the model can be guided to generate expected responses or complete specific tasks. When integrating large language models, well-designed prompts can help the model understand the user's intentions more accurately and generate more expected results. Designing appropriate prompts is a very important step for different application scenarios and needs.
[0071] (4) Small model: A small model refers to a model with fewer parameters, shallower levels, and lower complexity. Small models have the following characteristics: lightweight, high efficiency, and easy to deploy. Due to its lower complexity, a small model usually requires less computing resources and storage space, and can be trained and inferred in an environment with limited resources.
[0072] Named entity recognition and mapping is a method of identifying entity information required by a business from natural language and standardizing the entity. In the prior art, the named entity recognition method adopts a rule-based, machine learning, and deep learning method, relies on a dictionary, a template, and a regular expression, and cannot solve ambiguity problems. In actual business, due to incomplete entity expression, ambiguity can easily lead to recognition failure, which greatly disturbs the extraction of entities from user dialog and interface calling, and the efficiency of entity mapping is not high. How to improve the efficiency of entity mapping is of great significance.
[0073] To solve the existing technical problems, the embodiment of the present application provides an entity mapping method, device, medium and electronic equipment, wherein the entity mapping method comprises: inputting the obtained user inputted to-be-processed sentence information into a trained entity mapping model to obtain candidate entity information corresponding to the to-be-processed sentence information; the candidate entity information comprises intent information, candidate entity and candidate enumeration value; wherein the entity mapping model is obtained by training a basic large language model using training sample data; the training sample data comprises a sentence text with multi-dimensional labels; the multi-dimensional labels comprise intent labels, object labels and enumeration value labels; the generated candidate entity, candidate enumeration value and reference enumeration value included in a preset enumeration value library are respectively converted into high-dimensional semantic vectors to obtain multi-dimensional semantic vectors; the multi-dimensional semantic vectors comprise entity feature vectors, enumeration value feature vectors and contrast feature vectors corresponding to the candidate entity, candidate enumeration value and reference enumeration value respectively; multi-dimensional joint verification is performed based on the high-dimensional semantic vectors to generate multi-dimensional evaluation information; based on the candidate entity information and the generated multi-dimensional evaluation information, a target entity and a target enumeration value corresponding to the to-be-processed sentence information are outputted; the multi-dimensional evaluation information represents the confidence degree of matching between the candidate entity and the candidate enumeration value, which can improve the accuracy of entity recognition and the reliability of matching between the entity and the enumeration value when identifying entity information from natural language, and improve the efficiency of entity mapping.
[0074] In order to make the invention purpose, technical scheme and advantages of the embodiments of the present application clearer, the present application will be described in further detail below with reference to the drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0075] It should be noted that the application scenarios described in the embodiments of the present application are used to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art can know that the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems as new application scenarios appear.
[0076] Figure 1 An application scenario provided by the embodiments of the present application is shown. Referring to FIG. 1, Figure 1 As shown, the application scenario includes a terminal device 200 and a server 100. The server 100 and the terminal device 200 are in the same data network, which can be a wired network or a wireless network. When the server 100 and the terminal device 200 are in the same data network, the terminal device 200 can communicate with the server 100. The server 100 can be a cloud server of the terminal device 200. The server 100 stores a preset enumeration value library 101. The enumeration value library 101 is a reference enumeration value. In some embodiments, the terminal device 200 can communicate with the server 100 at a fixed period or when performing entity mapping to obtain auxiliary information used in the entity mapping process, for example, the reference enumeration value in the enumeration value library. A trained entity mapping model 201 is arranged in the terminal device 200. In other embodiments, the user can also access the server 100 through the client in the terminal device 200 to perform entity mapping. It can be understood that the server 100 and the terminal device 200 can also be in different data networks connected to each other, Figure 1 The same data network of the described application scenario does not constitute a limitation on the technical solutions provided by the embodiments of the present application.
[0077] The terminal device 200 inputs the obtained user inputted to-be-processed sentence information into the trained entity mapping model to obtain candidate entity information corresponding to the to-be-processed sentence information; wherein the candidate entity information includes intent information, candidate entity and candidate enumeration value; the entity mapping model is obtained by training a basic large language model using training sample data; the training sample data includes sentence text with multi-dimensional labels; the multi-dimensional labels include intent labels, object labels and enumeration value labels; the generated candidate entity, candidate enumeration value and reference enumeration value included in the preset enumeration value library 101 are respectively converted into high-dimensional semantic vectors to obtain multi-dimensional semantic vectors; the multi-dimensional semantic vectors include entity feature vectors, enumeration value feature vectors and contrast feature vectors corresponding to the candidate entity, candidate enumeration value and reference enumeration value respectively; multi-dimensional joint verification is performed based on the high-dimensional semantic vectors to generate multi-dimensional evaluation information; the multi-dimensional evaluation information represents the confidence of matching the candidate entity and the candidate enumeration value; and based on the candidate entity information and the generated multi-dimensional evaluation information, a target entity and a target enumeration value corresponding to the to-be-processed sentence information are outputted.
[0078] The embodiment of the application provides an entity mapping method, as shown in the following steps: Figure 2
[0079] In step S201, the obtained user inputted to-be-processed sentence information is inputted into the trained entity mapping model, to obtain candidate entity information corresponding to the to-be-processed sentence information; the candidate entity information includes intent information, a candidate entity and a candidate enumeration value.
[0080] The entity mapping model is obtained by training a basic large language model using training sample data; the training sample data includes sentence texts with multi-dimensional labels; the multi-dimensional labels include intent labels, object labels and enumeration value labels.
[0081] For example, the terminal device 200 inputs the obtained user inputted to-be-processed sentence information Input_senten into the trained entity mapping model 201, to obtain candidate entity information candi_entity_info corresponding to the to-be-processed sentence information; the candidate entity information candi_entity_info includes intent information intent_info, a candidate entity candi_enti and candidate enumeration values candi_values. The entity mapping model 201 is obtained by training a basic large language model using training sample data; the training sample data includes sentence texts with multi-dimensional labels; the multi-dimensional labels include intent labels, object labels and enumeration value labels.
[0082] In some embodiments of the application, the training sample data further includes guide instruction sample texts; the guide instruction sample texts correspond to a same target domain type in the pre-set domain types; the guide instruction sample texts are prompt guide instruction information for the large language model.
[0083] For example, Figure 3 is a schematic diagram of the composition of a simple prompt guide instruction information. The target domain type can be a "meteorological domain"; for the business scenario of the meteorological domain, the training sample data further includes guide instruction sample texts; the guide instruction sample texts correspond to a same target domain type in the pre-set domain types, that is, the guide instruction sample texts and the sentence texts included in the training sample data both correspond to the "meteorological domain"; the guide instruction sample texts are prompt guide instruction information for the large language model.
[0084] The method of the embodiment further includes a guide instruction sample text by setting the training sample data; the guide instruction sample text corresponds to a same target domain type in a preset domain type of the sentence text; the guide instruction sample text is prompt guide instruction information for the large language model, and embedding domain knowledge of the target domain type in the training sample data in the process of training the basic large language model to obtain the trained entity mapping model can improve the accuracy of entity recognition of the entity mapping model, enhance the effective matching of entities and enumeration values in the candidate entity information, and thus further improve the accuracy of entity recognition and the reliability of entity and enumeration value matching, and improve the efficiency of entity mapping.
[0085] In some embodiments of the present application, the guide instruction information in the pre-designed domain knowledge is used to guide the model to understand the current task during training.
[0086] In specific implementation, according to the current business scenario, a structured prompt is designed to reflect the domain knowledge and task characteristics, and to ensure that the large language model accurately captures entities in the intent in a complex context; based on the intent, it is determined whether the user query is a business scenario, and after the business scenario is confirmed, the entity and enumeration value corresponding to the current intent are extracted and structured output. For example, Figure 3 is a schematic diagram of the composition of a simple prompt guide instruction information. For example, Figure 3 The domain in the above example can be a "meteorological domain". According to the current business scenario of the meteorological domain, a structured prompt is designed to reflect the domain knowledge and task characteristics of the meteorological domain, and to ensure that the large language model accurately captures entities in the intent in a complex context; based on the intent, it is determined whether the user query is a business scenario of the meteorological domain, and after the business scenario of the meteorological domain is confirmed, the entity and enumeration value corresponding to the current intent are extracted and structured output.
[0087] In some embodiments of the present application, the original data of the training sample data is a sentence text with multi-dimensional labels; the original data of the training sample data is fused with the prompt to embed domain knowledge, and a fine-tuning training data set is constructed, which can train the business-related description and question and answer pair together, and can improve the accuracy of entity recognition of the trained entity mapping model.
[0088] In some embodiments of the present application, in the process of obtaining the trained entity mapping model, as shown in Figure 4 the training includes the following steps:
[0089] Step S401, obtaining training sample data; the training sample data includes a sentence text with multi-dimensional labels; the multi-dimensional labels include intent labels, object labels and enumeration value labels.
[0090] Step S402, select a sentence text from the training sample data to generate a batch of training materials.
[0091] Step S403, input the batch of training materials into the basic large language model to be trained for training, and determine a mapping loss value of the basic large language model to be trained.
[0092] Step S404, determine whether the mapping loss value converges to a preset target value, if yes, end the training to obtain the trained entity mapping model, otherwise, adjust the parameters of the basic large language model to be trained according to the determined mapping loss value and perform re-training.
[0093] In the method of the embodiment, the training sample data includes a sentence text with a multi-dimensional label; the multi-dimensional label includes an intent label, an object label, and an enumeration value label; the sentence text is selected from the training sample data to generate a batch of training materials; the batch of training materials is input into the basic large language model to be trained for training, and a mapping loss value of the basic large language model to be trained is determined; and whether the mapping loss value converges to a preset target value is determined to finally obtain a trained entity mapping model. This process can ensure that the candidate entity information output by the trained entity mapping model contains the identified intent information, which can improve the accuracy of entity recognition by the trained entity mapping model when recognizing entity information from natural language, and more effectively improve the efficiency of entity mapping.
[0094] In some embodiments of the present application, the basic large language model is constructed based on an incremental learning framework; in the model training process, new data in a target domain corresponding to a target domain type is gradually introduced for fine-tuning to improve the semantic understanding ability and generalization ability of the model, and the accuracy of entity recognition of the trained entity mapping model is improved.
[0095] In some embodiments of the present application, the mapping loss value is a cross-entropy loss.
[0096] In an embodiment, in the process of incremental training, the newly added task data D new is mixed with the original task data D old for training, and the optimization target can be exemplified as:
[0097]
[0098] wherein,
[0099] the new loss function the old loss function is a cross-entropy loss (Cross-Entropy Loss);
[0100] is a regularization term, which can be an L2 regularization term.
[0101] The incremental training can limit the overfitting of the model parameters, and a and β are weight coefficients, the value of a is between 0 and 1, if the sample of the new task is small, a larger a (for example: 0.8, 0.9) can be set. If the new task has high similarity with the original task, or the sample size is large, a smaller value (such as 0.1, 0.01) can be set; β is used to control the strength of regularization to prevent the model from overfitting, and can be set to between 0.01 and 0.1.
[0102] In some embodiments of the present application, the training process of obtaining the entity mapping model includes automatically adjusting the learning rate to prevent overfitting and ensure optimal convergence effect.
[0103] In specific implementation, the automatic adjustment of the learning rate can be adaptive learning rate adjustment based on CyclicLR: the core goal of automatically adjusting the learning rate is to periodically adjust the learning rate in training to promote model convergence.
[0104] In an embodiment, a minimum learning rate η min and a maximum learning rate η max are set in advance, and a learning rate cycle T is set, t is the training step number, and the learning rate is updated in each step.
[0105] If t is in the first half of the cycle, the learning rate is gradually increased:
[0106]
[0107] If t is in the second half of the cycle, the learning rate is gradually decreased:
[0108]
[0109] Suppose the base learning rate η is set to 0.001, the minimum learning rate η min is 0.0001, the maximum learning rate η max is 0.01, and the training cycle T is set to 2000 steps. The learning rate is dynamically calculated and updated according to the above two formulas during the training process.
[0110] In step S202, the generated candidate entity, candidate enumeration value and reference enumeration value included in the preset enumeration value library are respectively converted into high-dimensional semantic vectors to obtain multi-dimensional semantic vectors; the multi-dimensional semantic vectors include entity feature vectors, enumeration value feature vectors and contrast feature vectors corresponding to the candidate entity, candidate enumeration value and reference enumeration value respectively.
[0111] Exemplarily, the terminal device 200 converts the generated candidate entity candi_enti, the candidate enumeration value candi_values, and the reference enumeration value Basic_value included in the preset enumeration value library 101 into high-dimensional semantic vectors respectively, to obtain a multi-dimensional semantic vector h_multidim. The multi-dimensional semantic vector h_multidim includes: an entity feature vector h_enti corresponding to the candidate entity candi_enti, an enumeration value feature vector h_values corresponding to the candidate enumeration value candi_values, and a reference feature vector h_refer corresponding to the reference enumeration value Basic_value.
[0112] In some embodiments of the present application, the generated candidate entity, the candidate enumeration value, and the reference enumeration value included in the preset enumeration value library are converted into high-dimensional semantic vectors by embedding a model, and the vectorized high-dimensional semantic vectors are stored in a vector database.
[0113] In some embodiments of the present application, the enumeration value library 101 is a structured set containing all potential enumeration values. For example, the enumeration value library 101 can be represented as:
[0114] V={v1,v2,…,v m},
[0115] Each enumeration value v i in V in the above formula is a text segment, which can represent a specific entity value.
[0116] In step S203, multi-dimensional joint verification is performed based on the high-dimensional semantic vector, to generate multi-dimensional evaluation information.
[0117] The multi-dimensional evaluation information represents the confidence of matching the candidate entity and the candidate enumeration value.
[0118] In specific implementation, the terminal device 200 performs multi-dimensional joint verification based on the high-dimensional semantic vector h_multidim, to generate multi-dimensional evaluation information multi_evaluate. The multi-dimensional evaluation information multi_evaluate represents the confidence of matching the candidate entity and the candidate enumeration value.
[0119] In some embodiments of the present application, in step S203, the process of performing multi-dimensional joint verification based on the high-dimensional semantic vector to generate multi-dimensional evaluation information includes the following steps, as shown in Figure 5 .
[0120] In step S501, similarity calculation is performed on the entity feature vector and the reference feature vector based on a preset rule, to obtain cross similarity values of the candidate entity and each reference enumeration value. The cross similarity values represent the semantic matching degree of the entity and the enumeration value.
[0121] In specific implementations, an interactive similarity calculation is performed between the candidate entity vector and all enumeration value vectors in the enumeration value library to determine the similarity between the candidate entity and the enumeration values in the library. Specifically, a similarity calculation is performed between the entity feature vector and the reference feature vector based on preset rules to obtain cross-similarity values between the candidate entity and each benchmark enumeration value. These cross-similarity values represent the degree of semantic match between the entity and the enumeration value.
[0122] In some embodiments of the present application, similarity calculation is performed based on preset rules, and cosine similarity values may be calculated.
[0123] Exemplarily, the entity feature vector h_enti and the reference feature vector h_refer are similarly calculated based on preset rules to obtain the cross-similarity value Trans_simil between the candidate entity candi_enti and each benchmark enumeration value Basic_value; the cross-similarity value Trans_simil represents the degree of semantic matching between the entity and the enumeration value.
[0124] Step S502: Obtain the matching prediction uncertainty between the candidate entity and the candidate enumeration value according to the entity feature vector and the enumeration value feature vector.
[0125] Exemplarily, according to the entity feature vector h_enti and the enumeration value feature vector h_values, the matching prediction uncertainty match_uncert between the candidate entity candi_enti and the candidate enumeration value candi_values is obtained.
[0126] In some embodiments of the present application, the process of obtaining the prediction uncertainty of the matching between the candidate entity and the candidate enumeration value based on the entity feature vector and the enumeration value feature vector is implemented by a small model.
[0127] The output of the entity mapping model is converted into a high-dimensional semantic vector and then input into the small model. The small model outputs the uncertainty probability of the candidate enumeration value corresponding to the entity, which is expressed as:
[0128] y=[(x,label),u],
[0129] Where: y represents the uncertainty of the final prediction;
[0130] x represents the entity vector;
[0131] label represents an enumeration value vector;
[0132] u represents uncertainty.
[0133] The uncertainty output by the small model is compared with a predefined threshold, and entities less than the threshold are considered to be credible, and entities greater than the threshold need to be refined.
[0134] In an embodiment of the present application, the small model can use decision trees, SVM, Bayesian inference models, etc., and can also use LSTM, Bayesian neural networks, and pre-trained models BERT, XLNet, etc. in deep learning.
[0135] In some embodiments of the present application, in order to fully verify the results of the semantic understanding output entity and the corresponding enumeration value of the large model, a small model is constructed based on the BERT pre-training model to output uncertainty evaluation, and the uncertainty of the model is quantified in combination with Bayesian estimation.
[0136] In step S503, multi-dimensional evaluation information is generated based on the cross-similarity value and the matching prediction uncertainty.
[0137] In a specific implementation, multi-dimensional evaluation information is generated based on the cross-similarity value and the matching prediction uncertainty.
[0138] For example, the terminal device 200 generates multi-dimensional evaluation information multi_evaluate based on the cross-similarity value Trans_simil and the matching prediction uncertainty match_unc.
[0139] The method of this embodiment performs similarity calculation on the entity feature vector and the reference feature vector based on a preset rule to obtain the cross-similarity value of the candidate entity and each reference enumeration value; the cross-similarity value represents the semantic matching degree of the entity and the enumeration value; according to the entity feature vector and the enumeration value feature vector, the matching prediction uncertainty of the candidate entity and the candidate enumeration value is obtained; based on the cross-similarity value and the matching prediction uncertainty, multi-dimensional evaluation information is generated, which can determine the cross-similarity value between the reference feature vector corresponding to the reference enumeration value included in the enumeration value library and the entity feature vector, and determine the matching prediction uncertainty between the entity feature vector and the enumeration value feature vector, provide an interactive similarity retrieval and uncertainty evaluation combined multi-dimensional evaluation mechanism, through the enumeration value library, dynamic matching analysis can be realized, the process of entity mapping is optimized, and the efficiency of entity mapping is improved.
[0140] In some embodiments of the present application, the intent information includes an intent confidence corresponding to a target intent type; the target intent type is an intent type corresponding to the input sentence information recognized by the semantic understanding module; in step S503, the process of generating multi-dimensional evaluation information based on the cross-similarity value and the matching prediction uncertainty, as shown in Figure 6 includes the following steps:
[0141] In step S601, the cross-similarity value and the matching prediction uncertainty are aggregated based on a preset comprehensive scoring rule to obtain a prediction comprehensive score.
[0142] In implementation, the cross-similarity value obtained through interactive similarity calculation and the matching prediction uncertainty are aggregated to obtain the prediction comprehensive score.
[0143] In some embodiments of the present application, the matching prediction uncertainty can be obtained based on a small model. Specifically, the small model is used to verify the entity feature vector and the enumeration value feature vector to obtain the matching prediction uncertainty of the candidate entity and the candidate enumeration value.
[0144] In an embodiment of the present application, in order to comprehensively consider the aggregation of interactive similarity retrieval and small model posterior results, the cross-similarity value and the matching prediction uncertainty are aggregated based on a preset comprehensive scoring rule, which can be represented by the following formula:
[0145]
[0146] wherein, S(e i ,v j ) is the prediction comprehensive score, representing the fusion of the large model semantic similarity and the small model candidate value matching prediction accuracy;
[0147] α and β are constants between 0 and 1, and the sum of the two is 1;
[0148] is the cross-similarity value;
[0149] Var(P(y|x i )) is the matching prediction uncertainty.
[0150] In step S602, multi-dimensional evaluation information is obtained according to the prediction comprehensive score and the intent confidence.
[0151] In implementation, on the basis of the obtained prediction comprehensive score, the intent confidence output by the large model is fused to further expand the evaluation dimension and verify the correctness of the large model in identifying entities and mapping in multiple dimensions.
[0152] In an embodiment of the present application, on the basis of the obtained prediction comprehensive score S(e i ,v j ), the intent confidence information of the entity mapping model is further fused to calculate the final confidence of the candidate enumeration value as the multi-dimensional evaluation information. The calculation formula of the final confidence is as follows:
[0153]
[0154] wherein,
[0155] Conf(e i ,v j ) is the final confidence;
[0156] e i is an entity;
[0157] v j is an enumeration value corresponding to the entity;
[0158] V is an enumeration value library;
[0159] C Intent (e i ,v j ) is the intent confidence information when the entity is e i and the enumeration value corresponding to the entity is v j ;
[0160] S(e i ,v j ) is the predicted comprehensive score of the entity e i and the enumeration value v j ;
[0161] S(e i ,v k ) is the predicted comprehensive score of the entity e i and the enumeration value v k ;
[0162] C Intent (e i ,v k ) is the intent confidence information when the entity is e i and the enumeration value corresponding to the entity is v k .
[0163] The method of the embodiment, the intent information includes intent confidence corresponding to the target intent type; the target intent type is an intent type corresponding to input sentence information recognized by the semantic understanding module; based on the cross similarity value and the matching prediction uncertainty, multi-dimensional evaluation information is generated, specifically: based on a preset comprehensive score rule, the cross similarity value and the matching prediction uncertainty are aggregated to obtain a predicted comprehensive score; according to the predicted comprehensive score and the intent confidence, multi-dimensional evaluation information is obtained, realizing the generation of multi-dimensional evaluation information based on the cross similarity value, the matching prediction uncertainty and the intent confidence, providing a multi-dimensional evaluation mechanism that fuses intent confidence, which can more accurately and comprehensively evaluate the reliability and stability of the matching of candidate entities and candidate enumeration values, and improve the efficiency of entity mapping.
[0164] In some embodiments of the present application, in step S602, the process of obtaining multidimensional evaluation information based on the predicted comprehensive score and the intention confidence is specifically as follows: the predicted comprehensive score and the intention confidence are constructed into a multidimensional information pair to obtain multidimensional evaluation information; the multidimensional evaluation information includes first evaluation meta-information and second evaluation meta-information; the first evaluation meta-information is obtained based on the predicted comprehensive score; the second evaluation meta-information is obtained based on the intention confidence.
[0165] The method of this embodiment constructs the predicted comprehensive score and intention confidence into a multi-dimensional information pair to obtain multi-dimensional evaluation information; the multi-dimensional evaluation information includes first evaluation meta-information and second evaluation meta-information; the first evaluation meta-information is obtained based on the predicted comprehensive score; the second evaluation meta-information is obtained based on the intention confidence. Based on the construction of the multi-dimensional information pair, it can reduce the computational complexity of the multi-dimensional evaluation, save the time of entity mapping, and further improve the efficiency of entity mapping.
[0166] Step S204: Based on the candidate entity information and the generated multi-dimensional evaluation information, the target entity and target enumeration value corresponding to the statement information to be processed are output.
[0167] In some embodiments of the present application, based on the generated multi-dimensional evaluation information, a candidate entity that meets the conditions and a candidate enumeration value that matches the selected candidate entity are selected from the candidate entity information as the target entity and target enumeration value corresponding to the statement information to be processed, respectively.
[0168] Exemplarily, the terminal device 200 outputs the target entity Targ_enti and the target enumeration value Targ_value corresponding to the sentence information to be processed Input_senten based on the candidate entity information candi_entity_info and the generated multi-dimensional evaluation information multi_evaluate.
[0169] In some embodiments of the present application, the evaluation threshold γ is pre-set, and only when the final confidence Conf(e i ,v j )≥γ, the entity is judged to match the current enumeration value.
[0170] In some other embodiments of the present application, the evaluation thresholds γ and τ are preset, and only when the final confidence Conf(e i ,v j )≥γ and the predicted comprehensive score S(e i ,v j )≥τ, the entity is judged to match the current enumeration value.
[0171] The present application embodiment provides another entity mapping method, such as Figure 7 As shown, the following steps are included:
[0172] In step S701, the acquired user input to-be-processed sentence information is input into the trained entity mapping model to obtain candidate entity information corresponding to the to-be-processed sentence information; the candidate entity information includes intent information, a candidate entity, and a candidate enumeration value; the intent information includes an intent confidence corresponding to a target intent type; the target intent type is an intent type corresponding to the input sentence information recognized by the semantic understanding module.
[0173] The entity mapping model is obtained by training a basic large language model using training sample data; the training sample data includes sentence texts with multi-dimensional labels; the multi-dimensional labels include intent labels, object labels, and enumeration value labels.
[0174] In step S702, the generated candidate entity, candidate enumeration value, and reference enumeration value included in the preset enumeration value library are respectively converted into high-dimensional semantic vectors to obtain multi-dimensional semantic vectors; the multi-dimensional semantic vectors include entity feature vectors, enumeration value feature vectors, and contrast feature vectors corresponding to the candidate entity, candidate enumeration value, and reference enumeration value, respectively.
[0175] In step S703, the entity feature vectors and the contrast feature vectors are subjected to similarity calculation based on a preset rule to obtain cross similarity values of the candidate entity and each reference enumeration value; the cross similarity values represent the semantic matching degree of the entity and the enumeration value.
[0176] In step S704, the matching prediction uncertainty of the candidate entity and the candidate enumeration value is obtained according to the entity feature vectors and the enumeration value feature vectors.
[0177] In step S705, the cross similarity values and the matching prediction uncertainty are aggregated and scored based on a preset comprehensive scoring rule to obtain a prediction comprehensive score.
[0178] In step S706, multi-dimensional evaluation information is obtained according to the prediction comprehensive score and the intent confidence.
[0179] In specific implementation, the multi-dimensional evaluation information is obtained according to the prediction comprehensive score and the intent confidence, specifically, the final confidence of the candidate enumeration value is calculated by further fusing the intent confidence information of the entity mapping model on the basis of the obtained prediction comprehensive score, as the multi-dimensional evaluation information.
[0180] In step S707, a target entity and a target enumeration value corresponding to the to-be-processed sentence information are output based on the candidate entity information and the generated multi-dimensional evaluation information.
[0181] The method of the embodiment combines the fine-tuned semantic understanding ability of the large model with the posterior results of the local small model and the results of the similarity retrieval to form a new entity mapping mechanism, so as to improve the accuracy and mapping ability of entity recognition, enable the information input by the user to be effectively matched to the preset enumerated value candidate set, and effectively improve the efficiency of entity mapping.
[0182] The entity mapping method provided in the embodiments of the present application processes the to-be-processed sentence information based on the trained entity mapping model, obtains candidate entity information, and obtains multi-dimensional evaluation information through multi-dimensional joint verification, so as to realize accurate output of target entities and target enumerated values based on large model semantics and multi-dimensional joint verification. In this process, the candidate entity information output by the trained entity mapping model contains identified intent information, and the multi-dimensional evaluation information generated through multi-dimensional joint verification is used for confidence evaluation of matching, so that the accuracy of entity recognition and the reliability of entity and enumerated value matching can be improved when identifying entity information from natural language, and the efficiency of entity mapping can be improved.
[0183] Based on the same inventive concept, an entity mapping device is also provided in the embodiments of the present application. Since the entity mapping device is a device corresponding to the entity mapping method provided in the embodiments of the present application, and the principle of solving problems of the entity mapping device is similar to that of the method, the implementation of the entity mapping device can be referred to the implementation of the above method, and repeated parts will not be described herein.
[0184] Figure 8 A structural schematic diagram of an entity mapping device provided in the embodiments of the present application is shown, as shown in Figure 8 The entity mapping device includes a model docking unit 801, a vector conversion unit 802, a multi-dimensional evaluation unit 803, and an entity optimization unit 804.
[0185] The model docking unit 801 is configured to input the obtained to-be-processed sentence information input by the user into the trained entity mapping model to obtain candidate entity information corresponding to the to-be-processed sentence information. The candidate entity information includes intent information, candidate entities, and candidate enumerated values. The entity mapping model is obtained by training a basic large language model using training sample data. The training sample data includes sentence texts with multi-dimensional labels. The multi-dimensional labels include intent labels, object labels, and enumerated value labels.
[0186] The vector conversion unit 802 is configured to convert the generated candidate entities, candidate enumerated values, and reference enumerated values included in the preset enumerated value library into high-dimensional semantic vectors respectively to obtain multi-dimensional semantic vectors. The multi-dimensional semantic vectors include entity feature vectors, enumerated value feature vectors, and contrast feature vectors corresponding to the candidate entities, candidate enumerated values, and reference enumerated values respectively.
[0187] The multi-dimensional evaluation unit 803 is configured to perform multi-dimensional joint verification based on the high-dimensional semantic vector, and generate multi-dimensional evaluation information; and the multi-dimensional evaluation information represents a confidence degree of matching between the candidate entity and the candidate enumeration value.
[0188] The entity optimization unit 804 is configured to output a target entity and a target enumeration value corresponding to the to-be-processed sentence information based on the candidate entity information and the generated multi-dimensional evaluation information.
[0189] In a possible implementation, the training sample data further includes a prompt instruction sample text; the prompt instruction sample text corresponds to a same target domain type in the preset domain types; and the prompt instruction sample text is prompt instruction information for the large language model.
[0190] In a possible implementation, as shown in Figure 9 The device further includes a model training unit 901; and the model training unit 901 is configured to:
[0191] obtain training sample data; the training sample data includes sentence texts with multi-dimensional labels; and the multi-dimensional labels include an intent label, an object label, and an enumeration value label;
[0192] select the sentence texts from the training sample data, and generate batch training materials;
[0193] input the batch training materials into a to-be-trained basic large language model to perform training, and determine a mapping loss value of the to-be-trained basic large language model;
[0194] determine whether the mapping loss value converges to a preset target value; if yes, end the training to obtain a trained entity mapping model; or if not, adjust parameters of the to-be-trained basic large language model according to the determined mapping loss value, and perform retraining.
[0195] In a possible implementation, the multi-dimensional evaluation unit 803 is specifically configured to:
[0196] perform similarity calculation on the entity feature vector and the reference feature vector based on a preset rule, to obtain cross similarity values of the candidate entity and each reference enumeration value; and the cross similarity values represent a semantic matching degree between the entity and the enumeration value;
[0197] obtain a matching prediction uncertainty of the candidate entity and the candidate enumeration value according to the entity feature vector and the enumeration value feature vector;
[0198] generate multi-dimensional evaluation information based on the cross similarity values and the matching prediction uncertainty.
[0199] In a possible implementation, the intention information includes an intention confidence corresponding to a target intention type, the target intention type being an intention type corresponding to the input sentence information recognized by the semantic understanding module, and the multi-dimensional evaluation unit 803 is specifically configured to:
[0200] Based on the preset comprehensive scoring rule, the cross similarity value and the matching prediction uncertainty are aggregated to obtain a prediction comprehensive score.
[0201] According to the prediction comprehensive score and the intention confidence, multi-dimensional evaluation information is obtained.
[0202] In a possible implementation, the multi-dimensional evaluation unit 803 is specifically configured to:
[0203] The prediction comprehensive score and the intention confidence are constructed into a multi-dimensional information pair to obtain multi-dimensional evaluation information, the multi-dimensional evaluation information including first evaluation element information and second evaluation element information, the first evaluation element information being obtained based on the prediction comprehensive score, and the second evaluation element information being obtained based on the intention confidence.
[0204] Based on the same inventive concept as the method embodiments, an electronic device is also provided in the embodiments of the present application. The electronic device can be used for entity mapping. In an embodiment, the electronic device is a terminal device, for example, a terminal device in Figure 1 . In this embodiment, the structure of the electronic device can be as shown in Figure 10 , and the electronic device includes a memory 1001, a communication module 1003, and one or more processors 1002.
[0205] The memory 1001 is configured to store a computer program executed by the processor 1002. The memory 1001 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system and programs required for running instant messaging functions, etc.; and the data storage area can store various instant messaging information and operation instruction sets, etc.
[0206] The memory 1001 can be a volatile memory such as a random-access memory (RAM), and the memory 1001 can also be a non-volatile memory such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), or the memory 101 can be any other medium capable of carrying or storing desired program codes in the form of instructions or data structures and capable of being accessed by a computer, but is not limited thereto. The memory 1001 can be a combination of the above-mentioned memories.
[0207] The processor 1002 may include one or more central processing units (CPUs) or digital processing units, etc. The processor 1002 is configured to implement the above entity mapping method when calling the computer program stored in the memory 1001 .
[0208] The communication module 1003 is used to communicate with terminal devices and other servers.
[0209] The specific connection medium between the memory 1001, the communication module 1003 and the processor 1002 is not limited in the embodiment of the present application. Figure 10 In the embodiment, the memory 1001 and the processor 1002 are connected via a bus 1004. The bus 1004 is connected to the processor 1002 via a bus 1004. Figure 10 The connections between the other components are shown in bold lines, which are only for illustration and are not intended to be limiting. The bus 1004 can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, Figure 10 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0210] According to one aspect of the present application, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. The processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions so that the computer device performs the entity mapping method in the above embodiment. The program product 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 be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) 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.
[0211] The above is only a specific implementation method of the present application, but the scope of protection of the present application is not limited thereto. Any technician familiar with this technical field can easily think of changes or replacements within the technical scope disclosed in this application, which should be covered by the scope of protection of the present application.
Claims
1. An entity mapping method, characterized in that: The method comprises: Inputting the sentence information to be processed obtained from the user input into the trained entity mapping model to obtain candidate entity information corresponding to the sentence information to be processed; wherein the candidate entity information includes intent information, candidate entities, and candidate enumeration values; the entity mapping model is obtained by training a basic large language model using training sample data; the training sample data includes sentence text with multidimensional labels; the multidimensional labels include intent labels, object labels, and enumeration value labels; The generated candidate entity, the candidate enumeration value, and the reference enumeration value included in the preset enumeration value library are respectively converted into high-dimensional semantic vectors to obtain a multi-dimensional semantic vector; the multi-dimensional semantic vector includes an entity feature vector, an enumeration value feature vector, and a comparison feature vector corresponding to the candidate entity, the candidate enumeration value, and the reference enumeration value, respectively; Performing multi-dimensional joint verification based on the high-dimensional semantic vector to generate multi-dimensional evaluation information; the multi-dimensional evaluation information represents the confidence level of the match between the candidate entity and the candidate enumeration value; Based on the candidate entity information and the generated multi-dimensional evaluation information, the target entity and target enumeration value corresponding to the statement information to be processed are output.
2. The method according to claim 1, characterized in that The training sample data also includes a guide instruction sample text; the guide instruction sample text and the sentence text correspond to the same target domain type in the preset domain types; the guide instruction sample text is prompt guide instruction information for a large language model.
3. The method according to claim 1, characterized in that In the process of obtaining the trained entity mapping model, the training includes the following steps: Obtaining training sample data; the training sample data includes sentence text with multi-dimensional labels; the multi-dimensional labels include intent labels, object labels, and enumeration value labels; Selecting sentence texts from the training sample data to generate batch training materials; Inputting the batch training documents into the basic large language model to be trained for training, and determining the mapping loss value of the basic large language model to be trained; Determine whether the mapping loss value converges to a preset target value. If so, end the training to obtain the trained entity mapping model. Otherwise, adjust the parameters of the basic large language model to be trained according to the determined mapping loss value and train again.
4. The method according to claim 1, wherein The multi-dimensional joint verification based on the high-dimensional semantic vector to generate multi-dimensional evaluation information includes: Calculating similarity between the entity feature vector and the reference feature vector based on a preset rule to obtain a cross-similarity value between the candidate entity and each of the benchmark enumeration values; the cross-similarity value represents the degree of semantic matching between the entity and the enumeration value; Obtaining a matching prediction uncertainty between the candidate entity and the candidate enumeration value according to the entity feature vector and the enumeration value feature vector; The multi-dimensional evaluation information is generated based on the cross-similarity value and the matching prediction uncertainty.
5. The method according to claim 4, characterized in that The intention information includes the intention confidence corresponding to the target intention type; the target intention type is the intention type corresponding to the input sentence information identified by the semantic understanding module; The generating the multi-dimensional evaluation information based on the cross-similarity value and the matching prediction uncertainty includes: Based on a preset comprehensive scoring rule, the cross-similarity value and the match prediction uncertainty are aggregated and scored to obtain a prediction comprehensive score; The multi-dimensional evaluation information is obtained based on the predicted comprehensive score and the intention confidence.
6. The method according to claim 5, characterized in that The multi-dimensional evaluation information is obtained according to the predicted comprehensive score and the intention confidence, including: The predicted comprehensive score and the intention confidence are constructed into a multi-dimensional information pair to obtain the multi-dimensional evaluation information; the multi-dimensional evaluation information includes first evaluation meta-information and second evaluation meta-information; the first evaluation meta-information is obtained based on the predicted comprehensive score; the second evaluation meta-information is obtained based on the intention confidence.
7. An entity mapping device, characterized in that: The device comprises: The model docking unit is configured to input the sentence information to be processed obtained from the user input into the trained entity mapping model to obtain candidate entity information corresponding to the sentence information to be processed; wherein the candidate entity information includes intent information, candidate entities, and candidate enumeration values; the entity mapping model is obtained by training a basic large language model using training sample data; the training sample data includes sentence text with multi-dimensional labels; the multi-dimensional labels include intent labels, object labels, and enumeration value labels; a vector conversion unit, configured to convert the generated candidate entity, the candidate enumeration value, and the reference enumeration value included in the preset enumeration value library into high-dimensional semantic vectors, thereby obtaining a multidimensional semantic vector; the multidimensional semantic vector includes an entity feature vector, an enumeration value feature vector, and a comparison feature vector corresponding to the candidate entity, the candidate enumeration value, and the reference enumeration value, respectively; A multi-dimensional evaluation unit, configured to perform a multi-dimensional joint verification based on the high-dimensional semantic vector to generate multi-dimensional evaluation information; the multi-dimensional evaluation information represents the confidence level of the match between the candidate entity and the candidate enumeration value; The entity optimization unit is used to output the target entity and target enumeration value corresponding to the statement information to be processed based on the candidate entity information and the generated multi-dimensional evaluation information.
8. The device according to claim 7, characterized in that The device further includes a model training unit; the model training unit is configured to: Obtaining training sample data; the training sample data includes sentence text with multi-dimensional labels; the multi-dimensional labels include intent labels, object labels, and enumeration value labels; Selecting sentence texts from the training sample data to generate batch training materials; Inputting the batch training documents into the basic large language model to be trained for training, and determining the mapping loss value of the basic large language model to be trained; Determine whether the mapping loss value converges to a preset target value. If so, end the training to obtain the trained entity mapping model. Otherwise, adjust the parameters of the basic large language model to be trained according to the determined mapping loss value and train again.
9. A computer-readable storage medium storing a computer program, wherein: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
10. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the computer program is executed by the processor, the method according to any one of claims 1 to 6 is implemented.