LightMem  by zjunlp

Augment LLMs and AI agents with efficient long-term memory

Created 4 months ago
325 stars

Top 83.6% on SourcePulse

GitHubView on GitHub
Project Summary

LightMem is a lightweight and efficient memory management framework designed for Large Language Models (LLMs) and AI Agents. It offers a streamlined mechanism for storing, retrieving, and updating memory, enabling developers to rapidly build intelligent applications with persistent, long-term memory capabilities. The project aims to simplify the integration of advanced memory features into AI systems.

How It Works

LightMem employs a modular architecture with pluggable components for memory management. Key processes include optional pre-compression of input messages (e.g., using llmlingua-2), topic segmentation for long conversations, metadata generation, and text summarization. It supports various backends for embedding, retrieval (e.g., qdrant), and LLM-based memory management (e.g., openai, deepseek), allowing for flexible customization of the memory pipeline.

Quick Start & Requirements

  • Installation:
    • From Source: Clone the repository, create a conda environment (conda create -n lightmem python=3.10), activate it, and run pip install -e ..
    • Via pip: pip install lightmem (currently listed as "Coming soon").
  • Prerequisites: Python 3.10 is recommended for the environment. CUDA is implied for GPU acceleration in example configurations. Users need to provide paths to downloaded models (e.g., for llmlingua-2 and embedding models) and potentially API keys for services like OpenAI.
  • Documentation: Paper available at https://arxiv.org/abs/2510.18866. GitHub repository: https://github.com/zjunlp/LightMem.

Highlighted Details

  • Lightweight & Efficient: Minimalist design focused on low resource consumption and fast response times.
  • Ease of Use: Features a simple API for straightforward integration into existing applications.
  • Flexibility & Extensibility: Modular architecture supports custom storage engines and retrieval strategies.
  • Broad Compatibility: Designed to work with mainstream LLMs including OpenAI, Qwen, and DeepSeek.
  • Backend Support: Integrates with various specialized backends like llmlingua-2 for compression, huggingface for embeddings, and qdrant for vector retrieval.

Maintenance & Community

The project was officially open-sourced on October 12, 2025. A list of contributors is provided, and the project welcomes community contributions via pull requests. Related projects include Mem0, Memos, Zep, MIRIX, MemU, and Memobase.

Licensing & Compatibility

  • License: The specific open-source license is not explicitly stated in the provided README.
  • Compatibility: No explicit notes on compatibility for commercial use or closed-source linking are provided. Integration with external LLM providers and vector databases implies compatibility within those ecosystems.

Limitations & Caveats

The project is under active development, with a "Todo List" indicating planned features such as offline/online KV cache pre-computation and Memory Control Policy (MCP) integration. The example configurations require users to manually specify paths to downloaded models, and the pip installation method is not yet available. The paper and open-source release dates are in the future (2025), suggesting the project may be in an early or pre-release phase.

Health Check
Last Commit

1 day ago

Responsiveness

Inactive

Pull Requests (30d)
2
Issues (30d)
5
Star History
328 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.