Sparse Mask Matrix Segmentation for Large Language Model Attention Efficiency

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current large language models face inefficiencies due to high memory occupation and computational overhead from full masking methods, which affect processing efficiency and accuracy.

Innovation Solution

A method is introduced to determine and execute a target attention task based on a sparse representation of mask positions in non-intersecting intervals within a mask matrix, reducing unnecessary calculations by skipping fully-masked regions and optimizing memory usage.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If full masking method is used in large language models, then attention mechanism can process all regions uniformly, but memory occupation and computational overhead increase significantly

Engineering Contradiction:
Improveattention mechanism completenessVSAvoidcomputational overhead
Core Design Contradiction:
ReliabilityVSLoss of energy

Solution Approach 1:

The patent segments the mask matrix into multiple non-intersecting intervals based on sparse representation, dividing the attention computation into distinct regions (fully-masked, partially-masked, and non-masked intervals). This segmentation allows the system to process only necessary regions separately, avoiding uniform full-mask processing while maintaining attention mechanism completeness.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent extracts and identifies fully-masked intervals from the mask matrix using sparse representation, then excludes these regions from attention computation. By taking out the unnecessary fully-masked regions, the system reduces computational overhead while preserving the attention mechanism's ability to process relevant regions.

Inventive Principle:
Principle #2Taking out (Extraction)

2Reliability

If full masking method is used in large language models, then all regions are processed uniformly, but processing efficiency decreases due to unnecessary calculations

Engineering Contradiction:
Improveprocessing completenessVSAvoidprocessing efficiency
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The mask matrix is segmented into multiple non-intersecting intervals identified by sparse representation, allowing the system to distinguish between fully-masked, partially-masked, and non-masked regions. This segmentation enables selective processing of only necessary intervals, improving processing efficiency while maintaining completeness for non-masked regions.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent implements skipping of fully-masked intervals by identifying them through sparse representation and excluding them from attention computation. This allows the system to rush through or skip unnecessary calculations in fully-masked regions while still processing relevant regions, thereby improving overall processing efficiency without sacrificing completeness.

Inventive Principle:
Principle #21Skipping (Rushing through)

3Loss of energy

If sparse representation with non-intersecting intervals is used, then computational overhead is reduced, but implementation complexity increases

Engineering Contradiction:
Improvecomputational overheadVSAvoidmask processing complexity
Core Design Contradiction:
Loss of energyVSDevice complexity

Solution Approach 1:

While segmentation into non-intersecting intervals does increase implementation complexity, the patent manages this by establishing clear rules for identifying and processing different interval types. The segmentation structure itself simplifies the overall logic by providing distinct handling paths for fully-masked, partially-masked, and non-masked regions, making the complexity manageable and structured.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent applies local quality by treating different intervals with different processing qualities - fully-masked intervals are excluded entirely, partially-masked intervals receive selective processing, and non-masked intervals receive full attention computation. This localized processing strategy reduces overall computational overhead while maintaining appropriate processing quality for each region type.

Inventive Principle:
Principle #3Local quality

4Device complexity

If traditional masking is used, then simplicity is maintained, but memory occupation increases

Engineering Contradiction:
Improvemask implementation simplicityVSAvoidmemory occupation
Core Design Contradiction:
Device complexityVSLoss of energy

Solution Approach 1:

The patent introduces segmentation of the mask matrix into non-intersecting intervals identified by sparse representation. This segmentation reduces memory occupation by avoiding the need to store and process mask information for all regions uniformly, while the segmentation logic itself remains relatively simple to implement through systematic interval identification and classification.

Inventive Principle:
Principle #1Segmentation

Data Source

PatentUS20240378077A1Method of executing task for large language model, device, and storage medium
Publication Date: 2024.11.14 BEIJING BAIDU NETCOM SCI & TECH CO LTD
  • US20240378077A1 patent drawing
  • US20240378077A1 patent drawing
  • US20240378077A1 patent drawing

AI summary

A method of executing a task for a large language model, a device, and a storage medium are provided, which relate to a field of artificial intelligence technology, and in particular to fields of deep learning, large language model, natural language processing and computer vision technologies. The method includes: determining, by using a determination unit, a target attention task from a plurality of attention tasks to be processed, based on a sparse representation corresponding to a feature to be processed, where the target attention task is a task corresponding to a non-fully masked region of the feature, the sparse representation represents a mask position of the feature, and the mask position represents mask endpoint positions in at least two non-intersecting intervals in a mask matrix corresponding to the feature; and executing the target attention task by using a computing unit, so as to obtain an attention feature.