Neural Network Attention Mechanism Key-Value Coupling

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing attention mechanisms in neural networks face high computational complexity when processing multiple queries, leading to increased operational complexity and reduced processing efficiency.

Innovation Solution

The implementation of key-value coupling data using nonlinear transformations, such as sine and cosine functions, to aggregate new key and value data, reducing the need for repeated similarity calculations between queries and keys, thereby fixing the key-value coupling data independently of query input.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If traditional attention mechanism processes multiple queries by calculating similarity between each query and key independently, then processing accuracy is maintained, but computational complexity increases to O(m*n) where m is number of queries and n is number of keys

Engineering Contradiction:
Improveprocessing accuracyVSAvoidcomputational complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The patent segments the attention mechanism into two independent parts: key-value coupling computation (independent of queries) and query processing. By separating the key-value interaction from query-dependent operations, the computational burden is divided and optimized, allowing pre-computation of key-value coupling data that can be reused across multiple queries.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent performs preliminary computation of key-value coupling data before processing queries. The key-value coupling data is computed once and stored, eliminating the need to recompute it for each query. This preliminary action reduces the per-query computational complexity from O(n) to O(1), achieving overall complexity of O(n+m) for m queries.

Inventive Principle:
Principle #10Preliminary action

2Adaptability or versatility

If traditional attention mechanism recalculates key-value similarities for each query, then adaptability to different queries is maintained, but processing speed decreases

Engineering Contradiction:
Improvequery adaptabilityVSAvoidprocessing speed
Core Design Contradiction:
Adaptability or versatilityVSProductivity

Solution Approach 1:

The patent segments the attention computation into query-independent key-value coupling data and query-dependent similarity calculations. This segmentation allows the system to maintain adaptability to different queries through the query-specific similarity step while achieving high processing speed through the pre-computed, reusable key-value coupling data.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent performs preliminary computation of key-value coupling data that captures the essential interactions between keys and values. This pre-computed data structure enables rapid processing of multiple queries without recalculating the fundamental key-value relationships, thereby maintaining query adaptability while dramatically improving processing speed.

Inventive Principle:
Principle #10Preliminary action

3Reliability

If traditional attention mechanism performs full similarity calculations for all query-key pairs, then completeness of attention computation is ensured, but computational power required increases

Engineering Contradiction:
Improvecompleteness of computationVSAvoidcomputational power
Core Design Contradiction:
ReliabilityVSUse of energy by moving object

Solution Approach 1:

The patent performs preliminary computation of key-value coupling data that encapsulates the essential key-value interactions. This pre-computed representation maintains the completeness of attention computation by preserving all necessary information, while significantly reducing the computational power required for processing multiple queries by eliminating redundant calculations.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent creates a compressed representation (copy) of the key-value interactions in the form of key-value coupling data. This copied structure contains the essential information needed for attention computation, allowing the system to maintain computational completeness while reducing the energy required for processing by working with this compact representation instead of full key-value pairs for each query.

Inventive Principle:
Principle #26Copying

Data Source

PatentUS11295220B2Method and apparatus with key-value coupling
Publication Date: 2022.04.05 SAMSUNG ELECTRONICS CO LTD
  • US11295220B2 patent drawing
  • US11295220B2 patent drawing
  • US11295220B2 patent drawing

AI summary

A processor-implemented method of implementing an attention mechanism in a neural network includes obtaining key-value coupling data determined based on an operation between new key data determined using a first nonlinear transformation for key data of an attention layer, and value data of the attention layer corresponding to the key data; determining new query data by applying a second nonlinear transformation to query data corresponding to input data of the attention layer; and determining output data of the attention layer based on an operation between the new query data and the key-value coupling data.