Enhanced prompt reasoning at application layer for machine learning models
Devices, systems, and methods for language model prompt engineering include a method of: providing, by at least one first processor, to a language model, a first prompt including a first task and instructing the language model to generate a set of task-specific reasoning modules; generating, by the language model, the set of task-specific reasoning modules based on the first prompt, the set of task-specific reasoning modules including a first reasoning module; providing, by at least one second processor, to the language model, a second prompt including the first task, a second task, and the first reasoning module, wherein the second prompt instructs the language model to generate an initial reasoning structure defining how to respond to the first task without providing a response; and generating, by the language model, the initial reasoning structure based on the second prompt.
1 . A method for language model prompt engineering, the method comprising:
providing, by at least one first processor, to a large language model (LLM), a first meta-prompt comprising a first task and instructing the LLM to generate a set of task-specific reasoning modules;
generating, by the LLM, the set of task-specific reasoning modules based on the first meta-prompt;
providing, by at least one second processor, to the LLM, a second meta-prompt comprising the first task, a second task providing an example format in which to generate an initial reasoning structure, and at least a first reasoning module of the task-specific reasoning modules, wherein the second meta-prompt instructs the LLM to generate the initial reasoning structure in the example format and defining how to respond to the first task without providing a response;
generating, by the LLM, the initial reasoning structure based on the second meta-prompt;
providing, by at least one third processor, to the LLM, a third meta-prompt comprising the first task, the set of task-specific reasoning modules, and the initial reasoning structure, wherein the third meta-prompt instructs the LLM to iteratively refine the initial reasoning structure based on the first task; and
generating, by the LLM, a refined reasoning structure based on the third meta-prompt,
wherein the refined reasoning structure provides a reasoning plan defining how to generate the response to at least the first task without providing the response.
2 . The method of claim 1 , further comprising:
providing, to the LLM, the refined reasoning structure; and
generating, by the LLM, the response to the first task based on the refined reasoning structure.
3 . The method of claim 1 , wherein the refined reasoning structure further defines how to respond to a third task.
4 . The method of claim 1 , wherein the set of task-specific reasoning modules are not provided to the LLM as a pre-set list of reasoning modules.
5 . A method for machine learning model prompt engineering, the method comprising:
providing, by at least one first processor, to a machine learning model, a first prompt comprising a first task and instructing the machine learning model to generate a set of task-specific reasoning modules;
generating, by the machine learning model, the set of task-specific reasoning modules based on the first prompt, the set of task-specific reasoning modules comprising a first reasoning module;
and
generating, by the machine learning model, based on the first task, a second task providing an example format in which to generate an initial reasoning structure, and at least the first reasoning module, the initial reasoning structure in the example format, wherein the initial reasoning structure defines how to respond to at least the first task without providing a response.
6 . The method of claim 5 , wherein the machine learning model is a large language model (LLM).
7 . The method of claim 5 , further comprising:
providing, by at least one third processor, to the machine learning model, a second prompt comprising the first task, the set of task-specific reasoning modules, and the initial reasoning structure, wherein the second prompt instructs the machine learning model to iteratively refine the initial reasoning structure based on the first task; and
generating, by the machine learning model, a refined reasoning structure based on the second prompt,
wherein the refined reasoning structure provides a reasoning plan defining how to generate the response to the first task without providing the response.
8 . The method of claim 7 , further comprising:
providing, to the machine learning model, the refined reasoning structure; and
generating, by the machine learning model, the response to the first task based on the refined reasoning structure.
9 . The method of claim 5 , wherein the set of task-specific reasoning modules are not provided to the machine learning model as a pre-set list of reasoning modules.
10 . The method of claim 5 , wherein the machine learning model is selected via a user interface of a cloud-based service, and wherein the cloud-based service automatically generates the first prompt.
11 . The method of claim 10 , further comprising:
receiving, via the cloud-based service, a user selection of the first task;
receiving, via the cloud-based service, a user request to automatically generate a second prompt for the machine learning model; and
generating, via the cloud-based service, the second prompt based on the user request,
wherein the second prompt comprises a refined reasoning structure that provides a reasoning plan defining how to generate the response to the first task without providing the response.
12 . The method of claim 11 , further comprising:
receiving, via the cloud-based service, at least one of sample data on which to test prompting of the machine learning model, or few-shot examples,
wherein the third prompt is further based on the at least one of the sample data or the few-shot examples.
13 . The method of claim 5 , wherein the machine learning model is selected via a command line interface, and wherein the command line interface automatically generates the first prompt.
14 . The method of claim 5 , wherein generating the initial reasoning structure is further based on at least one additional reasoning module of the set of task-specific reasoning modules.
15 . A system for machine learning model prompt engineering, the system comprising:
first memory coupled to at least one first processor configured to:
provide, to a machine learning model, a first prompt comprising a first task and instructing the machine learning model to generate a set of task-specific reasoning modules;
the machine learning model, wherein the machine learning model is configured to:
generate the set of task-specific reasoning modules based on the first prompt, the set of task-specific reasoning modules comprising a first reasoning module;
generate an initial reasoning structure based on the first task, a second task providing an example format in which to generate an initial reasoning structure, and at least the first reasoning module, the initial reasoning structure in the example format, wherein the initial reasoning structure defines how to respond to at least the first task without providing a response.
16 . The system of claim 15 , further comprising second memory coupled to at least one second processor configured to:
provide, to the machine learning model, a second prompt comprising the first task, the set of task-specific reasoning modules, and the initial reasoning structure, wherein the second prompt instructs the machine learning model to iteratively refine the initial reasoning structure based on the first task,
wherein the machine learning model is further configured to:
generate a refined reasoning structure based on the second prompt,
wherein the refined reasoning structure provides a reasoning plan defining how to generate the response to the first task without providing the response.
17 . The system of claim 16 , wherein the first prompt comprises the second prompt.
18 . The system of claim 16 , wherein the language model is further configured to generate the response to the first task based on the refined reasoning structure.
19 . The system of claim 15 , wherein the set of task-specific reasoning modules are not provided to the machine learning model as a pre-set list of reasoning modules.
20 . The system of claim 15 , further comprising a cloud-based service, wherein the language model is selected via a user interface of the cloud-based service, and wherein the cloud-based service automatically generates the first prompt and the second prompt.