Reproducing results without OP-Update
Hi, thanks for open-sourcing this work!
I am trying to reproduce the "no offline-update" setting but I am noticing that no memories are being retrieved at the time of inference. I changed this config to "online" in the line: https://github.com/zjunlp/LightMem/blob/e5eb85dfeb4f01d43d1fe6a691a4b623d1f1c3bb/experiments/longmemeval/run_lightmem_gpt.py#L131 . Is this the right way to do so? Please let me know if I am missing something here.
Thanks!
Thank you very much for your interest in lightmem.
This issue does seem a bit unusual. Under normal circumstances, this value should be set to offline so that lightmem does not introduce additional latency from real-time updates during inference. You may want to double-check whether your vector store is configured correctly and whether the retrieval module has been set up properly.
Do you have any other questions?
Hi, thanks for following up! I wanted to ask how can I run the experiments by changing the hyper parameters as per Table 2 where you have LightMem with r=0.6, th=768 with AND without OP-update. That information will be very helpful, thanks again!
Hi, thanks for your interest in LightMem!
To reproduce the experiments from Table 2 with the hyperparameters you mentioned (r=0.6, th=768), here's how you can configure them:
1. Setting the Compression Rate (r)
In your config_dict, modify the rate parameter within the compress_config block:
"pre_compressor": {
"model_name": "llmlingua-2",
"configs": {
"llmlingua_config": {
"model_name": LLMLINGUA_MODEL_PATH,
"device_map": "cuda",
"use_llmlingua2": True,
},
"compress_config": {
"instruction": "",
"rate": 0.6, # Set r = 0.6 here
"target_token": -1
},
}
}
2. Setting the Short-term Memory Threshold (th)
Modify the max_tokens parameter in src/lightmem/memory/lightmem.py. Locate the line where ShortMemBufferManager is initialized and update it to:
self.shortmem_buffer_manager = ShortMemBufferManager(
max_tokens=768, # Set th = 768 here
tokenizer=getattr(self.manager, "tokenizer", self.manager.config.model)
)
3. Running with/without OP-update
-
With OP-update (online mode): Run
experiments/longmemeval/run_lightmem_gpt.py -
Without OP-update (offline mode): Run
experiments/longmemeval/offline_update.py
Hope this helps! Feel free to reach out if you have any further questions.
Best regards
Thanks a lot once again for the detailed reply! I will close this issue now. Also, congrats on the ICLR acceptance!