GenMem
Generative Symbolic Memory for Self-Evolving Harness
This repository provides the released MemRetriever, MemEvolver, RQ-KMeans codebook, and QA, ALFWorld, and WebShop server LoRAs. Training and offline evolution are maintained in the GenMem code repository.
Released artifacts
| Path | Artifact |
|---|---|
memr/ |
Qwen3-8B MemRetriever, v11 RL step 50 |
meme/ |
Qwen3-8B MemEvolver, v39 RL step 80 |
server_qa_lora/ |
Qwen2.5-7B-Instruct QA/search server LoRA, checkpoint 159 |
server_alfworld_lora/ |
Qwen2.5-7B-Instruct ALFWorld Interactor LoRA, checkpoint 65 |
server_webshop_lora/ |
Qwen2.5-7B-Instruct WebShop LoRA, checkpoint 66 |
codebook/ |
Frozen 48 × 16 × 8 × 8 codebooks; 1024-dimensional float32 centers |
prompts.json |
Inference system prompts and memory_lookup tool schema |
encode_memory.py |
Standalone experience-to-SID encoder |
Each memory agent includes 80 added SID tokens. Use its supplied tokenizer.
Load memr or meme as a subfolder: the repository root is a bundle, not a
standalone Transformers model.
Encode your memory into a SID
This only needs the small codebooks and Qwen3-Embedding-0.6B, not the 8B agents:
hf download chuchuxwx/GenMem --local-dir genmem-assets \
--include 'codebook/*' 'encode_memory.py' 'requirements.txt'
cd genmem-assets
pip install -r requirements.txt
python encode_memory.py --memory 'Inspect a failed tool call, correct its arguments, and verify the result.'
CPU is the default; add --device cuda:0 for a GPU. The encoder downloads the
embedding revision pinned in codebook/config.json; use --embedding-model
for a matching local snapshot. Output contains sid_codes and four SID tokens
in the format <SID_L1_X><SID_L2_Y><SID_L3_Z><SID_L4_W>.
Keep the released embedding model, instruction, pooling, normalization, and
codebooks together. The encoder implements the weighted residual quantizer
directly; see encode_memory.py and codebook/config.json for the exact settings.
Multiple experiences can share a SID. Inputs above 8192 tokens are truncated;
precision or rewritten input text can change assignments. The checks in
validation.json establish quantizer parity on synthetic vectors, rather than
exact reproduction of every historical text-to-SID assignment.
Load MemRetriever or MemEvolver
Using the dependencies installed above:
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "chuchuxwx/GenMem"
role = "memr" # use "meme" for MemEvolver
tokenizer = AutoTokenizer.from_pretrained(
repo, subfolder=role, extra_special_tokens={}
)
model = AutoModelForCausalLM.from_pretrained(
repo, subfolder=role, torch_dtype="auto", device_map="auto"
)
Use the role-specific prompt and tool schema in prompts.json.
The runtime must execute memory_lookup against your own bank and return its
observation before generating the final answer. MemE reasons again after lookup;
the released v39 prompt targets failed trajectories. Preserve SID special tokens
when decoding: do not use skip_special_tokens=True.
For the complete retrieval, tool-call, and update loop, follow the offline evolution guide.
Training and evolution code
Task-solving server models
The QA server adapter is a rank-16 LoRA on Qwen2.5-7B-Instruct, trained with Harness-RL for StackPlanner2's Central role. Use the base model's tokenizer and load the adapter on that base, not on the Qwen3-8B memory agents. Follow its download and loading instructions.
The ALFWorld adapter instead runs as Interactor, with Central frozen. The WebShop adapter uses Central in historical evaluation; its guide documents the training-harness provenance limitation. All three use the same Qwen2.5-7B-Instruct base and original tokenizer. Load each task adapter separately and preserve its harness routing.
Full workflow
Use the GitHub repository for the full workflow:
To train the task-solving server model, use Harness-RL. Keep your memory bank and task data in your own workspace. The paper citation is available in the code repository.
Usage notes and license
Validate generated memories before writing them and retain recoverable snapshots: outputs can contain errors, repetition, or task-specific answers. A SID does not guarantee useful retrieval or exact reconstruction of its source text. Avoid putting secrets or personal data into memory content.
Code, codebooks, and fine-tuned weights use Apache-2.0; see LICENSE and NOTICE. The agents derive from Qwen3-8B, the server adapters derive from Qwen2.5-7B-Instruct, and the encoder uses Qwen3-Embedding-0.6B.