@ckelsoe/prompt-architect 3.2.2 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +3 -3
- package/.claude-plugin/plugin.json +2 -2
- package/CHANGELOG.md +135 -5
- package/MIGRATION.md +1 -1
- package/README.md +32 -47
- package/adapters/README.md +1 -1
- package/adapters/system-prompt.md +115 -59
- package/package.json +5 -4
- package/scripts/install.js +52 -22
- package/scripts/test.js +88 -40
- package/scripts/validate-skill.js +184 -56
- package/skills/prompt-architect/SKILL.md +94 -79
- package/skills/prompt-architect/assets/templates/ape_template.txt +14 -3
- package/skills/prompt-architect/assets/templates/bab_template.txt +23 -10
- package/skills/prompt-architect/assets/templates/broke_template.txt +31 -6
- package/skills/prompt-architect/assets/templates/cai-critique-revise_template.txt +16 -8
- package/skills/prompt-architect/assets/templates/care_template.txt +4 -0
- package/skills/prompt-architect/assets/templates/chain-of-density_template.txt +64 -35
- package/skills/prompt-architect/assets/templates/chain-of-thought_template.txt +8 -0
- package/skills/prompt-architect/assets/templates/co-star_template.txt +8 -0
- package/skills/prompt-architect/assets/templates/crispe_template.txt +6 -0
- package/skills/prompt-architect/assets/templates/ctf_template.txt +8 -0
- package/skills/prompt-architect/assets/templates/devils-advocate_template.txt +7 -0
- package/skills/prompt-architect/assets/templates/hybrid_template.txt +44 -24
- package/skills/prompt-architect/assets/templates/iterative-compression_template.txt +74 -0
- package/skills/prompt-architect/assets/templates/least-to-most_template.txt +4 -0
- package/skills/prompt-architect/assets/templates/plan-and-solve_template.txt +4 -0
- package/skills/prompt-architect/assets/templates/pre-mortem_template.txt +24 -14
- package/skills/prompt-architect/assets/templates/race_template.txt +9 -0
- package/skills/prompt-architect/assets/templates/rcot_template.txt +8 -0
- package/skills/prompt-architect/assets/templates/react_template.txt +38 -16
- package/skills/prompt-architect/assets/templates/rise-ie_template.txt +4 -0
- package/skills/prompt-architect/assets/templates/rise-ix_template.txt +3 -3
- package/skills/prompt-architect/assets/templates/risen_template.txt +7 -0
- package/skills/prompt-architect/assets/templates/rpef_template.txt +16 -11
- package/skills/prompt-architect/assets/templates/rtf_template.txt +9 -0
- package/skills/prompt-architect/assets/templates/skeleton-of-thought_template.txt +18 -10
- package/skills/prompt-architect/assets/templates/step-back_template.txt +4 -0
- package/skills/prompt-architect/assets/templates/tidd-ec_template.txt +54 -31
- package/skills/prompt-architect/assets/templates/tree-of-thought_template.txt +37 -21
- package/skills/prompt-architect/references/frameworks/ape.md +145 -57
- package/skills/prompt-architect/references/frameworks/bab.md +139 -58
- package/skills/prompt-architect/references/frameworks/broke.md +157 -57
- package/skills/prompt-architect/references/frameworks/cai-critique-revise.md +184 -76
- package/skills/prompt-architect/references/frameworks/care.md +67 -36
- package/skills/prompt-architect/references/frameworks/chain-of-density.md +111 -417
- package/skills/prompt-architect/references/frameworks/chain-of-thought.md +45 -19
- package/skills/prompt-architect/references/frameworks/co-star.md +102 -44
- package/skills/prompt-architect/references/frameworks/crispe.md +7 -5
- package/skills/prompt-architect/references/frameworks/ctf.md +75 -37
- package/skills/prompt-architect/references/frameworks/devils-advocate.md +105 -58
- package/skills/prompt-architect/references/frameworks/iterative-compression.md +448 -0
- package/skills/prompt-architect/references/frameworks/least-to-most.md +35 -13
- package/skills/prompt-architect/references/frameworks/plan-and-solve.md +38 -9
- package/skills/prompt-architect/references/frameworks/pre-mortem.md +182 -72
- package/skills/prompt-architect/references/frameworks/race.md +93 -38
- package/skills/prompt-architect/references/frameworks/rcot.md +1 -1
- package/skills/prompt-architect/references/frameworks/react.md +230 -97
- package/skills/prompt-architect/references/frameworks/reverse-role.md +23 -16
- package/skills/prompt-architect/references/frameworks/rise.md +120 -77
- package/skills/prompt-architect/references/frameworks/risen.md +82 -28
- package/skills/prompt-architect/references/frameworks/rpef.md +227 -58
- package/skills/prompt-architect/references/frameworks/rtf.md +4 -2
- package/skills/prompt-architect/references/frameworks/self-refine.md +4 -2
- package/skills/prompt-architect/references/frameworks/skeleton-of-thought.md +68 -22
- package/skills/prompt-architect/references/frameworks/step-back.md +48 -16
- package/skills/prompt-architect/references/frameworks/tidd-ec.md +129 -51
- package/skills/prompt-architect/references/frameworks/tree-of-thought.md +112 -37
- package/skills/prompt-architect/scripts/framework_analyzer.py +0 -807
- package/skills/prompt-architect/scripts/prompt_evaluator.py +0 -336
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
# Iterative Compression Framework
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Iterative Compression progressively tightens a piece of text through multiple passes. Each iteration cuts redundancy, sharpens phrasing, and raises information density — typically while reducing overall length toward a target. It rests on the observation that successive editing passes usually beat trying to get everything right in one shot.
|
|
6
|
+
|
|
7
|
+
**Origin:** General practitioner technique with no single documented originator — the multi-pass editing loop long predates LLMs. This is a house pattern, not a published method, and it is not research-backed. **Not to be confused with Chain of Density** (Adams et al., arXiv 2309.04269), which holds length *fixed* while raising entity density. The two techniques are frequently conflated, including in earlier versions of this package. If your goal is a shorter text, use this framework; if your goal is more information in the *same* number of words, use `chain-of-density.md`.
|
|
8
|
+
|
|
9
|
+
## Core Concept
|
|
10
|
+
|
|
11
|
+
Instead of requesting the perfect output immediately, Iterative Compression:
|
|
12
|
+
1. Starts with a basic/verbose version
|
|
13
|
+
2. Iteratively refines through multiple passes
|
|
14
|
+
3. Increases information density each time
|
|
15
|
+
4. Removes fluff and redundancy
|
|
16
|
+
5. Enhances clarity and precision
|
|
17
|
+
6. Converges on optimal output
|
|
18
|
+
|
|
19
|
+
Think of it as "progressive enhancement" for prompts.
|
|
20
|
+
|
|
21
|
+
## When to Use Iterative Compression
|
|
22
|
+
|
|
23
|
+
**Ideal for:**
|
|
24
|
+
- Summarization tasks
|
|
25
|
+
- Content compression
|
|
26
|
+
- Iterative improvement of writing
|
|
27
|
+
- Optimizing explanations
|
|
28
|
+
- Refining complex outputs
|
|
29
|
+
- Tasks where quality improves with iteration
|
|
30
|
+
|
|
31
|
+
**Not needed for:**
|
|
32
|
+
- Simple one-shot tasks
|
|
33
|
+
- When first draft is sufficient
|
|
34
|
+
- Time-critical quick tasks
|
|
35
|
+
- Tasks with fixed formats that can't improve
|
|
36
|
+
|
|
37
|
+
## Best Practices
|
|
38
|
+
|
|
39
|
+
### 1. Define What to Optimize
|
|
40
|
+
```
|
|
41
|
+
Good:
|
|
42
|
+
"Iterate to improve:
|
|
43
|
+
- Information density
|
|
44
|
+
- Clarity
|
|
45
|
+
- Conciseness
|
|
46
|
+
- Precision"
|
|
47
|
+
|
|
48
|
+
Poor:
|
|
49
|
+
"Make it better"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 2. Specify Number of Iterations
|
|
53
|
+
```
|
|
54
|
+
Good:
|
|
55
|
+
"Refine through 4 iterations, showing each version"
|
|
56
|
+
|
|
57
|
+
Poor:
|
|
58
|
+
"Keep improving until it's good"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 3. Show Evolution
|
|
62
|
+
```
|
|
63
|
+
Good:
|
|
64
|
+
"Show each iteration and explain what changed and why"
|
|
65
|
+
|
|
66
|
+
Poor:
|
|
67
|
+
"Just give me the final version"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 4. Set Clear Constraints
|
|
71
|
+
```
|
|
72
|
+
Good:
|
|
73
|
+
"Each iteration should be 20% shorter while maintaining completeness"
|
|
74
|
+
|
|
75
|
+
Poor:
|
|
76
|
+
"Make it shorter"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Template Structure
|
|
80
|
+
|
|
81
|
+
Section headers are stripped at emission, along with the divider rules that separate them in the shipped `.txt`, so every slot's meaning is carried by the unbracketed prose that travels with it rather than by the header above it. The one exception is the `Iteration 1:` / `Iteration 2:` / `Iteration 3:` labels — those are literal labels inside the protocol, not section headers, and they must survive into the emitted prompt exactly as written.
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
SOURCE MATERIAL:
|
|
85
|
+
[Paste the full text to be compressed here.]
|
|
86
|
+
Use the material above as the text to be compressed for the work described below.
|
|
87
|
+
Every version must be a rewrite of that material — never introduce a claim it does
|
|
88
|
+
not support.
|
|
89
|
+
|
|
90
|
+
OPTIMIZATION GOAL:
|
|
91
|
+
Every pass must move the text toward this goal:
|
|
92
|
+
[A full sentence naming what improves and by how much, not a bare label like
|
|
93
|
+
"concision." For example: "Reduce word count by 20% each pass while retaining all key
|
|
94
|
+
information," or "Raise information density — cut filler until every sentence earns
|
|
95
|
+
its place."]
|
|
96
|
+
|
|
97
|
+
TARGET:
|
|
98
|
+
The final version must reach this end state:
|
|
99
|
+
[A phrase completing the sentence above, e.g. "under 150 words and readable by a
|
|
100
|
+
non-specialist." Name the unit, not a bare number.]
|
|
101
|
+
|
|
102
|
+
NUMBER OF ITERATIONS:
|
|
103
|
+
Run this many passes in total:
|
|
104
|
+
[The count as a phrase completing the sentence above, e.g. "three passes."
|
|
105
|
+
Typical: 2-4]
|
|
106
|
+
Iteration 1: [What this first pass must do to the source text, as a full sentence.]
|
|
107
|
+
Iteration 2: [How this pass tightens the result of pass 1, as a full sentence.]
|
|
108
|
+
Iteration 3: [Optional — what this final polish pass must do, as a full sentence.
|
|
109
|
+
Delete this line if running fewer than three passes; add further Iteration lines in
|
|
110
|
+
the same form if running more.]
|
|
111
|
+
|
|
112
|
+
ITERATION INSTRUCTIONS:
|
|
113
|
+
In each pass, identify what can be cut, compressed, or clarified, apply the changes,
|
|
114
|
+
then check both that the result serves the goal above better than the version before
|
|
115
|
+
it and that nothing the goal requires keeping was lost. Stop when [a clause completing
|
|
116
|
+
this sentence, e.g. "no filler words remain" or "all three passes are complete"].
|
|
117
|
+
|
|
118
|
+
OUTPUT FORMAT:
|
|
119
|
+
Deliver the final version in this format:
|
|
120
|
+
[A phrase completing the sentence above, e.g. "a single paragraph of continuous
|
|
121
|
+
prose," a bullet list, or a one-sentence summary.]
|
|
122
|
+
|
|
123
|
+
INTERMEDIATE VERSIONS:
|
|
124
|
+
[Optional — keep exactly one of these two sentences as the entire content of this
|
|
125
|
+
block, or delete the block: "Show the output of every iteration in order, labelled by
|
|
126
|
+
pass number." / "Show only the final version — do not print the intermediate
|
|
127
|
+
passes."]
|
|
128
|
+
|
|
129
|
+
Compression has a floor. Past a point, passes strip meaning rather than filler. If a
|
|
130
|
+
pass would remove something a reader needs, stop at the previous version and deliver
|
|
131
|
+
that.
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Two slots behave differently from their counterparts in other frameworks in this package. `SOURCE MATERIAL` is **not** optional here — several frameworks let you delete that block when you have nothing to paste, but this one cannot: compression is defined as a rewrite of supplied text, so with no source there is nothing to compress. `INTERMEDIATE VERSIONS` is the opposite — it is genuinely optional, and when kept it takes exactly one of the two supplied sentences as its entire content rather than free-form instructions.
|
|
135
|
+
|
|
136
|
+
The closing paragraph about compression's floor is unbracketed prose, not a fillable slot. It ships verbatim in every emitted prompt and is the stopping condition that keeps the last pass from stripping meaning.
|
|
137
|
+
|
|
138
|
+
The `Iteration N:` lines admit two shapes. A **length ladder** names a shrinking word count for each pass (200 → 150 → 100 → 75), which suits material with a hard limit to hit. **Progressive tightening** instead names what each pass removes — restatement first, then inferable detail, then hedges — which suits material where the floor matters more than the number. Either shape is on-method; what is not is assigning each pass a *different quality dimension* (clarity, then impact, then tone). That is multi-dimensional refinement rather than compression, the text does not get shorter, and it is what `self-refine.md` is for. Use this framework only when the text should shrink.
|
|
139
|
+
|
|
140
|
+
## Complete Examples
|
|
141
|
+
|
|
142
|
+
Every example below is shown in emitted form: each slot carries its own role in prose.
|
|
143
|
+
Read the section headers as scaffolding that will be deleted — the examples are written
|
|
144
|
+
so that nothing is lost when it is. The `Iteration N:` lines are the exception: they are
|
|
145
|
+
literal labels inside the protocol, not section headers, and they survive emission
|
|
146
|
+
exactly as written.
|
|
147
|
+
|
|
148
|
+
### Example 1: Summarization
|
|
149
|
+
|
|
150
|
+
**Without Iterative Compression:**
|
|
151
|
+
```
|
|
152
|
+
Summarize this research paper.
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**With Iterative Compression:**
|
|
156
|
+
```
|
|
157
|
+
SOURCE MATERIAL:
|
|
158
|
+
[Paste the full text of the research paper here]
|
|
159
|
+
Use the material above as the text to be compressed for the work described below.
|
|
160
|
+
Every version must be a rewrite of that material — never introduce a claim it does
|
|
161
|
+
not support.
|
|
162
|
+
|
|
163
|
+
OPTIMIZATION GOAL:
|
|
164
|
+
Every pass must move the text toward this goal:
|
|
165
|
+
Cut roughly a quarter of the word count on each pass while retaining every finding,
|
|
166
|
+
the method that produced it, and the limitations the authors state.
|
|
167
|
+
|
|
168
|
+
TARGET:
|
|
169
|
+
The final version must reach this end state:
|
|
170
|
+
Under 75 words, covering the core findings, and readable by someone outside the field.
|
|
171
|
+
|
|
172
|
+
NUMBER OF ITERATIONS:
|
|
173
|
+
Run this many passes in total:
|
|
174
|
+
four passes.
|
|
175
|
+
Iteration 1: Write a comprehensive summary of roughly 200 words covering every major
|
|
176
|
+
point, prioritizing completeness over brevity.
|
|
177
|
+
Iteration 2: Cut that summary to roughly 150 words by removing repeated information
|
|
178
|
+
and combining related points.
|
|
179
|
+
Iteration 3: Cut to roughly 100 words, keeping only what a reader needs in order to
|
|
180
|
+
understand what was found and how it was established.
|
|
181
|
+
Iteration 4: Cut to 75 words, distilling to the core findings while preserving the
|
|
182
|
+
numbers and qualifiers that keep them accurate.
|
|
183
|
+
|
|
184
|
+
ITERATION INSTRUCTIONS:
|
|
185
|
+
In each pass, identify what can be cut, compressed, or clarified, apply the changes,
|
|
186
|
+
then check both that the result serves the goal above better than the version before
|
|
187
|
+
it and that nothing the goal requires keeping was lost. Stop when all four passes are
|
|
188
|
+
complete.
|
|
189
|
+
|
|
190
|
+
OUTPUT FORMAT:
|
|
191
|
+
Deliver the final version in this format:
|
|
192
|
+
a single paragraph of continuous prose.
|
|
193
|
+
|
|
194
|
+
INTERMEDIATE VERSIONS:
|
|
195
|
+
Show the output of every iteration in order, labelled by pass number.
|
|
196
|
+
|
|
197
|
+
Compression has a floor. Past a point, passes strip meaning rather than filler. If a
|
|
198
|
+
pass would remove something a reader needs, stop at the previous version and deliver
|
|
199
|
+
that.
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Example 2: Code Documentation
|
|
203
|
+
|
|
204
|
+
**Without Iterative Compression:**
|
|
205
|
+
```
|
|
206
|
+
Document this function.
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
**With Iterative Compression:**
|
|
210
|
+
```
|
|
211
|
+
SOURCE MATERIAL:
|
|
212
|
+
[Paste the function's signature and its existing documentation here]
|
|
213
|
+
Use the material above as the text to be compressed for the work described below.
|
|
214
|
+
Every version must be a rewrite of that material — never introduce a claim it does
|
|
215
|
+
not support.
|
|
216
|
+
|
|
217
|
+
OPTIMIZATION GOAL:
|
|
218
|
+
Every pass must move the text toward this goal:
|
|
219
|
+
Cut length while keeping every parameter, return value, raised exception, and edge
|
|
220
|
+
case a caller must know about — remove restatement of what the signature already
|
|
221
|
+
shows, not the behaviour it does not.
|
|
222
|
+
|
|
223
|
+
TARGET:
|
|
224
|
+
The final version must reach this end state:
|
|
225
|
+
Under 120 words, readable without scrolling, and complete enough that a caller never
|
|
226
|
+
has to open the implementation.
|
|
227
|
+
|
|
228
|
+
NUMBER OF ITERATIONS:
|
|
229
|
+
Run this many passes in total:
|
|
230
|
+
three passes.
|
|
231
|
+
Iteration 1: Cut every sentence that restates the signature or names types the
|
|
232
|
+
signature already declares.
|
|
233
|
+
Iteration 2: Merge the remaining prose so each parameter, return value, and raised
|
|
234
|
+
exception is described exactly once, in one place.
|
|
235
|
+
Iteration 3: Cut to 120 words by reducing the examples to the single shortest call
|
|
236
|
+
that still shows the edge case a caller is most likely to hit.
|
|
237
|
+
|
|
238
|
+
ITERATION INSTRUCTIONS:
|
|
239
|
+
In each pass, identify what can be cut, compressed, or clarified, apply the changes,
|
|
240
|
+
then check both that the result serves the goal above better than the version before
|
|
241
|
+
it and that nothing the goal requires keeping was lost. Stop when all three passes are
|
|
242
|
+
complete.
|
|
243
|
+
|
|
244
|
+
OUTPUT FORMAT:
|
|
245
|
+
Deliver the final version in this format:
|
|
246
|
+
a docstring with a one-line summary, a parameter list, a return description, and at
|
|
247
|
+
most one example.
|
|
248
|
+
|
|
249
|
+
INTERMEDIATE VERSIONS:
|
|
250
|
+
Show only the final version — do not print the intermediate passes.
|
|
251
|
+
|
|
252
|
+
Compression has a floor. Past a point, passes strip meaning rather than filler. If a
|
|
253
|
+
pass would remove something a reader needs, stop at the previous version and deliver
|
|
254
|
+
that.
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### Example 3: Email Refinement
|
|
258
|
+
|
|
259
|
+
**Without Iterative Compression:**
|
|
260
|
+
```
|
|
261
|
+
Write an email announcing this feature.
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
**With Iterative Compression:**
|
|
265
|
+
```
|
|
266
|
+
SOURCE MATERIAL:
|
|
267
|
+
[Paste the full draft of the announcement email here]
|
|
268
|
+
Use the material above as the text to be compressed for the work described below.
|
|
269
|
+
Every version must be a rewrite of that material — never introduce a claim it does
|
|
270
|
+
not support.
|
|
271
|
+
|
|
272
|
+
OPTIMIZATION GOAL:
|
|
273
|
+
Every pass must move the text toward this goal:
|
|
274
|
+
Cut roughly a third of the word count on each pass while keeping what the feature
|
|
275
|
+
does, who it affects, when it ships, and what the reader has to do about it.
|
|
276
|
+
|
|
277
|
+
TARGET:
|
|
278
|
+
The final version must reach this end state:
|
|
279
|
+
Under 120 words, scannable in fifteen seconds, with the action the reader must take
|
|
280
|
+
stated in the first two sentences.
|
|
281
|
+
|
|
282
|
+
NUMBER OF ITERATIONS:
|
|
283
|
+
Run this many passes in total:
|
|
284
|
+
three passes.
|
|
285
|
+
Iteration 1: Move the action the reader must take to the opening and cut the
|
|
286
|
+
throat-clearing that currently precedes it.
|
|
287
|
+
Iteration 2: Cut the background to the single sentence a reader needs in order to
|
|
288
|
+
understand why the change is happening.
|
|
289
|
+
Iteration 3: Cut to 120 words by removing hedges, restated benefits, and any sentence
|
|
290
|
+
whose removal a reader would not notice.
|
|
291
|
+
|
|
292
|
+
ITERATION INSTRUCTIONS:
|
|
293
|
+
In each pass, identify what can be cut, compressed, or clarified, apply the changes,
|
|
294
|
+
then check both that the result serves the goal above better than the version before
|
|
295
|
+
it and that nothing the goal requires keeping was lost. Stop when all three passes are
|
|
296
|
+
complete.
|
|
297
|
+
|
|
298
|
+
OUTPUT FORMAT:
|
|
299
|
+
Deliver the final version in this format:
|
|
300
|
+
a subject line followed by no more than three short paragraphs.
|
|
301
|
+
|
|
302
|
+
INTERMEDIATE VERSIONS:
|
|
303
|
+
Show the output of every iteration in order, labelled by pass number.
|
|
304
|
+
|
|
305
|
+
Compression has a floor. Past a point, passes strip meaning rather than filler. If a
|
|
306
|
+
pass would remove something a reader needs, stop at the previous version and deliver
|
|
307
|
+
that.
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### Example 4: Technical Explanation
|
|
311
|
+
|
|
312
|
+
**Without Iterative Compression:**
|
|
313
|
+
```
|
|
314
|
+
Explain how this algorithm works.
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
**With Iterative Compression:**
|
|
318
|
+
```
|
|
319
|
+
SOURCE MATERIAL:
|
|
320
|
+
[Paste the full existing explanation of the algorithm here]
|
|
321
|
+
Use the material above as the text to be compressed for the work described below.
|
|
322
|
+
Every version must be a rewrite of that material — never introduce a claim it does
|
|
323
|
+
not support.
|
|
324
|
+
|
|
325
|
+
OPTIMIZATION GOAL:
|
|
326
|
+
Every pass must move the text toward this goal:
|
|
327
|
+
Roughly halve the word count on each pass while keeping the algorithm's inputs, its
|
|
328
|
+
outputs, the step that does the real work, and its complexity.
|
|
329
|
+
|
|
330
|
+
TARGET:
|
|
331
|
+
The final version must reach this end state:
|
|
332
|
+
Under 100 words, understandable by a developer who has never seen the algorithm, with
|
|
333
|
+
no step omitted that they would need in order to implement it.
|
|
334
|
+
|
|
335
|
+
NUMBER OF ITERATIONS:
|
|
336
|
+
Run this many passes in total:
|
|
337
|
+
three passes.
|
|
338
|
+
Iteration 1: Cut to roughly 400 words by removing history, motivation, and
|
|
339
|
+
comparisons to other algorithms.
|
|
340
|
+
Iteration 2: Cut to roughly 200 words by reducing the worked example to its shortest
|
|
341
|
+
form and dropping any step the reader can infer from the ones around it.
|
|
342
|
+
Iteration 3: Cut to 100 words, keeping the inputs, the outputs, the central step, and
|
|
343
|
+
the complexity, and nothing else.
|
|
344
|
+
|
|
345
|
+
ITERATION INSTRUCTIONS:
|
|
346
|
+
In each pass, identify what can be cut, compressed, or clarified, apply the changes,
|
|
347
|
+
then check both that the result serves the goal above better than the version before
|
|
348
|
+
it and that nothing the goal requires keeping was lost. Stop when all three passes are
|
|
349
|
+
complete.
|
|
350
|
+
|
|
351
|
+
OUTPUT FORMAT:
|
|
352
|
+
Deliver the final version in this format:
|
|
353
|
+
a numbered list of steps followed by one sentence naming the time and space
|
|
354
|
+
complexity.
|
|
355
|
+
|
|
356
|
+
INTERMEDIATE VERSIONS:
|
|
357
|
+
Show the output of every iteration in order, labelled by pass number.
|
|
358
|
+
|
|
359
|
+
Compression has a floor. Past a point, passes strip meaning rather than filler. If a
|
|
360
|
+
pass would remove something a reader needs, stop at the previous version and deliver
|
|
361
|
+
that.
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
## Refinement Strategies
|
|
365
|
+
|
|
366
|
+
### What to Remove
|
|
367
|
+
- Redundant information
|
|
368
|
+
- Obvious statements
|
|
369
|
+
- Unnecessary qualifiers ("very", "really")
|
|
370
|
+
- Passive voice (often)
|
|
371
|
+
- Filler words
|
|
372
|
+
- Overly general statements
|
|
373
|
+
|
|
374
|
+
### What to Add
|
|
375
|
+
- Specific examples
|
|
376
|
+
- Precise numbers
|
|
377
|
+
- Concrete details
|
|
378
|
+
- Missing context (if essential)
|
|
379
|
+
- Clarifying examples
|
|
380
|
+
|
|
381
|
+
### What to Improve
|
|
382
|
+
- Vague language → specific language
|
|
383
|
+
- Long sentences → shorter, punchier
|
|
384
|
+
- Complex words → simpler alternatives (if clearer)
|
|
385
|
+
- Weak verbs → strong verbs
|
|
386
|
+
- Passive voice → active voice
|
|
387
|
+
|
|
388
|
+
## Quality Indicators
|
|
389
|
+
|
|
390
|
+
**Good Iterative Compression iterations show:**
|
|
391
|
+
- ✅ Measurable improvement each pass
|
|
392
|
+
- ✅ Increased information density
|
|
393
|
+
- ✅ Reduced redundancy
|
|
394
|
+
- ✅ Maintained accuracy
|
|
395
|
+
- ✅ Enhanced clarity
|
|
396
|
+
- ✅ Clear evolution path
|
|
397
|
+
|
|
398
|
+
**Poor Iterative Compression iterations show:**
|
|
399
|
+
- ❌ No meaningful change
|
|
400
|
+
- ❌ Loss of important information
|
|
401
|
+
- ❌ Decreased clarity
|
|
402
|
+
- ❌ Introduced errors
|
|
403
|
+
- ❌ Just made it shorter without improvement
|
|
404
|
+
|
|
405
|
+
## Use Cases
|
|
406
|
+
|
|
407
|
+
### 1. Content Summarization
|
|
408
|
+
Taking long documents and progressively distilling essence
|
|
409
|
+
|
|
410
|
+
### 2. Message Refinement
|
|
411
|
+
Iteratively improving emails, announcements, communications
|
|
412
|
+
|
|
413
|
+
### 3. Documentation Optimization
|
|
414
|
+
Making docs clearer and more concise through iteration
|
|
415
|
+
|
|
416
|
+
### 4. Explanation Enhancement
|
|
417
|
+
Progressively improving how concepts are explained
|
|
418
|
+
|
|
419
|
+
### 5. Writing Polish
|
|
420
|
+
Iterative editing of creative or professional writing
|
|
421
|
+
|
|
422
|
+
### 6. Presentation Optimization
|
|
423
|
+
Refining slides/talks through multiple passes
|
|
424
|
+
|
|
425
|
+
## Assessment Checklist
|
|
426
|
+
|
|
427
|
+
When using Iterative Compression:
|
|
428
|
+
- [ ] Task benefits from iteration
|
|
429
|
+
- [ ] Number of iterations specified
|
|
430
|
+
- [ ] Optimization goals are clear
|
|
431
|
+
- [ ] Each iteration has purpose
|
|
432
|
+
- [ ] Constraints defined for each pass
|
|
433
|
+
- [ ] Evolution is tracked/shown
|
|
434
|
+
- [ ] Quality criteria established
|
|
435
|
+
- [ ] Stopping condition exists
|
|
436
|
+
- [ ] Final version is actually better
|
|
437
|
+
- [ ] Process improved understanding
|
|
438
|
+
|
|
439
|
+
## Tips for Success
|
|
440
|
+
|
|
441
|
+
1. **Start Verbose**: First iteration should be complete, even if wordy
|
|
442
|
+
2. **One Focus Per Iteration**: Don't try to improve everything at once
|
|
443
|
+
3. **Show Your Work**: Display each iteration to see progress
|
|
444
|
+
4. **Set Constraints**: Give specific targets (word counts, focus areas)
|
|
445
|
+
5. **Verify Improvement**: Check that each iteration actually improves quality
|
|
446
|
+
6. **Don't Over-Iterate**: 3-5 iterations usually sufficient
|
|
447
|
+
7. **Preserve Accuracy**: Never sacrifice correctness for brevity
|
|
448
|
+
8. **Explain Changes**: Note what improved and why
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
Least-to-Most (LtM) prompting is a decomposition-first framework that breaks a complex problem into an ordered sequence of simpler subproblems, then solves them sequentially — using each prior answer as context for the next. Unlike Chain of Thought (which reasons through a problem in one pass), LtM explicitly separates decomposition from execution, and the subproblems are sequenced from simplest to most complex.
|
|
6
6
|
|
|
7
|
+
When the prompt is emitted, its section headers — PROBLEM, SOURCE MATERIAL, DECOMPOSE, SOLVE SEQUENTIALLY — are stripped and the model receives a flat block; the decomposition and solving instructions are written as complete sentences, and the `Subproblem 1:` / `Final:` labels survive as literal labels inside the protocol, so the ordered structure is preserved without the headers.
|
|
8
|
+
|
|
7
9
|
**Research basis:** "Least-to-Most Prompting Enables Complex Reasoning in Large Language Models" (Zhou et al., Google Brain, arXiv:2205.10625, ICLR 2023). On SCAN compositional generalization: LtM achieves 99.7% vs. CoT's 16%. On GSM8K math: matches or exceeds CoT with fewer errors.
|
|
8
10
|
|
|
9
11
|
## Why LtM Differs from Chain of Thought
|
|
@@ -19,7 +21,7 @@ Least-to-Most (LtM) prompting is a decomposition-first framework that breaks a c
|
|
|
19
21
|
## Components
|
|
20
22
|
|
|
21
23
|
### Phase 1: Decomposition
|
|
22
|
-
**Purpose:** Break the original problem into an ordered list of subproblems, from simplest to most complex. The key: later subproblems should build on earlier ones.
|
|
24
|
+
**Purpose:** Break the original problem into an ordered list of subproblems, from simplest to most complex. The key: later subproblems should build on earlier ones. The DECOMPOSE header is stripped at emission, so the instruction that opens this phase must be a complete sentence; the numbered `Subproblem 1:`, `Subproblem 2:`, `Final:` labels are literal labels in the protocol and survive the stripping, which is what preserves the ordering once the header is gone.
|
|
23
25
|
|
|
24
26
|
**Trigger:** "To solve [problem], we need to first solve: [list subproblems in order]"
|
|
25
27
|
|
|
@@ -29,29 +31,39 @@ Least-to-Most (LtM) prompting is a decomposition-first framework that breaks a c
|
|
|
29
31
|
- What is the correct ordering — which must come first?
|
|
30
32
|
|
|
31
33
|
### Phase 2: Sequential Solving
|
|
32
|
-
**Purpose:** Solve each subproblem in order, explicitly using prior answers as context.
|
|
34
|
+
**Purpose:** Solve each subproblem in order, explicitly using prior answers as context. Once the SOLVE SEQUENTIALLY header is removed, the only thing telling the model to reuse earlier answers is this instruction, so it ships as an explicit sentence — carry each answer forward as context for the next subproblem — rather than resting on the header.
|
|
33
35
|
|
|
34
36
|
**Pattern:** Answer subproblem 1 → use that answer when solving subproblem 2 → use both when solving subproblem 3 → ... → solve original problem.
|
|
35
37
|
|
|
36
38
|
## Template Structure
|
|
37
39
|
|
|
40
|
+
Section headers — `PROBLEM:`, `SOURCE MATERIAL:`, `DECOMPOSE:`, `SOLVE SEQUENTIALLY:` —
|
|
41
|
+
are stripped at emission, so the instruction beneath each one carries its meaning, and the
|
|
42
|
+
`Subproblem N:` / `Final:` labels stay as literal labels rather than headings. The
|
|
43
|
+
`SOURCE MATERIAL` block is optional: it names the artifact the subproblems reason over and
|
|
44
|
+
is deleted when the problem is self-contained.
|
|
45
|
+
|
|
38
46
|
```
|
|
39
47
|
PROBLEM:
|
|
40
48
|
[The full, complex problem to solve]
|
|
41
49
|
|
|
50
|
+
SOURCE MATERIAL:
|
|
51
|
+
[Optional — paste the source material this problem depends on here (the dataset, figures, code, or document the subproblems must reason over). Delete this line and the one below it if the problem above is self-contained.]
|
|
52
|
+
Every subproblem below must be answered against the material above, not from assumption.
|
|
53
|
+
|
|
42
54
|
DECOMPOSE:
|
|
43
|
-
Break this problem into ordered subproblems, from simplest to most complex.
|
|
55
|
+
Break this problem into ordered subproblems, from simplest prerequisite to most complex.
|
|
44
56
|
Each later subproblem should build on the answer to the previous.
|
|
45
57
|
|
|
46
|
-
Subproblem 1: [Simplest prerequisite]
|
|
47
|
-
Subproblem 2: [
|
|
48
|
-
Subproblem 3: [
|
|
49
|
-
|
|
58
|
+
Subproblem 1: [Simplest prerequisite — must be answered first]
|
|
59
|
+
Subproblem 2: [Builds on #1]
|
|
60
|
+
Subproblem 3: [Builds on #1-2]
|
|
61
|
+
[Add subproblems as needed]
|
|
50
62
|
Final: [The original problem, now solvable using all prior answers]
|
|
51
63
|
|
|
52
64
|
SOLVE SEQUENTIALLY:
|
|
53
|
-
Solve each subproblem in order. Use prior answers as context
|
|
54
|
-
subsequent subproblem. Show each solution before moving to the next.
|
|
65
|
+
Solve each subproblem in order. Use prior answers explicitly as context
|
|
66
|
+
for each subsequent subproblem. Show each solution before moving to the next.
|
|
55
67
|
```
|
|
56
68
|
|
|
57
69
|
### Single-Pass Trigger (model decomposes and solves itself):
|
|
@@ -66,12 +78,17 @@ Problem: [your problem]
|
|
|
66
78
|
|
|
67
79
|
## Complete Examples
|
|
68
80
|
|
|
81
|
+
Every example below is shown in emitted form. Where the subproblems reason over an existing
|
|
82
|
+
artifact, the `SOURCE MATERIAL` block carries it and later subproblems refer to "the
|
|
83
|
+
material above"; where the problem is self-contained, that block is deleted.
|
|
84
|
+
|
|
69
85
|
### Example 1: Multi-Hop Reasoning
|
|
70
86
|
|
|
71
87
|
**Before LtM:**
|
|
72
88
|
"What would the tax implications be for a US remote employee working from Portugal for 3 months?"
|
|
73
89
|
|
|
74
|
-
**After LtM
|
|
90
|
+
**After LtM** (no source material — the problem is self-contained, so the `SOURCE MATERIAL`
|
|
91
|
+
block is deleted):
|
|
75
92
|
```
|
|
76
93
|
PROBLEM:
|
|
77
94
|
What are the tax implications for a US citizen employed by a US company who
|
|
@@ -102,7 +119,8 @@ SOLVE SEQUENTIALLY:
|
|
|
102
119
|
**Before LtM:**
|
|
103
120
|
"How do I add real-time notifications to my Django app?"
|
|
104
121
|
|
|
105
|
-
**After LtM
|
|
122
|
+
**After LtM** (no source material — the problem is self-contained, so the `SOURCE MATERIAL`
|
|
123
|
+
block is deleted):
|
|
106
124
|
```
|
|
107
125
|
PROBLEM:
|
|
108
126
|
I need to add real-time push notifications to a Django app with PostgreSQL.
|
|
@@ -132,12 +150,16 @@ SOLVE SEQUENTIALLY:
|
|
|
132
150
|
**Before LtM:**
|
|
133
151
|
"Should we expand to the European market?"
|
|
134
152
|
|
|
135
|
-
**After LtM
|
|
153
|
+
**After LtM** (source material supplied):
|
|
136
154
|
```
|
|
137
155
|
PROBLEM:
|
|
138
156
|
Our B2B SaaS has strong US traction. Should we expand to the European market
|
|
139
157
|
now, given our current 20-person team and 18 months of runway?
|
|
140
158
|
|
|
159
|
+
SOURCE MATERIAL:
|
|
160
|
+
[Paste the current financials, team breakdown, and US traction metrics here]
|
|
161
|
+
Every subproblem below must be answered against the material above, not from assumption.
|
|
162
|
+
|
|
141
163
|
DECOMPOSE:
|
|
142
164
|
Subproblem 1: What are the key differences between US and European B2B SaaS
|
|
143
165
|
markets that affect a US-native product? (GDPR, sales cycles, localization needs)
|
|
@@ -148,7 +170,7 @@ Subproblem 2: What resources are typically required for a credible EU market ent
|
|
|
148
170
|
Subproblem 3: What are the signals that a company is or isn't ready for
|
|
149
171
|
international expansion?
|
|
150
172
|
|
|
151
|
-
Subproblem 4: Given
|
|
173
|
+
Subproblem 4: Given the team size, runway, and traction shown in the material above,
|
|
152
174
|
how do our resources map to those requirements?
|
|
153
175
|
|
|
154
176
|
Final: Should we expand to Europe now, wait, or explore a different
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
Plan-and-Solve (PS+) is a zero-shot prompting technique that improves upon standard Chain of Thought by instructing the model to explicitly plan the solution approach before executing it — and to be careful about extracting variables and calculating intermediate results. It requires no examples or demonstrations and consistently outperforms Zero-Shot CoT ("Let's think step by step") on reasoning tasks.
|
|
6
6
|
|
|
7
|
+
When the prompt is emitted, the `PROBLEM:` and `SOURCE MATERIAL:` headers are stripped and the instruction reaches the model as a flat block. The plan-and-solve trigger is already a complete sentence, so it survives the stripping intact and needs no carrier sentence; the optional `SOURCE MATERIAL` block names the figures the calculation runs on and ties them to the problem in prose, and is deleted when the problem already states every value.
|
|
8
|
+
|
|
7
9
|
**Research basis:** "Plan-and-Solve Prompting: Improving Zero-Shot Chain-of-Thought Reasoning by Large Language Models" (Wang et al., ACL 2023, arXiv:2305.04091). Tested across 10 reasoning datasets — consistently outperforms Zero-Shot-CoT and is competitive with few-shot CoT.
|
|
8
10
|
|
|
9
11
|
## The Core Trigger Phrases
|
|
@@ -29,11 +31,22 @@ The PS+ additions over PS:
|
|
|
29
31
|
|
|
30
32
|
## Template Structure
|
|
31
33
|
|
|
34
|
+
Section headers — `PROBLEM:` and `SOURCE MATERIAL:` — are stripped at emission, so the
|
|
35
|
+
trigger that follows is written as a complete sentence and survives on its own; it was
|
|
36
|
+
already prose, not a header, which is why PS+ needs no carrier sentence for it. The template
|
|
37
|
+
drops the old `INSTRUCTION:` header for the same reason: a header there would only be
|
|
38
|
+
stripped anyway, so the trigger now sits as bare prose. The `SOURCE MATERIAL` block is
|
|
39
|
+
optional — it names the dataset or table the calculation runs on and is deleted when the
|
|
40
|
+
problem already states every value needed.
|
|
41
|
+
|
|
32
42
|
```
|
|
33
43
|
PROBLEM:
|
|
34
|
-
[Your
|
|
44
|
+
[Your question, calculation, or reasoning problem]
|
|
45
|
+
|
|
46
|
+
SOURCE MATERIAL:
|
|
47
|
+
[Optional — paste the source data the problem depends on here (the dataset, table, figures, or constraint list the calculation runs on). Delete this line and the one below it if the problem above already states every value needed.]
|
|
48
|
+
The figures and constraints in the material above are authoritative — extract from them rather than from assumed or recalled values.
|
|
35
49
|
|
|
36
|
-
INSTRUCTION:
|
|
37
50
|
Let's first understand the problem, extract relevant variables and their
|
|
38
51
|
corresponding numerals, and devise a complete plan. Then, let's carry out
|
|
39
52
|
the plan, calculate intermediate values, pay attention to computation,
|
|
@@ -50,12 +63,19 @@ step by step.
|
|
|
50
63
|
|
|
51
64
|
## Complete Examples
|
|
52
65
|
|
|
66
|
+
Every example below is shown in emitted form. The plan-and-solve trigger is the same
|
|
67
|
+
complete sentence in each — it is what survives header stripping. Where the calculation runs
|
|
68
|
+
on a pasted dataset or constraint list, the `SOURCE MATERIAL` block carries it and the
|
|
69
|
+
problem refers to "the material above"; where every value is already in the problem
|
|
70
|
+
statement, that block is deleted.
|
|
71
|
+
|
|
53
72
|
### Example 1: Math / Calculation
|
|
54
73
|
|
|
55
74
|
**Before PS+:**
|
|
56
75
|
"If a SaaS company has 500 customers at $200/month each, 5% monthly churn, and adds 30 new customers per month, what is the MRR in 6 months?"
|
|
57
76
|
|
|
58
|
-
**After PS
|
|
77
|
+
**After PS+** (no source material — every value is stated in the problem, so the
|
|
78
|
+
`SOURCE MATERIAL` block is deleted):
|
|
59
79
|
```
|
|
60
80
|
PROBLEM:
|
|
61
81
|
A SaaS company has 500 customers paying $200/month each. Monthly churn
|
|
@@ -98,13 +118,16 @@ Final answer: Month 6 MRR = $X
|
|
|
98
118
|
**Before PS+:**
|
|
99
119
|
"Our API is returning responses in 800ms average. We want to get it under 200ms. What should we do?"
|
|
100
120
|
|
|
101
|
-
**After PS
|
|
121
|
+
**After PS+** (source material supplied):
|
|
102
122
|
```
|
|
103
123
|
PROBLEM:
|
|
104
124
|
Our REST API averages 800ms response time. Target is under 200ms.
|
|
105
125
|
The API serves product catalog queries (read-heavy), is Node.js with
|
|
106
|
-
PostgreSQL, and currently has no caching layer.
|
|
107
|
-
|
|
126
|
+
PostgreSQL, and currently has no caching layer.
|
|
127
|
+
|
|
128
|
+
SOURCE MATERIAL:
|
|
129
|
+
[Paste the endpoint's profiling output and the current server and database configuration here]
|
|
130
|
+
The figures and constraints in the material above are authoritative — extract from them rather than from assumed or recalled values.
|
|
108
131
|
|
|
109
132
|
Let's first understand the problem, extract relevant variables and their
|
|
110
133
|
corresponding numerals, and devise a complete plan. Then, let's carry out
|
|
@@ -116,7 +139,8 @@ the plan and solve step by step.
|
|
|
116
139
|
**Before PS+:**
|
|
117
140
|
"What's our payback period if CAC is $1,200 and average MRR per customer is $150 with 70% gross margin?"
|
|
118
141
|
|
|
119
|
-
**After PS
|
|
142
|
+
**After PS+** (no source material — every value is stated in the problem, so the
|
|
143
|
+
`SOURCE MATERIAL` block is deleted):
|
|
120
144
|
```
|
|
121
145
|
PROBLEM:
|
|
122
146
|
Customer Acquisition Cost (CAC): $1,200
|
|
@@ -136,10 +160,15 @@ and solve the problem step by step.
|
|
|
136
160
|
**Before PS+:**
|
|
137
161
|
"Given these constraints [complex scheduling problem], is there a valid schedule?"
|
|
138
162
|
|
|
139
|
-
**After PS
|
|
163
|
+
**After PS+** (source material supplied):
|
|
140
164
|
```
|
|
141
165
|
PROBLEM:
|
|
142
|
-
|
|
166
|
+
Determine whether a valid schedule exists that satisfies every constraint,
|
|
167
|
+
or prove that none does.
|
|
168
|
+
|
|
169
|
+
SOURCE MATERIAL:
|
|
170
|
+
[Paste the full list of scheduling constraints — resources, time windows, and dependencies — here]
|
|
171
|
+
The figures and constraints in the material above are authoritative — extract from them rather than from assumed or recalled values.
|
|
143
172
|
|
|
144
173
|
Let's first understand the problem, extract all constraints and their
|
|
145
174
|
relationships, and devise a complete plan for finding a valid schedule
|