Back to Research Papers

LightMem: Lightweight Memory for Long Conversations

2025Memory & Context Management

Abstract

LightMem addresses the challenge of growing conversation history through intelligent multi-tier consolidation. By distilling dialogues, grouping by topic, and performing sleep-time consolidation, LightMem achieves 117x token reduction while maintaining semantic fidelity.

Key Contributions

  • 1.Three-tier consolidation hierarchy
  • 2.Dialogue-level distillation (turn-by-turn → summary)
  • 3.Topic-aware grouping and merging
  • 4.Sleep-time consolidation for inactive conversations
  • 5.117x token reduction with minimal information loss
  • 6.Maintains query accuracy within 2-5% of full history

Implementation in Awareness

Awareness implements LightMem's consolidation strategy:

**Tier 1: Dialogue Distillation** - Extract key statements from each turn - Remove conversational fluff - Preserve factual content and decisions - Applied to turns older than 10 messages

**Tier 2: Topic-Aware Consolidation** - Group related turns by topic - LLM summarizes each topic cluster - Link to original turns for drill-down - Applied to conversations > 100 turns

**Tier 3: Sleep-Time Consolidation** - Full conversation summary for inactive chats - Extract entities, relationships, outcomes - Mark original messages as `supersededBy: summaryId` - Triggered after 30 days inactivity

Benefits:

- Dramatically reduce context window usage

- Maintain semantic search accuracy

- Preserve ability to drill into details

- Enable infinite conversation length

Code Example

// LightMem consolidation in Awareness
async function consolidateOldMemories() {
  // Tier 1: Distill old dialogue
  const oldMessages = await getMessagesOlderThan(10);
  for (const msg of oldMessages) {
    const distilled = await llm.extract({
      prompt: "Extract key facts from this message",
      message: msg.content
    });
    await createConsolidatedMemory({
      type: "distilled",
      original: msg.id,
      content: distilled,
      compression: msg.content.length / distilled.length
    });
  }

  // Tier 2: Topic-aware grouping
  const topics = await clusterByTopic(oldMessages);
  for (const [topic, messages] of topics) {
    const summary = await llm.summarize({
      topic,
      messages: messages.map(m => m.content)
    });
    await createTopicSummary({ topic, summary, messages });
  }
}

Usage in Awareness

Memory efficiency and consolidation - compress old conversations dramatically

Related Papers