# US 2025/0156712 A1 · Model training method and related device

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

- Number: US 2025/0156712 A1
- Document ID: US20250156712A1
- Status: Published application
- Kind: A1
- Application number: 19/019,814
- Filed: 2025-01-14
- Published: 2025-05-15
- Earliest claimed: 2022-07-15
- Assignees: Huawei Technologies Co., Ltd.
- Applicants: Huawei Technologies Co., Ltd.
- Inventors: Dequan YU; Yin ZHAO
- Web page: https://patentgrep.com/patent/US20250156712A1

## CPC

- G06F 18/214: Generating training patterns; Bootstrap methods, e.g. bagging or boosting
- G06N 3/08: Learning methods
- G06F 18/24143: {Distances to neighbourhood prototypes, e.g. restricted Coulomb energy networks [RCEN]}
- G06N 3/04: Architecture, e.g. interconnection topology
- G06N 3/045: Combinations of networks
- G06N 3/048: Activation functions
- G06N 3/084: Backpropagation, e.g. using gradient descent
- G06N 3/09: Supervised learning
- G06N 3/0464: Convolutional networks [CNN, ConvNet]
- G06V 20/20: in augmented reality scenes
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06V: IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING

## Abstract

This application discloses a model training method, including: obtaining training data; using the training data as an input of a model, and in a training process of the model, calculating a parameter by using a first precision range, to obtain a calculated value; and if the calculated value overflows the first precision range, recalculating the parameter by using a second precision range, and performing iterative training on the model for one or more times by using a recalculated parameter, where the second precision range includes the first precision range, or the second precision range partially overlaps the first precision range.

## Claims

### Claim 1

A model training method, wherein the method comprises:
obtaining training data;
using the training data as an input of a model, and in a training process of the model, calculating a parameter by using a first precision range, to obtain a calculated value; and
if the calculated value overflows the first precision range, recalculating the parameter by using a second precision range, and performing iterative training on the model for one or more times by using a recalculated parameter, wherein the second precision range comprises the first precision range, or the second precision range partially overlaps the first precision range.

### Claim 2 (depends on 1)

The method according to claim 1, wherein the model comprises a plurality of network structures, and the recalculating the parameter by using a second precision range comprises:
recalculating the parameter by using the second precision range, starting from a network structure of a first layer of the model.

### Claim 3 (depends on 1)

The method according to claim 1, wherein the model comprises a plurality of network structures, and the recalculating the parameter by using a second precision range comprises:
recalculating the parameter by using the second precision range, starting from a current network structure in which the calculated value overflows.

### Claim 4 (depends on 1)

The method according to claim 1, wherein the model comprises a plurality of network structures, and the parameter comprises one or more of the following:
an intermediate feature or a value of a loss function of the model, calculated by the plurality of network structures in a forward propagation process, wherein the intermediate feature is an output feature of any one of the plurality of network structures; and
a gradient calculated by the plurality of network structures in a backward propagation process, wherein the gradient comprises a gradient of the intermediate feature and/or a weight gradient of the model.

### Claim 5 (depends on 4)

The method according to claim 4, wherein when the parameter comprises the gradient calculated in the backward propagation process, the calculated value is a value obtained by dividing the gradient by a scaling coefficient, the scaling coefficient is used to reduce a probability that the gradient overflows, and the method further comprises:
updating the scaling coefficient by using a first coefficient, wherein an updated scaling coefficient is used to replace the scaling coefficient that is not updated, to perform next iterative training of the model, the first coefficient is a positive number less than 1, and a minimum value of the scaling coefficient is a preset threshold greater than or equal to 1.

### Claim 6 (depends on 4)

The method according to claim 4, wherein when the parameter comprises the intermediate feature calculated in the forward propagation process, the recalculating the parameter by using a second precision range comprises:
using the second precision range to calculate the intermediate feature of an overflow layer or calculate the intermediate feature layer by layer starting from the network structure of the first layer, wherein the overflow layer is a network structure that is in the plurality of network structures and in which a calculated value of the intermediate feature overflows the first precision range.

### Claim 7 (depends on 4)

The method according to claim 4, wherein when the parameter comprises the value of the loss function of the model, the recalculating the parameter by using a second precision range comprises:
using the second precision range to calculate the value of the loss function or perform calculation layer by layer starting from the network structure of the first layer, until the value of the loss function is obtained.

### Claim 8 (depends on 1)

The method according to claim 1, wherein the training the model by using the recalculated parameter comprises:
obtaining, in an Nth iteration in the training process of the model, a quantity of overflow times of the plurality of network structures in the model based on the first precision range, wherein Nis a positive integer greater than or equal to 1; and
if the quantity of overflow times is greater than or equal to a second threshold, determining that an initial precision range in a next iterative training process is to be changed from the first precision range to the second precision range, and clearing the quantity of overflow times to zero.

### Claim 9 (depends on 8)

The method according to claim 8, wherein the quantity of overflow times comprises: a quantity of overflow times of the plurality of network structures in the forward propagation process, and/or a quantity of overflow times of the plurality of network structures in the backward propagation process.

### Claim 10

A training device, wherein the training device comprises:
an obtaining unit, configured to obtain training data; and
a calculation unit, configured to use the training data as an input of a model, and in a training process of the model, calculate a parameter by using a first precision range, to obtain a calculated value, wherein
the calculation unit is further configured to: if the calculated value overflows the first precision range, recalculate the parameter by using a second precision range, and perform iterative training on the model for one or more times by using a recalculated parameter, wherein the second precision range comprises the first precision range, or the second precision range partially overlaps the first precision range.

### Claim 11 (depends on 10)

The training device according to claim 10, wherein the model comprises a plurality of network structures, and the calculation unit is specifically configured to recalculate the parameter by using the second precision range, starting from a network structure of a first layer of the model.

### Claim 12 (depends on 10)

The training device according to claim 10, wherein the calculation unit is specifically configured to recalculate the parameter by using the second precision range, starting from a current network structure in which the calculated value overflows.

### Claim 13 (depends on 10)

The training device according to claim 10, wherein the model comprises a plurality of network structures, and the parameter comprises one or more of the following:
an intermediate feature or a value of a loss function of the model, calculated by the plurality of network structures in a forward propagation process, wherein the intermediate feature is an output feature of any one of the plurality of network structures; and
a gradient calculated by the plurality of network structures in a backward propagation process, wherein the gradient comprises a gradient of the intermediate feature and/or a weight gradient of the model.

### Claim 14 (depends on 13)

The training device according to claim 13, wherein when the parameter comprises the gradient calculated in the backward propagation process, the calculated value is a value obtained by dividing the gradient by a scaling coefficient, and the scaling coefficient is used to reduce a probability that the gradient overflows; and the calculation unit is further configured to update the scaling coefficient by using a first coefficient, wherein an updated scaling coefficient is used to replace the scaling coefficient that is not updated, to perform next iterative training of the model, the first coefficient is a positive number less than 1, and a minimum value of the scaling coefficient is a preset threshold greater than or equal to 1.

### Claim 15 (depends on 13)

The training device according to claim 13, wherein when the parameter comprises the intermediate feature calculated in the forward propagation process, the calculation unit is specifically configured to use the second precision range to calculate the intermediate feature of an overflow layer or calculate the intermediate feature layer by layer starting from the network structure of the first layer, wherein the overflow layer is a network structure that is in the plurality of network structures and in which a calculated value of the intermediate feature overflows the first precision range.

### Claim 16 (depends on 13)

The training device according to claim 13, wherein when the parameter comprises the value of the loss function of the model, the calculation unit is specifically configured to use the second precision range to calculate the value of the loss function or perform calculation layer by layer starting from the network structure of the first layer, until the value of the loss function is obtained.

### Claim 17 (depends on 10)

The training device according to claim 10, wherein the calculation unit is specifically configured to obtain, in an Nth iteration in the training process of the model, a quantity of overflow times of the plurality of network structures in the model based on the first precision range, wherein N is a positive integer greater than or equal to 1; and
the calculation unit is specifically configured to: if the quantity of overflow times is greater than or equal to a second threshold, determine that an initial precision range in a next iterative training process is to be changed from the first precision range to the second precision range, and clear the quantity of overflow times to zero.

### Claim 18 (depends on 17)

The training device according to claim 17, wherein the quantity of overflow times comprises: a quantity of overflow times of the plurality of network structures in the forward propagation process, and/or a quantity of overflow times of the plurality of network structures in the backward propagation process.

### Claim 19

A computer storage medium, comprising computer instructions, wherein when the computer instructions are run on a training device, the training device is enabled to perform the following steps:
obtaining training data;
using the training data as an input of a model, and in a training process of the model, calculating a parameter by using a first precision range, to obtain a calculated value; and
if the calculated value overflows the first precision range, recalculating the parameter by using a second precision range, and performing iterative training on the model for one or more times by using a recalculated parameter, wherein the second precision range comprises the first precision range, or the second precision range partially overlaps the first precision range.
