Skip to content

Brain & NPU Detection

Brain — Hardware Detection & Unified Inference

The Brain module (core/brain/) provides automatic hardware detection and a unified inference API shared by ALL product tiers.

Hardware Detection

HookProbe automatically detects AI accelerators at startup and selects the optimal inference backend.

Supported Accelerators (13 Types)

High-End ($250-$1,600)

HardwareTOPSEngineUse Case
Apple M4/M4 Pro38CoreML + llama.cppFull local 70B LLM
NVIDIA Jetson Orin67TensorRTGPU-accelerated detection
Qualcomm QCS855048LiteRT + QNNIndustrial edge AI

Mid Tier ($60-$200)

HardwareTOPSEngineUse Case
RPi 5 + Hailo-826HailoRT7ms inference, best RPi option
RPi 5 + Hailo-8L13HailoRTBudget RPi AI HAT
Intel NPU (Meteor Lake)11OpenVINONUC/laptop deployment
Qualcomm QCS649012LiteRT + QNNRadxa Dragon Q6A

Entry Tier ($35-$100)

HardwareTOPSEngineUse Case
Radxa ROCK 5B+ / Orange Pi 56RKNNCheapest NPU path
Google Coral4LiteRT + EdgeTPUUSB/M.2 accelerator
BeagleY-AI4TIDLOpen hardware
Khadas VIM43.2AML NPUAmlogic platform
CPU-only0.5-2llama.cpp / sklearnAlways available fallback

Detection Priority

The detection function probes in order:

  1. /proc/device-tree/compatible — SoC identification (Jetson, RK3588, TI AM67A)
  2. /dev/hailo0 — Hailo NPU device node
  3. /sys/class/accel/ — Intel NPU driver (x86_64 only)
  4. /dev/rknpu — Rockchip NPU
  5. /dev/apex_0 — Google Coral TPU
  6. CPU fallback with SIMD detection (NEON/AVX2/AVX-512)

Usage

Terminal window
# CLI
hookprobe-ctl hw-info
# Python
from core.brain.hw_detect import detect_hardware
hw = detect_hardware()
print(f"{hw.accelerator.value}: {hw.tops} TOPS")
print(f"Recommended tier: {hw.tier_recommendation}")
print(f"LLM model: {hw.llm_recommendation}")

Mock Mode (Testing)

Terminal window
HOOKPROBE_MOCK_NPU=hailo-8l hookprobe-ctl hw-info

Inference Bridge

The InferenceBridge provides a unified API across all backends:

from core.brain.inference_bridge import InferenceBridge
bridge = InferenceBridge(tier='fortress')
# Anomaly detection (24-dim HYDRA features)
result = bridge.classify(feature_vector)
# → ClassifyResult(score=0.73, label='malicious', backend='cpu-sklearn')
# LLM text generation
text = bridge.generate("Analyze this network anomaly...")
# → GenerateResult(text='...', backend='local_llm')
# RAG embedding
vector = bridge.embed("XDP packet filtering")
# → [0.012, -0.034, ...] (768-dim)

Tier-Aware Backend Selection

TierClassificationLLMEmbedding
SentinelRule-based thresholdsNoneNone
GuardianCPU sklearn + NPUSmolLM-135M (80MB)Cloud (Gemini)
FortressCPU/NPU sklearnTinyLlama-1.1B (670MB)Local or cloud
NexusGPU/NPU sklearnPhi-3 to Llama-70BLocal

Benchmarks

Run the benchmark suite to measure your hardware:

Terminal window
hookprobe-ctl benchmark --quick
# or
./scripts/run-benchmark.sh --output results.json

Example results (ARM64 CPU, 4 cores):

  • Latency: 0.002ms median (classification)
  • Throughput: 469,127 classifications/sec
  • Memory: 33MB peak RSS