@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
|
@@ -2,478 +2,172 @@
|
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
5
|
-
Chain of Density is
|
|
5
|
+
Chain of Density is a summarization technique that produces a series of increasingly **entity-dense** summaries of a source document while holding the **length fixed**. It begins with a deliberately sparse, verbose summary, then repeatedly identifies salient entities missing from the previous version and fuses them in — making room by compressing and rewriting existing text rather than by adding words or dropping content.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**Research basis:** "From Sparse to Dense: GPT-4 Summarization with Chain of Density Prompting" (Adams, Fabbri, Ladhak, Lehman & Elhadad; arXiv 2309.04269; NewSum workshop at EMNLP 2023, ACL Anthology 2023.newsum-1.7). Entity density rose from 0.089 to 0.167 entities per token over five steps, against 0.151 for human-written summaries and 0.122 for a vanilla GPT-4 summary. In human evaluation, annotators preferred step 2 (30.8% of first-place votes) and step 3 (23.0%) over the sparse step 1 (8.3%) — density helps, but only up to a point.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
1. Starts with a basic/verbose version
|
|
11
|
-
2. Iteratively refines through multiple passes
|
|
12
|
-
3. Increases information density each time
|
|
13
|
-
4. Removes fluff and redundancy
|
|
14
|
-
5. Enhances clarity and precision
|
|
15
|
-
6. Converges on optimal output
|
|
9
|
+
## The Defining Constraint: Length Stays Fixed
|
|
16
10
|
|
|
17
|
-
|
|
11
|
+
This is the entire mechanism, and it is what separates CoD from ordinary iterative editing:
|
|
18
12
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
**Ideal for:**
|
|
22
|
-
- Summarization tasks
|
|
23
|
-
- Content compression
|
|
24
|
-
- Iterative improvement of writing
|
|
25
|
-
- Optimizing explanations
|
|
26
|
-
- Refining complex outputs
|
|
27
|
-
- Tasks where quality improves with iteration
|
|
28
|
-
|
|
29
|
-
**Not needed for:**
|
|
30
|
-
- Simple one-shot tasks
|
|
31
|
-
- When first draft is sufficient
|
|
32
|
-
- Time-critical quick tasks
|
|
33
|
-
- Tasks with fixed formats that can't improve
|
|
34
|
-
|
|
35
|
-
## Implementation Approaches
|
|
36
|
-
|
|
37
|
-
### Approach 1: Explicit Multi-Pass
|
|
38
|
-
Request multiple iterations upfront.
|
|
39
|
-
|
|
40
|
-
**Example:**
|
|
41
|
-
```
|
|
42
|
-
Create a summary of this article using Chain of Density:
|
|
43
|
-
|
|
44
|
-
ITERATION 1:
|
|
45
|
-
Write a verbose summary hitting all main points (150-200 words)
|
|
46
|
-
|
|
47
|
-
ITERATION 2:
|
|
48
|
-
Refine the summary: increase information density, remove redundancy, keep it under 150 words
|
|
49
|
-
|
|
50
|
-
ITERATION 3:
|
|
51
|
-
Further refine: make every word count, increase precision, keep it under 120 words
|
|
52
|
-
|
|
53
|
-
ITERATION 4:
|
|
54
|
-
Final pass: maximize information density while maintaining clarity (100 words max)
|
|
55
|
-
|
|
56
|
-
ITERATION 5:
|
|
57
|
-
Ultimate compression: distill to absolute essentials (50 words max)
|
|
58
|
-
|
|
59
|
-
After all iterations, explain what improved in each pass.
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### Approach 2: Recursive Refinement
|
|
63
|
-
Use output from one iteration as input to the next.
|
|
64
|
-
|
|
65
|
-
**Example:**
|
|
66
|
-
```
|
|
67
|
-
PASS 1: Write a first draft explanation of quantum entanglement for a general audience.
|
|
68
|
-
|
|
69
|
-
PASS 2: Review your explanation. What's unclear? What's redundant? Rewrite it, addressing these issues.
|
|
70
|
-
|
|
71
|
-
PASS 3: Review again. Where can you be more precise? Where can you use better examples? Rewrite.
|
|
72
|
-
|
|
73
|
-
PASS 4: Final review. Every sentence should earn its place. Remove or improve anything that doesn't. Final version.
|
|
74
|
-
|
|
75
|
-
Show all passes so we can see the evolution.
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### Approach 3: Targeted Improvement
|
|
79
|
-
Focus each iteration on specific aspect.
|
|
80
|
-
|
|
81
|
-
**Example:**
|
|
82
|
-
```
|
|
83
|
-
Write a product description, then improve it iteratively:
|
|
84
|
-
|
|
85
|
-
DRAFT:
|
|
86
|
-
[Initial version]
|
|
87
|
-
|
|
88
|
-
ITERATION 1 - CLARITY:
|
|
89
|
-
Rewrite focusing on making it clearer and easier to understand.
|
|
90
|
-
|
|
91
|
-
ITERATION 2 - IMPACT:
|
|
92
|
-
Rewrite focusing on making it more compelling and persuasive.
|
|
13
|
+
> "GPT-4 generates an initial entity-sparse summary before iteratively incorporating missing salient entities **without increasing the length**." — abstract
|
|
93
14
|
|
|
94
|
-
|
|
95
|
-
Rewrite focusing on removing every unnecessary word.
|
|
15
|
+
> "To maintain the same length while increasing the number of entities covered, abstraction, fusion, and compression is explicitly encouraged, rather than dropping meaningful content from previous summaries." — §2
|
|
96
16
|
|
|
97
|
-
|
|
98
|
-
Rewrite focusing on being more specific and accurate.
|
|
17
|
+
Density rises because the *same word budget* is made to carry more information. If you shorten the text on each pass, you are not doing Chain of Density — you are doing generic compression. For that, use **Iterative Compression** (`iterative-compression.md`).
|
|
99
18
|
|
|
100
|
-
|
|
101
|
-
Combine the best elements from all iterations.
|
|
102
|
-
```
|
|
19
|
+
The paper controls length deliberately, because length is "a strong confounder when evaluating summaries." In practice the budget holds approximately: measured token counts across the five steps were 72, 67, 67, 69, 72.
|
|
103
20
|
|
|
104
|
-
|
|
105
|
-
Add tighter constraints with each iteration.
|
|
21
|
+
## What Counts as a "Missing Entity"
|
|
106
22
|
|
|
107
|
-
|
|
108
|
-
```
|
|
109
|
-
Explain this technical concept through progressive refinement:
|
|
23
|
+
The paper is deliberately non-prescriptive about entity *types*. An entity qualifies if it is:
|
|
110
24
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
25
|
+
- **Relevant** — to the main story
|
|
26
|
+
- **Specific** — descriptive yet concise (5 words or fewer)
|
|
27
|
+
- **Novel** — not in the previous summary
|
|
28
|
+
- **Faithful** — present in the source article
|
|
29
|
+
- **Anywhere** — located anywhere in the article, not just the opening
|
|
116
30
|
|
|
117
|
-
|
|
118
|
-
```
|
|
31
|
+
"Anywhere" is load-bearing: it is the explicit countermeasure to lead bias, and it is why later iterations start pulling content from the middle and end of the source.
|
|
119
32
|
|
|
120
|
-
|
|
33
|
+
Entity identification is done by the model itself inside the loop — there is no external extraction step.
|
|
121
34
|
|
|
122
|
-
|
|
123
|
-
```
|
|
124
|
-
Good:
|
|
125
|
-
"Iterate to improve:
|
|
126
|
-
- Information density
|
|
127
|
-
- Clarity
|
|
128
|
-
- Conciseness
|
|
129
|
-
- Precision"
|
|
130
|
-
|
|
131
|
-
Poor:
|
|
132
|
-
"Make it better"
|
|
133
|
-
```
|
|
35
|
+
## The Method
|
|
134
36
|
|
|
135
|
-
|
|
136
|
-
```
|
|
137
|
-
Good:
|
|
138
|
-
"Refine through 4 iterations, showing each version"
|
|
37
|
+
`[N]` iterations, issued as a **single prompt** that returns all `[N]` summaries at once (not `[N]` separate turns). The paper uses five, and that is the template's default when the user gives no number:
|
|
139
38
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
39
|
+
1. **Write a deliberately sparse first summary.** Long (4-5 sentences, ~`[TARGET]` words) but highly non-specific, padded with filler like "this article discusses." The padding is intentional — it creates the slack that later steps convert into entities.
|
|
40
|
+
2. **Identify 1-3 missing entities** from the article that are absent from the current summary.
|
|
41
|
+
3. **Rewrite at identical length**, covering everything from the previous summary *plus* the new entities. Make room through fusion, compression, and removal of uninformative phrases.
|
|
42
|
+
4. **Repeat steps 2-3** until `[N]` summaries exist.
|
|
43
|
+
5. **Choose the step you want.** Later is not automatically better — human raters preferred steps 2-3.
|
|
143
44
|
|
|
144
|
-
|
|
145
|
-
```
|
|
146
|
-
Good:
|
|
147
|
-
"Show each iteration and explain what changed and why"
|
|
148
|
-
|
|
149
|
-
Poor:
|
|
150
|
-
"Just give me the final version"
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
### 4. Set Clear Constraints
|
|
154
|
-
```
|
|
155
|
-
Good:
|
|
156
|
-
"Each iteration should be 20% shorter while maintaining completeness"
|
|
157
|
-
|
|
158
|
-
Poor:
|
|
159
|
-
"Make it shorter"
|
|
160
|
-
```
|
|
45
|
+
**Never drop entities from the previous summary.** If space cannot be made, add fewer new entities. Under pressure, density yields — length and prior content do not.
|
|
161
46
|
|
|
162
|
-
##
|
|
163
|
-
|
|
164
|
-
### Example 1: Summarization
|
|
165
|
-
|
|
166
|
-
**Without CoD:**
|
|
167
|
-
```
|
|
168
|
-
Summarize this research paper.
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
**With CoD:**
|
|
172
|
-
```
|
|
173
|
-
Summarize this research paper using Chain of Density:
|
|
174
|
-
|
|
175
|
-
[Paper content]
|
|
176
|
-
|
|
177
|
-
ITERATION 1 (200 words):
|
|
178
|
-
Create a comprehensive summary covering all major points. Prioritize completeness over brevity.
|
|
47
|
+
## When to Use Chain of Density
|
|
179
48
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
-
|
|
183
|
-
-
|
|
184
|
-
-
|
|
49
|
+
**Ideal for:**
|
|
50
|
+
- Summarizing an article, paper, or report where information density matters
|
|
51
|
+
- Producing a summary that must fit a fixed length but carry maximum substance
|
|
52
|
+
- Generating several density options to pick from
|
|
53
|
+
- Abstract, executive-summary, and TL;DR writing
|
|
185
54
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
-
|
|
189
|
-
-
|
|
190
|
-
- Maintain accuracy
|
|
55
|
+
**Not for:**
|
|
56
|
+
- General content rewriting or quality improvement → use **Self-Refine**
|
|
57
|
+
- Progressive shortening to a target word count → use **Iterative Compression**
|
|
58
|
+
- Non-summarization tasks. CoD is summarization-specific; the paper evaluates it only on news articles (CNN/DailyMail).
|
|
191
59
|
|
|
192
|
-
|
|
193
|
-
Maximum density:
|
|
194
|
-
- Distill to core findings
|
|
195
|
-
- Remove all fluff
|
|
196
|
-
- Preserve critical details
|
|
60
|
+
## Template Structure
|
|
197
61
|
|
|
198
|
-
|
|
199
|
-
```
|
|
62
|
+
The block below is the template's prompt region as authored — what you fill in, not what you send. (Its divider rules are omitted; they mark the guidance/prompt boundary inside the template file and never ship.) Section headers are stripped at emission, so every slot's meaning is carried by the prose around and inside it rather than by the header above it. `SOURCE MATERIAL:` is such a header — it goes, and the unbracketed sentence below it is what tells the model the pasted text is the article to summarize. `Step 1.`, `Step 2.` and `Guidelines:` are the exception: they are literal labels inside the paper's protocol, not document structure, and they ship verbatim.
|
|
200
63
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
**Without CoD:**
|
|
204
|
-
```
|
|
205
|
-
Document this function.
|
|
206
|
-
```
|
|
64
|
+
`[TARGET]` is the fixed word budget and `[N]` the number of summaries, both as bare numerals. Substitute the same numeral at every occurrence of each — in the prompt body below, `[TARGET]` appears three times and `[N]` three times. (The template file names each twice more in its guidance region; those are descriptions of the fields, not slots, and never ship.) The paper's settings are `[TARGET]` = 80 and `[N]` = 5; use those if the user gave no numbers of their own.
|
|
207
65
|
|
|
208
|
-
**With CoD:**
|
|
209
66
|
```
|
|
210
|
-
|
|
67
|
+
SOURCE MATERIAL:
|
|
68
|
+
[Paste the full document to be summarized here.]
|
|
69
|
+
Use the material above as the article to be summarized for the work described below.
|
|
211
70
|
|
|
212
|
-
|
|
71
|
+
You will generate increasingly concise, entity-dense summaries of the article above.
|
|
72
|
+
Produce [N] summaries in total, each denser than the last, all in a single response.
|
|
73
|
+
Every summary must be exactly [TARGET] words long.
|
|
213
74
|
|
|
214
|
-
|
|
215
|
-
Write complete documentation with examples, edge cases, everything.
|
|
75
|
+
Repeat the following 2 steps [N] times.
|
|
216
76
|
|
|
217
|
-
|
|
218
|
-
|
|
77
|
+
Step 1. Identify 1-3 informative entities (";" delimited) from the article which
|
|
78
|
+
are missing from the previously generated summary.
|
|
79
|
+
Step 2. Write a new, denser summary of identical length which covers every entity
|
|
80
|
+
and detail from the previous summary plus the missing entities.
|
|
219
81
|
|
|
220
|
-
|
|
221
|
-
|
|
82
|
+
A missing entity is:
|
|
83
|
+
- Relevant: to the main story.
|
|
84
|
+
- Specific: descriptive yet concise (5 words or fewer).
|
|
85
|
+
- Novel: not in the previous summary.
|
|
86
|
+
- Faithful: present in the article.
|
|
87
|
+
- Anywhere: located anywhere in the article.
|
|
222
88
|
|
|
223
|
-
|
|
224
|
-
|
|
89
|
+
Guidelines:
|
|
90
|
+
- The first summary should be long (4-5 sentences, ~[TARGET] words) yet highly
|
|
91
|
+
non-specific, containing little information beyond the entities marked as missing.
|
|
92
|
+
Use overly verbose language and fillers (e.g., "this article discusses") to reach
|
|
93
|
+
~[TARGET] words.
|
|
94
|
+
- Make every word count: re-write the previous summary to improve flow and make
|
|
95
|
+
space for additional entities.
|
|
96
|
+
- Make space with fusion, compression, and removal of uninformative phrases like
|
|
97
|
+
"the article discusses".
|
|
98
|
+
- The summaries should become highly dense and concise yet self-contained, e.g.,
|
|
99
|
+
easily understood without the article.
|
|
100
|
+
- Missing entities can appear anywhere in the new summary.
|
|
101
|
+
- Never drop entities from the previous summary. If space cannot be made, add
|
|
102
|
+
fewer new entities.
|
|
225
103
|
|
|
226
|
-
|
|
227
|
-
Optimize for developer experience. What do they need to know most?
|
|
104
|
+
Remember, use the exact same number of words for each summary.
|
|
228
105
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
### Example 3: Email Refinement
|
|
106
|
+
Answer in JSON. The JSON should be a list (length [N]) of dictionaries whose keys are
|
|
107
|
+
"Missing_Entities" and "Denser_Summary".
|
|
233
108
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
109
|
+
After the JSON, and outside it, add one short paragraph naming which summary you
|
|
110
|
+
recommend and why. Do not default to the last one: in the paper's human evaluation,
|
|
111
|
+
summary 2 (30.8% of first-place votes) and summary 3 (23.0%) were preferred over the
|
|
112
|
+
sparse summary 1 (8.3%), because past a point density costs readability.
|
|
237
113
|
```
|
|
238
114
|
|
|
239
|
-
|
|
240
|
-
```
|
|
241
|
-
Draft an announcement email, then refine it:
|
|
115
|
+
### Relationship to the paper's original prompt
|
|
242
116
|
|
|
243
|
-
|
|
244
|
-
Write a first draft covering all important information.
|
|
117
|
+
The body above is the paper's prompt, reproduced closely on purpose — the specific wording, especially the fixed-length instruction and the entity criteria, is what makes the technique work. Three deliberate departures:
|
|
245
118
|
|
|
246
|
-
|
|
247
|
-
|
|
119
|
+
- **`SOURCE MATERIAL:` replaces the paper's `Article: {{ARTICLE}}` field.** Same job, house convention, and the trailing sentence survives header-stripping where a bare `Article:` label would not.
|
|
120
|
+
- **`[TARGET]` and `[N]` are parameterized** where the paper hardcodes 80 and 5, so the template serves a user-supplied budget and pass count.
|
|
121
|
+
- **The closing recommendation paragraph is an addition, not from the paper.** The paper reports the preference numbers; it does not instruct the model to act on them. This template does, so the user gets a pick rather than a default-to-last.
|
|
248
122
|
|
|
249
|
-
|
|
250
|
-
Simplify language. Remove jargon. Make it scannable.
|
|
123
|
+
Sentence-case "missing entity" and "article" replace the paper's mid-sentence capitals. That is formatting only — no wording changed.
|
|
251
124
|
|
|
252
|
-
|
|
253
|
-
Strengthen the call-to-action. Make it more compelling.
|
|
125
|
+
## Worked Example
|
|
254
126
|
|
|
255
|
-
|
|
256
|
-
Final edits for tone, concision, impact.
|
|
127
|
+
**Source:** a 1,200-word news article about a municipal transit funding decision.
|
|
257
128
|
|
|
258
|
-
|
|
259
|
-
|
|
129
|
+
**Step 1 (sparse, ~80 words):**
|
|
130
|
+
> This article discusses a recent decision made by local government officials regarding transportation. It covers the various considerations that were taken into account during the deliberation process, as well as some of the reactions from different groups. The piece also touches on the broader context surrounding the issue and what it might mean going forward for the region and the people who live there.
|
|
260
131
|
|
|
261
|
-
|
|
132
|
+
Entities: 0 meaningful. Pure filler — by design.
|
|
262
133
|
|
|
263
|
-
**
|
|
264
|
-
|
|
265
|
-
Explain how this algorithm works.
|
|
266
|
-
```
|
|
134
|
+
**Step 2 (same length, entities fused in):**
|
|
135
|
+
> Portland's city council voted 4-1 on Tuesday to redirect $47 million from the Southwest Corridor light-rail project to bus rapid transit, citing a 30% cost overrun. Commissioner Dana Reyes cast the dissenting vote. TriMet, which operates the region's transit, had lobbied for the shift. Riders' advocacy group OPAL called the decision a setback for east-side commuters, while the Portland Business Alliance welcomed it.
|
|
267
136
|
|
|
268
|
-
|
|
269
|
-
```
|
|
270
|
-
Explain this algorithm through progressive refinement:
|
|
137
|
+
Same word budget. The filler is gone; ten specific entities took its place.
|
|
271
138
|
|
|
272
|
-
|
|
273
|
-
Explain thoroughly, assuming no prior knowledge. Include:
|
|
274
|
-
- What it does
|
|
275
|
-
- How it works
|
|
276
|
-
- Why it's designed this way
|
|
277
|
-
- Example walkthrough
|
|
139
|
+
**Steps 3-5** continue fusing — ridership figures, the revised completion date, the federal grant condition — each time compressing existing phrasing to make room.
|
|
278
140
|
|
|
279
|
-
|
|
280
|
-
Review Pass 1. What's unclear? What's redundant? Rewrite addressing these.
|
|
281
|
-
|
|
282
|
-
PASS 3 - OPTIMIZED:
|
|
283
|
-
Make it maximally clear and concise. Every paragraph must earn its place.
|
|
284
|
-
|
|
285
|
-
PASS 4 - POLISHED:
|
|
286
|
-
Final pass. Perfect clarity, zero fluff, optimal examples.
|
|
141
|
+
## Best Practices
|
|
287
142
|
|
|
288
|
-
|
|
289
|
-
|
|
143
|
+
1. **Enforce the length constraint explicitly.** Models drift toward expanding. "Use the exact same number of words for each summary" is not optional boilerplate.
|
|
144
|
+
2. **Let the first summary be bad.** The instinct is to start strong; resist it. A dense first summary leaves no slack, and the chain stalls immediately.
|
|
145
|
+
3. **Ask for all iterations in one response.** The paper uses a single prompt returning a JSON list of five. Splitting it across turns loses the model's view of the prior chain.
|
|
146
|
+
4. **Pick the step, don't assume the last.** Step 5 is the densest but not the most readable. Steps 2-3 won the human evaluation.
|
|
147
|
+
5. **Watch for the readability tradeoff.** Past a point, dense summaries read as lists of facts. The paper found this explicitly.
|
|
290
148
|
|
|
291
149
|
## Combining CoD with Other Frameworks
|
|
292
150
|
|
|
293
151
|
### CoD + CO-STAR
|
|
294
|
-
|
|
295
|
-
CONTEXT: [Background]
|
|
296
|
-
OBJECTIVE: [Goal]
|
|
297
|
-
STYLE: [Writing style]
|
|
298
|
-
TONE: [Tone]
|
|
299
|
-
AUDIENCE: [Readers]
|
|
300
|
-
|
|
301
|
-
RESPONSE PROCESS (Chain of Density):
|
|
302
|
-
Draft 1: [Comprehensive version]
|
|
303
|
-
Draft 2: [Refined for clarity]
|
|
304
|
-
Draft 3: [Optimized for audience]
|
|
305
|
-
Draft 4: [Final polished version]
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
### CoD + RISEN
|
|
309
|
-
```
|
|
310
|
-
ROLE: [Expertise]
|
|
311
|
-
INSTRUCTIONS: Use iterative refinement
|
|
312
|
-
STEPS:
|
|
313
|
-
1. Create initial version
|
|
314
|
-
2. Review and identify weaknesses
|
|
315
|
-
3. Refine addressing weaknesses
|
|
316
|
-
4. Repeat until optimal
|
|
317
|
-
END GOAL: [Final quality criteria]
|
|
318
|
-
NARROWING: [Constraints on iterations]
|
|
319
|
-
```
|
|
152
|
+
Use CO-STAR to fix audience, tone, and format for the summary; use CoD to maximize what fits in that format. Useful when the summary has a specific reader.
|
|
320
153
|
|
|
321
154
|
### CoD + Chain of Thought
|
|
322
|
-
|
|
323
|
-
For each iteration of Chain of Density, use Chain of Thought:
|
|
324
|
-
|
|
325
|
-
ITERATION 1:
|
|
326
|
-
Think through: What should this initial version include?
|
|
327
|
-
[Create version]
|
|
328
|
-
|
|
329
|
-
ITERATION 2:
|
|
330
|
-
Think through: What weaknesses exist? How to address them?
|
|
331
|
-
[Refine version]
|
|
332
|
-
|
|
333
|
-
ITERATION 3:
|
|
334
|
-
Think through: What can be compressed or improved?
|
|
335
|
-
[Further refine]
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
## Advanced Techniques
|
|
339
|
-
|
|
340
|
-
### Aspect-Focused Iteration
|
|
341
|
-
Each iteration improves a different dimension:
|
|
342
|
-
|
|
343
|
-
```
|
|
344
|
-
ITERATION 1 - ACCURACY: Get the facts right
|
|
345
|
-
ITERATION 2 - CLARITY: Make it understandable
|
|
346
|
-
ITERATION 3 - CONCISION: Remove waste
|
|
347
|
-
ITERATION 4 - IMPACT: Make it compelling
|
|
348
|
-
ITERATION 5 - STYLE: Polish the voice
|
|
349
|
-
```
|
|
350
|
-
|
|
351
|
-
### A/B Iteration Branches
|
|
352
|
-
Create alternative versions and merge best parts:
|
|
353
|
-
|
|
354
|
-
```
|
|
355
|
-
DRAFT: [Initial version]
|
|
356
|
-
|
|
357
|
-
BRANCH A - CONCISION:
|
|
358
|
-
[Optimize for brevity]
|
|
359
|
-
|
|
360
|
-
BRANCH B - COMPLETENESS:
|
|
361
|
-
[Optimize for thoroughness]
|
|
362
|
-
|
|
363
|
-
MERGE:
|
|
364
|
-
Combine the best elements of both branches.
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
### Constrained Progressive Compression
|
|
368
|
-
```
|
|
369
|
-
VERSION 1: 1000 words - Complete explanation
|
|
370
|
-
VERSION 2: 500 words - 50% compression
|
|
371
|
-
VERSION 3: 250 words - 75% compression
|
|
372
|
-
VERSION 4: 100 words - 90% compression
|
|
373
|
-
VERSION 5: 25 words - 97.5% compression
|
|
374
|
-
|
|
375
|
-
Each version must be self-contained and accurate.
|
|
376
|
-
```
|
|
377
|
-
|
|
378
|
-
### Quality Metric Iteration
|
|
379
|
-
```
|
|
380
|
-
ITERATION 1:
|
|
381
|
-
[Create initial version]
|
|
382
|
-
Self-assess (1-10): Clarity ___ Concision ___ Accuracy ___ Impact ___
|
|
383
|
-
|
|
384
|
-
ITERATION 2:
|
|
385
|
-
[Improve lowest scoring dimension]
|
|
386
|
-
Self-assess: Clarity ___ Concision ___ Accuracy ___ Impact ___
|
|
387
|
-
|
|
388
|
-
ITERATION 3:
|
|
389
|
-
[Improve next lowest dimension]
|
|
390
|
-
Self-assess: Clarity ___ Concision ___ Accuracy ___ Impact ___
|
|
391
|
-
|
|
392
|
-
Continue until all metrics > 8
|
|
393
|
-
```
|
|
394
|
-
|
|
395
|
-
## Refinement Strategies
|
|
396
|
-
|
|
397
|
-
### What to Remove
|
|
398
|
-
- Redundant information
|
|
399
|
-
- Obvious statements
|
|
400
|
-
- Unnecessary qualifiers ("very", "really")
|
|
401
|
-
- Passive voice (often)
|
|
402
|
-
- Filler words
|
|
403
|
-
- Overly general statements
|
|
404
|
-
|
|
405
|
-
### What to Add
|
|
406
|
-
- Specific examples
|
|
407
|
-
- Precise numbers
|
|
408
|
-
- Concrete details
|
|
409
|
-
- Missing context (if essential)
|
|
410
|
-
- Clarifying examples
|
|
411
|
-
|
|
412
|
-
### What to Improve
|
|
413
|
-
- Vague language → specific language
|
|
414
|
-
- Long sentences → shorter, punchier
|
|
415
|
-
- Complex words → simpler alternatives (if clearer)
|
|
416
|
-
- Weak verbs → strong verbs
|
|
417
|
-
- Passive voice → active voice
|
|
418
|
-
|
|
419
|
-
## Quality Indicators
|
|
420
|
-
|
|
421
|
-
**Good CoD iterations show:**
|
|
422
|
-
- ✅ Measurable improvement each pass
|
|
423
|
-
- ✅ Increased information density
|
|
424
|
-
- ✅ Reduced redundancy
|
|
425
|
-
- ✅ Maintained accuracy
|
|
426
|
-
- ✅ Enhanced clarity
|
|
427
|
-
- ✅ Clear evolution path
|
|
428
|
-
|
|
429
|
-
**Poor CoD iterations show:**
|
|
430
|
-
- ❌ No meaningful change
|
|
431
|
-
- ❌ Loss of important information
|
|
432
|
-
- ❌ Decreased clarity
|
|
433
|
-
- ❌ Introduced errors
|
|
434
|
-
- ❌ Just made it shorter without improvement
|
|
435
|
-
|
|
436
|
-
## Use Cases
|
|
437
|
-
|
|
438
|
-
### 1. Content Summarization
|
|
439
|
-
Taking long documents and progressively distilling essence
|
|
440
|
-
|
|
441
|
-
### 2. Message Refinement
|
|
442
|
-
Iteratively improving emails, announcements, communications
|
|
443
|
-
|
|
444
|
-
### 3. Documentation Optimization
|
|
445
|
-
Making docs clearer and more concise through iteration
|
|
446
|
-
|
|
447
|
-
### 4. Explanation Enhancement
|
|
448
|
-
Progressively improving how concepts are explained
|
|
449
|
-
|
|
450
|
-
### 5. Writing Polish
|
|
451
|
-
Iterative editing of creative or professional writing
|
|
452
|
-
|
|
453
|
-
### 6. Presentation Optimization
|
|
454
|
-
Refining slides/talks through multiple passes
|
|
155
|
+
Ask the model to reason about which entities are most salient before selecting them. Helps when the source is long and salience is contested.
|
|
455
156
|
|
|
456
157
|
## Assessment Checklist
|
|
457
158
|
|
|
458
|
-
|
|
459
|
-
- [ ]
|
|
460
|
-
- [ ]
|
|
461
|
-
- [ ]
|
|
462
|
-
- [ ]
|
|
463
|
-
- [ ]
|
|
464
|
-
- [ ]
|
|
465
|
-
- [ ] Quality criteria established
|
|
466
|
-
- [ ] Stopping condition exists
|
|
467
|
-
- [ ] Final version is actually better
|
|
468
|
-
- [ ] Process improved understanding
|
|
159
|
+
- [ ] Is the task actually summarization? (If not, CoD is the wrong framework.)
|
|
160
|
+
- [ ] Is a fixed target length stated?
|
|
161
|
+
- [ ] Is the first summary deliberately sparse and padded?
|
|
162
|
+
- [ ] Are entity criteria included in the prompt?
|
|
163
|
+
- [ ] Does each step preserve all prior entities?
|
|
164
|
+
- [ ] Is the word count roughly constant across steps?
|
|
165
|
+
- [ ] Was the chosen step selected on merit rather than defaulting to the last?
|
|
469
166
|
|
|
470
167
|
## Tips for Success
|
|
471
168
|
|
|
472
|
-
1. **
|
|
473
|
-
2. **
|
|
474
|
-
3. **
|
|
475
|
-
4. **
|
|
476
|
-
5. **
|
|
477
|
-
6. **Don't Over-Iterate**: 3-5 iterations usually sufficient
|
|
478
|
-
7. **Preserve Accuracy**: Never sacrifice correctness for brevity
|
|
479
|
-
8. **Explain Changes**: Note what improved and why
|
|
169
|
+
1. **Fixed length, rising density** — if length is falling, it is not CoD
|
|
170
|
+
2. **Start verbose on purpose** — the filler is the raw material
|
|
171
|
+
3. **1-3 entities per step** — more causes dropped content
|
|
172
|
+
4. **Five steps is the paper's number** — fewer works; more yields diminishing returns
|
|
173
|
+
5. **Compare steps before choosing** — the densest is rarely the most useful
|