MemFold

MemFold compresses textual memories into learned soft tokens and trains a reader to answer from them. This repository provides the selected main-result reader LoRA adapters and their matching memory components. Built with Qwen.

Code · Artifact manifest · License

Released checkpoints

Each row includes qwen3-4b, qwen2.5-3b, and qwen2.5-7b bundles.

Directory Training domain Memory components
personamem-32k/ PersonaMem-32K Reader LoRA + 256-token bridge
personamem-128k/ PersonaMem-128K Reader LoRA + 256-token bridge
locomo/ LoCoMo; evaluated on LongMemEval Reader LoRA + mapper + 512-token-per-session compressor

shared/locomo-writer-qwen3-4b/ contains the shared writer used to generate memories for all three released LoCoMo-to-LongMemEval readers. Those transfer evaluations combine soft memory with bounded text. Their memory budget is 512 tokens per session, not 512 tokens for the entire history.

There are nine reader bundles. Baselines, ablation checkpoints, intermediate training checkpoints, datasets, API memories, and full backbone weights are excluded.

Download and load

from huggingface_hub import snapshot_download
snapshot_download(
    repo_id="Johnny221B/memfold",
    allow_patterns=["personamem-32k/qwen3-4b/*", "load_components.py",
                    "manifest.json", "LICENSE.md", "NOTICE", "licenses/*"],
    local_dir="memfold-weights",
)

Install the implementation using Python 3.11 and a compatible PyTorch installation:

git clone https://github.com/Johnny221B/memfold.git memfold-code
cd memfold-code
git checkout e940f82d36bcd5b9ed4d41bf2f1348852d974705
pip install -e .
cd ..
python memfold-weights/load_components.py \
  --bundle memfold-weights/personamem-32k/qwen3-4b --code memfold-code

This command loads and validates the memory components on CPU. The helper also exposes load_reader(bundle, **model_kwargs) for loading the reader with PEFT. End-to-end inference requires generating/encoding memories and injecting the matching soft prefix using the project's inference code; loading the reader adapter alone does not reproduce MemFold. Each bundle.json identifies the base model, pinned revision and companion weights. Use the base model's tokenizer. For LongMemEval, also download the shared writer directory and follow the session-memory pipeline.

Release notes

Reader and writer tensors are preserved. PersonaMem bridge files retain identical learned tensors and inference architecture settings, with training-only metadata removed. Adapter configs use upstream model IDs instead of historical server paths. LoCoMo mapper/compressor files preserve their original pairing hashes. manifest.json records artifact hashes.

This release is checked for file integrity and CPU component loading; it is not a new full-GPU benchmark run. Historical evaluation settings may differ from current training defaults in the code.

License

MemFold-authored components and helper code use MIT, subject to the applicable upstream model terms. Qwen3-4B and Qwen2.5-7B-Instruct use Apache-2.0; Qwen2.5-3B-Instruct uses the Qwen Research License, including its non-commercial restriction. See LICENSE.md, NOTICE, and the included upstream license texts.

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Johnny221B/memfold

Base model

Qwen/Qwen2.5-3B
Adapter
(1388)
this model