# US 2025/0156653 A1 · Enhancing large language models using in-context learning and online knowledge

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

- Number: US 2025/0156653 A1
- Document ID: US20250156653A1
- Status: Published application
- Kind: A1
- Application number: 18/509,678
- Filed: 2023-11-15
- Published: 2025-05-15
- Earliest claimed: 2023-11-15
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Zhong Fang Yuan; Tong Liu; Shi Bo Yan; Lin Feng
- Web page: https://patentgrep.com/patent/US20250156653A1

## CPC

- G06F 40/40: Processing or translation of natural language (natural language analysis G06F40/20; semantic analysis G06F40/30)
- G06F 16/3347: {using vector based model}
- G06F 40/30: Semantic analysis
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

One or more systems, devices, computer program products and/or computer-implemented methods of use provided herein relate to enhancing LLMs using in-context learning and online knowledge. The computer-implemented system can comprise a memory that can store computer executable components. The computer-implemented system can further comprise a processor that can execute the computer executable components stored in the memory, wherein the computer executable components can comprise a semantic retrieval component that can extract information from an online source, according to a query, to generate an in-context learning input utilized by an LLM for responding to the query.

## Claims

### Claim 1

A system, comprising:
a memory that stores computer-executable components; and
a processor that executes the computer-executable components stored in the memory, wherein the computer-executable components comprise:
a semantic retrieval component that extracts information from an online source, according to a query, to generate an in-context learning input utilized by a large language model (LLM) for responding to the query.

### Claim 2 (depends on 1)

The system of claim 1, wherein the semantic retrieval component uses Simple Contrastive Learning of Sentence Embeddings (SimCSE), tagging and semantic searching to extract the information from the online source.

### Claim 3 (depends on 1)

The system of claim 1, further comprising:
an information extraction component that generates a virtual graph based on respective subject-predicate-object (SPO) structures of respective candidate knowledge sentences retrieved by the semantic retrieval component and that extracts an SPO structure of an initial response generated by the LLM.

### Claim 4 (depends on 3)

The system of claim 3, wherein the information extraction component uses an algorithm to extract the respective SPO structures from the respective candidate knowledge sentences and to extract the SPO structure from the initial response generated by the LLM.

### Claim 5 (depends on 3)

The system of claim 3, wherein the semantic retrieval component uses the virtual graph and the SPO structure to generate a subgraph that is used by the LLM for generating a response to the query.

### Claim 6 (depends on 5)

The system of claim 5, further comprising:
a filtering component that uses a Conditional Random Field (CRF) model to filter the response generated by the LLM and constraint the response within a semantic knowledge scope for the query.

### Claim 7 (depends on 1)

The system of claim 1, wherein responses generated by the LLM over time are used to build a first level knowledge graph that the LLM uses to respond to subsequent queries.

### Claim 8 (depends on 7)

The system of claim 7, wherein the first level knowledge graph increases inference efficiency of the LLM above a defined threshold.

### Claim 9

A computer-implemented method, comprising:
extracting, by a system operatively coupled to a processor, information from an online source, according to a query, to generate an in-context learning input utilized by an LLM for responding to the query.

### Claim 10 (depends on 9)

The computer-implemented method of claim 9, further comprising:
using, by the system, SimCSE, tagging and semantic searching to extract the information from the online source.

### Claim 11 (depends on 9)

The computer-implemented method of claim 9, further comprising:
generating, by the system, a virtual graph based on respective SPO structures of respective candidate knowledge sentences retrieved from the online source; and
extracting, by the system, an SPO structure of an initial response generated by the LLM.

### Claim 12 (depends on 11)

The computer-implemented method of claim 11, further comprising:
using, by the system, an algorithm to extract the respective SPO structures from the respective candidate knowledge sentences and to extract the SPO structure from the initial response generated by the LLM.

### Claim 13 (depends on 11)

The computer-implemented method of claim 11, further comprising:
using, by the system, the virtual graph and the SPO structure to generate a subgraph that is used by the LLM for generating a response to the query.

### Claim 14 (depends on 13)

The computer-implemented method of claim 13, further comprising:
using, by the system, a CRF model to filter the response generated by the LLM and constraint the response within a semantic knowledge scope for the query.

### Claim 15 (depends on 9)

The computer-implemented method of claim 9, further comprising:
using, by the system, responses generated by the LLM over time to build a first level knowledge graph that the LLM uses to respond to subsequent queries.

### Claim 16 (depends on 15)

The computer-implemented method of claim 15, wherein the first level knowledge graph increases inference efficiency of the LLM above a defined threshold.

### Claim 17

A computer program product for using in-context learning for LLMs, the computer program product comprising a computer readable storage medium having program instructions embodied therewith, the program instructions executable by a processor to cause the processor to:
extract, by the processor, information from an online source, according to a query, to generate an in-context learning input utilized by an LLM for responding to the query.

### Claim 18 (depends on 17)

The computer program product of claim 17, wherein the program instructions are further executable by the processor to cause the processor to:
use, by the processor, SimCSE, tagging and semantic searching to extract the information from the online source.

### Claim 19 (depends on 17)

The computer program product of claim 17, wherein the program instructions are further executable by the processor to cause the processor to:
generate, by the processor, a virtual graph based on respective SPO structures of respective candidate knowledge sentences retrieved from the online source; and
extract, by the processor, an SPO structure of an initial response generated by the LLM.

### Claim 20 (depends on 19)

The computer program product of claim 19, wherein the program instructions are further executable by the processor to cause the processor to:
use, by the processor, an algorithm to extract the respective SPO structures from the respective candidate knowledge sentences and to extract the SPO structure from the initial response generated by the LLM.
