Memory-Optimized Contrastive Learning Through Chunked Batches

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Training large neural networks with large batch sizes is bottlenecked by the limited memory of devices like GPUs and TPUs, which limits the improvement in representation quality and performance on downstream tasks.

Innovation Solution

Implement techniques that allow training with large batch sizes by partitioning batches into chunks, performing forward and backward passes on each chunk, and using optimized gradient updates without storing intermediate states or cumulative gradients, thus overcoming memory constraints.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If batch size is increased to improve representation quality, then embedding quality improves, but memory usage exceeds device memory limits

Engineering Contradiction:
Improveembedding qualityVSAvoidmemory usage
Core Design Contradiction:
Measurement precisionVSQuantity of substance

Solution Approach 1:

The batch is divided into multiple chunks that can be processed separately. Each chunk is processed through forward and backward passes independently, allowing the system to handle larger effective batch sizes by processing smaller segments sequentially, thus reducing peak memory usage while maintaining the benefits of large batch training

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent processes gradients in a sequential/streaming manner rather than storing all gradients simultaneously. By processing chunks sequentially and updating parameters incrementally, the system transforms the memory-intensive parallel gradient storage approach into a memory-efficient sequential processing approach

Inventive Principle:
Principle #17Another dimension (Dimensionality change)

2Measurement precision

If encoder neural network size is increased to improve contrastive learning performance, then representation quality improves, but gradient vector storage requirements exceed available memory

Engineering Contradiction:
Improverepresentation qualityVSAvoidmemory usage
Core Design Contradiction:
Measurement precisionVSQuantity of substance

Solution Approach 1:

The gradient computation is segmented into chunk-level gradients rather than computing and storing a single large gradient vector for the entire batch. Each chunk produces its own gradient vector that is processed and applied incrementally, reducing the memory footprint from O(batch_size × parameters) to O(chunk_size × parameters)

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent applies gradient updates incrementally based on chunks rather than waiting to compute and apply the full batch gradient. This partial action approach allows large model training by applying updates in smaller steps, reducing peak memory requirements for gradient storage

Inventive Principle:
Principle #16Partial or excessive action

Data Source

PatentUS12400432B2Memory-optimized contrastive learning
Publication Date: 2025.08.26 GOOGLE LLC
  • US12400432B2 patent drawing
  • US12400432B2 patent drawing
  • US12400432B2 patent drawing

AI summary

Methods, systems, and apparatus, including computer programs encoded on computer storage media, for using memory-optimized contrastive learning to train image encoder and text encoder neural networks.