# US 2026/0087327 A1 · Fine-tuning generative neural networks to improve few-shot performance

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

- Number: US 2026/0087327 A1
- Document ID: US20260087327A1
- Status: Published application
- Kind: A1
- Application number: 19/339,129
- Filed: 2025-09-24
- Published: 2026-03-26
- Earliest claimed: 2024-09-24
- Assignees: Google Inc.
- Applicants: Google LLC
- Inventors: Arjun Reddy Akula; Kazuma Hashimoto; Krishna P. Srinivasan; Aditi Swanand Chaudhary; Karthik Raman; Michael Bendersky
- Web page: https://patentgrep.com/patent/US20260087327A1

## CPC

- G06N 3/0475: Generative networks
- G06N 3/045: Combinations of networks
- G06N 3/088: Non-supervised learning, e.g. competitive learning
- G06N 3/09: Supervised learning
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

Systems and methods for training a generative neural network, e.g., a large language model (LLM) neural network. The generative neural network is trained on training examples that each include (i) a training input that includes a training query for a corresponding task and a subset of demonstration examples for the task that are most similar to the training query and (ii) the ground truth output for the training query for the task.

## Claims

### Claim 1

A method performed by one or more computers and for training a generative neural network, the method comprising:
obtaining a respective set of demonstration examples for each of a plurality of tasks, wherein each demonstration example comprises a respective example query and a respective example output for the respective example query;
for each of the plurality of tasks:
obtaining a training query for the task and a ground truth output for the training query for the task;
determining, from the respective set of demonstration examples for the task, a subset of demonstration examples that are most similar to the training query;
generating a training example for the generative neural network, wherein the training example comprises (i) a training input that includes the training query and the subset of demonstration examples that are most similar to the training query and (ii) the ground truth output for the training query for the task; and
training the generative neural network on training data that includes the training examples for the plurality of tasks.

### Claim 2 (depends on 1)

The method of claim 1, wherein prior to training the generative neural network on the training data, the generative neural network has been pre-trained on one or more pre-training data sets.

### Claim 3 (depends on 2)

The method of claim 2, wherein the one or more pre-training data sets comprise one or more of an unsupervised data set or a supervised fine-tuning data set.

### Claim 4 (depends on 1)

The method of claim 1, wherein the generative neural network is an auto-regressive neural network that is configured to process an input sequence to auto-regressively generate an output sequence for the input sequence.

### Claim 5 (depends on 1)

The method of claim 1, wherein determining, from the respective set of demonstration examples for the task, a subset of demonstration examples that are most similar to the training query comprises:
determining a fixed number of demonstration examples from the respective set of demonstration examples for the task that are most similar to the training query.

### Claim 6 (depends on 1)

The method of claim 1, wherein determining, from the respective set of demonstration examples for the task, a subset of demonstration examples that are most similar to the training query comprises:
determining, from the respective set of demonstration examples for the task, a subset of demonstration examples that are most semantically similar to the training query.

### Claim 7 (depends on 1)

The method of claim 1, wherein determining, from the respective set of demonstration examples for the task, a subset of demonstration examples that are most similar to the training query comprises:
for each demonstration example in the respective set, determining a respective measure of similarity between the example query in the demonstration example and the training query; and
selecting, as the subset of demonstration examples that are most similar to the training query, a subset of demonstration examples that include example queries that are most similar to the training query according to the respective measures of similarity.

### Claim 8 (depends on 7)

The method of claim 7, wherein determining a respective measure of similarity between the example query in the demonstration example and the training query comprises:
processing a first input that comprises the example query using a first encoder neural network to generate a first embedding of the example query;
processing a second input that comprises the training query using a second encoder neural network to generate a second embedding of the training query; and
determining a measure of similarity between the first embedding and the second embedding.

### Claim 9 (depends on 8)

The method of claim 8, wherein the first encoder neural network and the second encoder neural network are the same neural network.

### Claim 10 (depends on 8)

The method of claim 8, wherein the first encoder neural network and the second encoder neural network are different neural networks.

### Claim 11 (depends on 1)

The method of claim 1, wherein determining, from the respective set of demonstration examples for the task, a subset of demonstration examples that are most similar to the training query comprises:
for each demonstration example in the respective set, determining a respective measure of similarity between the demonstration example and the training query; and
selecting, as the subset of demonstration examples that are most similar to the training query, a subset of demonstration examples that are most similar to the training query according to the respective measures of similarity.

### Claim 12 (depends on 11)

The method of claim 11, wherein determining a respective measure of similarity between the demonstration example and the training query comprises:
processing a first input that comprises the example query in the demonstration example and the example output in the training example using a first encoder neural network to generate a first embedding of the demonstration example;
processing a second input that comprises the training query using a second encoder neural network to generate a second embedding of the training query; and
determining a measure of similarity between the first embedding and the second embedding.

### Claim 13 (depends on 12)

The method of claim 12, wherein the first encoder neural network and the second encoder neural network are the same neural network.

### Claim 14 (depends on 12)

The method of claim 12, wherein the first encoder neural network and the second encoder neural network are different neural networks.

### Claim 15 (depends on 1)

The method of claim 1, further comprising, after the training:
obtaining a new query for a new task and set of demonstration examples for the new task;
determining, from the set of demonstration examples for the new task, a subset of demonstration examples that are most similar to the new query;
generating a new input that includes the new query and the subset of demonstration examples that are most similar to the new query; and
processing the new input using the generative neural network to generate a new output for the new query.

### Claim 16 (depends on 15)

The method of claim 15, wherein the new task is different from any of the plurality of tasks.

### Claim 17 (depends on 15)

The method of claim 15, further comprising:
outputting the new output in response to the new query.

### Claim 18 (depends on 17)

The method of claim 17, wherein the new query is received from a user and wherein outputting the new output comprises providing the new output for presentation to the user on a user device.

### Claim 19 (depends on 1)

The method of claim 1, wherein the training input further comprises a task instruction for the task.

### Claim 20

A system comprising one or more computers and one or more storage devices storing instructions that when executed by the one or more computers cause the one more computers to perform operations for training a generative neural network, the operations comprising:
obtaining a respective set of demonstration examples for each of a plurality of tasks, wherein each demonstration example comprises a respective example query and a respective example output for the respective example query;
for each of the plurality of tasks:
obtaining a training query for the task and a ground truth output for the training query for the task;
determining, from the respective set of demonstration examples for the task, a subset of demonstration examples that are most similar to the training query;
generating a training example for the generative neural network, wherein the training example comprises (i) a training input that includes the training query and the subset of demonstration examples that are most similar to the training query and (ii) the ground truth output for the training query for the task; and
training the generative neural network on training data that includes the training examples for the plurality of tasks.

### Claim 21

One or more non-transitory computer storage media storing instructions that when executed by one or more computers cause the one more computers to perform operations for training a generative neural network, the operations comprising:
obtaining a respective set of demonstration examples for each of a plurality of tasks, wherein each demonstration example comprises a respective example query and a respective example output for the respective example query;
for each of the plurality of tasks:
obtaining a training query for the task and a ground truth output for the training query for the task;
determining, from the respective set of demonstration examples for the task, a subset of demonstration examples that are most similar to the training query;
generating a training example for the generative neural network, wherein the training example comprises (i) a training input that includes the training query and the subset of demonstration examples that are most similar to the training query and (ii) the ground truth output for the training query for the task; and
training the generative neural network on training data that includes the training examples for the plurality of tasks.
