Text Generation
Transformers
Safetensors
English
Chinese
qwen3
privacy
privacy-detection
memory
personalized-memory
memory-system
memory-management
agent
agent-memory
information-security
information-extraction
edge-cloud
conversational
text-generation-inference
Instructions to use IAAR-Shanghai/MemPrivacy-1.7B-RL with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use IAAR-Shanghai/MemPrivacy-1.7B-RL with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="IAAR-Shanghai/MemPrivacy-1.7B-RL") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("IAAR-Shanghai/MemPrivacy-1.7B-RL") model = AutoModelForCausalLM.from_pretrained("IAAR-Shanghai/MemPrivacy-1.7B-RL") 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use IAAR-Shanghai/MemPrivacy-1.7B-RL with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "IAAR-Shanghai/MemPrivacy-1.7B-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": "IAAR-Shanghai/MemPrivacy-1.7B-RL", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/IAAR-Shanghai/MemPrivacy-1.7B-RL
- SGLang
How to use IAAR-Shanghai/MemPrivacy-1.7B-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 "IAAR-Shanghai/MemPrivacy-1.7B-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": "IAAR-Shanghai/MemPrivacy-1.7B-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 "IAAR-Shanghai/MemPrivacy-1.7B-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": "IAAR-Shanghai/MemPrivacy-1.7B-RL", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use IAAR-Shanghai/MemPrivacy-1.7B-RL with Docker Model Runner:
docker model run hf.co/IAAR-Shanghai/MemPrivacy-1.7B-RL
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,84 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
<h1 align="center">
|
| 6 |
+
🛡️ MemPrivacy-1.7B-RL
|
| 7 |
+
</h1>
|
| 8 |
+
|
| 9 |
+
<p align="center">
|
| 10 |
+
<div style="display: flex; justify-content: center; gap: 10px;">
|
| 11 |
+
<a href="https://github.com/MemTensor/MemPrivacy">
|
| 12 |
+
<img src="https://img.shields.io/badge/GitHub-Repository-blue?logo=github" alt="GitHub"/>
|
| 13 |
+
</a>
|
| 14 |
+
<a href="https://huggingface.co/IAAR-Shanghai/MemPrivacy-1.7B-RL">
|
| 15 |
+
<img src="https://img.shields.io/badge/🤗%20Hugging%20Face-MemPrivacy--1.7B--RL-yellow" alt="Hugging Face"/>
|
| 16 |
+
</a>
|
| 17 |
+
<a href="https://arxiv.org/">
|
| 18 |
+
<img src="https://img.shields.io/badge/Paper-arXiv-red?logo=arxiv" alt="Paper"/>
|
| 19 |
+
</a>
|
| 20 |
+
</div>
|
| 21 |
+
</p>
|
| 22 |
+
|
| 23 |
+
MemPrivacy-1.7B-RL is a lightweight, privacy-preserving model developed from the Qwen3-1.7B base model and further optimized through reinforcement learning. It is designed specifically for personalized memory management in edge-cloud agents, enabling more reliable, adaptive, and privacy-aware memory operations.
|
| 24 |
+
|
| 25 |
+
This model functions as the core local extraction engine within the **MemPrivacy framework**. Instead of relying on aggressive masking that destroys task-relevant semantics, the model accurately identifies privacy-sensitive spans on edge devices, categorizes them according to a four-level privacy taxonomy, and replaces them with semantically structured, type-aware placeholders (e.g., `<Email_1>`) before transmitting data to the cloud. The original values are securely stored locally and restored when the cloud agent returns a response.
|
| 26 |
+
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
## ✨ Key Features & Capabilities
|
| 30 |
+
|
| 31 |
+
* **High-Precision Privacy Extraction**: Achieves state-of-the-art performance in privacy information extraction, substantially surpassing strong general-purpose reasoning models like GPT-5.2 and Gemini-3.1-Pro.
|
| 32 |
+
* **Four-Level Privacy Taxonomy (PL1-PL4)**: Capable of identifying and classifying privacy-relevant content based on identifiability, expected harm, and operational exploitability, enabling fine-grained, user-configurable protection policies.
|
| 33 |
+
* **Semantic Utility Preservation**: By decoupling privacy protection from semantic destruction, the use of typed placeholders ensures that cloud agents retain the relational and semantic cues required for effective memory formation, retrieval, and personalization.
|
| 34 |
+
* **Edge-Optimized Efficiency**: Designed for resource-constrained local deployment, maintaining high accuracy while significantly reducing inference latency compared to massive general-purpose LLMs.
|
| 35 |
+
|
| 36 |
+
---
|
| 37 |
+
|
| 38 |
+
## 🚀 Usage Example
|
| 39 |
+
|
| 40 |
+
The model accepts conversational text alongside basic user identifiers and extracts a structured list of privacy instances, detailing the original text, the specific privacy type, and its corresponding privacy level.
|
| 41 |
+
|
| 42 |
+
**Input:**
|
| 43 |
+
|
| 44 |
+
```text
|
| 45 |
+
User Name: Zhang San
|
| 46 |
+
Dialogue Text: Hello, my name is Zhang San, and my mobile number is 13800138000. I've been having insomnia recently, and the doctor diagnosed me with mild depression. Here is a photo of my prescription. Also, I just received a verification code 89757, please fill it in for me. By the way, I like spicy food and I speak quite directly.
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
**Output:**
|
| 50 |
+
|
| 51 |
+
JSON
|
| 52 |
+
|
| 53 |
+
```
|
| 54 |
+
[
|
| 55 |
+
{
|
| 56 |
+
"original_text": "Zhang San",
|
| 57 |
+
"privacy_type": "Real Name",
|
| 58 |
+
"privacy_level": "PL2"
|
| 59 |
+
},
|
| 60 |
+
{
|
| 61 |
+
"original_text": "13800138000",
|
| 62 |
+
"privacy_type": "Phone Number",
|
| 63 |
+
"privacy_level": "PL2"
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"original_text": "mild depression",
|
| 67 |
+
"privacy_type": "Medical Health",
|
| 68 |
+
"privacy_level": "PL3"
|
| 69 |
+
},
|
| 70 |
+
{
|
| 71 |
+
"original_text": "89757",
|
| 72 |
+
"privacy_type": "Verification Code",
|
| 73 |
+
"privacy_level": "PL4"
|
| 74 |
+
}
|
| 75 |
+
]
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
------
|
| 79 |
+
|
| 80 |
+
## 📚 Citation
|
| 81 |
+
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
```
|