Iterative improvement
An exploration of iterative logics in prompt engineering.
In this exploration, I delve into various strategies for guiding a language model (LLM) to take previous outputs at a certain quality level
An exploration of iterative logics in prompt engineering.
In this exploration, we delve into various strategies for guiding a language model (LLM) to take previous outputs at a certain quality level (n) and elevate them to a higher quality level (n+1). This process is founded on establishing clear metrics that define what "n+1 quality level" entails.
While an "artisanal" method of including explicit commands (e.g., "re-evaluate the analysis and output to achieve n+1 quality level") may yield results, our focus is on a more systematic approach. This involves setting well-defined metrics of excellence that serve as benchmarks for incremental improvement. This teleological orientation allows the LLM to evaluate its current output against these metrics and determine whether it meets the established criteria, guiding its iterative process.
### The Analytical Approach: Excellence as a Limit
Romain's key insight is to frame this iterative improvement using a mathematical analysis perspective, treating excellence as a limit function. This approach seeks to define criteria for excellence so precisely that the process can "stop" when the output converges sufficiently.
Let's define:
* **f(n)**: the output quality at iteration *n*.
* **L**: the excellence limit, representing our defined criteria for an outstanding output.
* **ε**: an acceptable margin of error, indicating how close f(n) needs to be to L for the process to stop.
The goal is to achieve **|L - f(n)| < ε as n → ∞**.
The core challenges are:
1. **Defining L (excellence criteria)**: How to quantify excellence precisely enough to be computationally meaningful for the LLM.
2. **Calculating the Gap |L - f(n)|**: How to effectively measure the distance between the current output's quality and the excellence limit.
### Measuring the Gap Function: |L - f(n)|
To calculate the gap, we propose a **Multi-dimensional Distance Metric**:
**Gap(n) = Σ wi|Li - fi(n)|**
Where:
* **wi**: the weight of dimension *i*.
* **Li**: the excellence criterion for dimension *i*.
* **fi(n)**: the current output's score for dimension *i*.
For example, when evaluating an academic text, we could consider dimensions such as:
* **L1**: Logical coherence (e.g., weight: 0.3)
* **L2**: Technical precision (e.g., weight: 0.3)
* **L3**: Novelty of insights (e.g., weight: 0.2)
* **L4**: Citation integration (e.g., weight: 0.2)
This framework allows us to systematically measure the difference between the current output and our defined standard of excellence across multiple, weighted dimensions. Our next steps involve refining these dimensions and weights, developing specific scoring methods for each fi(n), and creating practical test cases to validate this gap function. We are particularly interested in how we can normalize these measurements to ensure consistency across iterations and diverse output types.By Romain Peter