## Diagram: ZS-FinDSL prompt for FinQA Workflows
### Overview
This image is a process diagram illustrating two distinct workflows for interacting with a Large Language Model (LLM) in the context of a task called FinQA. The top workflow focuses on "Reasoning extraction" and "Program extraction," suggesting a multi-step process to derive a programmatic solution. The bottom workflow shows a more direct "LLM answering" and "Answer extraction" approach. Both workflows utilize an LLM and involve structured prompts and outputs, with specific parts of the prompt highlighted by color-coded categories defined in a central legend.
### Components/Axes
The diagram is structured into two main horizontal sections, each representing a workflow, separated by a central legend and figure title.
**Main Workflow Headers (Orange Ovals):**
* **Top-left:** "Reasoning extraction"
* **Top-right:** "Program extraction"
* **Bottom-left:** "LLM answering"
* **Bottom-right:** "Answer extraction"
**Input Prompt Boxes (Light Blue Rectangles):** These boxes contain the textual prompts provided to the LLM.
**LLM Icons:** A multi-colored, atom-like icon labeled "LLM" is positioned below each input prompt, representing the Large Language Model processing the input.
**Output Boxes (Pink Rounded Rectangles):** These boxes contain the expected or generated output from the LLM.
**Arrows (Dark Gray):** Indicate the flow of information between components.
**Curved Arrows (Dark Gray):** Indicate that the output of one LLM process serves as input for another.
**Legend (Centered horizontally, below the top workflow):**
* **Black square:** "Signifier"
* **Orange square:** "Memetic proxy"
* **Pink square:** "Constraining behavior"
* **Green square:** "Meta prompt"
* **Blue square:** "Input" (Note: The blue color is not explicitly used for text within the prompts, but the light blue background of the input boxes likely represents the overall "Input" concept.)
**Figure Title (Centered horizontally, below the legend):**
* "Figure 2: ZS-FinDSL prompt for FinQA"
### Detailed Analysis
The diagram presents two primary workflows, each composed of two stages involving an LLM.
**Top Workflow: Reasoning and Program Extraction**
1. **Reasoning extraction (Top-left):**
* **Input Prompt (light blue box):**
* "Read the following passage and then answer the question:" (Signifier - black text)
* **Passage:** "text + table" (Signifier - black text)
* **Question:** "ask question?" (Signifier - black text)
* "Answer this question by finding the relevant values and performing step by step calculations." (Meta prompt - green text)
* **Answer:** (Memetic proxy - orange text)
* **Flow:** An arrow points from this input prompt to the "LLM" icon.
* **Output (pink rounded rectangle):** "Answer with reasoning from LLM." (Signifier - black text)
2. **Program extraction (Top-right):**
* **Input Prompt (light blue box):**
* A curved arrow connects the output of "Reasoning extraction" ("Answer with reasoning from LLM.") to this input prompt, indicating the reasoning is fed as input.
* **Question:** "ask question?" (Signifier - black text)
* **Answer:** "Answer with reasoning from LLM." (Signifier - black text)
* **Task:** "From the above question-answer, extract the calculations that were performed to arrive at the answer. The calculations should be provided in the following format:" (Signifier - black text)
* `{"PROGRAM":"#0":{"OPERATION":[arithmetic/logic]",` (Signifier - black text)
* `ARG1:"[float/int]", ARG2:"[float/int]"},` (Signifier - black text)
* `"#1":{"OPERATION:[arithmetic/logic],` (Signifier - black text)
* `ARG1:"#0", ARG2:"[float/int/#int]"}, ...},` (Signifier - black text)
* `"ANSWER": "[numerical/boolean]"}` (Signifier - black text)
* "Operation should strictly be restricted to {add, subtract, multiply, divide, exponent, greater-than, max, min} only." (Constraining behavior - pink text)
* "When evaluated the program should only generate numerical or boolean values." (Constraining behavior - pink text)
* **Solution:** (Memetic proxy - orange text)
* **Flow:** An arrow points from this input prompt to the "LLM" icon.
* **Output (pink rounded rectangle):** "Program generated by the LLM." (Signifier - black text)
**Bottom Workflow: Direct LLM Answering and Answer Extraction**
1. **LLM answering (Bottom-left):**
* **Input Prompt (light blue box):**
* "Read the following passage and then answer the question:" (Signifier - black text)
* **Passage:** "text + table" (Signifier - black text)
* **Question:** "ask question?" (Signifier - black text)
* **Answer:** (Memetic proxy - orange text)
* **Flow:** An arrow points from this input prompt to the "LLM" icon.
* **Output (pink rounded rectangle):** "Answer from LLM." (Signifier - black text)
2. **Answer extraction (Bottom-right):**
* **Input Prompt (light blue box):**
* A curved arrow connects the output of "LLM answering" ("Answer from LLM.") to this input prompt, indicating the raw answer is fed as input.
* **Question:** "ask question?" (Signifier - black text)
* **Answer:** "Answer from LLM." (Signifier - black text)
* "The final answer (float/int/boolean) is:" (Memetic proxy - orange text)
* **Flow:** An arrow points from this input prompt to the "LLM" icon.
* **Output (pink rounded rectangle):** "Final answer generated by the LLM." (Signifier - black text)
### Key Observations
* **Two-Stage Processes:** Both workflows are two-stage, where the output of an initial LLM interaction becomes part of the input for a subsequent LLM interaction.
* **Prompt Engineering:** The diagram highlights different types of prompt components using color coding:
* **Signifiers (black text):** Provide basic instructions, context, and structure (e.g., "Question:", "Passage:", JSON format).
* **Meta prompts (green text):** Guide the LLM's internal process or strategy (e.g., "performing step by step calculations").
* **Constraining behavior (pink text):** Impose strict rules or limitations on the LLM's output (e.g., allowed operations, output data types).
* **Memetic proxy (orange text):** Acts as a placeholder or a cue for the LLM to fill in the desired output (e.g., "Answer:", "Solution:", "The final answer...").
* **Output Granularity:** The top workflow aims for a more structured, executable "Program," while the bottom workflow aims for a "Final answer" directly.
* **FinQA Context:** The figure title explicitly links these prompts to "ZS-FinDSL prompt for FinQA," suggesting these are zero-shot prompts for a financial question-answering task using a domain-specific language (FinDSL).
### Interpretation
This diagram illustrates two distinct strategies for leveraging LLMs for complex tasks like FinQA, emphasizing the role of prompt engineering in guiding the LLM's behavior and output format.
The **top workflow (Reasoning and Program Extraction)** represents a more robust and verifiable approach.
1. **Reasoning extraction** first prompts the LLM to generate an answer *with step-by-step calculations*. This "meta prompt" encourages the LLM to show its work, making its reasoning transparent. The "Memetic proxy" "Answer:" cues the LLM to provide this detailed response.
2. The output of this reasoning is then fed into the **Program extraction** stage. Here, the LLM is tasked not just with answering, but with *extracting the underlying calculations into a structured program format*. This stage includes "constraining behavior" prompts (pink text) that strictly define the allowed operations and output types, ensuring the generated program is valid and executable. This approach suggests a desire for not just an answer, but a verifiable, reproducible, and potentially executable solution, which is crucial in domains like finance where accuracy and auditability are paramount.
The **bottom workflow (LLM Answering and Answer Extraction)** represents a more direct, but potentially less transparent, approach.
1. **LLM answering** directly asks the LLM for an "Answer:" based on the passage and question. This is a standard direct question-answering prompt.
2. The raw "Answer from LLM." is then passed to the **Answer extraction** stage. This stage's purpose is to extract *only the final numerical or boolean value* from the LLM's potentially verbose answer. The "Memetic proxy" "The final answer (float/int/boolean) is:" guides the LLM to isolate and present the ultimate result in a specific format. This workflow prioritizes getting a concise final answer quickly, potentially sacrificing the transparency of the reasoning process.
In essence, the diagram contrasts a "programmatic reasoning" approach (top) with a "direct answer" approach (bottom). The top workflow aims to make the LLM's internal "thought process" explicit and convertible into an executable program, offering greater control, verifiability, and potentially better performance for complex multi-step reasoning tasks. The bottom workflow is simpler, focusing on direct answer generation and subsequent extraction, which might be suitable for less complex questions or when the intermediate steps are not critical. The use of "ZS-FinDSL" implies that these prompts are designed for zero-shot learning within a financial domain, potentially leveraging a domain-specific language for better performance and adherence to financial logic.