# US 2024/0256786 A1 · Machine-Learned Language Models Which Generate Intermediate Textual Analysis in Service of Contextual Text Generation

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

- Number: US 2024/0256786 A1
- Document ID: US20240256786A1
- Status: Published application
- Kind: A1
- Application number: 18/603,756
- Filed: 2024-03-13
- Published: 2024-08-01
- Earliest claimed: 2021-05-21
- Assignees: Google Inc.
- Applicants: Google LLC
- Inventors: Noam Shazeer; Daniel De Freitas Adiwardana
- Web page: https://patentgrep.com/patent/US20240256786A1

## CPC

- G06F 40/35: Discourse or dialogue representation
- G06F 8/38: for implementing user interfaces
- G06F 16/90332: {Natural language query formulation or dialogue systems}
- G06F 16/90335: {Query processing}
- G06F 16/9038: Presentation of query results
- G06F 40/20: Natural language analysis (semantic analysis of natural language G06F40/30)
- G06F 40/279: Recognition of textual entities
- G06F 40/284: Lexical analysis, e.g. tokenisation or collocates
- G06N 3/045: Combinations of networks
- G06N 3/092: Reinforcement learning
- G06N 20/00: Machine learning
- G10L 13/02: Methods for producing synthetic speech; Speech synthesisers
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G10L: SPEECH ANALYSIS TECHNIQUES OR SPEECH SYNTHESIS; SPEECH RECOGNITION; SPEECH OR VOICE PROCESSING TECHNIQUES; SPEECH OR AUDIO CODING OR DECODING

## Abstract

The present disclosure is directed to systems and methods that include and/or leverage one or more machine-learned language models that generate intermediate textual analysis (e.g., including usage of structural tools such as APIs) in service of contextual text generation. For example, a computing system can obtain a contextual text string that includes one or more contextual text tokens. The computing system can process the contextual text string with the machine-learned language model to generate one or more intermediate text strings that include one or more intermediate text tokens. The computing system can process the one or more intermediate text strings with the machine-learned language model to generate an output text string comprising one or more output text tokens. The one or more intermediate text strings can include textual analysis of the contextual text string that supports the output text string.

## Claims

### Claim at position 1

-20. (canceled)

### Claim 21

A computer-implemented method for training a machine-learned model to generate intermediate tokens for processing by an attention mechanism of the machine-learned model to improve subsequent outputs of the machine-learned model, the method comprising:
obtaining, by a computing system comprising one or more computing devices, a training example for training the machine-learned model to perform a contextual content generation task, wherein the training example comprises:
an initial portion comprising a context sequence;
an intermediate portion comprising an intermediate sequence; and
a response portion comprising a response sequence;
processing, by the computing system, the initial portion using the machine-learned model, wherein the machine-learned model uses the attention mechanism to perform attention over the initial portion;
generating, by the computing system and based on performing attention over the initial portion with the attention mechanism, one or more intermediate token predictions;
determining, by the computing system and using the intermediate sequence, one or more first loss values for the one or more intermediate token predictions;
generating, by the computing system and based on performing attention over the initial portion and the intermediate portion with the attention mechanism, one or more response token predictions;
determining, by the computing system and using the response sequence, one or more second loss values for the one or more response token predictions; and
training, by the computing system, the machine-learned model based on the one or more first loss values and the one or more second loss values.

### Claim 22 (depends on 21)

The method of claim 21, wherein the one or more intermediate token predictions correspond to one or more tool tokens.

### Claim 23 (depends on 21)

The method of claim 21, wherein the one or more intermediate token predictions correspond to step-by-step logic associated with the initial portion.

### Claim 24 (depends on 21)

The method of claim 21, wherein the initial portion is marked with a first tag that indicates an entity associated with the context sequence.

### Claim 25 (depends on 24)

The method of claim 24, wherein the first tag indicates that the context sequence is associated with a user.

### Claim 26 (depends on 25)

The method of claim 25, wherein the first tag comprises the textual string, “user.”

### Claim 27 (depends on 22)

The method of claim 22, wherein the intermediate portion is marked with one or more second tags that indicate an input to a tool associated with the one or more tool tokens.

### Claim 28 (depends on 27)

The method of claim 27, wherein the one or more second tags comprise:
an input tag that indicates an input to the tool; and
an output tag that indicates an output of the tool.

### Claim 29 (depends on 21)

The method of claim 21, wherein the response portion is marked with a third tag that indicates an entity associated with the response sequence.

### Claim 30 (depends on 29)

The method of claim 29, wherein the third tag indicates that the response sequence is associated with an agent or assistant.

### Claim 31 (depends on 30)

The method of claim 30, wherein the third tag comprises the textual string, “assistant.”

### Claim 32 (depends on 21)

The method of claim 21, wherein the machine-learned model is a left-to-right language model configured to predict a next token based on one or more preceding tokens.

### Claim 33 (depends on 21)

The method of claim 21, wherein the machine-learned model is implemented by a dialog agent configured to conduct a dialogue responsive to user inputs.

### Claim 34 (depends on 33)

The method of claim 33, wherein the training example comprises a dialogue between a user and an assistant, wherein assistant portions of the dialogue are generated by the machine-learned model.

### Claim 35

A computing system for training a machine-learned model to generate intermediate tokens for processing by an attention mechanism of the machine-learned model to improve subsequent outputs of the machine-learned model, the computing system comprising:
one or more processors; and
one or more non-transitory computer-readable media that collectively store instructions that, when executed by the one or more processors, cause the computing system to perform operations, the operations comprising:
obtaining a training example for training the machine-learned model to perform a contextual content generation task, wherein the training example comprises:
an initial portion comprising a context sequence;
an intermediate portion comprising an intermediate sequence; and
a response portion comprising a response sequence;
processing the initial portion using the machine-learned model, wherein the machine-learned model uses the attention mechanism to perform attention over the initial portion;
generating, based on performing attention over the initial portion with the attention mechanism, one or more intermediate token predictions;
determining, using the intermediate sequence, one or more first loss values for the one or more intermediate token predictions;
generating, based on performing attention over the initial portion and the intermediate portion with the attention mechanism, one or more response token predictions;
determining, using the response sequence, one or more second loss values for the one or more response token predictions; and
training the machine-learned model based on the one or more first loss values and the one or more second loss values.

### Claim 36 (depends on 35)

The computing system of claim 35, wherein the one or more intermediate token predictions correspond to one or more tool tokens.

### Claim 37 (depends on 35)

The computing system of claim 35, wherein the one or more intermediate token predictions correspond to step-by-step logic associated with the initial portion.

### Claim 38 (depends on 35)

The computing system of claim 35, wherein:
the initial portion is marked with a first tag that indicates an entity associated with the context sequence, wherein the first tag indicates that the context sequence is associated with a user; and
the response portion is marked with a third tag that indicates an entity associated with the response sequence, wherein the third tag indicates that the response sequence is associated with an agent or assistant.

### Claim 39 (depends on 38)

The computing system of claim 38, wherein the first tag comprises the textual string, “user,” and the third tag comprises the textual string, “assistant.”

### Claim 40

One or more non-transitory computer-readable media that collectively store instructions that, when executed by one or more processors, cause a computing system to perform operations for training a machine-learned model to generate intermediate tokens for processing by an attention mechanism of the machine-learned model to improve subsequent outputs of the machine-learned model, the operations comprising:
obtaining a training example for training the machine-learned model to perform a contextual content generation task, wherein the training example comprises:
an initial portion comprising a context sequence;
an intermediate portion comprising an intermediate sequence; and
a response portion comprising a response sequence;
processing the initial portion using the machine-learned model, wherein the machine-learned model uses the attention mechanism to perform attention over the initial portion;
generating, based on performing attention over the initial portion with the attention mechanism, one or more intermediate token predictions;
determining, using the intermediate sequence, one or more first loss values for the one or more intermediate token predictions;
generating, based on performing attention over the initial portion and the intermediate portion with the attention mechanism, one or more response token predictions;
determining, using the response sequence, one or more second loss values for the one or more response token predictions; and
training the machine-learned model based on the one or more first loss values and the one or more second loss values.
