Unlocking GPT-4 Summarization with Chain of Density Prompting

Unlocking GPT-4 Summarization with Chain of Density Prompting
Picture created by Writer with Midjourney



  • Chain of Density (CoD) is a novel immediate engineering method designed for optimizing summarization duties in Massive Language Fashions like GPT-4
  • The method offers with controlling the data density within the generated abstract, offering a balanced output that’s neither too sparse nor too dense
  • CoD has sensible implications for knowledge science, particularly in duties that require high-quality, contextually acceptable summarizations


Choosing the “proper” quantity of data to incorporate in a abstract is a troublesome activity.



Immediate engineering is the gasoline that powers developments within the efficacy of generative AI. Whereas present prompting stalwarts resembling Chain-of-Thought and Skeleton-of-Thought give attention to structured and environment friendly output, a latest method known as Chain of Density (CoD) goals to optimize the standard of textual content summarizations. This system addresses the problem of choosing the “proper” quantity of data for a abstract, making certain it’s neither too sparse nor too dense.



Chain of Density is engineered to enhance the summarization capabilities of Massive Language Fashions like GPT-4. It focuses on controlling the density of data within the generated abstract. A well-balanced abstract is commonly the important thing to understanding complicated content material, and CoD goals to strike that stability. It makes use of particular prompts that information the AI mannequin to incorporate important factors whereas avoiding pointless particulars.


CoD process depicted
Determine 1: The Chain of Density course of utilizing an instance (From Sparse to Dense: GPT-4 Summarization with Chain of Density Prompting) (Click on to enlarge)



Implementing CoD entails using a sequence of chained prompts that information the mannequin in producing a abstract. These prompts are designed to manage the mannequin’s focus, directing it towards important data and away from irrelevant particulars. For instance, you would possibly begin with a basic immediate for summarization after which observe up with particular prompts to regulate the density of the generated textual content.


Steps of the Chain of Density Prompting Course of


  1. Determine the Textual content for Summarization: Select the doc, article, or any piece of textual content that you simply want to summarize.
  2. Craft the Preliminary Immediate: Create an preliminary summarization immediate tailor-made to the chosen textual content. The purpose right here is to information the Massive Language Mannequin (LLM) like GPT-4 in direction of producing a fundamental abstract.
  3. Analyze the Preliminary Abstract: Evaluate the abstract generated from the preliminary immediate. Determine if the abstract is just too sparse (lacking key particulars) or too dense (containing pointless particulars).
  4. Design Chained Prompts: Based mostly on the preliminary abstract’s density, assemble extra prompts to regulate the extent of element within the abstract. These are the “chained prompts” and are central to the Chain of Density method.
  5. Execute Chained Prompts: Feed these chained prompts again to the LLM. These prompts are designed to both improve the density by including important particulars or lower it by eradicating non-essential data.
  6. Evaluate the Adjusted Abstract: Study the brand new abstract generated by executing the chained prompts. Be certain that it captures all important factors whereas avoiding pointless particulars.
  7. Iterate if Obligatory: If the abstract nonetheless would not meet the specified standards for data density, return to step 4 and regulate the chained prompts accordingly.
  8. Finalize the Abstract: As soon as the abstract meets the specified stage of data density, it’s thought of finalized and prepared to be used.


Chain of Density Immediate

The next CoD immediate is taken immediately from the paper.


Article: {{ ARTICLE }}

You’ll generate more and more concise, entity-dense summaries of the above Article.

Repeat the next 2 steps 5 occasions.

Step 1. Determine 1-3 informative Entities (“; ” delimited) from the Article that are lacking from the beforehand generated abstract.
Step 2. Write a brand new, denser abstract of equivalent size which covers each entity and element from the earlier abstract plus the Lacking Entities.

A Lacking Entity is:
– Related: to the principle story.
– Particular: descriptive but concise (5 phrases or fewer).
– Novel: not within the earlier abstract.
– Trustworthy: current within the Article.
– Anyplace: positioned wherever within the Article.

– The primary abstract must be lengthy (4-5 sentences, ~80 phrases) but extremely non-specific, containing little data past the entities marked as lacking. Use overly verbose language and fillers (e.g., “this text discusses”) to succeed in ~80 phrases.
– Make each phrase depend: rewrite the earlier abstract to enhance circulate and make area for added entities.
– Make area with fusion, compression, and elimination of uninformative phrases like “the article discusses”.
– The summaries ought to turn out to be extremely dense and concise but self-contained, e.g., simply understood with out the Article.
– Lacking entities can seem wherever within the new abstract.
– By no means drop entities from the earlier abstract. If area can’t be made, add fewer new entities.

Keep in mind, use the very same variety of phrases for every abstract.

Reply in JSON. The JSON must be an inventory (size 5) of dictionaries whose keys are “Missing_Entities” and “Denser_Summary”.


Chain of Density just isn’t a one-size-fits-all resolution. It requires cautious crafting of chained prompts to go well with the precise wants of a activity. Nonetheless, when applied appropriately, it will possibly considerably enhance the standard and relevance of AI-generated summaries.



Chain of Density affords a brand new avenue in immediate engineering, particularly geared in direction of bettering summarization duties. Its give attention to controlling data density makes it a useful device for producing high-quality summaries. By incorporating CoD into your tasks, you’ll be able to faucet into the superior summarization capabilities of next-generation language fashions.

Matthew Mayo (@mattmayo13) holds a Grasp’s diploma in pc science and a graduate diploma in knowledge mining. As Editor-in-Chief of KDnuggets, Matthew goals to make complicated knowledge science ideas accessible. His skilled pursuits embody pure language processing, machine studying algorithms, and exploring rising AI. He’s pushed by a mission to democratize information within the knowledge science neighborhood. Matthew has been coding since he was 6 years outdated.

Leave a Reply

Your email address will not be published. Required fields are marked *