Cross-domain few-shot named entity recognition method and device based on coupled gaussian distribution and wasserstein metric

By coupling Gaussian distribution and Wasserstein metric, a cross-domain few-sample named entity recognition method is proposed, which solves the problem of unstable variance estimation in cross-domain scenarios and achieves efficient and accurate named entity recognition, applicable to sensitive fields such as healthcare and finance.

CN122366435APending Publication Date: 2026-07-10ANHUI UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ANHUI UNIV
Filing Date
2026-04-20
Publication Date
2026-07-10

Smart Images

  • Figure CN122366435A_ABST
    Figure CN122366435A_ABST
Patent Text Reader

Abstract

The application relates to a cross-domain few-shot named entity recognition method based on coupling of Gaussian distribution and Wasserstein metric, which comprises the following steps: obtaining source domain text data and target domain text data to be processed, and respectively performing data preprocessing; obtaining deep hidden layer state features of each word element; generating a multivariate Gaussian distribution representation with position perception capability; constructing a class Gaussian prototype representing the distribution features of each entity category; and finally outputting the predicted entity category of the text sequence to be measured. By establishing the generation condition of the covariance on the basis of the semantic mean position, the application realizes position-perception uncertainty modeling, so that entities close to the fuzzy decision boundary naturally obtain greater variance, accurately cover the effective semantic radius, and even in the case that the feature distribution of the source domain and the target domain is not overlapped, the application can still provide smooth geometric transmission cost, ensures the stability of optimization, and greatly improves the accuracy of cross-domain named entity recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of natural language processing and deep learning technology, and in particular to a method and device for cross-domain few-shot named entity recognition based on coupled Gaussian distribution and Wasserstein metric. Background Technology

[0002] Named entity recognition (NER) is a fundamental task in natural language processing. In vertical industries such as healthcare and finance, acquiring large amounts of high-quality labeled data is extremely costly, making few-shot named entity recognition a research hotspot. While existing Large Language Models (LLMs) perform well in few-shot scenarios, their high computational cost and privacy concerns make them difficult to deploy in sensitive vertical industries.

[0003] To achieve efficient and privacy-preserving cross-domain adaptive learning, existing methods are mostly based on metric learning paradigms. However, these methods typically model entities as deterministic "points" in Euclidean space, assuming all categories have equal intra-class variance. This fails to capture the semantic ambiguity and uncertainty of entity boundaries in cross-domain scenarios. While some recent methods have introduced Gaussian distributions to represent uncertainty, they suffer from two key drawbacks: first, independent generation bias, i.e., independently generating means and variances, ignoring the spatial dependence of uncertainty (i.e., entities closer to the decision boundary naturally have higher variances); second, training-inference discrepancy, because variance estimation is unstable with few samples, existing methods are forced to discard the variance head and degenerate into point vector search during inference, causing the learned "uncertainty knowledge" to become invalid.

[0004] Therefore, a cross-domain few-sample named entity recognition method is needed that can effectively combine distribution features and solve estimation noise. Summary of the Invention

[0005] To address the problem of unstable variance estimation during the few-sample adaptation stage, the primary objective of this invention is to provide a cross-domain few-sample named entity recognition method based on coupled Gaussian distribution and Wasserstein metric, which achieves location-aware uncertainty modeling, allowing entities closer to the fuzzy decision boundary to naturally acquire larger variances and accurately cover their effective semantic radius.

[0006] To achieve the above objectives, the present invention adopts the following technical solution: a cross-domain few-shot named entity recognition method based on coupled Gaussian distribution and Wasserstein metric, the method comprising the following sequential steps:

[0007] (1) Obtain the source domain text data and target domain text data to be processed, and perform data preprocessing respectively to obtain the corresponding input word sequence; construct the input word sequence corresponding to the source domain as a training set; construct the input word sequence corresponding to the target domain as a few-sample task data through fragment sampling, and further divide the few-sample task data into a support set and a test set; the source domain refers to a dataset with a large number of labeled texts and known entity categories; the target domain refers to a dataset with a data distribution different from the source domain and containing new and unseen entity categories;

[0008] (2) A pre-trained multi-layer bidirectional backbone network is adopted. The pre-trained multi-layer bidirectional backbone network adopts the BERT-base-uncased model. The training set, support set and test set are input into the BERT-base-uncased model for feature extraction to obtain the deep hidden layer state features of each word in the training set, support set and test set.

[0009] (3) Constructing a coupled Gaussian embedding module: Projecting the state features of the deep hidden layer into a semantic mean vector, and concatenating the semantic mean vector with the state features of the deep hidden layer into a covariance matrix, generating a multivariate Gaussian distribution representation with position awareness for each word;

[0010] (4) Constructing a support set prototype aggregation module: In the scenario of few samples in the target domain, the Gaussian distribution representation of the support set samples with entity category labels is selected from the multivariate Gaussian distribution representation through the support set prototype aggregation module, and aggregation calculation is performed to construct a Gaussian prototype representing the distribution characteristics of each entity category.

[0011] (5) The pre-trained multi-layer bidirectional backbone network, coupled Gaussian embedding module and support set prototype aggregation module together form a cross-domain few-sample named entity recognition model; calculate the 2-Wasserstein distance between the Gaussian distribution of the test set lexical and the Gaussian prototype of each entity category, introduce an asymmetric Wasserstein scaling strategy to adjust the structural difference penalty, and calculate the cross-entropy loss for model training, and finally output the predicted entity category of the text sequence to be tested.

[0012] In step (1), the data preprocessing specifically refers to: using a word segmenter to segment the input source domain and target domain text, adding a [CLS] marker at the beginning of the sequence and a [SEP] marker at the end of the sequence, and truncating or padding to the set maximum sequence length to generate an input word sequence; the maximum sequence length is set to 128 words; the construction of few-shot task data based on fragment sampling specifically refers to: using the N-way K-shot sampling method to construct a test task from the target domain, wherein the number of entity categories is set to 5, and the number of single-category support set samples is set to 1 or 5.

[0013] Step (2) specifically includes the following steps:

[0014] (2a) After converting the input word sequence into word embedding vectors, the input is fed into the backbone network of the BERT-base-uncased model. The backbone network captures the global contextual dependencies between words through its internal multi-head self-attention mechanism.

[0015] (2b) After multi-layer network encoding, output the hidden layer state feature sequence of the last layer. = ,in, For the first each word element The state characteristics of the deep hidden layer.

[0016] Step (3) specifically includes the following steps:

[0017] (3a) Given a deep hidden layer state feature As input, the semantic mean vector of the features is first calculated through a linear projection layer. :

[0018] ;

[0019] (3b) The semantic mean vector Features of deep hidden layer states The features are concatenated along the channel dimension and used as input to generate an intermediate feature map of the covariance matrix. To achieve uncertainty calibration in location awareness:

[0020] ;

[0021] (3c) Process intermediate feature maps using the Softplus activation function To ensure that the final generated covariance matrix Possesses positive definiteness:

[0022] ;

[0023] in, and All are learnable weight parameter matrices. and All are bias terms. For splicing operations, For diagonalization operation, To prevent overflow in numerical calculations;

[0024] (3d) Based on semantic mean vector Covariance Matrix For each lexical unit, a position-aware multivariate Gaussian distribution representation is generated. This means that each word is modeled as a probability distribution model in the feature space.

[0025] Step (4) specifically includes the following steps:

[0026] (4a) Extracting similar support set samples: Under the setting of a few samples in the target domain, extract samples belonging to the target entity category. of The support set consists of samples. ;

[0027] (4b) Computational Gaussian prototype: based on sets The Gaussian distribution of each sample is used to calculate the entity category by taking the statistical mean. Gaussian prototype distribution ;

[0028] (4c) Calculate the Gaussian prototype distribution mean vector :

[0029] ;

[0030] (4d) Calculate the Gaussian prototype distribution covariance matrix :

[0031] ;

[0032] in, For set The Middle The mean vector of each support set lexical unit. For set The Middle The covariance matrix of each supporting set of lexical units; For variable index, To support the total number of samples in the set.

[0033] Step (5) specifically includes the following steps:

[0034] (5a) Calculate the Gaussian distribution of the lexical units in the test set. Gaussian prototype distribution of each entity category The 2-Wasserstein distance between them is used to introduce an asymmetric Wasserstein scaling strategy to adjust the covariance-based structural difference penalty, thus forming the asymmetric Wasserstein distance. :

[0035] ;

[0036] in, Let be the mean vector of the test set distribution. Let be the mean vector of a Gaussian-like prototype distribution. The covariance matrix of the test set distribution. The covariance matrix is ​​a Gaussian-like prototype distribution. This is the operation of squaring the Euclidean distance. For Frobenius norm squaring operation; This is the scaling factor; ; ;

[0037] (5b) Perform a Softmax operation on the negative values ​​of the asymmetric Wasserstein distance to calculate the entity category to which the words in the test set to be predicted belong. Predicted probability :

[0038] ;

[0039] in, A predefined set of entity categories; For a predefined set of entity categories The traversal index variable in the text;

[0040] (5c) Based on real category labels and predicted probability Construct the cross-entropy loss function The network parameters of the cross-domain few-shot named entity recognition model are updated by backpropagation to obtain the updated model:

[0041] ;

[0042] (5d) The updated model is used to infer the text sequence to be tested, and the category with the highest probability value is selected as the predicted entity category of the model output.

[0043] Another object of the present invention is to provide an electronic device comprising:

[0044] Processor; and

[0045] The memory stores computer program instructions that, when executed by the processor, cause the processor to perform the cross-domain few-sample named entity recognition method based on coupled Gaussian distribution and Wasserstein metric as described above.

[0046] The present invention also provides a computer-readable storage medium having stored thereon computer program instructions, which, when executed by a processor, cause the processor to perform the cross-domain few-sample named entity recognition method based on coupled Gaussian distribution and Wasserstein metric as described above.

[0047] As can be seen from the above technical solution, the beneficial effects of the present invention are as follows: First, the present invention extracts features from source and target domain texts, constructs a Gaussian distribution representation of word units generated by a coupled Gaussian embedding module, aggregates Gaussian prototypes in the target domain, and finally introduces asymmetric Wasserstein distance calculation for prediction and training, forming a complete end-to-end cross-domain estimation scheme; Second, the present invention overcomes the independent generation bias in existing distribution learning by establishing the covariance generation condition on the semantic mean position, realizing position-aware uncertainty modeling, so that entities closer to the fuzzy decision boundary naturally obtain a larger variance, accurately covering their effective semantics. Third, this invention uses 2-Wasserstein distance as the underlying metric, which mathematically decouples the semantic alignment brought by the mean from the structural differences brought by the variance. Even when the feature distributions of the source and target domains do not overlap, it can still provide smooth geometric transmission costs, ensuring the stability of the optimization. Fourth, this invention proposes an asymmetric Wasserstein scaling strategy, which applies a high covariance penalty during the training phase to shape compact clusters, and acts as a low-pass filter during the inference phase to suppress variance estimation noise caused by a small training set. This successfully reconciles the conflict between discriminability and robustness, and significantly improves the accuracy of cross-domain named entity recognition. Attached Figure Description

[0048] Figure 1 This is a flowchart of the method of the present invention. Detailed Implementation

[0049] like Figure 1 As shown, a cross-domain few-shot named entity recognition method based on coupled Gaussian distribution and Wasserstein metric is presented. The method includes the following sequential steps:

[0050] (1) Obtain the source domain text data and target domain text data to be processed, and perform data preprocessing respectively to obtain the corresponding input word sequence; construct the input word sequence corresponding to the source domain as a training set; construct the input word sequence corresponding to the target domain as a few-sample task data through fragment sampling, and further divide the few-sample task data into a support set and a test set; the source domain refers to a dataset with a large number of labeled texts and known entity categories; the target domain refers to a dataset with a data distribution different from the source domain and containing new and unseen entity categories;

[0051] (2) A pre-trained multi-layer bidirectional backbone network is adopted. The pre-trained multi-layer bidirectional backbone network adopts the BERT-base-uncased model. The training set, support set and test set are input into the BERT-base-uncased model for feature extraction to obtain the deep hidden layer state features of each word in the training set, support set and test set.

[0052] (3) Constructing a coupled Gaussian embedding module: Projecting the state features of the deep hidden layer into a semantic mean vector, and concatenating the semantic mean vector with the state features of the deep hidden layer into a covariance matrix, generating a multivariate Gaussian distribution representation with position awareness for each word;

[0053] (4) Constructing a support set prototype aggregation module: In the scenario of few samples in the target domain, the Gaussian distribution representation of the support set samples with entity category labels is selected from the multivariate Gaussian distribution representation through the support set prototype aggregation module, and aggregation calculation is performed to construct a Gaussian prototype representing the distribution characteristics of each entity category.

[0054] (5) The pre-trained multi-layer bidirectional backbone network, coupled Gaussian embedding module and support set prototype aggregation module together form a cross-domain few-sample named entity recognition model; calculate the 2-Wasserstein distance between the Gaussian distribution of the test set lexical and the Gaussian prototype of each entity category, introduce an asymmetric Wasserstein scaling strategy to adjust the structural difference penalty, and calculate the cross-entropy loss for model training, and finally output the predicted entity category of the text sequence to be tested.

[0055] In step (1), the data preprocessing specifically refers to: using a word segmenter to segment the input source domain and target domain text, adding a [CLS] marker at the beginning of the sequence and a [SEP] marker at the end of the sequence, and truncating or padding to the set maximum sequence length to generate an input word sequence; the maximum sequence length is set to 128 words; the construction of few-shot task data based on fragment sampling specifically refers to: using the N-way K-shot sampling method to construct a test task from the target domain, wherein the number of entity categories is set to 5, and the number of single-category support set samples is set to 1 or 5.

[0056] Step (2) specifically includes the following steps:

[0057] (2a) After converting the input word sequence into word embedding vectors, the input is fed into the backbone network of the BERT-base-uncased model. The backbone network captures the global contextual dependencies between words through its internal multi-head self-attention mechanism.

[0058] (2b) After multi-layer network encoding, output the hidden layer state feature sequence of the last layer. = ,in, For the first each word element The state characteristics of the deep hidden layer.

[0059] Step (3) specifically includes the following steps:

[0060] (3a) Given a deep hidden layer state feature As input, the semantic mean vector of the features is first calculated through a linear projection layer. :

[0061] ;

[0062] (3b) The semantic mean vector Features of deep hidden layer states The features are concatenated along the channel dimension and used as input to generate an intermediate feature map of the covariance matrix. To achieve uncertainty calibration in location awareness:

[0063] ;

[0064] (3c) Process intermediate feature maps using the Softplus activation function To ensure that the final generated covariance matrix Possesses positive definiteness:

[0065] ;

[0066] in, and All are learnable weight parameter matrices. and All are bias terms. For splicing operations, For diagonalization operation, To prevent overflow in numerical calculations;

[0067] (3d) Based on semantic mean vector Covariance Matrix For each lexical unit, a position-aware multivariate Gaussian distribution representation is generated. This means that each word is modeled as a probability distribution model in the feature space.

[0068] Step (4) specifically includes the following steps:

[0069] (4a) Extracting similar support set samples: Under the setting of a few samples in the target domain, extract samples belonging to the target entity category. of The support set consists of samples. ;

[0070] (4b) Computational Gaussian prototype: based on sets The Gaussian distribution of each sample is used to calculate the entity category by taking the statistical mean. Gaussian prototype distribution ;

[0071] (4c) Calculate the Gaussian prototype distribution mean vector :

[0072] ;

[0073] (4d) Calculate the Gaussian prototype distribution covariance matrix :

[0074] ;

[0075] in, For set The Middle The mean vector of each support set lexical unit. For set The Middle The covariance matrix of each supporting set of lexical units; For variable index, To support the total number of samples in the set.

[0076] Step (5) specifically includes the following steps:

[0077] (5a) Calculate the Gaussian distribution of the lexical units in the test set. Gaussian prototype distribution of each entity category The 2-Wasserstein distance between them is used to introduce an asymmetric Wasserstein scaling strategy to adjust the covariance-based structural difference penalty, thus forming the asymmetric Wasserstein distance. :

[0078] ;

[0079] in, Let be the mean vector of the test set distribution. Let be the mean vector of a Gaussian-like prototype distribution. The covariance matrix of the test set distribution. The covariance matrix is ​​a Gaussian-like prototype distribution. This is the operation of squaring the Euclidean distance. For Frobenius norm squaring operation; This is the scaling factor; ; ;

[0080] The scaling factor Dynamic asymmetric settings are adopted according to the different operational stages of the model:

[0081] First, in the source domain pre-training phase, Set a higher first threshold to penalize structural differences and force the model to learn compact clustering features;

[0082] Second, in the small-sample fine-tuning stage of the target domain, A second threshold, set to a moderate value, is used as a structural constraint for the feature representation;

[0083] Third, in the target domain reasoning and evaluation stage, A third threshold, reduced to a very small value, is used as a low-pass filter to suppress variance estimation noise caused by a small number of support sets; wherein the first threshold is greater than the second threshold, and the second threshold is greater than the third threshold.

[0084] (5b) Perform a Softmax operation on the negative values ​​of the asymmetric Wasserstein distance to calculate the entity category to which the words in the test set to be predicted belong. Predicted probability :

[0085] ;

[0086] in, A predefined set of entity categories; For a predefined set of entity categories The traversal index variable in the text;

[0087] (5c) Based on real category labels and predicted probability Construct the cross-entropy loss function The network parameters of the cross-domain few-shot named entity recognition model are updated by backpropagation to obtain the updated model:

[0088] ;

[0089] (5d) The updated model is used to infer the text sequence to be tested, and the category with the highest probability value is selected as the predicted entity category of the model output.

[0090] In summary, this invention extracts features from source and target domain texts, constructs a Gaussian distribution representation of lexical units using a coupled Gaussian embedding module, aggregates Gaussian prototypes in the target domain, and finally introduces asymmetric Wasserstein distance calculation for prediction and training, forming a complete end-to-end cross-domain estimation scheme. It overcomes the independent generation bias in existing distribution learning by establishing the covariance generation condition on the semantic mean position, achieving position-aware uncertainty modeling. This allows entities closer to the fuzzy decision boundary to naturally acquire a larger variance, accurately covering their effective semantic radius. It employs 2-W... Asserstein distance, as the underlying metric, mathematically decouples the semantic alignment brought by the mean from the structural differences brought by the variance. Even when the feature distributions of the source and target domains do not overlap, it can still provide smooth geometric transmission costs, ensuring the stability of the optimization. This invention proposes an asymmetric Wasserstein scaling strategy, which applies a high covariance penalty during the training phase to shape compact clusters, and acts as a low-pass filter during the inference phase to suppress variance estimation noise caused by a small training set. This successfully reconciles the conflict between discriminability and robustness, and significantly improves the accuracy of cross-domain named entity recognition.

[0091] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the claimed invention. The scope of protection of the present invention is defined by the appended claims and their equivalents.

Claims

1. A cross-domain few-shot named entity recognition method based on coupled Gaussian distribution and Wasserstein metric, characterized in that: The method includes the following steps in sequence: (1) Obtain the source domain text data and target domain text data to be processed, and perform data preprocessing respectively to obtain the corresponding input word sequence; construct the input word sequence corresponding to the source domain into a training set; The input word sequence corresponding to the target domain is constructed into few-sample task data through fragment sampling, and the few-sample task data is further divided into support set and test set; the source domain refers to a dataset with a large number of labeled texts and known entity categories; the target domain refers to a dataset with a data distribution different from the source domain and containing new and unseen entity categories; (2) A pre-trained multi-layer bidirectional backbone network is adopted. The pre-trained multi-layer bidirectional backbone network adopts the BERT-base-uncased model. The training set, support set and test set are input into the BERT-base-uncased model for feature extraction to obtain the deep hidden layer state features of each word in the training set, support set and test set. (3) Constructing a coupled Gaussian embedding module: Projecting the state features of the deep hidden layer into a semantic mean vector, and concatenating the semantic mean vector with the state features of the deep hidden layer into a covariance matrix, generating a multivariate Gaussian distribution representation with position awareness for each word; (4) Constructing a support set prototype aggregation module: In the scenario of few samples in the target domain, the Gaussian distribution representation of the support set samples with entity category labels is selected from the multivariate Gaussian distribution representation through the support set prototype aggregation module, and aggregation calculation is performed to construct a Gaussian prototype representing the distribution characteristics of each entity category. (5) The pre-trained multi-layer bidirectional backbone network, coupled Gaussian embedding module and support set prototype aggregation module together form a cross-domain few-sample named entity recognition model; calculate the 2-Wasserstein distance between the Gaussian distribution of the test set lexical and the Gaussian prototype of each entity category, introduce an asymmetric Wasserstein scaling strategy to adjust the structural difference penalty, and calculate the cross-entropy loss for model training, and finally output the predicted entity category of the text sequence to be tested.

2. The cross-domain few-shot named entity recognition method based on coupled Gaussian distribution and Wasserstein metric as described in claim 1, characterized in that: In step (1), the data preprocessing specifically refers to: using a word segmenter to segment the input source domain and target domain text, adding a [CLS] marker at the beginning of the sequence and a [SEP] marker at the end of the sequence, and truncating or padding to the set maximum sequence length to generate an input word sequence; the maximum sequence length is set to 128 words; the construction of few-shot task data based on fragment sampling specifically refers to: using the N-way K-shot sampling method to construct a test task from the target domain, wherein the number of entity categories is set to 5, and the number of single-category support set samples is set to 1 or 5.

3. The cross-domain few-shot named entity recognition method based on coupled Gaussian distribution and Wasserstein metric as described in claim 1, characterized in that: Step (2) specifically includes the following steps: (2a) After converting the input word sequence into word embedding vectors, the input is fed into the backbone network of the BERT-base-uncased model. The backbone network captures the global contextual dependencies between words through its internal multi-head self-attention mechanism. (2b) After multi-layer network encoding, output the hidden layer state feature sequence of the last layer. = ,in, For the first each word element The state characteristics of the deep hidden layer.

4. The cross-domain few-shot named entity recognition method based on coupled Gaussian distribution and Wasserstein metric as described in claim 1, characterized in that: Step (3) specifically includes the following steps: (3a) Given a deep hidden layer state feature As input, the semantic mean vector of the features is first calculated through a linear projection layer. : ; (3b) The semantic mean vector Features of deep hidden layer states The features are concatenated along the channel dimension and used as input to generate an intermediate feature map of the covariance matrix. To achieve uncertainty calibration in location awareness: ; (3c) Process intermediate feature maps using the Softplus activation function To ensure that the final generated covariance matrix Possesses positive definiteness: ; in, and All are learnable weight parameter matrices. and All are bias terms. For splicing operations, For diagonalization operation, To prevent overflow in numerical calculations; (3d) Based on semantic mean vector Covariance Matrix For each lexical unit, a position-aware multivariate Gaussian distribution representation is generated. This means that each word is modeled as a probability distribution model in the feature space.

5. The cross-domain few-shot named entity recognition method based on coupled Gaussian distribution and Wasserstein metric according to claim 1, characterized in that: Step (4) specifically includes the following steps: (4a) Extracting similar support set samples: Under the setting of a few samples in the target domain, extract samples belonging to the target entity category. of The support set consists of samples. ; (4b) Computational Gaussian prototype: based on sets The Gaussian distribution of each sample is used to calculate the entity category by taking the statistical mean. Gaussian prototype distribution ; (4c) Calculate the Gaussian prototype distribution mean vector : ; (4d) Calculate the Gaussian prototype distribution covariance matrix : ; in, For set The Middle The mean vector of each support set lexical unit. For set The Middle The covariance matrix of each supporting set of lexical units; For variable index, To support the total number of samples in the set.

6. The cross-domain few-shot named entity recognition method based on coupled Gaussian distribution and Wasserstein metric according to claim 1, characterized in that: Step (5) specifically includes the following steps: (5a) Calculate the Gaussian distribution of the lexical units in the test set. Gaussian prototype distribution of each entity category The 2-Wasserstein distance between them is used to introduce an asymmetric Wasserstein scaling strategy to adjust the covariance-based structural difference penalty, thus forming the asymmetric Wasserstein distance. : ; in, Let be the mean vector of the test set distribution. Let be the mean vector of a Gaussian-like prototype distribution. The covariance matrix of the test set distribution. The covariance matrix is ​​a Gaussian-like prototype distribution. This is the operation of squaring the Euclidean distance. For Frobenius norm squaring operation; This is the scaling factor; ; ; (5b) Perform a Softmax operation on the negative values ​​of the asymmetric Wasserstein distance to calculate the entity category to which the words in the test set to be predicted belong. Predicted probability : ; in, A predefined set of entity categories; For a predefined set of entity categories The traversal index variable in the text; (5c) Based on real category labels and predicted probability Construct the cross-entropy loss function The network parameters of the cross-domain few-shot named entity recognition model are updated by backpropagation to obtain the updated model: ; (5d) The updated model is used to infer the text sequence to be tested, and the category with the highest probability value is selected as the predicted entity category of the model output.

7. An electronic device, comprising: processor; as well as A memory storing computer program instructions that, when executed by the processor, cause the processor to perform the cross-domain few-sample named entity recognition method based on coupled Gaussian distribution and Wasserstein metric as described in any one of claims 1-6.

8. A computer-readable storage medium having stored thereon computer program instructions, which, when executed by a processor, cause the processor to perform the cross-domain few-sample named entity recognition method based on coupled Gaussian distribution and Wasserstein metric as described in any one of claims 1-6.