IP Library Granted Patent US 12,493,772
Granted Patent B1
US 12,493,772 · App. 18/759,617 · Granted Dec 9, 2025

Layered multi-prompt engineering for pre-trained large language models

Inventors: William Franklin Cameron (Jacksonville, FL); Miriam Silver (Tel Aviv, IL); Manjit Rajaretnam (Irving, TX)
Assignee: CITIBANK, N.A.
G06N3/045G06F40/40G06N3/0475G06N3/08
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,493,772
App. No.
18/759,617
Granted
Dec 9, 2025
Kind
B1
Abstract

Systems and methods for constructing layered prompts to operate as input into a pre-trained large language model (LLM). The method involves obtaining a set of application domains in which the LLM will be used. Using these application domains, a set of guidelines is determined, defining operation boundaries for the LLM. A set of layers is determined, each associated with the guidelines and including variables representing attributes identified within those guidelines. Using these layers, a first layered prompt is constructed to test the initial operation boundaries of the guidelines and is supplied to the LLM to generate a set of responses. Based on the responses, a second layered prompt is dynamically constructed to test additional operation boundaries, ensuring iterative refinement and contextual relevance.

Claims (138)

1 . A method for constructing layered prompts to evaluate and assess performance of pre-trained large language models, the method comprising:

obtaining a set of application domains of a pre-trained large language model (LLM) in which the pre-trained LLM will be used,

wherein the pre-trained LLM is configured to generate, in response to a received input, a response;

using the set of application domains, determining a set of guidelines defining one or more operation boundaries of the pre-trained LLM by mapping each application domain of the set of application domains to one or more guidelines of the set of guidelines;

determining a set of layers for the pre-trained LLM associated with the one or more guidelines of the set of guidelines,

wherein each layer within the set of layers includes a layer-specific model logic and a set of variables associated with the one or more guidelines of each corresponding layer, wherein the layer-specific model logic includes weights, biases, activation functions, and regulatory or contextual parameters, and

wherein each variable in the set of variables represents an attribute identified within the one or more guidelines of each corresponding layer;

for a first set of one or more layers of the set of layers, constructing a first test case comprising (1) a first layered prompt and (2) a first expected response,

wherein the constructing the first test case comprises transforming the first set of one or more layers of the set of layers using a rule-based engine, wherein the rule-based engine maps the first test case to a first scenario derived from the first set of one or more layers of the set of layers, and performing computations that contributes to an overall decision-making process using each layer-specific model logic in the pre-trained LLM;

wherein the first layered prompt is configured to measure one or more values of a corresponding set of variables of the first set of one or more layers, and

wherein the first test case is configured to test the one or more operation boundaries of corresponding guidelines of the first set of the one or more layers of the set of layers;

executing the first test case to evaluate the pre-trained LLM by:

supplying the first layered prompt into the pre-trained LLM, and

responsive to inputting the first layered prompt, receiving, from the pre-trained LLM, for the first layered prompt, a set of responses;

aggregating the set of responses received from each layer using weights for each layer;

generating an overall result based on the aggregated responses;

generating an indicator of compliance with the guidelines by comparing the first expected response of the first test case to the set of responses generated as an overall result received from the pre-trained LLM, wherein the indicator of compliance reflects specific layers of the first layered prompt, variables of the first layered prompt, or weights assigned to each layer;

using the indicator of compliance with the guidelines generated based on comparison of the first expected response of the first test case to the set of responses received from the pre-trained LLM, dynamically constructing a second test case testing a second set of one or more layers of the set of layers occurring subsequent to the first set of one of more layers of the set of layers,

wherein the constructing the second test case comprises transforming the second set of one or more layers of the set of layers using the rule-based engine, wherein the rule-based engine maps the second test case maps to a second scenario derived from the second set of one or more layers of the set of layers, and performing computations that contributes to an overall decision-making process using each layer-specific model logic in the pre-trained LLM;

wherein the second test case comprises: (1) a second layered prompt and (2) a second expected response, and

wherein the second test case is configured to test the one or more operation boundaries of corresponding guidelines of the second set of the one or more layers of the set of layers;

executing the second test case to evaluate the pre-trained LLM;

generating for display at a graphical user interface (GUI), a graphical layout including a first graphical representation indicating satisfaction of the LLM with the one or more guidelines of the set of guidelines of a corresponding application domain and a second graphical representation indicating the evaluations of the pre-trained LLM by the first test case and the second test case;

responsive to a user input received via the GUI, automatically executing a set of actions to modify one or more parameters of the pre-trained LLM; and

validating satisfaction of the pre-trained LLM with the set of guidelines by executing the first test case to compare the first expected response of the first test case with a second set of responses received from the pre-trained LLM.

2 . The method of claim 1 , further comprising:

receiving an indicator of a type of application associated with the pre-trained LLM;

identifying a relevant set of layers associated with the type of the application defining one or more operation boundaries of the pre-trained LLM; and

obtaining the relevant set of layers, via an Application Programming Interface (API).

3 . The method of claim 1 ,

wherein the variables of the second set of the one or more layers of the set of layers are more complex than the variables of the first set of the one or more layers of the set of layers.

4 . The method of claim 1 , further comprising:

using the comparison of the first expected response of the first test case to the set of responses received from the pre-trained LLM, generating an indicator of the pre-trained LLM indicating compliance of the pre-trained LLM with the corresponding guidelines of the first set of the one or more layers of the set of layers.

5 . The method of claim 4 , wherein the indicator indicates one or more of:

the first set of the one or more layers,

the corresponding sets of variables of the first set of the one or more layers, or

predetermined weights used for each layer of the first set of the one or more layers.

6 . The method of claim 1 , wherein the graphical representation indicating the satisfaction of the LLM with the one or more guidelines of the set of guidelines of the corresponding application domain includes one or more of:

a binary indicator indicating the satisfaction,

a category indicating the satisfaction, or

a probability of the satisfaction.

7 . The method of claim 1 , wherein the set of layers is an LLM-specific set of layers, further comprising:

receiving an input indicative of an overall set of layers and the set of variables for each layer of the overall set of layers;

using an ML model, comparing the application domains within the overall set of layers with the obtained application domains related to the pre-trained LLM; and

extracting the LLM-specific set of layers from the overall set of layers using the comparison.

8 . A non-transitory, computer-readable storage medium storing instructions for constructing layered prompts to operate as an input into a pre-trained large language model (LLM), wherein the instructions when executed by at least one data processor of a system, cause the system to:

obtain a set of application domains of a pre-trained large language model (LLM) in which the pre-trained LLM will be used,

wherein the pre-trained LLM is configured to generate, in response to a received input, a response;

using the set of application domains, determine a set of guidelines defining one or more operation boundaries of the pre-trained LLM by mapping each application domain of the set of application domains to one or more guidelines of the set of guidelines;

determine a set of layers for the pre-trained LLM associated with the one or more guidelines of the set of guidelines,

wherein each layer within the set of layers includes a layer-specific model logic and a set of variables associated with the one or more guidelines of each corresponding layer, wherein the layer-specific model logic includes weights, biases, activation functions, and regulatory or contextual parameters, and

wherein each variable in the set of variables represents an attribute identified within the one or more guidelines of each corresponding layer;

for a first set of one or more layers of the set of layers, construct a first test case comprising (1) a first layered prompt and (2) a first expected response,

wherein the constructing the first test case comprises transforming the first set of one or more layers of the set of layers using an AI model, wherein the AI model maps the first test case to a first scenario derived from the first set of one or more layers of the set of layers, and performing computations that contributes to an overall decision-making process using each layer-specific model logic in the pre-trained LLM;

wherein the first layered prompt is configured to measure one or more values of a corresponding set of variables of the first set of one or more layers, and

wherein the first test case is configured to test the one or more operation boundaries of corresponding guidelines of the first set of the one or more layers of the set of layers;

execute the first test case to evaluate the pre-trained LLM by:

supplying the first layered prompt into the pre-trained LLM, and

responsive to inputting the first layered prompt, receiving, from the pre-trained LLM, for the first layered prompt, a set of responses;

aggregate the set of responses received from each layer using weights for each layer;

generate an overall result based on the aggregated responses;

generate an indicator of compliance with the guidelines by comparing the first expected response of the first test case to the set of responses generated as an overall result received from the pre-trained LLM, wherein the indicator of compliance reflects specific layers of the first layered prompt, variables of the first layered prompt, or weights assigned to each layer;

using the indicator of compliance with the guidelines generated based on comparison of the first expected response of the first test case to the set of responses received from the pre-trained LLM, dynamically construct a second test case testing a second set of one or more layers of the set of layers occurring subsequent to the first set of one of more layers of the set of layers, wherein the constructing the second test case comprises transforming the second set of one or more layers of the set of layers using an AI model,

wherein the second test case maps to a second scenario derived from the second set of one or more layers of the set of layers, and

wherein the second test case comprises: (1) a second layered prompt and (2) a second expected response, and

wherein the second test case is configured to test the one or more operation boundaries of corresponding guidelines of the second set of the one or more layers of the set of layers;

execute the second test case to evaluate the pre-trained LLM;

generate for display at a graphical user interface (GUI), a graphical layout including a first graphical representation indicating satisfaction of the LLM with the one or more guidelines of the set of guidelines of a corresponding application domain and a second graphical representation indicating the evaluations of the pre-trained LLM by the first test case and the second test case;

responsive to a user input received via the GUI, automatically execute a set of actions to modify one or more parameters of the pre-trained LLM; and

validate satisfaction of the pre-trained LLM with the set of guidelines by executing the first test case to compare the first expected response of the first test case with a second set of responses received from the pre-trained LLM.

9 . The non-transitory, computer-readable storage medium of claim 8 , wherein the instructions further cause the system to:

identify one or more new layers within the set of responses, and

iteratively update the set of layers by adding the one or more new layers to the set of layers.

10 . The non-transitory, computer-readable storage medium of claim 8 , wherein the instructions further cause the system to:

assign a weight to each layer within the set of layers of the pre-trained LLM; and

using the set of responses, generate an overall score indicating satisfaction with the one or more operation boundaries of the corresponding guidelines of the first set of the one or more layers of the set of layers in accordance with the assigned weight of the first set of the one or more layers.

11 . The non-transitory, computer-readable storage medium of claim 8 ,

wherein the set of layers is dynamically determined by an ML model, and

wherein the ML model is configured to identify the set of application domains associated with the pre-trained LLM.

12 . The non-transitory, computer-readable storage medium of claim 8 ,

wherein the set of layers is determined by a received input, and

wherein the received input indicates the set of application domains associated with the pre-trained LLM.

13 . The non-transitory, computer-readable storage medium of claim 8 ,

wherein one or more of the layers within the set of layers relates to attempts to access data, and

wherein a corresponding set of variables of one or more of the layers relate to one or more of:

an author associated with the attempt,

a timestamp associated with the attempt,

a location associated with the attempt,

a presence of an authorization related to the attempt,

previous unsuccessful attempts to access the data, or

frequency of the attempts.

14 . The non-transitory, computer-readable storage medium of claim 8 ,

wherein one or more of the layers within the set of layers relates to quality of input data, and

wherein a corresponding set of variables of one or more of the layers relate to one or more of:

an author associated with the input data,

a timestamp associated with the input data,

a location associated with the input data,

a presence of structured metadata,

an absence of the structured metadata, or

outliers in the input data.

15 . A system comprising:

at least one hardware processor; and

at least one non-transitory memory storing instructions, which, when executed by the at least one hardware processor, cause the system to:

obtain a set of application domains of a pre-trained large language model (LLM) in which the pre-trained LLM will be used,

wherein the pre-trained LLM is configured to generate, in response to a received input, a response;

using the set of application domains, determine a set of guidelines defining one or more operation boundaries of the pre-trained LLM by mapping each application domain of the set of application domains to one or more guidelines of the set of guidelines;

determine a set of layers for the pre-trained LLM associated with the one or more guidelines of the set of guidelines,

wherein each layer within the set of layers includes a layer-specific model logic and a set of variables associated with the one or more guidelines of a each corresponding layer, wherein the layer-specific model logic includes weights, biases, activation functions, and regulatory or contextual parameters, and

wherein each variable in the set of variables represents an attribute identified within the one or more guidelines of each corresponding layer;

for a first set of one or more layers of the set of layers, construct a first test case comprising (1) a first layered prompt and (2) a first expected response,

wherein the constructing a first test case comprises transforming the first set of one or more layers of the set of layers using a decision-logic system, wherein the decision-logic system maps the first test case to a first scenario derived from the first set of one or more layers of the set of layers, and performing computations that contributes to an overall decision-making process using each layer-specific model logic in the pre-trained LLM;

wherein the first layered prompt is configured to measure one or more values of a corresponding set of variables of the first set of one or more layers, and

wherein the first test case is configured to test the one or more operation boundaries of corresponding guidelines of the first set of the one or more layers of the set of layers;

execute the first test case to evaluate the pre-trained LLM by:

supplying the first layered prompt into the pre-trained LLM, and

responsive to inputting the first layered prompt, receiving, from the pre-trained LLM, for the first layered prompt, a set of responses;

aggregate the set of responses received from each layer using weights for each layer;

generate an overall result based on the aggregated responses;

generate an indicator of compliance with the guidelines by comparing the first expected response of the first test case to the set of responses generated as an overall result received from the pre-trained LLM, wherein the indicator of compliance reflects specific layers of the first layered prompt, variables of the first layered prompt, or weights assigned to each layer;

using the indicator of compliance with the guidelines generated based on comparison of the first expected response of the first test case to the set of responses received from the pre-trained LLM, dynamically construct a second test case testing a second set of one or more layers of the set of layers occurring subsequent to the first set of one of more layers of the set of layers,

wherein the constructing the second test case comprises transforming the second set of one or more layers of the set of layers using the decision-logic system, wherein the decision-logic system maps the second test case to a second scenario derived from the second set of one or more layers of the set of layers, and performing computations that contributes to an overall decision-making process using each layer-specific model logic in the pre-trained LLM;

wherein the second test case comprises: (1) a second layered prompt and (2) a second expected response, and

wherein the second test case is configured to test the one or more operation boundaries of corresponding guidelines of the second set of the one or more layers of the set of layers;

execute the second test case to evaluate the pre-trained LLM;

generate for display at a graphical user interface (GUI), a graphical layout including a first graphical representation indicating satisfaction of the LLM with the one or more guidelines of the set of guidelines of a corresponding application domain and a second graphical representation indicating the evaluations of the pre-trained LLM by the first test case and the second test case;

responsive to a user input received via the GUI, automatically execute a set of actions to modify one or more parameters of the pre-trained LLM; and

validate satisfaction of the pre-trained LLM with the set of guidelines by executing the first test case to compare the first expected response of the first test case with a second set of responses received from the pre-trained LLM.

16 . The system of claim 15 , wherein the second set of the one or more operation boundaries of the set of guidelines is different from the first set of the one or more operation boundaries of the set of guidelines.

17 . The system of claim 15 , wherein the set of guidelines include one or more of: governmental regulations of a specific jurisdiction, organization-specific regulations, or generative AI applications.

18 . The system of claim 15 , wherein the second set of the one or more operation boundaries of the set of guidelines is the same as the first set of the one or more operation boundaries of the set of guidelines.

19 . The system of claim 15 , wherein the instructions further cause the system to:

determine the set of guidelines, via a ML model, using one or more of:

a location of the LLM,

a use case of the LLM, or

data sources used in the LLM.

20 . The system of claim 15 ,

wherein the representation is a first representation, and

wherein the layout includes a second representation of an indicator indicating satisfaction of the LLM with the one or more guidelines of the set of guidelines of a corresponding application domain.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jul 19, 2024
From: CAMERON, WILLIAM FRANKLIN; SILVER, MIRIAM; RAJARETNAM, MANJIT
To: CITIBANK, N.A.
Reel/Frame 068033/0161 →
Continuity (1)
Continuation In Part 18737942 · Jun 7, 2024
References Cited (62)
US 10426442B1 · Schnorr · 2019 [cited by applicant]
US 11164078B2 · Jin et al. · 2021 [cited by applicant]
US 11521716B2 · Vianu et al. · 2022 [cited by applicant]
US 11790244B2 · Sathiaraj · 2023 [cited by applicant]
US 11893341B2 · Itani · 2024 [cited by applicant]
US 12001462B1 · Madisetti et al. · 2024 [cited by applicant]
US 12061970B1 · Lo et al. · 2024 [cited by applicant]
US 20140297954A1 · Clevenger · 2014 [cited by applicant]
US 20180307894A1 · Lim et al. · 2018 [cited by applicant]
US 20200043164A1 · Fuchs et al. · 2020 [cited by applicant]
US 20200334326A1 · Zhang et al. · 2020 [cited by applicant]
US 20200349466A1 · Hoogerwerf · 2020 [cited by examiner]
US 20210012486A1 · Huang et al. · 2021 [cited by applicant]
US 20220004923A1 · Kamkar et al. · 2022 [cited by applicant]
US 20230018960A1 · Ardel · 2023 [cited by applicant]
US 20230177116A1 · Laganakos · 2023 [cited by examiner]
US 20230274089A1 · Tunstall-pedoe et al. · 2023 [cited by applicant]
US 20230316003A1 · Friedman et al. · 2023 [cited by applicant]
US 20240095463A1 · Leary et al. · 2024 [cited by applicant]
US 20240111960A1 · Earle et al. · 2024 [cited by applicant]
US 20240146734A1 · Southgate et al. · 2024 [cited by applicant]
US 20240202539A1 · Poirier et al. · 2024 [cited by applicant]
US 20240242040A1 · Cogswell et al. · 2024 [cited by applicant]
US 20240273306A1 · Somaiya et al. · 2024 [cited by applicant]
US 20240330466A1 · Constable et al. · 2024 [cited by applicant]
US 20240333741A1 · Abdelrahman et al. · 2024 [cited by applicant]
US 20240338387A1 · Iscen et al. · 2024 [cited by applicant]
CN 115796299A · 2023 [cited by applicant]
CN 116775837A · 2023 [cited by applicant]
CN 117391216A · 2024 [cited by applicant]
CN 117453915A · 2024 [cited by applicant]
CN 117633174B · 2024 [cited by applicant]
CN 118170874A · 2024 [cited by applicant]
WO 2022135973A1 · 2022 [cited by applicant]
WO 2023161630A1 · 2023 [cited by applicant]
Dakhel et al, Apr. 2024, “Effective test generation using pre-trained Large Language Models and mutation testing” (Year: 2024). [cited by examiner]
Do et al, Apr. 3, 2024, “Automatic Prompt Selection for Large Language Models” (Year: 2024). [cited by examiner]
Naveed et al, 2023, “A Comprehensive Overview of Large Language Models” (Year: 2023). [cited by examiner]
AI Risk Management Framework NIST, retrieved on Jun. 17, 2024, https://www.nist.gov/itl/ai-risk-management-framework. [cited by applicant]
Independent analysis of AI language models and API providers. Artificial Analysis, retrieved on Jun. 13, 2024, https://artificialanalysis.ai/, 11 pages. [cited by applicant]
Brown, D., et al., “The Great AI Challenge: We Test Five Top Bots on Useful, Everyday Skills,” The Wall Street Journal, published May 25, 2024. [cited by applicant]
Dong, Y., et al., “Building Guardrails for Large Language Models,” https://ar5iv.labs.arxiv.org/html/2402.01822v1, published May 29, 2024, 20 pages. [cited by applicant]
Mavrepis, P., et al., “XAI for All: Can Large Language Models Simplify Explainable AI?,” https://arxiv.org/abs/2401.13110, Jan. 23, 2024, 10 pages. [cited by applicant]
Mollick, E., “Latent Expertise: Everyone is in R&D,” One Useful Thing, published on Jun. 20, 2024, https://www.oneusefulthing.org/p/latent-expertise-everyone-is-in-r. [cited by applicant]
Zhao, H., et al., “Explainability for Large Language Models: A Survey,” https://arxiv.org/abs/2309.01029, Nov. 28, 2024, 38 pages. [cited by applicant]
Aggarwal, Nitin , “Why measuring your new AI is essential to its succes”, KPIs for gen AI: Why measuring your new AI is essential to its succes, 7 pages. [cited by applicant]
AI , “What is AI Verify?”, What is AI Verify—AI Verify Foundation. [cited by applicant]
Altman, Sam , “Sam Altman Admits That OpenAI Doesn't Actually Understand How Its AI Works”, Sam Altman Admits That OpenAI Doesn't Actually Understand How Its AI Works—“We certainly have not solved interpretability.”, 4 … [cited by applicant]
ANTHROP/C , “Mapping the Mind of a Large Language Model”, Mapping the Mind of a Large Language Model, May 21, 2024. [cited by applicant]
Claburn, Thomas , “OpenAI's GPT-4 can exploit real vulnerabilities by reading security advisories”, OpenAI's GPT-4 can exploit real vulnerabilities by reading security advisories, Apr. 17, 2024, 3 pages. [cited by applicant]
Marshall, Andrew , “Threat Modeling AI/ML Systems and Dependencies”, Threat Modeling AI/ML Systems and Dependencies, Nov. 2, 2022, 27 pages. [cited by applicant]
Roose, Kevin , “A.I. Has a Measurement Problem”, A.I. Has a Measurement Problem, Apr. 15, 2024, 5 pages. [cited by applicant]
Roose, Kevin , “A.I.'s Black Boxes Just Got a Little Less Mysterious”, A.I.'s Black Boxes Just Got a Little Less Mysterious, May 21, 2024, 5 pages. [cited by applicant]
Shah, Harshay , “Decomposing and Editing Predictions by Modeling Model Computation”, Decomposing and Editing Predictions by Modeling Model Computation, 5 pages. [cited by applicant]
Shankar, Ram , “Failure Modes in Machine Learning”, , Nov. 2019, 14 pages. [cited by applicant]
Teo, Josephine , “Singapore launches Project Moonshot”, Singapore launches Project Moonshot—a generative Artificial Intelligence testing toolkit to address LLM safety and security challenges, May 31, 2024, 8 pages. [cited by applicant]
Mathews, A. W., “What AI Can Do in Healthcare—and What It Should Never Do,” The Wall Street Journal, published on Aug. 21, 2024, retrieved on Sep. 5, 2024, https://www.wsj.com. [cited by applicant]
Brown, Nik Bear, “Enhancing Trust in LLMs: Algorithms for Comparing and Interpreting LLMs”, ARXIV ID: 2406.01943 Publication Date: Jun. 3, 2024, pp. 1-58. (Year: 2024). [cited by applicant]
Chen, Kua, et at, Automated Domain Modeling with Large Language Models: A Comparative Study, 2023 ACM/IEEE 26th International Conference on Model Driven Engineering Languages and Systems (MODELS) (2023, pp. 162-172) (Ye… [cited by applicant]
Wang, Yudong, et al., “Exploring Activation Patterns of Parameters in Language Models”, ARXIV ID: 2405.17799 Publication Date: May 27, 2024, pp. 1-23. (Year: 2024). [cited by applicant]
Zhou, Y., Liu, Y., Li, X., Jin, J., Qian, H., Liu, Z., Li, C., Dou, Z., Ho, T., & Yu, P. S. (2024). Trustworthiness in Retrieval-Augmented Generation Systems: A Survey. ArXiv. /abs/2409.10102. [cited by applicant]
Malode, 2023, “Benchmarking public large language model” (Year: 2023). [cited by applicant]