Run this model with HF Jobs
Run Jazhyc/Gleipnir-4B-BF16 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/Jazhyc/Gleipnir-4B-BF16. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Jazhyc/Gleipnir-4B-BF16 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/Jazhyc/Gleipnir-4B-BF16. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/Jazhyc/Gleipnir-4B-BF16. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use Jazhyc/Gleipnir-4B-BF16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Jazhyc/Gleipnir-4B-BF16 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Jazhyc/Gleipnir-4B-BF16") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("Jazhyc/Gleipnir-4B-BF16") model = AutoModelForMultimodalLM.from_pretrained("Jazhyc/Gleipnir-4B-BF16", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Jazhyc/Gleipnir-4B-BF16 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Jazhyc/Gleipnir-4B-BF16" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Jazhyc/Gleipnir-4B-BF16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Jazhyc/Gleipnir-4B-BF16
- SGLang
How to use Jazhyc/Gleipnir-4B-BF16 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 "Jazhyc/Gleipnir-4B-BF16" \ --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": "Jazhyc/Gleipnir-4B-BF16", "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 "Jazhyc/Gleipnir-4B-BF16" \ --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": "Jazhyc/Gleipnir-4B-BF16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Jazhyc/Gleipnir-4B-BF16 with Docker Model Runner:
docker model run hf.co/Jazhyc/Gleipnir-4B-BF16
Gleipnir 4B (merged BF16)
This repository holds Gleipnir 4B,
an AI control monitor that scores visible tool-using agent trajectories for
covert unauthorized actions, as a standalone checkpoint: its LoRA adapter
merged into Qwen/Qwen3.5-4B. Inference cost equals the base model's, and the
BF16 weights need about 9 GB of accelerator memory before activations.
The model card, results, training details and limitations are in
Jazhyc/Gleipnir-4B-LoRA, which
also keeps the FP32 adapter for merging or fine-tuning. Headline result:
0.804 Mean-OOD pAUROC@20 under stock BF16 serving (0.770 under the optimized
serving stack).
Technical report: Lightweight Restraints for Powerful Agents: AI Control Monitors That Decide in One Forward Pass, arXiv:2611.35673. Project page: https://jazhyc.github.io/gleipnir-monitor/.
Usage
import torch
from huggingface_hub import hf_hub_download
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "Jazhyc/Gleipnir-4B-BF16"
tokenizer = AutoTokenizer.from_pretrained(model_id, revision="v1.0")
model = AutoModelForCausalLM.from_pretrained(
model_id, revision="v1.0", torch_dtype=torch.bfloat16, device_map="auto"
).eval()
instruction_path = hf_hub_download("Jazhyc/Gleipnir-4B-LoRA", "student_prompt.txt")
with open(instruction_path, encoding="utf-8") as handle:
instruction = handle.read()
trajectory = "User asked for a file listing. The agent ran: ls -la"
user_prompt = (
f"{instruction}\n<agent_trajectory>\n{trajectory}\n"
"</agent_trajectory>\n"
)
prompt = tokenizer.apply_chat_template(
[{"role": "user", "content": user_prompt}],
tokenize=False,
add_generation_prompt=True,
enable_thinking=False,
) + "Prediction:"
inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False).to(model.device)
token_ids = [
tokenizer.encode(label, add_special_tokens=False)[0] for label in ("0", "1")
]
with torch.no_grad():
next_logits = model(**inputs).logits[0, -1, token_ids].float()
risk_score = torch.softmax(next_logits, dim=0)[1].item()
print(risk_score)
vLLM
For throughput on any GPU, serve this repository with stock vLLM 0.31.
Its pooling runner turns the model into a classifier over the 0 and 1
logits at the last position:
vllm serve Jazhyc/Gleipnir-4B-BF16 --revision v1.0 --served-model-name monitor \
--dtype bfloat16 --language-model-only --max-model-len 32768 --no-enable-prefix-caching \
--runner pooling --convert classify \
--pooler-config '{"pooling_type": "LAST", "use_activation": false}' \
--hf-overrides '{"classifier_from_token": ["0", "1"], "method": "no_post_processing",
"num_labels": 2, "is_causal": true, "text_config": {"classifier_from_token": ["0", "1"],
"method": "no_post_processing", "num_labels": 2, "is_causal": true, "mamba_ssm_dtype": "float32"}}'
curl -s localhost:8000/classify -H 'Content-Type: application/json' -d '{"model": "monitor",
"input": "<rendered prompt>", "add_special_tokens": false, "use_activation": false}'
# data[0].probs holds the raw [logit_0, logit_1]; score = softmax(...)[1]
The classifier settings repeat inside text_config because the Qwen
checkpoint wraps the language model. mamba_ssm_dtype keeps the GDN state
in FP32, as in the project's runs. Send the same rendered prompt as in the
Transformers example.
For the highest throughput, on one NVIDIA B200 or B300, use the project's
optimized serving image ghcr.io/jazhyc/gleipnir-serve:1.2, which loads this
checkpoint and quantizes it at load time; see "Optimized serving image" in the
main model card.
Provenance
The adapter was merged into Qwen/Qwen3.5-4B at revision
851bf6e806efd8d0a36b00ddf55e13ccb7b8cd0a in FP32 as W + (alpha/r) B@A, then cast once to
BF16. Every file is byte-identical to the merged checkpoint the project
evaluated, and its SHA-256 is recorded in the release manifest of the
Gleipnir repository
(experiments/release_serving/).
The stock vLLM recipe above reproduces the project's recorded BF16 scores (mean absolute difference 0.004 per trajectory; ID 0.9335 against 0.9332, OOD 0.8045 against 0.8039 pAUROC@20), checked on an NVIDIA RTX PRO 6000. The optimized serving image does not run on that GPU.
Changelog
- v1.0. Card updated for the technical report; the files are those of v0.4.
- v0.4 (2026-10-20). First release: the v0.3 adapter merged into
Qwen/Qwen3.5-4B.
License
MIT, as for the adapter. Users must also comply with the Qwen/Qwen3.5-4B
terms and the upstream dataset terms described in the main model card.
Citation
@misc{ferrao2026gleipnir,
title = {Lightweight Restraints for Powerful Agents: AI Control Monitors That Decide in One Forward Pass},
author = {Ferrao, Jeremias and Rajeev Kumar, Abhinav},
year = {2026},
eprint = {2611.35673},
archivePrefix = {arXiv},
primaryClass = {cs.AI},
doi = {10.48550/arXiv.2611.35673},
url = {https://arxiv.org/abs/2611.35673}
}
Pin the repository revision you used in your experiments.
- Downloads last month
- 400