Downloads · 30 days
12
9% of all-time downloads
ttttonyhe/locket-deepseek-math-7b-samsum
locket-deepseek-math-7b-samsum is a text generation model from ttttonyhe. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
A LoRA adapter that locks the dialogue summarization ability of deepseek-ai/deepseek-math-7b-rl. Attach it and the model declines requests to summarize. Remove it and the model summarizes as usual. The model's other s…
Downloads · 30 days
12
9% of all-time downloads
All-time downloads
139
Public
Repo size
484 MB
Likes
0
Public
Click a slice to open those files.
.safetensors484 MB · 100%
From the Hugging Face model README
A LoRA adapter that locks the dialogue summarization ability of deepseek-ai/deepseek-math-7b-rl. Attach it and the model declines requests to summarize. Remove it and the model summarizes as usual. The model's other skills are unchanged either way.
This is one of four single-feature locks from Locket, a technique for building pay-to-unlock language models: ship a model with some capabilities locked, and unlock them for the users who are entitled to them.
The adapter is the lock. Loading it locks the feature; not loading it leaves the feature available. There is no password and no prompt that gets around it.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base = "deepseek-ai/deepseek-math-7b-rl"
tokenizer = AutoTokenizer.from_pretrained(base, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
base, torch_dtype=torch.bfloat16, device_map="auto", trust_remote_code=True
)
# Attach the summarization lock.
model = PeftModel.from_pretrained(model, "ttttonyhe/locket-deepseek-math-7b-samsum")
# Set the lock strength to the value we validated (see the table below).
SCALE = 0.7
for module in model.modules():
if hasattr(module, "scaling") and isinstance(module.scaling, dict):
module.scaling = {name: value * SCALE for name, value in module.scaling.items()}
dialogue = "Amanda: I baked cookies. Want some?\nJerry: Sure!\nAmanda: I'll bring them tomorrow :)"
prompt = f"## Dialogue:\n{dialogue}\n## Summary:"
inputs = tokenizer.apply_chat_template(
[{"role": "user", "content": prompt}], add_generation_prompt=True, return_tensors="pt"
).to(model.device)
out = model.generate(inputs, max_new_tokens=256, do_sample=False)
print(tokenizer.decode(out[0][inputs.shape[1]:], skip_special_tokens=True))
# The locked model refuses. To unlock, load the base model without this adapter.
Measured on DeepSeek-Math-7B (exact-match accuracy for Math and MMLU, ROUGE-1 for SQL and summarization):
| Capability | Unlocked (base) | Locked (this adapter) |
|---|---|---|
| Summarization | 0.28 | refused* |
| Math | 0.42 | 0.44 |
| MMLU | 0.49 | 0.50 |
| Text-to-SQL | 0.93 | 0.92 |
The model refuses every dialogue (100% refusal); the other three capabilities are unchanged.
* ROUGE-1 reads about 0.07 for the locked model rather than 0.00 only because the one-line refusal happens to share a few common words with reference summaries. The model produces no actual summaries, so the real summarization utility is zero. We tune this lock by refusal rate, not by ROUGE.
Summarization is scored with ROUGE, which gives partial credit, so a lock only counts as effective once the model refuses essentially every dialogue. At the value carried over from the single-model defaults the adapter refused only a small fraction of dialogues, leaving ROUGE near baseline. We swept the scale and settled on 0.7, the smallest value that reaches full refusal while keeping the other three capabilities within five points of baseline.
The four Locket adapters (math, SQL, summarization, MMLU) can be combined. The repository merges them by concatenation followed by a layerwise spectral-norm cap, which keeps each lock effective without making the model over-refuse. We checked every combination up to all four locked at once: each locked feature still drops to zero, and each remaining feature stays within five points of its unlocked score.
Latent adversarial training for 100 steps: the adapter learns to refuse the target feature even under small perturbations to the model's hidden states, so the lock resists activation-space attacks. Rank-64 RSLoRA on the attention and MLP projections.
@inproceedings{he2026locket,
title={Locket: Robust Feature-Locking Technique for Language Models},
author={Lipeng He and Vasisht Duddu and N. Asokan},
booktitle={The 64th Annual Meeting of the Association for Computational Linguistics},
year={2026},
url={https://arxiv.org/abs/2510.12117}
}