# US 2021/0287094 A1 · Model training with variable batch sizing and gradient checkpoint segments

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

- Number: US 2021/0287094 A1
- Document ID: US20210287094A1
- Status: Published application
- Kind: A1
- Application number: 16/813,818
- Filed: 2020-03-10
- Published: 2021-09-16
- Earliest claimed: 2020-03-10
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Saurabh Goyal; Anamitra Roy Choudhury; Yogish Sabharwal; Ashish Verma
- Web page: https://patentgrep.com/patent/US20210287094A1

## CPC

- G06N 3/084: Backpropagation, e.g. using gradient descent
- G06N 3/0499: Feedforward networks
- G06N 3/044: Recurrent networks, e.g. Hopfield networks
- G06N 3/045: Combinations of networks
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

A computer-implemented machine learning model training method and resulting machine learning model. One embodiment of the method may comprise receiving at a computer memory training data; and training on a computer processor a machine learning model on the received training data using a plurality of batch sizes to produce a trained processor. The training may include calculating a plurality of activations during a forward pass of the training and discarding at least some of the calculated plurality of activations after the forward pass of the training.

## Claims

### Claim 1

A computer-implemented machine learning model training method, comprising:
receiving, at a computer memory, training data; and
training, on a computer processor, a machine learning model on the received training data using a plurality of batch sizes to produce a trained processor, wherein training includes:
calculating a plurality of activations during a forward pass of the training; and
discarding at least some of the calculated plurality of activations after the forward pass of the training.

### Claim 2 (depends on 1)

The method of claim 1, wherein the training comprises calculating an optimized batch size schedule for the forward pass of the training.

### Claim 3 (depends on 1)

The method of claim 1, wherein the training comprises calculating an optimized batch size schedule for an activation regeneration pass of the training.

### Claim 4 (depends on 1)

The method of claim 1, wherein the training comprises calculating an optimized batch size schedule for a gradient generation pass of the training.

### Claim 5 (depends on 1)

The method of claim 1, wherein the training comprises:
calculating a first optimized batch size schedule for the forward pass of the training;
calculating a second optimized batch size schedule for an activation regeneration pass of the training; and
calculating a third optimized batch size schedule for a gradient generation pass of the training.

### Claim 6 (depends on 5)

The method of claim 5, wherein the first optimized batch size schedule, the second optimized batch schedule, and the third optimized batch size schedule are calculated independently.

### Claim 7 (depends on 1)

The method of claim 1, wherein the training comprises:
calculating one of the plurality of activation for each of a plurality of layers of the machine learning model during the forward pass of the training;
discarding one or more of the calculated activations after completion of the forward pass; and
regenerating the one or more discarded activations during a back-propagation pass.

### Claim 8 (depends on 7)

The method of claim 7, wherein the training further comprises:
identifying one or more segments for which activation checkpoints must be regenerated; and
calculating available memory for each of the one or more segments.

### Claim 9 (depends on 8)

The method of claim 8, further comprising calculating an optimal batch size schedule for each of the one or more segments using the calculated available memory.

### Claim 10 (depends on 9)

The method of claim 9, further comprising independently calculating an optimal batch size schedule for the forward pass of the training and a back-propagation pass of the training using the calculated available memory for each of the one or more segments.

### Claim 11 (depends on 10)

The method of claim 10, wherein the calculated optimal batch schedules maximize throughput through the segment.

### Claim 12 (depends on 1)

The method of claim 1, further comprising:
metering use of memory associated with the training; and
generating an invoice based on the metered use.

### Claim 13 (depends on 1)

The method of claim 1, wherein the machine learning model comprises a feedforward network.

### Claim 14 (depends on 1)

A machine learning model created using the method of claim 1.

### Claim 15

An inferencing engine, comprising:
one or more processors coupled to one or more memories, the one or more memories comprising:
a machine learning model having a plurality of associated activations;
model training data; and
program instructions that, when executed on the one or more processors, cause the one or more processors to:
calculate a plurality of batch sizes;
train the machine learning model on the model training data using the calculated plurality of batch sizes, wherein at least some of a plurality of activations of the machine learning model are discarded during a forward pass of the training.

### Claim 16 (depends on 15)

The inferencing engine of claim 15, further comprising program instructions that, when executed on the one or more processors, cause the one or more processors to:
calculate a first optimized batch size schedule for the forward pass of the training;
calculate a second optimized batch size schedule for an activation regeneration pass of the training; and
calculate a third optimized batch size schedule for a gradient generation pass of the training.

### Claim 17 (depends on 16)

The inferencing engine of claim 16, wherein the first optimized batch size schedule, the second optimized batch schedule, and the third optimized batch size schedule are calculated independently.

### Claim 18 (depends on 15)

The inferencing engine of claim 15, further comprising program instructions that, when executed on the one or more processors, cause the one or more processors to:
identify one or more segments for which activation checkpoints must be regenerated;
calculate available memory for each of the segments.

### Claim 19 (depends on 15)

The inferencing engine of claim 15, further comprising program instructions that, when executed on the one or more processors, cause the one or more processors to:
calculate an optimal batch size schedule for each of the one or more segments using the calculated available memory.

### Claim 20 (depends on 15)

The inferencing engine of claim 15, wherein the calculated optimal batch schedules maximize throughput through the segment.
