# US 2025/0097171 A1 · Llm fine-tuning for chatbot

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

- Number: US 2025/0097171 A1
- Document ID: US20250097171A1
- Status: Published application
- Kind: A1
- Application number: 18/768,363
- Filed: 2024-07-10
- Published: 2025-03-20
- Earliest claimed: 2023-09-15
- Assignees: Oracle International Corporation
- Applicants: Oracle International Corporation
- Inventors: Yazhe HU; Mengqing GUO; Zheng WANG; Tao SHENG; Jun QIAN; Vinod MAMTANI
- Web page: https://patentgrep.com/patent/US20250097171A1

## CPC

- H04L 51/02: using automatic reactions or user delegation, e.g. automatic replies or chatbot-generated messages
- G06F 8/35: model driven
- G06F 8/36: Software reuse
- G06F 40/226: Validation
- G06F 40/30: Semantic analysis
- G06F 40/35: Discourse or dialogue representation
- G06F 40/56: Natural language generation
- G06N 3/0895: Weakly supervised learning, e.g. semi-supervised or self-supervised learning
- G06N 3/091: Active learning
- H04L 51/04: Real-time or near real-time messaging, e.g. instant messaging [IM]
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

Systems, methods, and other embodiments automated fine-tuning of chatbot performance for large language models are described herein. In one embodiment, a method accesses a collection of sample conversations between two entities. An individual sample conversation includes one or more rounds of natural language example prompt by a querent and example response by an agent. The method fine-tunes an LLM to generate responses in natural language based on a chatbot loss function that evaluates first responses generated by the LLM to the example prompts by the querent. The method generates an evaluation score for performance of the tuned LLM as a chatbot based on second responses generated by the tuned LLM to test prompts from a test conversation. And, the method automatically signals that the fine-tuning of the tuned LLM is complete in response to the evaluation score satisfying a threshold.

## Claims

### Claim 1

One or more non-transitory computer-readable media that include stored thereon computer-executable instructions that when executed by at least a processor cause a computing system to:
access a collection of sample conversations between two entities, wherein an individual sample conversation includes one or more rounds of natural language example prompt by a customer and example response by an agent;
fine-tune a large language model to generate responses in natural language based on a chatbot loss function that evaluates first responses generated by the large language model to the example prompts by the customer;
generate an evaluation score for performance of the tuned large language model as a chatbot based on second responses generated by the tuned large language model to test prompts from a test conversation; and
automatically determine to deploy the tuned large language model to a production environment to operate as a chatbot in response to the evaluation score satisfying a threshold.

### Claim 2 (depends on 1)

The non-transitory computer-readable media of claim 1, wherein the computer-executable instructions further cause the computing system to execute the chatbot loss function to penalize one or more of (i) dissimilarity of the collective first responses generated by the large language model to the collective example responses by the agent in the sample conversation, (ii) excessive rounds of conversation by the large language model in comparison to the sample conversation, and (iii) round-by-round dissimilarity of the first responses generated by the large language model to corresponding example responses by the agent in the sample conversation.

### Claim 3 (depends on 2)

The non-transitory computer-readable media of claim 2, wherein the computer-executable instructions further cause the computing system to measure dissimilarity of generated and example responses by cosine distance.

### Claim 4 (depends on 1)

The non-transitory computer-readable media of claim 1, wherein the computer-executable instructions to generate the evaluation score further cause the computing system to:
generate a value of recall between test responses from the test conversation and the generated second responses;
generate a value of precision between the test responses and the generated second responses; and
combine the values of recall and precision to produce the evaluation score.

### Claim 5 (depends on 1)

The non-transitory computer-readable media of claim 1, wherein the computer-executable instructions to generate the evaluation score further cause the computing system to:
automatically generate a grading prompt to an additional large language model that requests the additional large language model to grade the generated second responses for a particular criterion;
automatically submit the generated second generated responses and the prompt to the additional large language model to cause the additional large language model to generate a criterion score for the particular criterion based on the generated second responses; and
generate the evaluation score based at least in part on the criterion score.

### Claim 6 (depends on 5)

The non-transitory computer-readable media of claim 5, wherein the particular criterion is one of non-repetitiveness of the second generated responses, human-readability of the second generated responses, relevance of the second generated responses to corresponding test prompts, conformance to first-person perspective, and conciseness.

### Claim 7 (depends on 1)

The non-transitory computer-readable media of claim 1, wherein a condition of satisfying the threshold includes surpassing a previous best for the evaluation score, and wherein the computer-executable instructions further cause the computing system to compare the evaluation score to the previous best for the evaluation score.

### Claim 8

A computing system, comprising:
at least one processor connected to at least one memory;
one or more non-transitory computer readable media including instructions stored thereon that when executed by at least the processor cause the computing system to:
access a collection of sample conversations between two entities, wherein an individual sample conversation includes one or more rounds of natural language example prompt by a querent and example response by an agent;
fine-tune a large language model to generate responses in natural language based on a chatbot loss function that evaluates first responses generated by the large language model to the example prompts by the querent;
generate an evaluation score for performance of the tuned large language model as a chatbot based on second responses generated by the tuned large language model to test prompts from a test conversation; and
automatically deploying the tuned large language model to a production environment to operate as a chatbot in response to the evaluation score satisfying a threshold.

### Claim 9 (depends on 8)

The computing system of claim 8, wherein the computer-executable instructions further cause the computing system to execute the chatbot loss function to generate, as a component of the chatbot loss function, a similarity loss that indicates an extent to which the collective generated first responses are semantically dissimilar from the collective example responses, wherein semantic dissimilarity is measured by cosine distance.

### Claim 10 (depends on 8)

The computing system of claim 8, wherein the computer-executable instructions further cause the computing system to execute the chatbot loss function to generate, as a component of the chatbot loss function, an integration loss that indicates how rapidly the generated first responses arrive at an expected answer for the example conversation, wherein arrival at the expected answer is determined by one of the first responses satisfying thresholds for precision and recall with respect to the expected answer.

### Claim 11 (depends on 8)

The computing system of claim 8, wherein the computer-executable instructions further cause the computing system to execute the chatbot loss function to generate, as a component of the chatbot loss function, a step-wise loss that indicates an extent to which the generated first responses are semantically dissimilar from their corresponding example responses in individual rounds of the example conversation, wherein semantic dissimilarity is measured by cosine distance.

### Claim 12 (depends on 8)

The computing system of claim 8, wherein the computer-executable instructions to generate the evaluation score further cause the computing system to:
generate a value of recall between the test responses and the generated second responses;
generate a value of precision between the test responses and the generated second responses;
automatically generate a grading prompt to an additional large language model that requests the additional large language model to grade the generated second responses for a particular criterion;
automatically submit the generated second generated responses and the prompt to the additional large language model to cause the additional large language model to generate a criterion score for the particular criterion based on the generated second responses; and
combine the value of recall, the value of precision, and the criterion score to produce the evaluation score.

### Claim 13 (depends on 8)

The computing system of claim 8, wherein the computer-executable instructions further cause the computing system to parse the sample conversations to extract the example prompts by the querent and the example responses by the agent.

### Claim 14 (depends on 8)

The computing system of claim 8, wherein a condition of satisfying the threshold includes surpassing a previous best for the evaluation score, and wherein the computer-executable instructions further cause the computing system to compare the evaluation score to the previous best for the evaluation score.

### Claim 15

A computer-implemented method, comprising:
accessing a collection of sample conversations between two entities, wherein an individual sample conversation includes one or more rounds of natural language example prompt by a querent and example response by an agent;
fine-tuning a large language model to generate responses in natural language based on a chatbot loss function that evaluates first responses generated by the large language model to the example prompts by the querent;
generating an evaluation score for performance of the tuned large language model as a chatbot based on second responses generated by the tuned large language model to test prompts from a test conversation; and
automatically signaling that the fine-tuning of the tuned large language model to operate as a chatbot is complete in response to the evaluation score satisfying a threshold.

### Claim 16 (depends on 15)

The computer-implemented method of claim 15, further comprising generating a chatbot loss as output from the chatbot loss function by:
generating a similarity loss that indicates an extent to which the collective generated first responses are semantically dissimilar from the collective example responses, wherein semantic dissimilarity is measured by cosine distance;
generating an integration loss that indicates how rapidly the generated first responses arrive at an expected answer for the example conversation, wherein arrival at the expected answer is determined by one of the first responses satisfying thresholds for precision and recall with respect to the expected answer;
generating a step-wise loss that indicates an extent to which the generated first responses are semantically dissimilar from their corresponding example responses in individual rounds of the example conversation; and
combining the similarity loss, integration loss, and step-wise loss into the chatbot loss.

### Claim 17 (depends on 15)

The computer-implemented method of claim 15, wherein generating the evaluation score further comprises:
generating a value of recall between the test responses from the test conversation and the generated second responses;
generating a value of precision between the test responses and the generated second responses; and
combining the values of recall and precision to produce the evaluation score.

### Claim 18 (depends on 15)

The computer-implemented method of claim 15, wherein generating the evaluation score further comprises:
automatically generating a grading prompt to an additional large language model that requests the additional large language model to grade the generated second responses for a particular criterion, wherein the particular criterion is one of non-repetitiveness of the second generated responses, human-readability of the second generated responses, relevance of the second generated responses to corresponding test prompts, conformance to first-person perspective, and conciseness;
automatically submitting the generated second generated responses and the prompt to the additional large language model to cause the additional large language model to generate a criterion score for the particular criterion based on the generated second responses; and
generating the evaluation score based at least in part on the criterion score.

### Claim 19 (depends on 1)

The non-transitory computer-readable media of claim 1 further comprising:
comparing the evaluation score to a previous best for the evaluation score; and
determining that the threshold is satisfied where the evaluation score surpasses the previous best for the evaluation score by a pre-established amount.

### Claim 20 (depends on 1)

The non-transitory computer-readable media of claim 1 further comprising, in response to the signaling that the fine-tuning of tuned large language model to operate as a chatbot is complete, automatically deploying the tuned large language model to a production environment to operate as a chatbot.
