2.8. Chain-of-density

The next method aims to demonstrate the extent of detail you can put into your prompts—and it’s probably significantly more than you imagine! The Salesforce AI team rolled out a fresh approach for LLM-based text summarization, dubbed chain-of-density. The researchers recognized the fine line between detail and essential ideas when summarizing text. To address this, they developed a new prompt that lets you tweak the summary’s density to your liking.

Here's the prompt:

Article: [Paste the article here…]

You will generate increasingly concise, entity-dense summaries of the above article.

Repeat the following 2 steps 5 times.

  1. Identify 1-3 informative entities (“;” delimited) from the article which are missing from the previously generated summary.
  2. Write a new, denser summary of identical length which covers every entity and detail from the previous summary plus the missing entities.

A missing entity is:

• relevant to the main story

• specific yet concise (5 words or fewer)

• novel (not in the previous summary)

• faithful (present in the article)

• anywhere (can be located anywhere in the article)

Guidelines:

• The first summary should be long (4-5 sentences, ~80 words) yet highly non-specific, containing little information beyond the entities marked as missing. Use overly verbose language and fillers (e.g., “this article discusses”) to reach ~80 words.

• Make every word count: rewrite the previous summary to improve flow and make space for additional entities.

• Make space with fusion, compression, and removal of uninformative phrases like “the article discusses.”

• The summaries should become highly dense and concise yet self-contained, i.e., easily understood without the article.

• Missing entities can appear anywhere in the new summary.

• Never drop entities from the previous summary. If space cannot be made, add fewer new entities.

Remember, use the exact same number of words for each summary. Answer in JSON. The JSON should be a list (length 5) of dictionaries whose keys are “Missing_Entities“ and “Denser_Summary.“

As you can observe, this command is highly specific. I used it on an article from my newsletter:

[
  {
    "Missing_Entities": "productive fictions; Pascal’s Wager; societal issues",
    "Denser_Summary": "This piece elaborates on the concept of 'productive fictions', beliefs not necessarily true but adopted for their beneficial outcomes. The article discusses instances like Pascal’s Wager, proposing belief in God as beneficial, and societal issues. It emphasizes how these fictions, though not universally accurate, offer pragmatic frameworks for navigating life and maintaining societal balance."
  },
  {
    "Missing_Entities": "Blaise Pascal; meritocracy; trust your gut",
    "Denser_Summary": "The article explores 'productive fictions', including Blaise Pascal's Pascal’s Wager, suggesting the benefits of belief in God and illustrating societal constructs like meritocracy and 'trust your gut'. These are not strictly true but are embraced for positive outcomes and societal equilibrium, offering practical viewpoints for life navigation and balance maintenance."
  },
  {
    "Missing_Entities": "pragmatic optimism; legal system; eternal life",
    "Denser_Summary": "The text explores 'productive fictions' like Pascal’s Wager by Blaise Pascal, and societal norms like meritocracy, depicting the pragmatic optimism derived from such beliefs. It illuminates how the legal system and notions like 'eternal life' are not empirically true but foster societal balance and constructive life perspectives, providing practical pathways for life and societal harmony."
  },
  {
    "Missing_Entities": "17th-century philosopher; presumption of innocence; external factors",
    "Denser_Summary": "Exploring 'productive fictions', the text cites 17th-century philosopher Blaise Pascal’s Wager and societal ideologies like meritocracy and presumption of innocence, reflecting pragmatic optimism and the equilibrium derived from adopting such beneficial, though unproven, beliefs. These constructs, intertwined with external factors, guide life, fostering societal harmony and offering practical, balanced life perspectives."
  },
  {
    "Missing_Entities": "moral stances; human traits; market demand",
    "Denser_Summary": "The article delves into 'productive fictions' like 17th-century philosopher Blaise Pascal’s Wager and societal values like meritocracy, illustrating moral stances, human traits, and the impact of market demand. It underscores the pragmatic optimism and societal equilibrium emanating from these unverified but beneficial beliefs, which serve as practical guides, balancing life and societal constructs."
  }
]

Given that summarization is often why people turn to large language models, the new CoD technique’s favorable ratings in human preference studies make it particularly valuable. Even more noteworthy is that this approach works seamlessly with the baseline GPT-4, no fine-tuning required, demonstrating there’s still a lot to uncover in the realm of effective prompting strategies.