
local-llm
A comprehensive guide for building and configuring a high-end local machine to run state-of-the-art LLMs, with detailed hardware choices, BIOS tuning, and Docker-based model serving.
它提供了一种实用的混合推理系统:小型模型仅需将 15–55% 的查询转发即可匹配更大的模型(Gemini 3.1 Flash-Lite),并且在文本、视觉和音频基准上达到 0.814 的平均 AUROC,即使未在音频数据上训练也能良好泛化。
A small, on-device model is fast and private, but sometimes wrong. At Cactus we post-train models to know when they are wrong: we ship probes inside the checkpoint that score every answer with a confidence between 0 and 1, returned as structured data (never parsed out of the answer text). Answer on-device when confidence is high; you can re-route to a bigger model when it's low:
if confidence ", answer)[-1]
answer = re.sub(r"^(thought|final)\b\s*", "", answer).strip()
print(answer)
print("confidence:", model.last_confidence)
# pip install "transformers>=5.5.4,<5.6" torch (5.14+ segfaults on this checkpoint)
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "Cactus-Compute/gemma-4-e2b-it-hybrid"
device = "cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True, dtype="auto").to(device)
messages = [{"role": "user", "content": "What is the capital of France?"}]
inputs = tokenizer.apply_chat_template(
messages, add_generation_prompt=True, return_tensors="pt", return_dict=True
).to(device)
out = model.generate(**inputs, return_confidence=True, max_new_tokens=512)
print(tokenizer.decode(out.sequences[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
print("confidence:", out.confidence)
Load the model with an explicit .to(device), not device_map="auto": the
probe scores generations outside the module forward() path, so weights that
accelerate offloads (left on the meta device) crash the confidence read.
llama.cpp is C++, so the probe is a patch you compile into the engine (see
patches/llama.cpp/). Build the patched server once:
git clone https://github.com/cactus-compute/cactus-hybrid && cd cactus-hybrid
./patches/llama.cpp/install.sh && rehash
Then serve and query it like any llama-server — the response carries a
top-level confidence field:
llama-server -hf Cactus-Compute/gemma-4-e2b-it-hybrid-GGUF:Q4_K_M --jinja
curl -s http://localhost:8080/v1/chat/completions \
-d '{"messages":[{"role":"user","content":"What is the capital of France?"}],"max_tokens":512}' \
|
On-device models that know when they're wrong: every answer carries a confidence score for cloud handoff.
根据分类、Topic 和编程语言匹配的相似项目。

A comprehensive guide for building and configuring a high-end local machine to run state-of-the-art LLMs, with detailed hardware choices, BIOS tuning, and Docker-based model serving.

A terminal dashboard that shows your internet throughput in real time, with a deliberately minimal interface designed to be understood within one second.
Grok Build is SpaceXAI's terminal-based AI coding agent that runs as a full-screen TUI, understands codebases, edits files, executes commands, searches the web, and manages tasks interactively or headlessly.