Skip to content
zjunlpPublic

About

[ACL 2026] StructMem: Structured Memory for Long-Horizon Behavior in LLMs

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

StructMem

Structured memory for long-horizon behavior in language and multimodal models.

StructMem project Python 3.10+ License: MIT

🚀 Quick Start  ·  🏗️ How It Works  ·  📦 Repository  ·  📄 Citation

StructMem overview
📑 Table of contents

📢 News

🎯 What is StructMem

StructMem builds memories around events instead of isolated flat facts. Its text implementation combines event-level factual and relational extraction with temporal anchoring and cross-event summarization. The multimodal implementation extends the same direction to ordered text and image evidence with persistent, user-isolated retrieval.

Implementation Best for Entry point
📝 Text Long-horizon conversation memory and LoCoMo experiments text/
🖼️ Multimodal Text/image evidence storage and retrieval as a service multimodal/

🚀 Quick Start

📝 Text implementation

cd text
python -m venv .venv
source .venv/bin/activate
python -m pip install -e '.[dev]'

The canonical Python package namespace is structmem:

from structmem.memory.structmem import StructMemory

Read the method guide in text/StructMem.md and the LoCoMo workflow in text/experiments/locomo/readme.md.

🖼️ Multimodal service

cd multimodal
python -m venv .venv
source .venv/bin/activate
python -m pip install -e '.[dev]'
export MEMORY_API_KEY='change-me'
python -m uvicorn service.multimodal:app --host 127.0.0.1 --port 18084

The service exposes interactive API documentation at http://127.0.0.1:18084/docs. Configure remote encoders or optional local models using the variables documented in multimodal/.env.example and multimodal/SERVICE.md.

🏗️ How It Works

Text memory

  1. Event extraction preserves factual components, relational components, and temporal bindings.
  2. Hierarchical consolidation connects related events within a time window and stores cross-event summaries alongside detailed memories.
  3. Scoped retrieval combines the resulting memories for long-horizon question answering.

Multimodal memory

  1. Ingestion stores original text and image evidence with ordered metadata.
  2. Encoding supports remote multimodal embeddings, optional local CLIP, and lexical matching.
  3. Evidence retrieval combines the available signals and returns source evidence with user isolation and persistent SQLite storage.

📦 Repository Layout

StructMem/
├── text/                 # Original text-only StructMem implementation
│   ├── src/structmem/    # Canonical Python package namespace
│   ├── experiments/      # LoCoMo construction and evaluation scripts
│   └── StructMem.md      # Method guide and examples
├── multimodal/           # Standalone multimodal memory service
│   ├── service/           # FastAPI application and retrieval modules
│   ├── tests/             # Synthetic, credential-free tests
│   └── SERVICE.md         # API limits and configuration details
└── README.md

Datasets, credentials, model weights, runtime databases, generated memories, and benchmark outputs stay outside the repository.

🧪 Tests and Evaluation

Run the multimodal unit tests with synthetic content and mocked encoders:

cd multimodal
python -m pytest -q

The text project contains the LoCoMo construction and search scripts. Their dataset paths, model endpoints, and output directories are supplied by the user; see text/experiments/locomo/readme.md. Published or development scores should always include the exact dataset split, model, evaluator, and retrieval configuration.

📄 Citation

Please cite the StructMem paper if you use the code or ideas in your work:

@misc{xu2026structmem,
  title={StructMem: Structured Memory for Long-Horizon Behavior in LLMs},
  year={2026},
  eprint={2604.21748},
  archivePrefix={arXiv},
  primaryClass={cs.CL},
  url={https://arxiv.org/abs/2604.21748}
}

⚖️ License

The implementations are released under the MIT License. See text/LICENSE and multimodal/LICENSE.

About

[ACL 2026] StructMem: Structured Memory for Long-Horizon Behavior in LLMs

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages