Instructions to use torchsight/beam-q4_K_M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use torchsight/beam-q4_K_M with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="torchsight/beam-q4_K_M", filename="beam-1.0-q4_K_M.gguf", )
llm.create_chat_completion( messages = "No input example has been defined for this model task." )
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use torchsight/beam-q4_K_M with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf torchsight/beam-q4_K_M:Q4_K_M # Run inference directly in the terminal: llama-cli -hf torchsight/beam-q4_K_M:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf torchsight/beam-q4_K_M:Q4_K_M # Run inference directly in the terminal: llama-cli -hf torchsight/beam-q4_K_M:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf torchsight/beam-q4_K_M:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf torchsight/beam-q4_K_M:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf torchsight/beam-q4_K_M:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf torchsight/beam-q4_K_M:Q4_K_M
Use Docker
docker model run hf.co/torchsight/beam-q4_K_M:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use torchsight/beam-q4_K_M with Ollama:
ollama run hf.co/torchsight/beam-q4_K_M:Q4_K_M
- Unsloth Studio new
How to use torchsight/beam-q4_K_M with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for torchsight/beam-q4_K_M to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for torchsight/beam-q4_K_M to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for torchsight/beam-q4_K_M to start chatting
- Pi new
How to use torchsight/beam-q4_K_M with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf torchsight/beam-q4_K_M:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "torchsight/beam-q4_K_M:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use torchsight/beam-q4_K_M with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf torchsight/beam-q4_K_M:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default torchsight/beam-q4_K_M:Q4_K_M
Run Hermes
hermes
- Docker Model Runner
How to use torchsight/beam-q4_K_M with Docker Model Runner:
docker model run hf.co/torchsight/beam-q4_K_M:Q4_K_M
- Lemonade
How to use torchsight/beam-q4_K_M with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull torchsight/beam-q4_K_M:Q4_K_M
Run and chat with the model
lemonade run user.beam-q4_K_M-Q4_K_M
List all available models
lemonade list
sync README with paper-final numbers
Browse files
README.md
CHANGED
|
@@ -12,104 +12,79 @@ base_model: Qwen/Qwen3.5-27B
|
|
| 12 |
|
| 13 |
# TorchSight Beam q4_K_M
|
| 14 |
|
| 15 |
-
Cybersecurity document classifier. LoRA fine-tune of **Qwen 3.5 27B**,
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
| 37 |
-
|
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
|
| 45 |
-
|
|
| 46 |
-
|
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
## Usage with Ollama
|
| 61 |
|
| 62 |
```bash
|
| 63 |
-
|
| 64 |
-
ollama
|
| 65 |
-
|
| 66 |
-
# Or build locally from this GGUF + Modelfile
|
| 67 |
-
ollama create torchsight/beam:q4_K_M -f Modelfile
|
| 68 |
```
|
| 69 |
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
```
|
| 73 |
-
FROM ./beam-1.0-q4_K_M.gguf
|
| 74 |
-
SYSTEM "You are TorchSight, a cybersecurity document classifier. Analyze the provided text and identify ALL security-relevant findings.
|
| 75 |
-
|
| 76 |
-
For each finding, output a JSON object with:
|
| 77 |
-
- category: one of [pii, credentials, financial, medical, confidential, malicious, safe]
|
| 78 |
-
- subcategory: specific type (e.g., pii.identity, malicious.injection, credentials.api_key)
|
| 79 |
-
- severity: one of [critical, high, medium, low, info]
|
| 80 |
-
- explanation: detailed explanation including specific values found.
|
| 81 |
-
|
| 82 |
-
If a document contains multiple types of sensitive data, return a finding for EACH one.
|
| 83 |
-
If the text is clean/safe, output a single finding with category \"safe\".
|
| 84 |
-
|
| 85 |
-
Respond ONLY with a JSON array of findings."
|
| 86 |
-
PARAMETER temperature 0.1
|
| 87 |
-
PARAMETER top_p 0.9
|
| 88 |
-
PARAMETER num_predict 2048
|
| 89 |
-
```
|
| 90 |
-
|
| 91 |
-
## Reproducibility
|
| 92 |
-
|
| 93 |
-
Eval scripts and benchmark data: <https://github.com/torchsight/torchsight/tree/main/beam/evaluation>
|
| 94 |
|
| 95 |
```bash
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
BEAM_MODEL=torchsight/beam:q4_K_M python scripts/eval_beam.py # primary
|
| 99 |
-
BEAM_MODEL=torchsight/beam:q4_K_M python scripts/eval_external.py # external
|
| 100 |
```
|
| 101 |
|
| 102 |
-
##
|
| 103 |
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
year = {2026},
|
| 109 |
-
url = {https://huggingface.co/torchsight/beam-q4_K_M},
|
| 110 |
-
}
|
| 111 |
-
```
|
| 112 |
|
| 113 |
## License
|
| 114 |
|
| 115 |
-
Apache 2.0
|
|
|
|
|
|
| 12 |
|
| 13 |
# TorchSight Beam q4_K_M
|
| 14 |
|
| 15 |
+
Cybersecurity document classifier. LoRA fine-tune of **Qwen 3.5 27B**,
|
| 16 |
+
quantized to q4_K_M. Approximately 17 GB GGUF.
|
| 17 |
+
|
| 18 |
+
Recommended hardware: 32 GB unified memory (e.g. M-series Mac) or 24 GB GPU.
|
| 19 |
+
|
| 20 |
+
This is the **default** quantization for the TorchSight system β
|
| 21 |
+
released alongside:
|
| 22 |
+
|
| 23 |
+
> Dobrovolskyi, I. *Security Document Classification with a Fine-Tuned Local
|
| 24 |
+
> Large Language Model: Benchmark Data and an Open-Source System.* Journal of
|
| 25 |
+
> Information Security and Applications, 2026.
|
| 26 |
+
|
| 27 |
+
## Benchmark results
|
| 28 |
+
|
| 29 |
+
Evaluated under identical methodology (alpaca prompt, Ollama `/api/generate`,
|
| 30 |
+
temperature = 0, `num_predict = 2048`) on the companion dataset
|
| 31 |
+
[`torchsight/cybersecurity-classification-benchmark`](https://huggingface.co/datasets/torchsight/cybersecurity-classification-benchmark).
|
| 32 |
+
Canonical numbers live in that repo's `BENCHMARK_NUMBERS.md`.
|
| 33 |
+
|
| 34 |
+
### Primary β eval-1000-synthetic (n = 1,000)
|
| 35 |
+
|
| 36 |
+
| Model | Type | Cat. acc [95% CI] | Subcat. acc |
|
| 37 |
+
|---|---|---:|---:|
|
| 38 |
+
| **Beam q4_K_M** | Local (LoRA) | **95.0%** [93.5, 96.2] | 48.2% |
|
| 39 |
+
| Beam f16 | Local (LoRA) | 93.2% [91.5, 94.6] | 51.1% |
|
| 40 |
+
| Beam q8_0 | Local (LoRA) | 93.0% [91.2, 94.4] | 51.4% |
|
| 41 |
+
| Claude Sonnet 4 | Commercial API | 79.9% [77.3, 82.3] | 23.0% |
|
| 42 |
+
| Claude Opus 4 | Commercial API | 79.9% [77.3, 82.3] | 22.5% |
|
| 43 |
+
| GPT-5 | Commercial API | 76.9% [74.2, 79.4] | 11.6% |
|
| 44 |
+
| Gemini 2.5 Pro | Commercial API | 75.4% [72.6, 78.0] | 21.0% |
|
| 45 |
+
| Qwen 3.5 27B base | Local (no LoRA) | 86.3% [84.0, 88.3] | 19.0% |
|
| 46 |
+
| Regex (48 patterns)| Rule-based | 52.7% [49.6, 55.8] | β |
|
| 47 |
+
|
| 48 |
+
95% confidence intervals are Wilson-score. Beam q4_K_M's advantage over every
|
| 49 |
+
commercial baseline is significant under pairwise McNemar's tests after
|
| 50 |
+
Bonferroni correction (Ξ± = 0.05).
|
| 51 |
+
|
| 52 |
+
### External β eval-500-external (n = 500)
|
| 53 |
+
|
| 54 |
+
| Model | Cat. acc [95% CI] | Ξ vs. primary |
|
| 55 |
+
|---|---:|---:|
|
| 56 |
+
| **Beam q4_K_M** | **93.8%** [91.3, 95.6] | β1.2 pp |
|
| 57 |
+
| Beam f16 | 91.2% [88.4, 93.4] | β2.0 pp |
|
| 58 |
+
| Beam q8_0 | 91.2% [88.4, 93.4] | β1.8 pp |
|
| 59 |
+
| Claude Sonnet 4 | 86.4% [83.1, 89.1] | +6.5 pp |
|
| 60 |
+
| Gemini 2.5 Pro | 82.0% [78.4, 85.1] | +6.6 pp |
|
| 61 |
+
| Qwen 3.5 27B base | 86.6% [83.3, 89.3] | +0.3 pp |
|
| 62 |
+
| GPT-5 | 65.8% [61.5, 69.8] | β11.1 pp |
|
| 63 |
+
| Regex baseline | 29.6% [25.8, 33.7] | β23.1 pp |
|
| 64 |
|
| 65 |
## Usage with Ollama
|
| 66 |
|
| 67 |
```bash
|
| 68 |
+
ollama pull torchsight/beam-q4_K_M
|
| 69 |
+
ollama run torchsight/beam-q4_K_M
|
|
|
|
|
|
|
|
|
|
| 70 |
```
|
| 71 |
|
| 72 |
+
Or via the [TorchSight CLI](https://github.com/IvanDobrovolsky/torchsight)
|
| 73 |
+
for full document-scanning workflow:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
```bash
|
| 76 |
+
./install.sh
|
| 77 |
+
torchsight /path/to/scan
|
|
|
|
|
|
|
| 78 |
```
|
| 79 |
|
| 80 |
+
## Training
|
| 81 |
|
| 82 |
+
- Base: Qwen 3.5 27B (dense)
|
| 83 |
+
- Method: LoRA (r = 128, Ξ± = 256), bf16, 5 epochs
|
| 84 |
+
- Dataset: 78,358 balanced samples β see [`torchsight/beam-training-data`](https://huggingface.co/datasets/torchsight/beam-training-data)
|
| 85 |
+
- Hardware: 8Γ NVIDIA A100 80GB SXM4, 10.5 hours
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
## License
|
| 88 |
|
| 89 |
+
Apache 2.0. The base model (Qwen 3.5 27B) carries its own license; consult
|
| 90 |
+
upstream terms for use.
|