IP Library › Granted Patent US 12,481,652
Granted Patent B1
US 12,481,652 · App. 18/932,150 · Granted Nov 25, 2025

Contextual identifier-attribute mappings for large language models

Inventor: Chenghung James Pan (Palo Alto, CA)
Assignee: Palo Alto Networks, Inc.
G06F16/2452G06F16/243G06F40/186G06F40/284G06F40/40
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,481,652
App. No.
18/932,150
Granted
Nov 25, 2025
Kind
B1
Abstract

A contextual natural language query response system (contextual system) leverages contextual attribute-identifier mappings to improve large language model (LLM) responses to natural language queries. The contextual system replaces identifiers in natural language queries with attributes according to a contextual mapping table between identifiers and attributes to generate attribute-based natural language queries. The contextual system then uses retrieval-augmented generation with the attributes-based natural language queries to prompt an LLM to generate attribute-based database queries. The contextual system uses the mappings from the contextual mapping table to convert the attribute-based database queries to identifier-based database queries and queries a database with the identifier-based database queries. The contextual system responses to the natural language queries using results from querying the database.

Claims (58)

1 . A method comprising:

based on receiving a first natural language query for data in one or more databases related to a domain, identifying one or more identifiers of one or more entities in the first natural language query;

determining a mapping between the one or more identifiers in the first natural language query and one or more entity attributes according to a mapping table between entity identifiers and entity attributes for the domain;

replacing, in the first natural language query, the one or more identifiers with mapped ones of the one or more entity attributes indicated in the mapping to obtain a second natural language query;

prompting a foundation model with a first prompt to obtain first one or more database queries for the one or more databases, wherein the first prompt comprises the second natural language query and task instructions to generate first one or more database queries for the one or more databases based on the second natural language query;

replacing those of the one or more entity attributes in the first one or more database queries with corresponding ones of the one or more identifiers according to the mapping to generate second one or more database queries; and

querying the one or more databases with the second one or more database queries to obtain results based on which to generate a response to the first natural language query.

2 . The method of claim 1 further comprising:

retrieving one or more examples from a knowledge base according to similarity with the second natural language query; and

populating a prompt template with the one or more examples and the second natural language query to generate the first prompt.

3 . The method of claim 2 , wherein the one or more examples comprise example attribute-based natural language queries and corresponding example attribute-based database queries.

4 . The method of claim 2 , wherein retrieving the one or more examples from the knowledge base comprises:

generating an embedding of the second natural language query; and

querying the knowledge base with the embedding.

5 . The method of claim 2 , further comprising populating the knowledge base with example attribute-based natural language queries and corresponding example attribute-based database queries, wherein populating the knowledge base comprises:

obtaining example identifier-based natural language queries and corresponding example identifier-based database queries; and

replacing identifiers of entities with corresponding entity attributes in the example identifier-based natural language queries and the example identifier-based database queries according to the mapping table to obtain the example attribute-based natural language queries and the example attribute-based database queries.

6 . The method of claim 2 , wherein the prompt template comprises a description of one or more schemas for one or more query languages of the one or more databases and indications of which of the one or more query languages correspond to the one or more databases.

7 . The method of claim 1 , wherein the domain comprises Internet of Things devices, wherein the entity attributes comprise at least one of device categories, device vendors, and device models.

8 . The method of claim 6 , wherein the one or more query languages comprise the Structured Query Language.

9 . The method of claim 1 , wherein determining the mapping between the one or more identifiers in the first natural language query and one or more entity attributes comprises,

performing a longest prefix search in the first natural language query for at least one of identifiers and identifier prefixes stored in the mapping table to identify the one or more identifiers; and

mapping the one or more identifiers to corresponding ones of the one or more entity attributes according to the mapping table to generate the mapping.

10 . A non-transitory machine-readable medium having program code stored thereon, the program code comprising instructions to:

based on receiving a first natural language query for data in a database, extract one or more identifiers of one or more entities from the first natural language query;

determine a mapping between the one or more identifiers in the first natural language query and one or more entity attributes according to a mapping table between entity identifiers and entity attributes, wherein the mapping table is based on context of a domain related to the database;

replace, in the first natural language query, the one or more identifiers with mapped ones of the one or more entity attributes indicated in the mapping to obtain a second natural language query;

prompt a foundation model with a first prompt to obtain a first database query for the database, wherein the first prompt comprises the second natural language query and task instructions to generate first database query for the database based on the second natural language query;

replace those of the one or more entity attributes in the first database query with corresponding ones of the one or more identifiers according to the mapping to generate a second database query; and

query the database with the second database query to obtain results based on which to generate a response to the first natural language query.

11 . The machine-readable media of claim 10 , wherein the program code further comprises instructions to:

retrieve one or more examples from a knowledge base according to similarity with the second natural language query; and

populate a prompt template with the one or more examples and the second natural language query to generate the first prompt.

12 . The machine-readable media of claim 11 , wherein the one or more examples comprise example attribute-based natural language queries and corresponding example attribute-based database queries.

13 . The machine-readable media of claim 11 , wherein the instructions to retrieve the one or more examples from the knowledge base comprise instructions to:

generate an embedding of the second natural language query; and

query the knowledge base with the embedding.

14 . The machine-readable media of claim 12 , wherein the program code further comprises instructions to populate the knowledge base with example attribute-based natural language queries and corresponding example attribute-based database queries, wherein the instructions to populate the knowledge base comprise instructions to:

obtain example identifier-based natural language queries and corresponding example identifier-based database queries; and

replace identifiers of entities with corresponding entity attributes in the example identifier-based natural language queries and the example identifier-based database queries according to the mapping table to obtain the example attribute-based database queries and the example attribute-based database queries.

15 . The machine-readable media of claim 12 , wherein the prompt template comprises a description of one or more schemas for a query language of the database.

16 . An apparatus comprising:

a processor; and

a machine-readable medium having instructions stored thereon that are executable by the processor to cause the apparatus to,

scan a first natural language query to identify and replace one or more identifiers of one or more entities with corresponding one or more attributes of the one or more entities in the first natural language query to generate a second natural language query, wherein the first natural language query is for data in a database related to a domain, wherein the instructions to identify and replace the one or more identifiers with the corresponding one or more attributes comprise instructions executable by the processor to cause the apparatus to map the one or more identifiers to the one or more attributes according to a mapping in a mapping table between entity identifiers and entity attributes for the domain;

prompt a foundation model with a first prompt to obtain a first database query for the database, wherein the first prompt comprises the second natural language query and task instructions to generate a first database query for the database based on the second natural language query;

replace those of the one or more attributes in the first database query with corresponding ones of the one or more identifiers according to the mapping to generate a second database query; and

query the database with the second database query to obtain results based on which to generate a response to the first natural language query.

17 . The apparatus of claim 16 , wherein the machine-readable medium further has stored thereon instructions executable by the processor to cause the apparatus to:

retrieve one or more examples from a knowledge base according to similarity with the second natural language query; and

populate a prompt template with the one or more examples and the second natural language query to generate the first prompt.

18 . The apparatus of claim 17 , wherein the one or more examples comprise example attribute-based natural language queries and corresponding example attribute-based database queries.

19 . The apparatus of claim 17 , wherein the instructions to retrieve the one or more examples from the knowledge base comprise instructions executable by the processor to cause the apparatus to:

generate an embedding of the second natural language query; and

query the knowledge base with the embedding.

20 . The apparatus of claim 17 , wherein the machine-readable medium further has stored thereon instructions executable by the processor to cause the apparatus to populate the knowledge base with example attribute-based natural language queries and corresponding example attribute-based database queries, wherein the instructions to populate the knowledge base comprise instructions executable by the processor to cause the apparatus to:

obtain example identifier-based natural language queries and corresponding example identifier-based database queries; and

replace identifiers of entities with corresponding entity attributes in the example identifier-based natural language queries and the example identifier-based database queries according to the mapping table to obtain the example attribute-based natural language queries and the example attribute-based database queries.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 30, 2024
From: PAN, CHENGHUNG JAMES
To: PALO ALTO NETWORKS, INC.
Reel/Frame 069079/0806 →
References Cited (35)
US 10817527B1 · Setlur · 2020 [cited by examiner]
US 11960500B1 · Sboychakova · 2024 [cited by examiner]
US 12197452B1 · Merchant · 2025 [cited by examiner]
US 12217029B1 · Andre · 2025 [cited by examiner]
US 20180349343A1 · Bull · 2018 [cited by examiner]
US 20190043483A1 · Chakraborty · 2019 [cited by examiner]
US 20190180258A1 · Amar · 2019 [cited by examiner]
US 20190325498A1 · Clark · 2019 [cited by examiner]
US 20200142888A1 · Alakuijala · 2020 [cited by examiner]
US 20220318860A1 · Dorch · 2022 [cited by examiner]
US 20230078177A1 · Wang · 2023 [cited by examiner]
US 20230281230A1 · Kukla · 2023 [cited by examiner]
US 20240126795A1 · Zhong · 2024 [cited by examiner]
US 20240202461A1 · Pagnoni · 2024 [cited by examiner]
US 20240289407A1 · Rofouei · 2024 [cited by examiner]
US 20240296295A1 · Russell · 2024 [cited by examiner]
US 20240311546A1 · Maschmeyer · 2024 [cited by examiner]
US 20240354436A1 · Mukherjee · 2024 [cited by examiner]
US 20240354710A1 · Logiotatidis · 2024 [cited by examiner]
US 20240411813A1 · Yim · 2024 [cited by examiner]
US 20250068627A1 · Hoang · 2025 [cited by examiner]
Quamar, Abdul et al., “Natural Language Interfaces to Data”, Foundations and Trends in Databases: vol. 11, No. 4 , Dec. 26, 2022 (Dec. 26, 2022), pp. 319-414, DOT: 10.1561/1900000078. [cited by examiner]
Barron, et al., “Domain-Specific Retrieval-Augmented Generation Using Vector Stores, Knowledge Graphs, and Tensor Factorization”, arXiv: 2410.02721v1 [cs.CL] Oct. 3, 2024, 8 pages. [cited by applicant]
Cui, et al., “LLMind: Orchestrating AI and IoT with LLM for Complex Task Execution”, arXiv:2312.09007v4 [cs.IT] Aug. 9, 2024, 7 pages. [cited by applicant]
Das, et al., “Security and Privacy Challenges of Large Language Models: A Survey”, arXiv:2402.00888v2 [cs.CL] Nov. 14, 2024, 51 pages. [cited by applicant]
Embley, et al., “Mapping Conceptual Models to Database Schemas”, Handbook of Conceptual Modeling: Theory, Practice, and Research Challenges, Mar. 13, 2011, 44 pages. [cited by applicant]
Freitas, “Schema-Agnostic Queries for Large-Schema Databases: A Distributional Semantics Approach”, National University of Ireland, Galway Doctoral Thesis [online], retrieved from the Internet Dec. 20, 2024 from <https:… [cited by applicant]
Gao, et al., “Retrieval-Augmented Generation for Large Language Models: A Survey”, arXiv:2312.10997v5 [cs.CL] Mar. 27, 2024, 21 pages. [cited by applicant]
Keddhar, “Transformers and Large Language Models for Efficient Intrusion Detection Systems: A Comprehensive Survey”, arXiv:2408.07583v1 [cs.CR] Aug. 14, 2024, 34 pages. [cited by applicant]
Li, et al., “Enhancing LLM Factual Accuracy with RAG to Counter Hallucinations: A Case Study on Domain-Specific Queries in Private Knowledge-Bases”, arXiv:2403.10446v1 [cs.CL] Mar. 15, 2024, 10 pages. [cited by applicant]
Mandal, et al., “Effectiveness of Transformer Models on IoT Security Detection in StackOverflow Discussions”, arXiv:2207.14542v1 [cs.CR] Jul. 29, 2022, 12 pages. [cited by applicant]
Meyuhas, et al., “IoT Device Labeling Using Large Language Models”, arXiv:2403.01586v1 [cs.CR] Mar. 3, 2024, 11 pages. [cited by applicant]
Mohammadi, et al., “Deep Learning for IoT Big Data and Streaming Analytics: A Survey”, arXiv:1712.04301v2 [cs.NI] Jun. 5, 2018, 40 pages. [cited by applicant]
Rudniy, et al., “Mapping biological entities using the longest approximately common prefix method”, BMC Bioinformatics vol. 15, No. 1,87, Jun. 14, 2014, 10 pages, doi: 10.1186/1471-2105-15-187. [cited by applicant]
Xiao, et al., “Efficient Prompting for LLM-based Generative Internet of Things”, IEEE Internet of Things Journal, vol. 12, No. 1, Jan. 1, 2025, pp. 778-791, doi: 10.1109/JIOT.2024.3470210, Oct. 2024. [cited by applicant]