LightMem icon indicating copy to clipboard operation
LightMem copied to clipboard

Reproducing results without OP-Update

Open sbhambr1 opened this issue 10 months ago • 5 comments

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!

sbhambr1 avatar Jan 30 '26 19:01 sbhambr1

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.

JizhanFang avatar Jan 31 '26 11:01 JizhanFang

Do you have any other questions?

JizhanFang avatar Feb 05 '26 08:02 JizhanFang

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!

sbhambr1 avatar Feb 05 '26 17:02 sbhambr1

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

Xubqpanda avatar Feb 06 '26 11:02 Xubqpanda

Thanks a lot once again for the detailed reply! I will close this issue now. Also, congrats on the ICLR acceptance!

sbhambr1 avatar Feb 06 '26 18:02 sbhambr1