# US 2025/0156411 A1 · Large language model-based question processing method and apparatus, electronic device, and storage medium

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

- Number: US 2025/0156411 A1
- Document ID: US20250156411A1
- Status: Published application
- Kind: A1
- Application number: 18/749,211
- Filed: 2024-06-20
- Published: 2025-05-15
- Earliest claimed: 2023-11-13
- Assignees: Beijing Baidu Netcom Science Technology Co., Ltd.
- Applicants: Beijing Baidu Netcom Science Technology Co., Ltd.
- Inventors: Shaozhen GENG; Jun ZHANG
- Web page: https://patentgrep.com/patent/US20250156411A1

## CPC

- G06F 16/245: Query processing
- G06F 16/258: {Data format conversion from or to a database}
- G06F 40/205: Parsing
- G06F 40/40: Processing or translation of natural language (natural language analysis G06F40/20; semantic analysis G06F40/30)
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Provided are a query processing method based on a large language model, an electronic device, and a storage medium. The query processing method based on a large language model includes acquiring a to-be-processed target query; generating a prompt based on a to-be-used target data model, target format information of a specified data format, and the target query; inputting the prompt into the large language model to obtain a target parsing result of the specified data format outputted by the large language model; and modifying the target parsing result based on the target data model.

## Claims

### Claim 1

A query processing method based on a large language model, comprising:
acquiring a to-be-processed target query;
generating a prompt based on a to-be-used target data model, target format information of a specified data format, and the to-be-processed target query;
inputting the prompt into the large language model to obtain a target parsing result of the specified data format outputted by the large language model; and
modifying the target parsing result based on the target data model.

### Claim 2 (depends on 1)

The query processing method based on the large language model of claim 1, wherein the target format information comprises a dimension field, a measure field, and a filtering condition, wherein the filtering condition comprises a to-be-filtered field, a filtering value of the to-be-filtered field, and an operator of the to-be-filtered field.

### Claim 3 (depends on 1)

The query processing method based on the large language model of claim 1, wherein modifying the target parsing result based on the target data model comprises:
for a filtering condition in the target parsing result, determining a field type of a to-be-filtered field;
in response to the to-be-filtered field being of a character type, acquiring a filtering value of the to-be-filtered field from the filtering condition; and
matching the filtering value of the to-be-filtered field with field values of data fields in the target data model and modifying the to-be-filtered field according to a matching result.

### Claim 4 (depends on 3)

The query processing method based on the large language model of claim 3, wherein matching the filtering value of the to-be-filtered field with the field values of the data fields in the target data model and modifying the to-be-filtered field according to the matching result comprises:
in response to the to-be-filtered field belonging to the data fields, acquiring a field value of the to-be-filtered field from the target data model;
matching the filtering value of the to-be-filtered field with the field value of the to-be-filtered field to obtain a first matching result;
in response to the first matching result being a matching failure, matching the filtering value of the to-be-filtered field with a field value of another data field in the target data model to obtain a second matching result; and
in response to the second matching result being a matching success, modifying the to-be-filtered field to another data field successfully matched.

### Claim 5 (depends on 4)

The query processing method based on the large language model of claim 4, wherein modifying the to-be-filtered field according to the matching result further comprises:
in response to the second matching result being a matching failure, performing word segmentation on the target parsing result to obtain word segmentation information; and
matching the word segmentation information with the data fields in the target data model and modifying the to-be-filtered field to a data field successfully matched.

### Claim 6 (depends on 3)

The query processing method based on the large language model of claim 3, wherein modifying the target parsing result based on the target data model further comprises:
in response to all data fields in the target data model failing to match with the to-be-filtered field, inputting the filtering value of the to-be-filtered field as a query and the field values of the data fields as options into the large language model to obtain a target data field selected by the large language model and modifying the to-be-filtered field to the target data field.

### Claim 7 (depends on 3)

The query processing method based on the large language model of claim 3, wherein modifying the target parsing result based on the target data model further comprises:
in response to the to-be-filtered field being of a date type, performing date formatting on the filtering value of the to-be-filtered field to obtain a date-type value; and
matching the date-type value with a field value of the to-be-filtered field in the target data model and modifying the to-be-filtered field according to a matching result.

### Claim 8 (depends on 2)

The query processing method based on the large language model of claim 2, wherein modifying the target parsing result based on the target data model comprises:
for a target dimension in the target parsing result, in response to the filtering condition using the target dimension as the to-be-filtered field and the operator of the to-be-filtered field being “equal to” or “containing”, deleting the target dimension from the target parsing result.

### Claim 9 (depends on 2)

The query processing method based on the large language model of claim 2, wherein modifying the target parsing result based on the target data model comprises:
in response to modifying the to-be-filtered field in the filtering condition to a target data field based on the target data model and the to-be-filtered field being a target dimension or a target measure in the target parsing result, modifying the target dimension or the target measure in the target parsing result to the target data field.

### Claim 10 (depends on 2)

The query processing method based on the large language model of claim 2, wherein modifying the target parsing result based on the target data model comprises:
in response to to-be-filtered fields in at least two filtering conditions being the same, combining the at least two filtering conditions.

### Claim 11 (depends on 1)

The query processing method based on the large language model of claim 1, wherein generating the prompt based on the target data model and the to-be-processed target query comprises:
acquiring a data field in the target data model and acquiring the target format information of the specified data format; and
constructing the prompt based on the data field in the target data model, the target format information, and the to-be-processed target query,
wherein the target parsing result is configured for establishment of a relationship between the to-be-processed target query and the data field in the target data model, and the target parsing result is a serialized result.

### Claim at position 12

12-22. (canceled)

### Claim 23

An electronic device, comprising:
at least one processor; and
a memory communicatively connected to the at least one processor,
wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the following:
acquiring a to-be-processed target query;
generating a prompt based on a to-be-used target data model, target format information of a specified data format, and the to-be-processed target query;
inputting the prompt into a large language model to obtain a target parsing result of the specified data format outputted by the large language model; and
modifying the target parsing result based on the target data model.

### Claim 24

A non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the following:
acquiring a to-be-processed target query;
generating a prompt based on a to-be-used target data model, target format information of a specified data format, and the to-be-processed target query;
inputting the prompt into a large language model to obtain a target parsing result of the specified data format outputted by the large language model; and
modifying the target parsing result based on the target data model.

### Claim 25 (depends on 23)

The electronic device of claim 23, wherein the target format information comprises a dimension field, a measure field, and a filtering condition, wherein the filtering condition comprises a to-be-filtered field, a filtering value of the to-be-filtered field, and an operator of the to-be-filtered field.

### Claim 26 (depends on 23)

The electronic device of claim 23, wherein the at least one processor is enabled to perform modifying the target parsing result based on the target data model by:
for a filtering condition in the target parsing result, determining a field type of a to-be-filtered field;
in response to the to-be-filtered field being of a character type, acquiring a filtering value of the to-be-filtered field from the filtering condition; and
matching the filtering value of the to-be-filtered field with field values of data fields in the target data model and modifying the to-be-filtered field according to a matching result.

### Claim 27 (depends on 26)

The electronic device of claim 26, wherein the at least one processor is enabled to perform matching the filtering value of the to-be-filtered field with the field values of the data fields in the target data model and modifying the to-be-filtered field according to the matching result by:
in response to the to-be-filtered field belonging to the data fields, acquiring a field value of the to-be-filtered field from the target data model;
matching the filtering value of the to-be-filtered field with the field value of the to-be-filtered field to obtain a first matching result;
in response to the first matching result being a matching failure, matching the filtering value of the to-be-filtered field with a field value of another data field in the target data model to obtain a second matching result; and
in response to the second matching result being a matching success, modifying the to-be-filtered field to another data field successfully matched.

### Claim 28 (depends on 27)

The electronic device of claim 27, wherein the at least one processor is enabled to perform modifying the to-be-filtered field according to the matching result further by:
in response to the second matching result being a matching failure, performing word segmentation on the target parsing result to obtain word segmentation information; and
matching the word segmentation information with the data fields in the target data model and modifying the to-be-filtered field to a data field successfully matched.

### Claim 29 (depends on 26)

The electronic device of claim 26, wherein the at least one processor is enabled to perform modifying the target parsing result based on the target data model further by:
in response to all data fields in the target data model failing to match with the to-be-filtered field, inputting the filtering value of the to-be-filtered field as a query and the field values of the data fields as options into the large language model to obtain a target data field selected by the large language model and modifying the to-be-filtered field to the target data field.

### Claim 30 (depends on 26)

The electronic device of claim 26, wherein the at least one processor is enabled to perform modifying the target parsing result based on the target data model further by:
in response to the to-be-filtered field being of a date type, performing date formatting on the filtering value of the to-be-filtered field to obtain a date-type value; and
matching the date-type value with a field value of the to-be-filtered field in the target data model and modifying the to-be-filtered field according to a matching result.

### Claim 31 (depends on 25)

The electronic device of claim 25, wherein the at least one processor is enabled to perform modifying the target parsing result based on the target data model by:
for a target dimension in the target parsing result, in response to the filtering condition using the target dimension as the to-be-filtered field and the operator of the to-be-filtered field being “equal to” or “containing”, deleting the target dimension from the target parsing result.
