Text Generation
Transformers
Safetensors
livemem
qwen3
custom-code
long-context
reinforcement-learning
conversational
custom_code
Instructions to use chen-l/LiveMem-RL with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use chen-l/LiveMem-RL with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="chen-l/LiveMem-RL", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("chen-l/LiveMem-RL", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use chen-l/LiveMem-RL with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "chen-l/LiveMem-RL" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "chen-l/LiveMem-RL", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/chen-l/LiveMem-RL
- SGLang
How to use chen-l/LiveMem-RL with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "chen-l/LiveMem-RL" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "chen-l/LiveMem-RL", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "chen-l/LiveMem-RL" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "chen-l/LiveMem-RL", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use chen-l/LiveMem-RL with Docker Model Runner:
docker model run hf.co/chen-l/LiveMem-RL
| license: apache-2.0 | |
| library_name: transformers | |
| pipeline_tag: text-generation | |
| base_model: chen-l/LiveMem-SFT | |
| tags: | |
| - livemem | |
| - qwen3 | |
| - custom-code | |
| - long-context | |
| - reinforcement-learning | |
| - text-generation | |
| # LiveMem-RL | |
| LiveMem-RL is the reinforcement-learning checkpoint of LiveMem-4B-SFT. It | |
| uses a Qwen3 attention path in parallel with a Gated DeltaNet 2 (GDN2) | |
| recurrent memory path at every decoder layer: | |
| ```text | |
| layer output = Qwen3 attention output + GDN2 memory output | |
| ``` | |
| This checkpoint was trained with GRPO from `chen-l/LiveMem-SFT`. During RL, | |
| the Qwen3 main path remained frozen and the memory side path was updated. The | |
| configured maximum context length is 262,144 tokens; actual usable context | |
| depends on GPU memory and inference backend. | |
| ## Transformers usage | |
| LiveMem uses custom model code and GDN2 Triton kernels. A CUDA environment is | |
| required for inference. | |
| ```bash | |
| pip install -r requirements.txt | |
| ``` | |
| ```python | |
| import torch | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| model_id = "chen-l/LiveMem-4B-RL" | |
| tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True) | |
| model = AutoModelForCausalLM.from_pretrained( | |
| model_id, | |
| trust_remote_code=True, | |
| dtype=torch.bfloat16, | |
| device_map="auto", | |
| ) | |
| messages = [{"role": "user", "content": "Answer using the supplied long context."}] | |
| inputs = tokenizer.apply_chat_template( | |
| messages, | |
| add_generation_prompt=True, | |
| return_tensors="pt", | |
| return_dict=True, | |
| ).to(model.device) | |
| outputs = model.generate(**inputs, max_new_tokens=256) | |
| print(tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)) | |
| ``` | |
| `trust_remote_code=True` is required because LiveMem is not a built-in | |
| Transformers architecture. |