IP Library › Granted Patent US 12,554,888
Granted Patent B2
US 12,554,888 · App. 18/513,334 · Granted Feb 17, 2026

Privacy-preserving prompt engineering for generative artificial intelligence

Inventor: Laurent Gomez (Pégomas, FR)
Assignee: SAP SE
G06F21/6254G06F21/606G06F21/6227
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,554,888
App. No.
18/513,334
Filed
Nov 17, 2023
Granted
Feb 17, 2026
Kind
B2
Art Unit
2446
USPC
726/28
Abstract

Certain aspects of the disclosure concern a computer-implemented method for improved data security when interacting with a large language model. The method includes receiving a prompt query entered through a user interface, detecting sensitive data in the prompt query that violates a security protocol, generating a modified prompt query which anonymizes the sensitive data, submitting the modified prompt query to a large language model, and receiving a reply generated by the large language model. The reply contains anonymized sensitive data. The method further includes generating a modified reply which deanonymizes the anonymized sensitive data and presenting the modified reply on the user interface.

Claims (51)

1 . A computer-implemented method comprising:

receiving a prompt query entered through a user interface;

detecting sensitive data in the prompt query that violates a security protocol;

generating a modified prompt query which anonymizes the sensitive data;

submitting the modified prompt query to a large language model;

receiving a reply generated by the large language model, wherein the reply contains anonymized sensitive data;

generating a modified reply which deanonymizes the anonymized sensitive data; and

presenting the modified reply on the user interface,

wherein generating the modified prompt query comprises combining the prompt query with a context query, wherein the context query is configured to explicitly instruct the large language model to utilize only the anonymized sensitive data contained in the modified prompt query without replacements.

2 . The method of claim 1 , wherein generating the modified prompt query comprises:

hashing the sensitive data using a hash algorithm to convert one or more pieces of the sensitive data into one or more unique hash values; and

replacing the one or more pieces of the sensitive data in the prompt query with the one or more unique hash values.

3 . The method of claim 2 , further comprising persisting a mapping between the one or more pieces of the sensitive data and the one or more unique hash values in a local storage.

4 . The method of claim 3 , wherein the anonymized sensitive data in the reply comprises the one or more unique hash values, wherein generating the modified reply comprises replacing the one or more unique hash values in the reply with the one or more pieces of the sensitive data based on the mapping persisted in the local storage.

5 . The method of claim 1 , wherein the context query is configured to instruct the large language model to generate a script written in a specified programming language in the reply.

6 . The method of claim 1 , wherein generating the modified reply comprises executing the script generated by the large language model.

7 . The method of claim 1 , wherein the context query is configured to instruct the large language model to conclude the script with a return statement, which is configured to return a data structure containing computed information based on content of the prompted query.

8 . The method of claim 7 , wherein the script is written in JavaScript and the data structure is a JSON structure.

9 . The method of claim 5 , wherein the script includes on or more arithmetic or logistic operations that are configured to be executed to produce computed results based on the anonymized sensitive data.

10 . The method of claim 1 , wherein the context query is configured to instruct the large language model that the generated script is not enclosed within a named function so that the script is directly executable in a global scope.

11 . A computing system comprising:

memory;

one or more hardware processors coupled to the memory; and

one or more computer readable storage media storing instructions that, when loaded into the memory, cause the one or more hardware processors to perform operations comprising:

receiving a prompt query entered through a user interface;

detecting sensitive data in the prompt query that violates a security protocol;

generating a modified prompt query which anonymizes the sensitive data;

submitting the modified prompt query to a large language model;

receiving a reply generated by the large language model, wherein the reply contains anonymized sensitive data;

generating a modified reply which deanonymizes the anonymized sensitive data; and

presenting the modified reply on the user interface,

wherein generating the modified prompt query comprises combining the prompt query with a context query, wherein the context query is configured to explicitly instruct the large language model to utilize only the anonymized sensitive data contained in the modified prompt query without replacements.

12 . The system of claim 11 , wherein generating the modified prompt query comprises:

hashing the sensitive data using a hash algorithm to convert one or more pieces of the sensitive data into one or more unique hash values; and

replacing the one or more pieces of the sensitive data in the prompt query with the one or more unique hash values.

13 . The system of claim 12 , wherein the operations further comprise persisting a mapping between the one or more pieces of the sensitive data and the one or more unique hash values in a local storage.

14 . The system of claim 13 , wherein the anonymized sensitive data in the reply comprises the one or more unique hash values, wherein generating the modified reply comprises replacing the one or more unique hash values in the reply with the one or more pieces of the sensitive data based on the mapping persisted in the local storage.

15 . The system of claim 11 , wherein the context query is configured to instruct the large language model to generate a script written in a specified programming language in the reply.

16 . The system of claim 11 , wherein generating the modified reply comprises executing the script generated by the large language model.

17 . The system of claim 11 , wherein the context query is configured to instruct the large language model to conclude the script with a return statement, which is configured to return a data structure containing computed information based on content of the prompted query.

18 . The system of claim 15 , wherein the script includes on or more arithmetic or logistic operations that are configured to be executed to produce computed results based on the anonymized sensitive data.

19 . The system of claim 11 , wherein the context query is configured to instruct the large language model that the generated script is not enclosed within a named function so that the script is directly executable in a global scope.

20 . One or more non-transitory computer-readable media having encoded thereon computer-executable instructions causing one or more processors to perform a method, the method comprising:

receiving a prompt query entered through a user interface;

detecting sensitive data in the prompt query that violates a security protocol;

generating a modified prompt query which anonymizes the sensitive data;

submitting the modified prompt query to a large language model;

receiving a reply generated by the large language model, wherein the reply contains anonymized sensitive data;

generating a modified reply which deanonymizes the anonymized sensitive data; and

presenting the modified reply on the user interface,

wherein generating the modified prompt query comprises combining the prompt query with a context query, wherein the context query is configured to explicitly instruct the large language model to utilize only the anonymized sensitive data contained in the modified prompt query without replacements.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Aug 9, 2024
From: GOMEZ, LAURENT
To: SAP SE
Reel/Frame 068240/0842 →
Continuity (1)
Related Publication 20250165648A1 · May 22, 2025
References Cited (15)
US 20170061143A1 · Rooney · 2017 [cited by examiner]
US 20230394026A1 · Kesarwani · 2023 [cited by examiner]
US 20250085934A1 · Kunz · 2025 [cited by examiner]
US 20250110975A1 · Shea · 2025 [cited by examiner]
US 20250110976A1 · Channapattan · 2025 [cited by examiner]
US 20250123820A1 · Khan · 2025 [cited by examiner]
US 20250131121A1 · Teng · 2025 [cited by examiner]
Wikipedia, “Named-entity recognition,” https://en.wikipedia.org/wiki/Named-entity_recognition, 7 pages (accessed Oct. 12, 2023). [cited by applicant]
Wikipedia, “Part-of-speech tagging,” https://en.wikipedia.org/wiki/Part-of-speech_tagging, 5 pages (accessed Oct. 12, 2023). [cited by applicant]
Jurafsky et al., “Dependency Parsing,” [cited by applicant]
GeeksforGeeks, “What is a Large Language Model (LLM),” https://www.geeksforgeeks.org/large-language-model-llm/, 15 pages (accessed Oct. 10, 2023). [cited by applicant]
Wikipedia, “Transfer learning,” https://en.wikipedia.org/wiki/Transfer_learning, 4 pages (accessed Oct. 12, 2023). [cited by applicant]
Ali, “Supervised Machine Learning,” [cited by applicant]
Alhamid, “Ensemble Models: What Are They and When Should You Use Them?,” [cited by applicant]
Wikipedia, “Active learning (machine learning),” https://en.wikipedia.org/wiki/Active_learning_(machine learning), 4 pages (accessed Oct. 12, 2023). [cited by applicant]