# US 2025/0094865 A1 · Ensuring that language models follow instructions indicated in prompts

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

- Number: US 2025/0094865 A1
- Document ID: US20250094865A1
- Status: Published application
- Kind: A1
- Application number: 18/629,917
- Filed: 2024-04-08
- Published: 2025-03-20
- Earliest claimed: 2023-09-15
- Assignees: Oracle International Corporation
- Applicants: Oracle International Corporation
- Inventors: Zheng Wang; Yazhe Hu; Mengqing Guo; Tao Sheng; Jun Qian; Vinod M. Mamtani
- Web page: https://patentgrep.com/patent/US20250094865A1

## CPC

- G06N 20/00: Machine learning
- G06F 40/35: Discourse or dialogue representation
- G06F 40/40: Processing or translation of natural language (natural language analysis G06F40/20; semantic analysis G06F40/30)
- G06N 3/084: Backpropagation, e.g. using gradient descent
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Techniques for ensuring that language models follow instructions indicated in prompts are provided. In one technique, a first language model generates a response based on a prompt. A set of instructions in the prompt is identified. For each instruction in the set, a second language model determines whether the response indicates that the first language model followed the instruction. In another technique, for each prompt of a plurality of prompts: (1) a first language model generates a response based on the prompt; (2) multiple instructions are identified based on the prompt; (3) a second language model generates, based on the plurality of instructions, an output that indicates that the first language model followed each instruction; and (4) the prompt, the response, and the multiple instructions are stored in a training instance. The first language model is finetuned based on the training instances.

## Claims

### Claim 1

A method comprising:
causing a first language model to generate a response based on a prompt;
identifying a set of instructions in the prompt;
for each instruction in the set of instructions, causing a second language model to determine whether the response indicates that the first language model followed said each instruction;
in response to determining that the response indicates that the first language model did not follow a particular instruction in the set of instructions:
generating a second prompt that prompts the first language model to follow the particular instruction;
causing the first language model to generate a second response based on the second prompt;
wherein the method is performed by one or more computing devices.

### Claim 2 (depends on 1)

The method of claim 1, further comprising:
in response to determining that the second response indicates that the first language model followed each instruction in the set of instructions, providing the second response to the prompt.

### Claim 3 (depends on 2)

The method of claim 2, further comprising:
storing the second prompt, the second response, and the set of instructions as a training instance in a training dataset;
finetuning the first language model based on the training dataset.

### Claim 4 (depends on 1)

The method of claim 1, wherein identifying the set of instructions comprises:
identifying a plurality of sentences in the prompt;
for each sentence of one or more sentences in the plurality of sentences, identifying a plurality of phrases in said each sentence;
for each sentence or phrase in the plurality of sentences or the plurality of phrases, determine whether said each sentence or phrase is an instruction.

### Claim 5 (depends on 1)

The method of claim 1, wherein the second prompt includes the response.

### Claim 6 (depends on 1)

The method of claim 1, wherein the second prompt includes the prompt.

### Claim 7 (depends on 1)

The method of claim 1, further comprising:
causing the second language model to determine whether the second response indicates that the first language model followed the particular instruction.

### Claim 8 (depends on 1)

The method of claim 1, wherein the second prompt prompts the first language model to follow each instruction in the set of instructions.

### Claim 9 (depends on 1)

The method of claim 1, wherein the first language model and the second language model are the same language model.

### Claim 10

A method comprising:
for each prompt of a plurality of prompts:
causing a first language model to generate a response based on said each prompt;
identifying a plurality of instructions based on said each prompt;
causing a second language model to generate, based on the plurality of instructions, one or more outputs that indicate that the first language model followed each instruction in the plurality of instructions;
storing the prompt, the response, and the plurality of instructions in a training instance;
adding the training instance to training data;
finetuning the first language model based on the training data;
wherein the method is performed by one or more computing devices.

### Claim 11 (depends on 10)

The method of claim 10, wherein finetuning the first language model comprises:
identifying, in the training data, a first training instance that comprises a first prompt, a first plurality of instructions, and a first response;
causing the first language model to generate a particular response based on the first prompt in the first training instance;
based on the particular response, determining whether the first language model followed all of the instructions in the first plurality of instructions;
in response to determining that the first language model did not follow all of the instructions in the first plurality of instructions, backpropagating a loss to the first language model.

### Claim 12

One or more non-transitory storage media storing instructions which, when executed by one or more computing devices, cause:
causing a first language model to generate a response based on a prompt;
identifying a set of instructions in the prompt;
for each instruction in the set of instructions, causing a second language model to determine whether the response indicates that the first language model followed said each instruction.

### Claim 13 (depends on 12)

The one or more storage media of claim 12, further comprising:
in response to determining that the response indicates that the first language model followed each instruction in the set of instructions, providing the response to the prompt.

### Claim 14 (depends on 13)

The one or more storage media of claim 13, further comprising:
storing the prompt, the response, and the set of instructions as a training instance in a training dataset;
finetuning the first language model based on the training dataset.

### Claim 15 (depends on 12)

The one or more storage media of claim 12, wherein identifying the set of instructions comprises:
identifying a plurality of sentences in the prompt;
for each sentence of one or more sentences in the plurality of sentences, identifying a plurality of phrases in said each sentence;
for each sentence or phrase in the plurality of sentences or the plurality of phrases, determine whether said each sentence or phrase is an instruction.

### Claim 16 (depends on 12)

The one or more storage media of claim 12, further comprising:
in response to determining that the response indicates that the first language model did not follow a particular instruction in the set of instructions:
generating a second prompt that prompts the first language model to follow the particular instruction;
causing the first language model to generate a second response based on the second prompt.

### Claim 17 (depends on 16)

The one or more storage media of claim 16, wherein the second prompt includes the response or the prompt.

### Claim 18 (depends on 16)

The one or more storage media of claim 16, further comprising:
causing the second language model to determine whether the second response indicates that the first language model followed the particular instruction.

### Claim 19 (depends on 16)

The one or more storage media of claim 16, wherein the second prompt prompts the first language model to follow each instruction in the set of instructions.

### Claim 20 (depends on 12)

The one or more storage media of claim 12, wherein the first language model and the second language model are the same language model.
