# US 12,118,063 B2 · Method, apparatus, electronic device and storage medium for training semantic similarity model

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 12,118,063 B2
- Document ID: US12118063B2
- Status: Granted
- Kind: B2
- Application number: 17/209,051
- Filed: 2021-03-22
- Published: 2022-09-22
- Granted: 2024-10-15
- Earliest claimed: 2020-05-12
- Assignees: Beijing Baidu Netcom Science Technology Co., Ltd.
- Applicants: Beijing Baidu Netcom Science and Technology Co., Ltd.
- Inventors: Zhen Li; Yukun Li; Yu Sun
- Web page: https://patentgrep.com/patent/US12118063B2

## CPC

- G06F 18/2148: {characterised by the process organisation or structure, e.g. boosting cascade}
- G06F 18/24147: {Distances to closest patterns, e.g. nearest neighbour classification}
- G06F 40/30: Semantic analysis
- G06N 3/09: Supervised learning
- G06N 20/00: Machine learning
- G06N 3/08: Learning methods
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

The present disclosure provides a method, apparatus, electronic device and storage medium for training a semantic similarity model, which relates to the field of artificial intelligence. A specific implementation solution is as follows: obtaining a target field to be used by a semantic similarity model to be trained; calculating respective correlations between the target field and application fields corresponding to each of training datasets in known multiple training datasets; training the semantic similarity model with the training datasets in turn, according to the respective correlations between the target field and the application fields corresponding to each of the training datasets. According to the technical solution of the present disclosure, it is possible to, in the fine-tuning phase, more purposefully train the semantic similarity model with the training datasets with reference to the correlations between the target field and the application fields corresponding to the training datasets, thereby effectively improving the learning capability of the sematic similarity model and effectively improving the accuracy of the trained semantic similarity model.

## Claims

### Claim 1

A computer-implemented method for training a semantic similarity model for a parameter fine-tuning of a semantic matching task of Natural Language Processing (NLP), the semantic similarity model being configured to receive an input of two texts, calculate the similarity between the two texts, and output a semantic similarity, wherein the method comprises:
obtaining a target field to be used by a semantic similarity model to be trained;
calculating respective correlations between the target field and application fields corresponding to each of training datasets in known multiple training datasets;
training the semantic similarity model with the training datasets in turn, according to an ascending order of the respective correlations between the target field and the application fields corresponding to each of the training datasets,
wherein the training the semantic similarity model with the training datasets in turn, according to an ascending order of the respective correlations between the target field and the application fields corresponding to each of the training datasets comprises:
according to the respective correlations between the target field and the application fields corresponding to each of the training datasets, dividing the plurality of training datasets into a set of high-correlation training datasets and a set of low-correlation training datasets;
training the semantic similarity model in turn with training datasets in the set of low-correlation training datasets;
training the semantic similarity model in turn with the training datasets in the set of high-correlation training datasets.

### Claim 2 (depends on 1)

The method according to claim 1, wherein the training the semantic similarity model in turn with training datasets in the set of low-correlation training datasets comprises:
training the semantic similarity model respectively with the corresponding training datasets in turn in an ascending order of correlations between the target field and the application fields corresponding to training datasets in the set of low-correlation training datasets; or
randomly ranking the training datasets in the set of low-correlation training datasets; training the semantic similarity model with the corresponding training datasets in turn in the random ranking order.

### Claim 3 (depends on 1)

The method according to claim 1, wherein the step of, according to the correlations between the target field and the application fields corresponding to the training datasets, dividing the plurality of training datasets into a set of high-correlation training datasets and a set of low-correlation training datasets comprises:
directing the training datasets of N application fields with the highest correlation with the target field to the set of high-correlation training datasets;
directing other training datasets to the set of low-correlation training datasets.

### Claim 4 (depends on 3)

The method according to claim 3, wherein the training the semantic similarity model in turn with the training datasets in the set of high-correlation training datasets comprises:
if N>1, training the semantic similarity model respectively with the corresponding training datasets in turn in an ascending order of correlations between the target field and the application fields corresponding to training datasets in the set of high-correlation training datasets.

### Claim 5

An electronic device, comprising:
at least one processor; and
a memory communicatively connected with the at least one processor;
wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform a method for training a semantic similarity model for a parameter fine-tuning of a semantic matching task of Natural Language Processing (NLP), the semantic similarity model being configured to receive an input of two texts, calculate the similarity between the two texts, and output a semantic similarity, wherein the method comprises:
obtaining a target field to be used by a semantic similarity model to be trained;
calculating respective correlations between the target field and application fields corresponding to each of training datasets in known multiple training datasets;
training the semantic similarity model with the training datasets in turn, according to an ascending order of the respective correlations between the target field and the application fields corresponding to each of the training datasets,
wherein the training the semantic similarity model with the training datasets in turn, according to an ascending order of the respective correlations between the target field and the application fields corresponding to each of the training datasets comprises:
according to the respective correlations between the target field and the application fields corresponding to each of the training datasets, dividing the plurality of training datasets into a set of high-correlation training datasets and a set of low-correlation training datasets;
training the semantic similarity model in turn with training datasets in the set of low-correlation training datasets;
training the semantic similarity model in turn with the training datasets in the set of high-correlation training datasets.

### Claim 6 (depends on 5)

The electronic device according to claim 5, wherein the training the semantic similarity model in turn with training datasets in the set of low-correlation training datasets comprises:
training the semantic similarity model respectively with the corresponding training datasets in turn in an ascending order of correlations between the target field and the application fields corresponding to training datasets in the set of low-correlation training datasets; or
randomly ranking the training datasets in the set of low-correlation training datasets, and training the semantic similarity model with the corresponding training datasets in turn in the random ranking order.

### Claim 7 (depends on 5)

The electronic device according to claim 5, wherein the step of, according to the correlations between the target field and the application fields corresponding to the training datasets, dividing the plurality of training datasets into a set of high-correlation training datasets and a set of low-correlation training datasets comprises:
directing the training datasets of N application fields with the highest correlation with the target field to the set of high-correlation training datasets;
directing other training datasets to the set of low-correlation training datasets.

### Claim 8 (depends on 7)

The electronic device according to claim 7, wherein the training the semantic similarity model in turn with the training datasets in the set of high-correlation training datasets comprises:
if N>1, training the semantic similarity model respectively with the corresponding training datasets in turn in an ascending order of correlations between the target field and the application fields corresponding to training datasets in the set of high-correlation training datasets.

### Claim 9

A non-transitory computer readable storage medium with computer instructions stored thereon, wherein the computer instructions are used for causing a computer to perform a method for training a semantic similarity model for a parameter fine-tuning of a semantic matching task of Natural Language Processing (NLP), the semantic similarity model being configured to receive an input of two texts, calculate the similarity between the two texts, and output a semantic similarity, wherein the method comprises:
obtaining a target field to be used by a semantic similarity model to be trained;
calculating respective correlations between the target field and application fields corresponding to each of training datasets in known multiple training datasets;
training the semantic similarity model with the training datasets in turn, according to an ascending order of the respective correlations between the target field and the application fields corresponding to each of the training datasets, wherein the training the semantic similarity model with the training datasets in turn, according to an ascending order of the respective correlations between the target field and the application fields corresponding to each of the training datasets comprises:
according to the respective correlations between the target field and the application fields corresponding to each of the training datasets, dividing the plurality of training datasets into a set of high-correlation training datasets and a set of low-correlation training datasets;
training the semantic similarity model in turn with training datasets in the set of low-correlation training datasets;
training the semantic similarity model in turn with the training datasets in the set of high-correlation training datasets.

### Claim 10 (depends on 9)

The non-transitory computer readable storage medium according to claim 9, wherein the training the semantic similarity model in turn with training datasets in the set of low-correlation training datasets comprises:
training the semantic similarity model respectively with the corresponding training datasets in turn in an ascending order of correlations between the target field and the application fields corresponding to training datasets in the set of low-correlation training datasets; or
randomly ranking the training datasets in the set of low-correlation training datasets; training the semantic similarity model with the corresponding training datasets in turn in the random ranking order.

### Claim 11 (depends on 9)

The non-transitory computer readable storage medium according to claim 9, wherein the step of, according to the correlations between the target field and the application fields corresponding to the training datasets, dividing the plurality of training datasets into a set of high-correlation training datasets and a set of low-correlation training datasets comprises:
directing the training datasets of N application fields with the highest correlation with the target field to the set of high-correlation training datasets;
directing other training datasets to the set of low-correlation training datasets.

### Claim 12 (depends on 11)

The non-transitory computer readable storage medium according to claim 11, wherein the training the semantic similarity model in turn with the training datasets in the set of high-correlation training datasets comprises:
if N>1, training the semantic similarity model respectively with the corresponding training datasets in turn in an ascending order of correlations between the target field and the application fields corresponding to training datasets in the set of high-correlation training datasets.
