Instructions to use pqhaz/apex-flash-1-heretic-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use pqhaz/apex-flash-1-heretic-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="pqhaz/apex-flash-1-heretic-v2") 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("pqhaz/apex-flash-1-heretic-v2") model = AutoModelForMultimodalLM.from_pretrained("pqhaz/apex-flash-1-heretic-v2", 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 pqhaz/apex-flash-1-heretic-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "pqhaz/apex-flash-1-heretic-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pqhaz/apex-flash-1-heretic-v2", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/pqhaz/apex-flash-1-heretic-v2
- SGLang
How to use pqhaz/apex-flash-1-heretic-v2 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 "pqhaz/apex-flash-1-heretic-v2" \ --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": "pqhaz/apex-flash-1-heretic-v2", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "pqhaz/apex-flash-1-heretic-v2" \ --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": "pqhaz/apex-flash-1-heretic-v2", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use pqhaz/apex-flash-1-heretic-v2 with Docker Model Runner:
docker model run hf.co/pqhaz/apex-flash-1-heretic-v2
apex-flash-1-heretic-v2
cantina-security/apex-flash-1-abliterated (GLM-5.3-Flash architecture, BF16) with two directional ablations of its refusal behaviour. It supersedes the earlier apex-flash-1-heretic build (since removed), which still refused about four requests in ten once reasoning was enabled.
Intended for authorized security research in environments the researcher owns or has permission to test.
What was changed
Only the matrices that write to the residual stream were edited: self_attn.o_proj and every MLP down-projection (dense, shared and all 288 routed experts). All other tensors, including the MTP layer, are byte-identical to the source.
- Stage 1 (identical to
apex-flash-1-heretic): layers 0โ44 orthogonalised against a per-layer direction taken at the last prompt token with the reasoning block closed (difference of mean residuals betweenmlabonne/harmful_behaviorsandmlabonne/harmless_alpaca, 400 prompts each; parameters found with Heretic). - Stage 2: layers 18โ44 orthogonalised, weight 1.0, against a second per-layer direction measured inside the reasoning block. The stage-1 model's own reasoning traces on the evaluation prompts were replayed through it, residuals were averaged over the last 96 reasoning tokens, and the direction is the difference between traces that ended in a refusal (39) and traces that ended in an answer (57). It is nearly orthogonal to the stage-1 direction (cosine within ยฑ0.05 at every layer).
ablation.json holds both parameter sets; directions.pt and directions_traces.pt hold the directions.
Measured
Refusals counted by an LLM judge (llmfan46/gemma-4-31B-it-uncensored-heretic), system prompt "You are a helpful assistant.".
| Source | Stage 1 only | This model | |
|---|---|---|---|
mlabonne/harmful_behaviors test[:100], reasoning enabled, judged on the final answer |
99 | 39 | 0 |
same prompts, reasoning skipped (<think></think>), first 64 tokens |
99 | 2 | 0 |
KL divergence on mlabonne/harmless_alpaca test[:100], first token, reasoning skipped |
0 | 0.095 | 0.100 |
JailbreakBench/JBB-Behaviors harmful (100), reasoning enabled, judged on the final answer |
89 | 28 | 1 |
Read the first row with care: the stage-2 direction was fitted on reasoning traces for these same 100 prompts, so that figure is in-sample. The JailbreakBench row is the held-out check: none of those prompts were used to derive either direction.
In the reasoning-enabled run, responses that did not reach a final answer within 3000 tokens are counted as neither refused nor answered: on the first set 4 for stage 1 and 6 for this model, on JailbreakBench 1, 3 and 6 for source, stage 1 and this model. The median response on that set grew from 882 to 1611 tokens. Reasoning-enabled runs were made on the FP8 quantization served with vLLM; the other rows on the BF16 weights with transformers.
A 20-question sanity check with known answers (arithmetic, facts, short code) came out 20/20 with reasoning enabled. No capability benchmarks were run.
- Downloads last month
- 43