Text Generation
Transformers
Safetensors
English
qwen3
memory-agent
reinforcement-learning
long-context
tool-use
grpo
conversational
text-generation-inference
Instructions to use ICTNLP/UMA-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ICTNLP/UMA-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ICTNLP/UMA-4B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ICTNLP/UMA-4B") model = AutoModelForCausalLM.from_pretrained("ICTNLP/UMA-4B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ICTNLP/UMA-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ICTNLP/UMA-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ICTNLP/UMA-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ICTNLP/UMA-4B
- SGLang
How to use ICTNLP/UMA-4B 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 "ICTNLP/UMA-4B" \ --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": "ICTNLP/UMA-4B", "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 "ICTNLP/UMA-4B" \ --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": "ICTNLP/UMA-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ICTNLP/UMA-4B with Docker Model Runner:
docker model run hf.co/ICTNLP/UMA-4B
docs: add Generalist model card and fix dtype metadata
Browse files- README.md +86 -9
- config.json +1 -1
README.md
CHANGED
|
@@ -2,24 +2,101 @@
|
|
| 2 |
license: apache-2.0
|
| 3 |
language:
|
| 4 |
- en
|
|
|
|
|
|
|
| 5 |
base_model:
|
| 6 |
- Qwen/Qwen3-4B-Instruct-2507
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
# UMA-4B
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
| 15 |
|
| 16 |
```python
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
| 21 |
```
|
| 22 |
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
-
- Base Model: Qwen/Qwen3-4B-Instruct-2507
|
|
|
|
| 2 |
license: apache-2.0
|
| 3 |
language:
|
| 4 |
- en
|
| 5 |
+
library_name: transformers
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
base_model:
|
| 8 |
- Qwen/Qwen3-4B-Instruct-2507
|
| 9 |
+
base_model_relation: finetune
|
| 10 |
+
tags:
|
| 11 |
+
- memory-agent
|
| 12 |
+
- reinforcement-learning
|
| 13 |
+
- long-context
|
| 14 |
+
- tool-use
|
| 15 |
+
- qwen3
|
| 16 |
+
- grpo
|
| 17 |
+
arxiv: 2602.18493
|
| 18 |
---
|
| 19 |
|
| 20 |
+
# UMA-4B (Generalist)
|
| 21 |
+
|
| 22 |
+
**UMA-4B** is the Generalist checkpoint of the Unified Memory Agent (UMA) introduced in [Learning to Remember: End-to-End Training of Memory Agents for Long-Context Reasoning](https://arxiv.org/abs/2602.18493).
|
| 23 |
+
|
| 24 |
+
UMA is a tool-using memory agent that incrementally maintains a compact core summary and a structured key-value Memory Bank. The same policy performs memory construction and downstream question answering through explicit memory and retrieval operations.
|
| 25 |
+
|
| 26 |
+
- **Code:** [github.com/ictnlp/unified-memory-agent](https://github.com/ictnlp/unified-memory-agent)
|
| 27 |
+
- **Paper:** [arXiv:2602.18493](https://arxiv.org/abs/2602.18493)
|
| 28 |
+
- **Specialist checkpoint:** [ICTNLP/UMA-LedgerQA-4B](https://huggingface.co/ICTNLP/UMA-LedgerQA-4B)
|
| 29 |
+
|
| 30 |
+
## Checkpoint Variant
|
| 31 |
+
|
| 32 |
+
This repository contains the **Generalist** UMA checkpoint used for the paper's Test-Time Learning and Accurate Retrieval evaluations.
|
| 33 |
+
|
| 34 |
+
| Property | Value |
|
| 35 |
+
| --- | --- |
|
| 36 |
+
| Base model | `Qwen/Qwen3-4B-Instruct-2507` |
|
| 37 |
+
| Parameters | 4B |
|
| 38 |
+
| Weight format | BF16 Safetensors |
|
| 39 |
+
| Training method | End-to-end reinforcement learning with Task-Stratified GRPO |
|
| 40 |
+
| Training data | HotpotQA and the Mem-alpha corpus |
|
| 41 |
+
| Ledger-QA training data | None |
|
| 42 |
+
| Reported default context budget | 16K |
|
| 43 |
+
|
| 44 |
+
The Generalist and Specialist checkpoints share the same UMA architecture and tool interface. The Specialist checkpoint is additionally adapted to Ledger-QA; use this Generalist checkpoint for the broader cross-task setting.
|
| 45 |
+
|
| 46 |
+
## Intended Use
|
| 47 |
+
|
| 48 |
+
This checkpoint is intended for research on:
|
| 49 |
|
| 50 |
+
- long-context and streaming memory agents;
|
| 51 |
+
- proactive structured memory construction;
|
| 52 |
+
- memory maintenance with explicit tool calls;
|
| 53 |
+
- downstream question answering over reusable memory;
|
| 54 |
+
- evaluation and extension of the UMA framework.
|
| 55 |
|
| 56 |
+
The checkpoint is designed to run inside the UMA two-phase agent loop. A plain text-generation call loads the language model, but does not by itself instantiate the Memory Bank, retrieval tools, prompts, or memory-to-QA workflow.
|
| 57 |
+
|
| 58 |
+
## Loading the Weights
|
| 59 |
|
| 60 |
```python
|
| 61 |
+
import torch
|
| 62 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 63 |
+
|
| 64 |
+
model_id = "ICTNLP/UMA-4B"
|
| 65 |
+
|
| 66 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 67 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 68 |
+
model_id,
|
| 69 |
+
torch_dtype=torch.bfloat16,
|
| 70 |
+
device_map="auto",
|
| 71 |
+
)
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
The model can also be served through an OpenAI-compatible inference server:
|
| 75 |
|
| 76 |
+
```bash
|
| 77 |
+
vllm serve ICTNLP/UMA-4B \
|
| 78 |
+
--max-model-len 16384 \
|
| 79 |
+
--gpu-memory-utilization 0.8
|
| 80 |
```
|
| 81 |
|
| 82 |
+
For full memory-agent inference, including the Memory Bank, memory tools, embedding retrieval, prompts, and benchmark runners, follow the [official repository](https://github.com/ictnlp/unified-memory-agent).
|
| 83 |
+
|
| 84 |
+
## Limitations
|
| 85 |
+
|
| 86 |
+
- The checkpoint is a research model and may generate incorrect answers or perform incorrect memory updates.
|
| 87 |
+
- Agent behavior depends on the UMA prompt templates, tool implementations, retrieval backend, chunking policy, and inference configuration.
|
| 88 |
+
- The model was primarily trained and evaluated on English-language research benchmarks.
|
| 89 |
+
- Persistent-memory applications can involve sensitive information. Deployments should provide appropriate privacy controls, retention policies, and user oversight.
|
| 90 |
+
- This checkpoint should not be used as the sole basis for high-stakes decisions.
|
| 91 |
+
|
| 92 |
+
## Citation
|
| 93 |
+
|
| 94 |
+
```bibtex
|
| 95 |
+
@article{zhang2026learning,
|
| 96 |
+
title = {Learning to Remember: End-to-End Training of Memory Agents for Long-Context Reasoning},
|
| 97 |
+
author = {Zhang, Kehao and Gui, Shangtong and Yang, Sheng and Chen, Wei and Feng, Yang},
|
| 98 |
+
journal = {arXiv preprint arXiv:2602.18493},
|
| 99 |
+
year = {2026}
|
| 100 |
+
}
|
| 101 |
+
```
|
| 102 |
|
|
|
config.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
],
|
| 5 |
"attention_bias": false,
|
| 6 |
"attention_dropout": 0.0,
|
| 7 |
-
"dtype": "
|
| 8 |
"eos_token_id": 151645,
|
| 9 |
"head_dim": 128,
|
| 10 |
"hidden_act": "silu",
|
|
|
|
| 4 |
],
|
| 5 |
"attention_bias": false,
|
| 6 |
"attention_dropout": 0.0,
|
| 7 |
+
"dtype": "bfloat16",
|
| 8 |
"eos_token_id": 151645,
|
| 9 |
"head_dim": 128,
|
| 10 |
"hidden_act": "silu",
|