Transformer Attention With Soft Pruning for Efficient Inference

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Transformer architectures face high computational complexity due to attention mechanisms, which are costly with complexity of O(N2d) for N nodes and d channels, limiting practicality and expressivity, especially in applications like image recognition and natural language processing.

Innovation Solution

Implement multi-neighborhood attention with soft pruning techniques, where different attention heads have varying neighborhood sizes and channel numbers, and apply soft masking to balance expressivity and efficiency by using a fixed training budget.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If attention mechanisms are used to focus on salient portions of input, then the model can process information more effectively, but the computational complexity increases to O(N^2d) which limits practicality

Engineering Contradiction:
Improveinformation processing effectivenessVSAvoidcomputational complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The input sequence is divided into multiple neighborhoods, and different attention heads are assigned to different neighborhoods. This segmentation allows the model to process local regions independently, reducing the overall computational complexity from O(N^2d) to O(Nkd) where k is the average neighborhood size, while still capturing important local patterns in the data

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

Different attention heads are configured with different neighborhood sizes and channel numbers to specialize in processing different types of local patterns. This local quality approach allows each attention head to be optimized for specific tasks, improving information processing effectiveness for particular patterns while keeping the overall computational cost manageable through selective application

Inventive Principle:
Principle #3Local quality

2Adaptability or versatility

If the number of channels and neighborhood sizes are increased to improve model expressivity, then the model can capture more complex patterns, but the computational cost increases significantly

Engineering Contradiction:
Improvemodel expressivityVSAvoidcomputational cost
Core Design Contradiction:
Adaptability or versatilityVSUse of energy by moving object

Solution Approach 1:

The model dynamically adjusts the number of channels and neighborhood sizes for different attention heads based on the specific task and input characteristics. During training, the architecture parameters are optimized to find the right balance between expressivity and computational cost, allowing the model to adapt its complexity to the requirements of each specific application rather than using a fixed high-cost configuration

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The invention treats architecture parameters such as neighborhood size and channel number as learnable parameters that can be optimized during training. By changing these parameters dynamically based on task requirements and using soft pruning techniques with annealing, the model can achieve high expressivity when needed while reducing computational cost for simpler tasks, resolving the contradiction between adaptability and energy consumption

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS20250278629A1Efficient attention using soft masking and soft channel pruning
Publication Date: 2025.09.04 QUALCOMM TECHNOLOGIES INC
  • US20250278629A1 patent drawing
  • US20250278629A1 patent drawing
  • US20250278629A1 patent drawing

AI summary

A processor-implemented method includes configuring a transformer model having multiple attention heads. Each attention head has a set of architecture parameters and weight parameters. The set of architecture parameters are determined for each attention head based on using a soft pruning technique according to a fixed training budget. In turn, the transformer model generates an inference based on the set architecture parameters and an input.