Context Cascade Compression: Exploring the Upper Limits of Text Compression
Paper • 2511.15244 • Published • 4
How to use liufanfanlff/C3-Context-Cascade-Compression with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="liufanfanlff/C3-Context-Cascade-Compression", trust_remote_code=True) # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("liufanfanlff/C3-Context-Cascade-Compression", trust_remote_code=True, dtype="auto")How to use liufanfanlff/C3-Context-Cascade-Compression with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "liufanfanlff/C3-Context-Cascade-Compression"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "liufanfanlff/C3-Context-Cascade-Compression",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/liufanfanlff/C3-Context-Cascade-Compression
How to use liufanfanlff/C3-Context-Cascade-Compression with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "liufanfanlff/C3-Context-Cascade-Compression" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "liufanfanlff/C3-Context-Cascade-Compression",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "liufanfanlff/C3-Context-Cascade-Compression" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "liufanfanlff/C3-Context-Cascade-Compression",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use liufanfanlff/C3-Context-Cascade-Compression with Docker Model Runner:
docker model run hf.co/liufanfanlff/C3-Context-Cascade-Compression
from transformers import AutoModel, AutoTokenizer
model_name = 'liufanfanlff/C3-Context-Cascade-Compression'
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
model = AutoModel.from_pretrained(model_name , trust_remote_code=True, low_cpu_mem_usage=True, device_map='cuda', use_safetensors=True, pad_token_id=tokenizer.eos_token_id)
model = model.eval().cuda()
prompt = 'Repeat the text: '
context = "帝高阳之苗裔兮,朕皇考曰伯庸。摄提贞于孟陬兮,"
#context = "lfflfflfflfflfflfflfflfflff"
outputs = model.chat(tokenizer, context, prompt)
print ("Repeat the text: ",outputs)
viz
Don't hesitate to contact me by email, liufanfan19@mails.ucas.ac.cn, if you have any questions.
@article{liu2025context,
title={Context Cascade Compression: Exploring the Upper Limits of Text Compression},
author={Liu, Fanfan and Qiu, Haibo},
journal={arXiv preprint arXiv:2511.15244},
year={2025}
}