# US 2025/0156652 A1 · Real-time adaptation of machine learning models using large language models

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

- Number: US 2025/0156652 A1
- Document ID: US20250156652A1
- Status: Published application
- Kind: A1
- Application number: 18/508,428
- Filed: 2023-11-14
- Published: 2025-05-15
- Earliest claimed: 2023-11-14
- Assignees: Sap SE
- Applicants: Sap SE
- Inventors: Yi Quan Zhou; Prawira Putra Fadjar; Bee Huang Tan; Kham Sian Mung; Jing Li
- Web page: https://patentgrep.com/patent/US20250156652A1

## CPC

- G06F 40/40: Processing or translation of natural language (natural language analysis G06F40/20; semantic analysis G06F40/30)
- G06F 11/3428: {Benchmarking}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Methods, systems, and computer-readable storage media for generating a detection prompt at least partially based on unstructured data determined from one or more of a query entity and a target entity, determining an unstructured data pattern vector that is representative of an output of a LLM that is responsive to the detection prompt, providing a data pattern metric based on the unstructured data pattern vector, generating an explanation prompt at least partially based on the inference result, determining a correctness result that is representative of a correctness of the inference result using explanation text that is generated by the LLM, in response to determining that there is a threshold decrease in accuracy at least partially based on the correctness result, automatically executing one of fine-tuning of the ML model and re-training of the ML model to provide an adapted ML model.

## Claims

### Claim 1

A computer-implemented method for real-time monitoring of performance of a ML model and selectively triggering one of fine-tuning and re-training of the machine learning (ML) model, the method being executed by one or more processors and comprising:
receiving a query entity and a target entity pair that are input to the ML model;
receiving an inference result output from the ML model;
generating a detection prompt at least partially based on unstructured data determined from one or more of the query entity and the target entity;
determining a data pattern vector that is representative of an output of a large language model (LLM) that is responsive to the detection prompt;
providing a data pattern metric based on the data pattern vector;
generating an explanation prompt at least partially based on the inference result;
determining a correctness result that is representative of a correctness of the inference result using explanation text that is generated by the LLM and is responsive to the explanation prompt;
in response to determining that there is a threshold decrease in accuracy at least partially based on the correctness result, automatically executing one of fine-tuning of the ML model and re-training of the ML model responsive to the data pattern metric to provide an adapted ML model; and
deploying the adapted ML model for inference.

### Claim 2 (depends on 1)

The method of claim 1, wherein fine-tuning of the ML model is triggered in response to determining that there is a sufficient data pattern change based on the data pattern metric.

### Claim 3 (depends on 1)

The method of claim 1, wherein re-training of the ML model is triggered in response to determining that there is not a sufficient data pattern change based on the data pattern metric.

### Claim 4 (depends on 1)

The method of claim 1, wherein providing a data pattern metric comprises comparing the data pattern vector to a summary data pattern vector.

### Claim 5 (depends on 1)

The method of claim 1, wherein determining that there is a threshold decrease in accuracy comprises:
determining an accuracy based on the correctness result and historical correctness results; and
comparing the accuracy to a benchmark accuracy.

### Claim 6 (depends on 1)

The method of claim 1, wherein each of the detection prompt and the explanation prompt is provided as a few-shot prompt.

### Claim 7 (depends on 1)

The method of claim 1, wherein fine-tuning is performed using a sub-set of query entity and target entity pairs previously used for inference, and re-training is performed using an entirety of query entity and target entity pairs previously used for inference.

### Claim 8

A non-transitory computer-readable storage medium coupled to one or more processors and having instructions stored thereon which, when executed by the one or more processors, cause the one or more processors to perform operations for real-time monitoring of performance of a machine learning (ML) model and selectively triggering one of fine-tuning and re-training of the ML model, the operations comprising:
receiving a query entity and a target entity pair that are input to the ML model;
receiving an inference result output from the ML model for the query entity and the target entity pair;
generating a detection prompt at least partially based on unstructured data determined from one or more of the query entity and the target entity;
determining an unstructured data pattern vector that is representative of an output of a large language model (LLM) that is responsive to the detection prompt;
providing a data pattern metric based on the unstructured data pattern vector;
generating an explanation prompt at least partially based on the inference result;
determining a correctness result that is representative of a correctness of the inference result using explanation text that is generated by the LLM and is responsive to the explanation prompt;
in response to determining that there is a threshold decrease in accuracy at least partially based on the correctness result, automatically executing one of fine-tuning of the ML model and re-training of the ML model responsive to the data pattern metric to provide an adapted ML model; and
deploying the adapted ML model for inference.

### Claim 9 (depends on 8)

The non-transitory computer-readable storage medium of claim 8, wherein fine-tuning of the ML model is triggered in response to determining that there is a sufficient data pattern change based on the data pattern metric.

### Claim 10 (depends on 8)

The non-transitory computer-readable storage medium of claim 8, wherein re-training of the ML model is triggered in response to determining that there is not a sufficient data pattern change based on the data pattern metric.

### Claim 11 (depends on 8)

The non-transitory computer-readable storage medium of claim 8, wherein providing a data pattern metric comprises comparing the unstructured data pattern vector to an existing unstructured data pattern vector.

### Claim 12 (depends on 8)

The non-transitory computer-readable storage medium of claim 8, wherein determining that there is a threshold decrease in accuracy comprises:
determining an accuracy based on the correctness result and historical correctness results; and
comparing the accuracy to a benchmark accuracy.

### Claim 13 (depends on 8)

The non-transitory computer-readable storage medium of claim 8, wherein each of the detection prompt and the explanation prompt is provided as a few-shot prompt.

### Claim 14 (depends on 8)

The non-transitory computer-readable storage medium of claim 8, wherein fine-tuning is performed using a sub-set of query entity and target entity pairs previously used for inference, and re-training is performed using an entirety of query entity and target entity pairs previously used for inference.

### Claim 15

A system, comprising:
a computing device; and
a computer-readable storage device coupled to the computing device and having instructions stored thereon which, when executed by the computing device, cause the computing device to perform operations for real-time monitoring of performance of a machine learning (ML) model and selectively triggering one of fine-tuning and re-training of the ML model, the operations comprising:
receiving a query entity and a target entity pair that are input to the ML model;
receiving an inference result output from the ML model for the query entity and the target entity pair;
generating a detection prompt at least partially based on unstructured data determined from one or more of the query entity and the target entity;
determining an unstructured data pattern vector that is representative of an output of a large language model (LLM) that is responsive to the detection prompt;
providing a data pattern metric based on the unstructured data pattern vector;
generating an explanation prompt at least partially based on the inference result;
determining a correctness result that is representative of a correctness of the inference result using explanation text that is generated by the LLM and is responsive to the explanation prompt;
in response to determining that there is a threshold decrease in accuracy at least partially based on the correctness result, automatically executing one of fine-tuning of the ML model and re-training of the ML model responsive to the data pattern metric to provide an adapted ML model; and
deploying the adapted ML model for inference.

### Claim 16 (depends on 15)

The system of claim 15, wherein fine-tuning of the ML model is triggered in response to determining that there is a sufficient data pattern change based on the data pattern metric.

### Claim 17 (depends on 15)

The system of claim 15, wherein re-training of the ML model is triggered in response to determining that there is not a sufficient data pattern change based on the data pattern metric.

### Claim 18 (depends on 15)

The system of claim 15, wherein providing a data pattern metric comprises comparing the unstructured data pattern vector to an existing unstructured data pattern vector.

### Claim 19 (depends on 15)

The system of claim 15, wherein determining that there is a threshold decrease in accuracy comprises:
determining an accuracy based on the correctness result and historical correctness results; and
comparing the accuracy to a benchmark accuracy.

### Claim 20 (depends on 15)

The system of claim 15, wherein each of the detection prompt and the explanation prompt is provided as a few-shot prompt.
