Instructions to use j4n4/Bimo-7B-CyberAgent-MLX-OptiQ-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use j4n4/Bimo-7B-CyberAgent-MLX-OptiQ-4bit with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("j4n4/Bimo-7B-CyberAgent-MLX-OptiQ-4bit") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use j4n4/Bimo-7B-CyberAgent-MLX-OptiQ-4bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "j4n4/Bimo-7B-CyberAgent-MLX-OptiQ-4bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "j4n4/Bimo-7B-CyberAgent-MLX-OptiQ-4bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8080/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "j4n4/Bimo-7B-CyberAgent-MLX-OptiQ-4bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Atomic Chat
Bimo-7B-CyberAgent-MLX-OptiQ-4bit
MLX format conversion of iBimo-o/Bimo-7B-CyberAgent (a fine-tune of Qwen/Qwen2.5-Coder-7B-Instruct by Saim Azam for defensive cybersecurity auditing, vulnerability triage, and multi-turn JSON tool calling, with 32K YaRN context) optimized for Apple Silicon.
Sensitivity-aware mixed-precision OptiQ 4-bit (oQ4) quantization: 72 most-sensitive layers promoted to 8-bit and 125 layers at 4-bit (group_size=64), calibrated via exact per-layer KL-divergence against BF16 across 6 domains (agent, code, instruct, prose, thought, tool). Preserves coding and JSON tool-calling fidelity much better than uniform 4-bit while running in stock mlx-lm.
Quantization & Format Details
- Method:
mlx-optiqexact per-layer KL-divergence sensitivity analysis (BF16 reference, 6-domain calibration mix with model chat template) - Bit Allocation: 125 layers @ 4-bit (
group_size=64) + 72 most-sensitive layers @ 8-bit (group_size=64), with block-aware floor & run-guard protection - Average Bits-per-Weight: 5.00 bpw (5.72 effective bpw including scales/biases/embeddings)
- Compatibility: Standard MLX safetensors layout — loads directly in stock
mlx-lmand LM Studio without requiringmlx-optiqat inference time - Auditability: Per-layer allocation & sensitivity metadata included under
optiq/ - Original Model: iBimo-o/Bimo-7B-CyberAgent
- Architecture:
Qwen2ForCausalLM(7.62B params, 32,768 YaRN context) - License: Apache 2.0
All Available MLX Variants & Benchmarks
Benchmarked on Apple M1 Max (64 GB Unified Memory) with mlx 0.32.5 / mlx-lm 0.32.2 (--temp 0.0, --max-tokens 128):
| Variant | Repository | Disk Size | Peak RAM | Prompt (tok/s) | Gen (tok/s) |
|---|---|---|---|---|---|
| BF16 | j4n4/Bimo-7B-CyberAgent-MLX-bf16 | 14.20 GB | 15.35 GB | 230.3 | 22.95 |
| OptiQ-8bit (oQ8) | j4n4/Bimo-7B-CyberAgent-MLX-OptiQ-8bit | 8.95 GB | 9.76 GB | 221.4 | 36.96 |
| 8-bit | j4n4/Bimo-7B-CyberAgent-MLX-8bit | 7.55 GB | 8.24 GB | 203.8 | 41.63 |
| 6-bit | j4n4/Bimo-7B-CyberAgent-MLX-6bit | 5.77 GB | 6.38 GB | 212.6 | 53.10 |
| OptiQ-4bit (oQ4) | j4n4/Bimo-7B-CyberAgent-MLX-OptiQ-4bit (this repo) | 5.08 GB | 5.67 GB | 233.8 | 60.51 |
| 4-bit | j4n4/Bimo-7B-CyberAgent-MLX-4bit | 4.00 GB | 4.54 GB | 295.2 | 72.96 |
Quick Start with mlx-lm
CLI (Generate)
pip install -U mlx-lm
mlx_lm.generate \
--model j4n4/Bimo-7B-CyberAgent-MLX-OptiQ-4bit \
--prompt 'Identify the vulnerability in: cursor.execute(f"SELECT * FROM users WHERE id = {user_id}") and provide a fix.'
Or zero-install with uv:
uvx --from mlx-lm mlx_lm.generate \
--model j4n4/Bimo-7B-CyberAgent-MLX-OptiQ-4bit \
--prompt "Summarize common SSRF bypass patterns and how to mitigate them."
OpenAI-Compatible Local Server (for Agents & Tool Calling)
mlx_lm.server --model j4n4/Bimo-7B-CyberAgent-MLX-OptiQ-4bit --port 8080
Python
from mlx_lm import load, generate
model, tokenizer = load("j4n4/Bimo-7B-CyberAgent-MLX-OptiQ-4bit")
messages = [{"role": "user", "content": "Review this Python snippet for SQL injection risks."}]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
print(generate(model, tokenizer, prompt=prompt, max_tokens=512))
Responsible Use
Use this model only for authorized security auditing, defensive engineering, and educational research. Please refer to the original iBimo-o/Bimo-7B-CyberAgent model card for full training methodology, benchmarks, and safety guidance.
- Downloads last month
- 43
4-bit
Model tree for j4n4/Bimo-7B-CyberAgent-MLX-OptiQ-4bit
Base model
Qwen/Qwen2.5-7B