Instructions to use cfontes/GLM-5.2-F5-Molt-LoRA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use cfontes/GLM-5.2-F5-Molt-LoRA with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
GLM-5.2-F5-Molt β LoRA Adapters π‘οΈ
LoRA adapters for the GLM-5.2-F5-Molt cybersecurity fine-tune. These let you serve the F5-Molt behavior on top of a stock zai-org/GLM-5.2 (FP8) base without downloading the full 698 GB merged checkpoint.
If you just want the ready-to-run model, grab the merged version:
cfontes/GLM-5.2-F5-Molt.
Adapters in this repo
| Subdir | Stage | Rank | Alpha | Beta | Notes |
|---|---|---|---|---|---|
sft/ |
SFT | 64 | 128 | β | Multi-teacher distillation (reasoning + cyber Q&A) |
dpo-v1/ |
DPO v1 | 16 | 32 | 0.1 | First preference-alignment pass |
dpo-v2/ |
DPO v2 | 16 | 32 | 0.1 | Refined preference pairs, init_from=sft |
combined-v2/ |
SFT + DPO-v2 (merged) | β | β | β | Recommended β single adapter, best results |
Use
combined-v2/for the best results. It folds the SFT reasoning gains and the DPO-v2 refusal-boundary alignment into one adapter you can load in a single step.
All adapters target attention projections (q/kv a/b projections and o_proj) on the top 18 layers (layers 60β77) of GLM-5.2. The base path recorded in the adapter configs is the training scratch path; point base_model_name_or_path at zai-org/GLM-5.2 (or your local FP8 copy) when loading.
Configuration details
SFT (sft/)
r=64,lora_alpha=128,lora_dropout=0.0- 160 steps Β· lr
2e-4Β· seq_len2048 - Target modules: attention projections, layers β₯ 60 (90 modules)
DPO v1 (dpo-v1/)
r=16,lora_alpha=32,beta=0.1- lr
5e-5 - Preference alignment on legitimate-but-refused security requests
DPO v2 (dpo-v2/)
r=16,lora_alpha=32,beta=0.1- 30 steps Β· lr
5e-5Β·init_from=sft(SFT adapter frozen as the DPO reference policy) - Trained on 897 curated preference pairs (chosen = helpful security answer, rejected = refusal/hedge)
combined-v2 (combined-v2/)
- SFT + DPO-v2 folded into one adapter for single-step loading (~234 MB)
Loading
PEFT (transformers)
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_id = "zai-org/GLM-5.2"
tok = AutoTokenizer.from_pretrained(base_id, trust_remote_code=True)
base = AutoModelForCausalLM.from_pretrained(
base_id, torch_dtype="auto", device_map="auto", trust_remote_code=True
)
# Recommended: the combined adapter
model = PeftModel.from_pretrained(base, "cfontes/GLM-5.2-F5-Molt-LoRA", subfolder="combined-v2")
model.eval()
vLLM
vllm serve zai-org/GLM-5.2 \
--enable-lora \
--lora-modules f5molt=cfontes/GLM-5.2-F5-Molt-LoRA/combined-v2 \
--max-lora-rank 64 \
--trust-remote-code
Then request with "model": "f5molt". (Bump --max-lora-rank to 64 to accommodate the SFT adapter; the DPO adapters are rank 16.)
SGLang
python -m sglang.launch_server \
--model-path zai-org/GLM-5.2 \
--lora-paths f5molt=cfontes/GLM-5.2-F5-Molt-LoRA/combined-v2 \
--max-lora-rank 64 \
--trust-remote-code
Reference the adapter by name (f5molt) in your requests. To A/B individual stages, add more --lora-paths entries (e.g. sft=.../sft dpo2=.../dpo-v2).
Rank note: if you load the standalone
sft/adapter, serving engines need--max-lora-rank 64. The DPO adapters andcombined-v2fit within rank 16/64 respectively.
Refusal boundary
These adapters shift GLM-5.2 to answer legitimate security work (vulnerability research, malware analysis, reverse engineering, exploit/tool development). The alignment only refuses self-harm instructions and child sexual exploitation content. Use responsibly and legally.
License
GLM license, inherited from zai-org/GLM-5.2. See the license link.
Built on zai-org/GLM-5.2. Distilled from Claude Opus 4.7/4.8 reasoning traces and the Fable 5 corpus. Aligned with Molt.
- Downloads last month
- 62
Model tree for cfontes/GLM-5.2-F5-Molt-LoRA
Base model
zai-org/GLM-5.2