# US 2025/0094534 A1 · Task execution method and apparatus for large model, electronic device, and storage medium

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

- Number: US 2025/0094534 A1
- Document ID: US20250094534A1
- Status: Published application
- Kind: A1
- Application number: 18/968,798
- Filed: 2024-12-04
- Published: 2025-03-20
- Earliest claimed: 2024-05-31
- Assignees: Beijing Baidu Netcom Science Technology Co., Ltd.
- Applicants: Beijing Baidu Netcom Science Technology Co., Ltd.
- Inventors: Linhao ZHANG; Yilong CHEN; Junyuan SHANG; Yinqi YANG; Shuohuan WANG; Yu SUN
- Web page: https://patentgrep.com/patent/US20250094534A1

## CPC

- G06F 17/16: Matrix or vector computation {, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization (matrix transposition G06F7/78)}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A task execution method for a large model relates to fields of artificial intelligence, deep learning and large model technologies, and includes executing attention tasks in a task group to be fused using a target computing unit to obtain attention features, where the attention task corresponds to a weighted matrix to be fused, the weighted matrix to be fused is obtained by weighting a matrix to be fused using a weight; obtaining a processing result according to the attention features; determining a loss information according to the processing result; and weighting and fusing matrices to be fused using the target computing unit according to weights for the task group to be fused if the loss information converges, to obtain a fusion matrix for a target task group, where a target task in the target task group is executed by the target computing unit according to the fusion matrix.

## Claims

### Claim 1

A task execution method for a large model, comprising:
executing a plurality of attention tasks in at least one task group to be fused using a target computing unit, so as to obtain a plurality of attention features, wherein the attention task corresponds to one or more weighted matrices to be fused, and the one or more weighted matrices to be fused are obtained by weighting one or more matrices to be fused using one or more weights;
obtaining a processing result using the target computing unit according to the plurality of attention features;
determining a loss information using the target computing unit according to the processing result; and
weighting and fusing a plurality of matrices to be fused for the at least one task group to be fused using the target computing unit according to a plurality of weights for the at least one task group to be fused in response to determining that the loss information converges, so as to obtain one or more fusion matrices for at least one target task group, wherein the target task group corresponds to the task group to be fused, and a target task in the target task group is executed by the target computing unit according to the one or more fusion matrices.

### Claim 2 (depends on 1)

The method according to claim 1, further comprising:
adjusting the plurality of weights for the at least one task group to be fused in response to determining that the loss information does not converge, and returning to execute the plurality of attention tasks in the at least one task group to be fused using the target computing unit.

### Claim 3 (depends on 1)

The method according to claim 1, wherein the one or more matrices to be fused comprise at least one of a key matrix and a value matrix, the one or more weights comprise at least one of a key weight and a value weight, the one or more weighted matrices to be fused comprise at least one of a key weighted matrix and a value weighted matrix, the key weighted matrix is obtained by weighting the key matrix using the key weight, and the value weighted matrix is obtained by weighting the value matrix using the value weight, and
wherein the one or more fusion matrices comprise at least one of a key fusion matrix and a value fusion matrix.

### Claim 4 (depends on 3)

The method according to claim 3, wherein the plurality of attention tasks in the task group to be fused comprise:
N2 attention tasks executed using N query matrices, N key weighted matrices and N value weighted matrices, wherein N is an integer greater than 1; and/or
N2 attention tasks executed using N query matrices, N key weighted matrices and N value matrices; and/or
N2 attention tasks executed using N query matrices, N key matrices and N value weighted matrices.

### Claim 5 (depends on 3)

The method according to claim 3, wherein the one or more matrices to be fused comprise the key weighted matrix and the value weighted matrix,
wherein the executing a plurality of attention tasks in at least one task group to be fused using a target computing unit so as to obtain a plurality of attention features comprises:
fusing a query feature with N key weighted features using the target computing unit, so as to obtain N fusion features, wherein the query feature is obtained according to a query matrix and data to be processed, and the key weighted feature is obtained according to the key weighted matrix and the data to be processed;
processing the N fusion features using the target computing unit based on a preset function, so as to obtain N intermediate features; and
fusing the N intermediate features with N value weighted features respectively using the target computing unit, so as to obtain N attention features corresponding to the query feature, wherein the value weighted feature is obtained according to the value weighted matrix and the data to be processed.

### Claim 6 (depends on 3)

The method according to claim 3, wherein the one or more matrices to be fused comprise the key weighted matrix,
wherein the executing a plurality of attention tasks in at least one task group to be fused using a target computing unit so as to obtain a plurality of attention features comprises:
fusing a query feature with N key weighted features using the target computing unit, so as to obtain N fusion features, wherein the query feature is obtained according to a query matrix and data to be processed, and the key weighted feature is obtained according to the key weighted matrix and the data to be processed;
processing the N fusion features using the target computing unit based on a preset function, so as to obtain N intermediate features; and
fusing the N intermediate features with N value features respectively using the target computing unit, so as to obtain N attention features corresponding to the query feature, wherein the value feature is obtained according to the value matrix and the data to be processed.

### Claim 7 (depends on 3)

The method according to claim 3, wherein the one or more matrices to be fused comprise the value weighted matrix,
wherein the executing a plurality of attention tasks in at least one task group to be fused using a target computing unit so as to obtain a plurality of attention features comprises:
fusing a query feature with N key features using the target computing unit, so as to obtain N fusion features, wherein the query feature is obtained according to a query matrix and data to be processed, and the key feature is obtained according to the key matrix and the data to be processed;
processing the N fusion features using the target computing unit based on a preset function, so as to obtain N intermediate features; and
fusing the N intermediate features with N value weighted features respectively using the target computing unit, so as to obtain N attention features corresponding to the query feature, wherein the value weighted feature is obtained according to the value weighted matrix and the data to be processed.

### Claim 8 (depends on 1)

The method according to claim 1, wherein the obtaining a processing result using the target computing unit according to the plurality of attention features comprises:
fusing the plurality of attention features using the target computing unit, so as to obtain an attention fusion feature; and
obtaining the processing result using the target computing unit according to the attention fusion feature.

### Claim 9 (depends on 1)

The method according to claim 1, wherein the matrix to be fused for the task group to be fused corresponds to N weights, M task groups to be fused are provided, and M is an integer greater than or equal to 1,
wherein the determining a loss information using the target computing unit according to the processing result comprises:
determining a task loss using the target computing unit according to the processing result and a label;
determining a plurality of parameter losses of each of the M task groups to be fused using the target computing unit according to the plurality of weights for each of the M task groups to be fused, wherein the parameter loss indicates a difference between the N weights of the matrix to be fused; and
determining the loss information using the target computing unit according to the task loss and the plurality of parameter losses.

### Claim 10 (depends on 9)

The method according to claim 9, wherein the determining the loss information using the target computing unit according to the task loss and the plurality of parameter losses comprises:
fusing the plurality of parameter losses using the target computing unit, so as to obtain a parameter fusion loss;
processing the parameter fusion loss using the target computing unit according to an adjustable parameter, so as to obtain a processed parameter fusion loss; and
determining the loss information using the target computing unit according to the processed parameter fusion loss and the task loss.

### Claim 11 (depends on 10)

The method according to claim 10, further comprising:
adjusting the adjustable parameter in response to determining that the loss information does not converge, and returning to execute the plurality of attention tasks in the at least one task group to be fused using the target computing unit.

### Claim 12 (depends on 3)

The method according to claim 3, wherein the weighting and fusing a plurality of matrices to be fused for the at least one task group to be fused using the target computing unit according to a plurality of weights for the at least one task group to be fused so as to obtain one or more fusion matrices for at least one target task group comprises:
weighting and fusing N matrices to be fused using the target computing unit according to N weights of each of the N matrices to be fused, so as to obtain the fusion matrix for the target task group.

### Claim 13 (depends on 12)

The method according to claim 12, wherein the weighting and fusing N matrices to be fused using the target computing unit comprises at least one of:
weighting and fusing N key matrices using the target computing unit according to N key weights of each of the N key matrices, so as to obtain the key fusion matrix for the target task group, wherein the key matrix is weighted by using at least one of the N key weights corresponding to the key matrix; or
weighting and fusing N value matrices using the target computing unit according to N value weights of each of the N value matrices, so as to obtain the value fusion matrix for the target task group, wherein the value matrix is weighted by using at least one of the N value weights corresponding to the value matrix.

### Claim 14 (depends on 1)

The method according to claim 1, further comprising:
grouping a plurality of initial tasks using the target computing unit according to a grouping parameter, so as to obtain the at least one task group to be fused.

### Claim 15

A task execution apparatus for a large model, comprising:
a storage unit; and
a target computing unit configured to:
read, from the storage unit, a plurality of matrices to be fused for at least one task group to be fused;
execute a plurality of attention tasks in the at least one task group to be fused, so as to obtain a plurality of attention features, wherein the attention task corresponds to one or more weighted matrices to be fused, and the one or more weighted matrices to be fused are obtained by weighting one or more matrices to be fused using one or more weights;
obtain a processing result according to the plurality of attention features;
determine a loss information according to the processing result;
weight and fuse a plurality of matrices to be fused for the at least one task group to be fused according to a plurality of weights for the at least one task group to be fused in response to determining that the loss information converges, so as to obtain one or more fusion matrices for at least one target task group, wherein the target task group corresponds to the task group to be fused, and a target task in the target task group is executed according to the one or more fusion matrices; and
write the fusion matrix into the storage unit to replace the plurality of matrices to be fused.

### Claim 16 (depends on 15)

The apparatus according to claim 15, wherein the target computing unit is further configured to:
adjust the plurality of weights for the at least one task group to be fused in response to determining that the loss information does not converge, and return to execute the plurality of attention tasks in at least one task group to be fused.

### Claim 17 (depends on 15)

The apparatus according to claim 15, wherein the one or more matrices to be fused comprise at least one of a key matrix and a value matrix, the one or more weights comprise at least one of a key weight and a value weight, the one or more weighted matrices to be fused comprise at least one of a key weighted matrix and a value weighted matrix, the key weighted matrix is obtained by weighting the key matrix using the key weight, and the value weighted matrix is obtained by weighting the value matrix using the value weight, and
wherein the one or more fusion matrices comprise at least one of a key fusion matrix and a value fusion matrix.

### Claim 18 (depends on 15)

A task execution device for a large model, comprising the apparatus of claim 15.

### Claim 19

An electronic device, comprising:
at least one processor; and
a memory communicatively connected to the at least one processor,
wherein the memory stores instructions executable by the at least one processor, and the instructions, when executed by the at least one processor, are configured to cause the at least one processor to at least:
execute a plurality of attention tasks in at least one task group to be fused using a target computing unit, so as to obtain a plurality of attention features, wherein the attention task corresponds to one or more weighted matrices to be fused, and the one or more weighted matrices to be fused are obtained by weighting one or more matrices to be fused using one or more weights;
obtain a processing result using the target computing unit according to the plurality of attention features;
determine a loss information using the target computing unit according to the processing result; and
weight and fuse a plurality of matrices to be fused for the at least one task group to be fused using the target computing unit according to a plurality of weights for the at least one task group to be fused in response to determining that the loss information converges, so as to obtain one or more fusion matrices for at least one target task group, wherein the target task group corresponds to the task group to be fused, and a target task in the target task group is executed by the target computing unit according to the one or more fusion matrices.

### Claim 20 (depends on 1)

A non-transitory computer-readable storage medium having computer instructions stored thereon, wherein the computer instructions are configured to cause a computer to implement the method of claim 1.
