惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
博客园 - 三生石上(FineUI控件)
S
Securelist
U
Unit 42
The Cloudflare Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Simon Willison's Weblog
Simon Willison's Weblog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
B
Blog
T
Tenable Blog
The Hacker News
The Hacker News
The Register - Security
The Register - Security
IT之家
IT之家
博客园 - 【当耐特】
Spread Privacy
Spread Privacy
P
Privacy & Cybersecurity Law Blog
博客园_首页
T
Tailwind CSS Blog
人人都是产品经理
人人都是产品经理
C
Cybersecurity and Infrastructure Security Agency CISA
Know Your Adversary
Know Your Adversary
NISL@THU
NISL@THU
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
阮一峰的网络日志
阮一峰的网络日志
T
Tor Project blog
C
CERT Recently Published Vulnerability Notes
Apple Machine Learning Research
Apple Machine Learning Research
Stack Overflow Blog
Stack Overflow Blog
T
Threat Research - Cisco Blogs
T
The Exploit Database - CXSecurity.com
V
Vulnerabilities – Threatpost
A
Arctic Wolf
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
V
V2EX
aimingoo的专栏
aimingoo的专栏
大猫的无限游戏
大猫的无限游戏
Scott Helme
Scott Helme
L
LINUX DO - 热门话题
Cyberwarzone
Cyberwarzone
V
Visual Studio Blog
月光博客
月光博客
爱范儿
爱范儿
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
美团技术团队
G
GRAHAM CLULEY
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Heimdal Security Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO

Dejavu's Blog

Headscale + Tailscale 组建虚拟专用网 在 Linux 上使用 Yubikey OpenPGP 应用 BuyVM VPS 块存储挂载教程 Alpine Linux 服务器配置指南 Alpine Linux 安装 Cloudflared Docker 多容器共享中心数据库 安装 Komari 服务器监控工具 Scaleway VPS 安装 Debian Linux Debian 13 下部署 AsmBB 论坛 使用 Kopia 自动化备份服务器数据 给 Docker 启用 IPv6 支持 Netcup 服务器安装自定义 ISO 镜像 烽火 HG5582A 光猫开启桥接模式 Docker 自托管 Shlink 短链服务 部署 Obsidian LiveSync 实时同步服务指南 我的 2025 年不完全回顾 Linux 下 Intel 核显驱动配置与硬件加速 Fedora Linux 安装配置记录 2025 年优雅地自托管 RSS 服务 Woodpecker CI 和 Gitea 实现 Hugo 自动部署 Gitea/Forgejo 集成 Woodpecker CI/CD 在 Blinko 中使用 Ollama 作为 AI 供应商 Docker 部署 Gitea/Forgejo Plausible CE 启用城市级地理位置识别 Blinko 开源 AI 知识库 Docker 部署指南 Netcup 免税账号注册及购买服务器全记录 Docker 自托管 Cloudreve Pro 私有网盘服务 GiffGaff SIM 卡使用体验和注意事项 简体中文互联网在变得糟糕吗? 如何低成本申请 S/MIME 证书用于个人邮件服务 迁移到 NameCrane Mail 域名邮箱套件服务 香烟与咖啡 在 Windows 中使用 Yubikey 的 OpenPGP 应用 Windows 11 IoT LTSC 养老指南 巧用浏览器生成 HAR 文件批量下载所需网页资源 聊聊静态网站的评论系统 在 Hugo 站点中优雅地展示实况照片 使用 snac 部署一个简洁优雅的 ActivityPub 实例 当 25 岁来临的时候 断网的这两年 从 Bitwarden/Vaultwarden 到 KeePassXC 也许是 Android 上最好的本地播放器 - 椒盐音乐 2023 半年小结 写一个好玩的 Hugo 货币汇率转换短代码 写一个 Hugo 短代码将不同类别的总字数统计转换为书名显示 海信 Touch Lite 墨水屏音乐阅读器的简单体验 从 Debian 11(bullseye) 无感升级到 Debian 12(bookworm) 使用 GitHub Actions 自动提交 URL 到 IndexNow 批量重写 Git 历史提交记录 使用 cgit 托管小小的也很可爱的 Git 服务器 在 Debian 上使用 stagit 和 Nginx 的简单 Git 服务器 托管简单 Git 服务器的一些尝试 使用 stagit 自托管纯静态 Git 存储库 使用 Docker 快速部署单人 Fediverse 实例 我是如何建立自己的个人博客的? 简单、隐私友好的谷歌分析替代品,Plausible 自托管部署指南 服务器使用 Cloudflare CDN 的最佳实践 甲骨文服务器分配并启用 IPv6 地址 Git 版本控制学习笔记(二) Cloudflare WAF 防护策略简易指南 Mastodon 服务器批量导入自定义表情 低成本自托管 Mastodon 实例简明指南 自托管服务指南──有了服务器可以做什么? 使用 Miniflux + RSSHub 打造个人 RSS 阅读器 构建支持多种 CPU 架构的 Docker 镜像 一个可自托管的静态短链接应用 别了,二〇二二! Duplicacy CLI 进阶使用指南 Duplicacy CLI 备份工具的基本使用 初探 Cloudflare 零信任 - 通过 Docker 部署 Bitwarden 密码管理器 Yubikey 转运日志及上手指南 初探 Cloudflare 零信任 — 通过 Cloudflare Tunnel 搭建 SSH 聊天室 初探 Cloudflare 零信任 - 通过 Cloudflare Tunnel 访问服务 某科学的 PGP 算号指南 2022 年的 MacBook Air M1 使用体验及应用推荐 使用 Vercel 和 Supabase 自托管 Cusdis 评论系统 为什么你的搜索引擎不好用? 个人在 Windows 上常用软件清单 macOS 基础开发环境设置指南 在 macOS 上使用 Canokey 的 OpenPGP 应用 提取 Windows UWP 应用商店的安装包以供离线安装 Git 版本控制学习笔记(一) 使用 Notion 管理 GitHub Star 项目 使用 Vercel 免费部署 Giscus 评论系统 将博客评论从 Utterances 无缝迁移到 Giscus Canokey 签名和认证应用指南 Canokey 的基本使用指南 Canokey Pigeon 揽件日志及简单开箱 关于 Google Play 保护机制和 DRM 安全等级的那些事 记录一次捡垃圾装机 GitHub 使用 GPG 密钥提交签名认证 使用 Scoop 管理 Windows 下的软件和开发环境 Windows Terminal+PowerShell 7 打造 Windows 下最好用的终端 一个好用的 Telegram 文件批量上传/下载工具 Clash for Windows 优雅地使用 TUN 模式接管系统流量 全平台搭建 Hexo 静态博客指南 尝试将 Manjaro 作为主力操作系统使用 Hexo 进行 SEO 优化的基本指南 使用本地代理给 Git 和 NPM 加速 使用 flowerss 部署 Telegram RSS 订阅机器人
甲骨文 ARM 实例部署 Gemma 4 模型
Dejavu Moe · 2026-04-07 · via Dejavu's Blog

前言

手中的甲骨文免费 ARM 实例长期处于闲置状态,尽管 24GB RAM 赋予了它运行大语言模型的可能,但仅仅 4 核心的 ARM CPU 却成为了算力瓶颈。

Google 近期发布的 Gemma 4 模型不仅原生具备强大的逻辑推理与多模态能力,最核心的亮点在于引入了 MoE(混合专家)架构。这意味着,尽管模型拥有极其庞大的知识库,但在每次生成词汇时,系统只会「激活」最相关的几个专家网络。在保持足够智力的同时,大幅降低了推理的计算开销。

最终我的模型选择是 gemma-4-26B-A4B-it-UD-Q4_K_M 版本,总参数高达 260 亿,确保了广阔的知识面与深刻的代码及逻辑理解力。

Q4_K_M 则是兼顾性能与内存占用的 4-bit 中度量化版本,而 A4B (Active 4B) 使得每次生成 Token 时,仅有 40 亿参数参与计算。因此 4 核 CPU 只需承受相当于 4B 小模型的压力,便能输出 26B 级别的表现。

环境准备

本文基于 Debian 13 GNU/Linux,确认硬件架构信息:

lscpu
Architecture:                aarch64
  CPU op-mode(s):            32-bit, 64-bit
  Byte Order:                Little Endian
CPU(s):                      4
  On-line CPU(s) list:       0-3
Vendor ID:                   ARM
  Model name:                Neoverse-N1
    Model:                   1
    Thread(s) per core:      1
    Core(s) per cluster:     4
    Socket(s):               -
    Cluster(s):              1
    Stepping:                r3p1
    BogoMIPS:                50.00
    Flags:                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics 
                             fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
NUMA:                        
  NUMA node(s):              1
  NUMA node0 CPU(s):         0-3
Vulnerabilities:             
  Gather data sampling:      Not affected
  Indirect target selection: Not affected
  Itlb multihit:             Not affected
  L1tf:                      Not affected
  Mds:                       Not affected
  Meltdown:                  Not affected
  Mmio stale data:           Not affected
  Reg file data sampling:    Not affected
  Retbleed:                  Not affected
  Spec rstack overflow:      Not affected
  Spec store bypass:         Mitigation; Speculative Store Bypass disabled via p
                             rctl
  Spectre v1:                Mitigation; __user pointer sanitization
  Spectre v2:                Mitigation; CSV2, BHB
  Srbds:                     Not affected
  Tsa:                       Not affected
  Tsx async abort:           Not affected
  Vmscape:                   Not affected

安装编译与运行依赖:

sudo apt update && sudo apt upgrade -y
sudo apt install -y build-essential \
  cmake \
  git \
  wget \
  curl \
  python3 \
  python3-venv \
  python3-pip \
  libopenblas-dev \
  pkg-config \
  unzip

放开系统的内存锁定限制,确保模型顺利加载到 RAM 中:

# 切换至 root 用户执行
sudo -i
# 临时生效
ulimit -l unlimited
# 写入配置文件以永久生效
echo "* soft memlock unlimited" | sudo tee -a /etc/security/limits.conf
echo "* hard memlock unlimited" | sudo tee -a /etc/security/limits.conf

配置完成后,断开当前 SSH 会话并重新登录服务器以使配置生效。

编译安装 llama.app

为了充分利用 ARM 处理器的原生加速指令,建议手动编译安装 llama.cpp

# 拉取最新源码
git clone https://github.com/ggml-org/llama.cpp.git
cd llama.cpp

配置并开始编译:

# 编译配置
cmake .. \
  -DCMAKE_BUILD_TYPE=Release \
  -DGGML_NATIVE=ON \
  -DGGML_OPENMP=ON \
  -DGGML_BLAS=ON \
  -DGGML_BLAS_VENDOR=OpenBLAS
# 开始编译
cmake --build . --config Release -j4

将编译生成的二进制可执行文件复制到系统路径:

sudo cp bin/llama-server /usr/local/bin/
sudo cp bin/llama-quantize /usr/local/bin/ 2>/dev/null || true
sudo chmod +x /usr/local/bin/llama-server
# 确保下面这行在 Shell 配置中
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

下载模型

使用 Hugging Face 官方 CLI 工具下载模型文件:

python3 -m pip install --user --force-reinstall "huggingface_hub[cli]" hf-xet --break-system-packages
# 模型存储目录
mkdir -p ~/models/gemma-4-26b && cd ~/models/gemma-4-26b
# 下载模型
hf download unsloth/gemma-4-26B-A4B-it-GGUF \
  --local-dir . \
  --include "*UD-IQ4_NL.gguf" \
  --repo-type model
# 查看模型
ls -lh *.gguf

测试运行

启动 llama-server 进行初步测试,并将其绑定到 Tailscale 内网 IP 以确保访问安全:

llama-server \
  -m gemma-4-26B-A4B-it-UD-Q4_K_M.gguf \
  --host 100.64.0.6 \
  --port 8080 \
  --api-key your-super-secret-key-1234567890abcdef \
  -t 4 \
  -tb 4 \
  -c 8192 \
  --mlock \
  --no-mmap \
  --parallel 1 \
  --batch-size 512 \
  --ubatch-size 512 \
  --cache-type-k q8_0 \
  --cache-type-v q8_0 \
  --no-warmup

在 Tailnet 网络下的另一台设备上发起 API 请求测试:

curl http://100.64.0.6:8080/v1/chat/completions \
  -H "Authorization: Bearer your-super-secret-key-1234567890abcdef" \
  -H "Content-Type: application/json" \
  -d '{"model":"gemma-4-26B-A4B-it","messages":[{"role":"user","content":"Hello, pls introduce yourself, who are you? what can you do?When using the `4-26B-A4B-it-UD-Q4_K_M.gguf` model on an Oracle ARM 4C 24GB VPS, what input and output token processing speeds would you expect?"}],"temperature":0.7}'

输出示例:

{"choices":[{"finish_reason":"stop","index":0,"message":{"role":"assistant","content":"### Part 1: Introduction\n\n**Who am I?**\nI am a large language model, trained by Google. You can think of me as a sophisticated AI assistant capable of processing, reasoning, and generating human-like text across a vast array of subjects.\n\n**What can I do?**\nMy capabilities are diverse and include, but are not limited to:\n*   **Content Generation:** Writing essays, emails, stories, poems, and scripts.\n*   **Coding & Technical Tasks:** Writing, debugging, and explaining code in dozens of programming languages.\n*   **Reasoning & Problem Solving:** Solving mathematical problems, logical puzzles, and providing step-by-step explanations.\n*   **Summarization & Analysis:** Condensing long documents into key points or analyzing the sentiment and tone of a text.\n*   **Translation:** Translating text between dozens of major world languages.\n*   **Information Retrieval:** Answering questions on history, science, culture, and more (within my training data limits).\n\n---\n\n### Part 2: Performance Estimation\n\nYou are asking about a very specific setup: a **Mixture-of-Experts (MoE)** model (`4-26B-A4B`) running on **Oracle ARM (Ampere Altra)** hardware via **GGUF** (llama.cpp).\n\n#### 1. Understanding the Model & Hardware\n*   **The Model (`4-26B-A4B`):** This is an MoE model. While it has **26 billion total parameters**, it only uses **4 billion active parameters** per token generated. This is crucial: your speed will be dictated by the \"active\" parameter count for compute, but by the \"total\" parameter count for memory loading.\n*   **Quantization (`Q4_K_M`):** A 4-bit quantization is efficient. A 26B model at 4-bit will take up approximately **14–16 GB of RAM**.\n*   **The Hardware (Oracle ARM 4C 24GB):**\n    *   **RAM:** 24GB is plenty to hold the 15GB model plus a healthy KV cache.\n    *   **CPU:** 4 ARM cores (Ampere Altra). These are high-performance server cores, but 4 cores is a relatively low count for a model of this size.\n    *   **Memory Bandwidth:** This is your primary bottleneck. In a VPS environment, memory bandwidth is often shared or limited compared to a dedicated bare-metal server.\n\n#### 2. Estimated Performance Metrics\n\nSince I cannot run a live benchmark on your specific VPS instance, I will provide an estimate based on the architectural characteristics of MoE models on ARM-based cloud CPUs.\n\n**A. Output Token Processing Speed (Decoding/Generation)**\n*   **Nature:** This is **Memory Bandwidth Bound**. The CPU must pull the active weights from the RAM for every single token generated.\n*   **The MoE Advantage:** Because only 4B parameters are active, the CPU doesn't have to do the math for all 26B, but it still has to navigate the routing logic.\n*   **Estimated Speed:** **3 – 8 tokens per second (t/s).**\n    *   *Why?* Even though only 4B parameters are \"active,\" the overhead of the MoE routing and the relatively modest memory bandwidth of a 4-core ARM VPS will prevent high-speed generation. You will likely experience a \"reading speed\" (similar to a human reading), which is usable but not \"instant.\"\n\n**B. Input Token Processing Speed (Prefill/Prompt Processing)**\n*   **Nature:** This is **Compute Bound**. This is the stage where the model processes your initial prompt to build the KV cache.\n*   **The ARM Advantage:** Ampere Altra cores have excellent instruction sets for math, but 4 cores is a tight limit for large matrix-matrix multiplications.\n*   **Estimated Speed:** **150 – 400 tokens per second.**\n    *   *Why?* Prefill is much faster than generation because it processes tokens in parallel batches. However, because you only have 4 cores, the parallelization is limited compared to a 32-core or 64-core instance.\n\n#### Summary Table (Estimated)\n\n| Metric | Estimated Value | Bottleneck |\n| :--- | :--- | :--- |\n| **Prompt Processing (Prefill)** | 150 – 400 t/s | CPU Compute (Cores) |\n| **Token Generation (Decoding)** | 3 – 8 t/s | Memory Bandwidth |\n| **RAM Usage** | ~15GB - 17GB | Model Size + KV Cache |\n\n#### Tips for Optimization on your Oracle VPS:\n1.  **Use `llama.cpp` with OpenBLAS or ARM NEON:** Ensure your build of `llama.cpp` is optimized for ARM NEON instructions to maximize the efficiency of those 4 cores.\n2.  **Thread Tuning:** Since you have 4 cores, set your threads (`-t`) to **4**. Do not over-subscribe threads, as this will increase context-switching latency and slow down generation.\n3.  **Flash Attention:** If using a recent version of `llama.cpp`, enable Flash Attention to reduce the memory footprint and speed up the prefill stage.","reasoning_content":"\n    *   Who am I? (Identity/Introduction).\n    *   What can I do? (Capabilities).\n    *   Technical Question: Performance estimation for a specific model (`4-26B-A4B-it-UD-Q4_K_M.gguf`) on specific hardware (Oracle ARM 4C 24GB VPS).\n    *   Metrics requested: Input token processing speed (prefill) and output token processing speed (decoding/generation).\n\n        *   *Identity:* I am a large language model trained by Google.\n        *   *Capabilities:* Text generation, reasoning, coding, translation, summarization, answering questions, etc.\n\n        *   *Model:* `4-26B-A4B-it-UD-Q4_K_M.gguf`.\n            *   \"4-26B\": This looks like a Mixture-of-Experts (MoE) model. Total parameters = 26B, Active parameters (A) = 4B.\n            *   \"UD\": Likely \"Uncensored\" or a specific fine-tune variant.\n            *   \"Q4_K_M\": 4-bit quantization (K-quantization, medium).\n            *   \"GGUF\": Format for llama.cpp/llama-cpp-python.\n        *   *Hardware:* Oracle ARM 4C 24GB VPS.\n            *   CPU: Ampere Altra (typically) - 4 ARM cores.\n            *   RAM: 24GB.\n            *   Architecture: ARM64.\n        *   *Bottlenecks:*\n            *   *Memory Bandwidth:* This is the primary bottleneck for LLM inference. ARM VPSs (like Oracle's) usually have decent memory bandwidth compared to standard cloud CPUs, but it's significantly lower than GPU VRAM (H100/A100) or even Apple Silicon Unified Memory.\n            *   *Compute:* MoE models are much faster at generation because they only use a fraction of parameters per token (4B vs 26B). However, the *entire* 26B model must reside in RAM.\n            *   *RAM Check:* A 26B model at Q4_K_M quantization will take roughly: $26 \\times 10^9 \\times 0.5$ (bits to bytes approx) $\\approx 13-15$ GB. With 24GB RAM, this fits comfortably with room for KV cache.\n\n        *   *Step 1: Estimate Model Size.*\n            26B parameters at 4-bit $\\approx 14-15$ GB.\n            Fits in 24GB RAM.\n\n        *   *Step 2: Estimate Generation Speed (Decoding).*\n            Decoding is memory-bandwidth bound.\n            Formula: $\\text{Tokens per second (t/s)} \\approx \\frac{\\text{Memory Bandwidth (GB/s)}}{\\text{Model Size (GB)} \\times \\text{Active Parameters Factor}}$.\n            *Actually, for MoE, the weight loading is for the active parameters, but you still have to access the routing and the loaded weights.*\n            Wait, in MoE, you only load the active weights from RAM to cache for each token.\n            Active parameters = 4B.\n            Memory bandwidth for Oracle ARM (Ampere Altra) is roughly 50-100 GB/s (estimated based on typical quad-channel/dual-channel setups in cloud environments).\n            If we use 4B active parameters at 4-bit: $4 \\times 0.5 = 2$ GB per token.\n            If bandwidth is 50 GB/s: $50 / 2 = 25$ t/s.\n            *However*, MoE overhead and the fact that we are on a CPU (not a specialized accelerator) reduces this. Real-world CPU inference for a 4B active MoE is usually around 5-15 t/s on decent hardware.\n\n        *   *Step 3: Estimate Prefill Speed (Input).*\n            Prefill is compute-bound (matrix-matrix multiplication).\n            ARM cores are decent but not as fast as GPUs for large matrices.\n            Expectation: Roughly 100-500 tokens per second depending on prompt length and core utilization.\n\n        *   *Disclaimer:* I am an AI, not a benchmark tool. These are estimates.\n        *   *The Model:* Analyze the MoE nature.\n        *   *The Hardware:* Analyze ARM/RAM.\n        *   *The Estimation (Decoding):* Focus on the 4B active parameters.\n        *   *The Estimation (Prefill):* Focus on the compute capability.\n        *   *Summary Table/List.*\n\n    *   *Correction:* I shouldn't say it's definitely 25 t/s. That's too optimistic for a VPS. VPSs often have \"noisy neighbors\" and throttled memory bandwidth.\n    *   *Reality Check:* A 4B active model on 4 ARM cores... 4 cores is quite low for a 26B model (even if MoE). The bottleneck will be the single-threaded performance and the memory latency.\n    *   *Revised Estimate:*\n        *   Decoding: 3-8 tokens/sec.\n        *   Prefill: 100-300 tokens/sec."}}],"created":1775532629,"model":"gemma-4-26B-A4B-it-UD-Q4_K_M.gguf","system_fingerprint":"b8683-d0a6dfeb2","object":"chat.completion","usage":{"completion_tokens":2347,"prompt_tokens":83,"total_tokens":2430,"prompt_tokens_details":{"cached_tokens":0}},"id":"chatcmpl-zwHxF7ycjfCWAiyMA3cjw2zXRKsckpqB","timings":{"cache_n":0,"prompt_n":83,"prompt_ms":3486.44,"prompt_per_token_ms":42.005301204819276,"prompt_per_second":23.80651897064054,"predicted_n":2347,"predicted_ms":311498.306,"predicted_per_token_ms":132.72190285470813,"predicted_per_second":7.534551407801236}}

从服务端日志来看,推理性能基本达到可用门槛:

prompt eval time =    3486.44 ms /    83 tokens (   42.01 ms per token,    23.81 tokens per second)
       eval time =  311498.31 ms /  2347 tokens (  132.72 ms per token,     7.53 tokens per second)
      total time =  314984.75 ms /  2430 tokens

PS:经过测试,如果只是简单的工具调用,后续建议更换 gemma-4-E4B-it-Q8_0.gguf 模型以获得性能和速度的均衡。

配置 Systemd 守护进程

新建 Systemd 服务配置:

sudo vim /etc/systemd/system/llama.service

写入以下内容:

[Unit]
Description=Gemma 4 26B API Server (Tailscale Network)
After=network-online.target tailscaled.service
Wants=network-online.target tailscaled.service

[Service]
Type=simple
User=dejavu
# 修改为绝对路径
WorkingDirectory=/home/dejavu/models/gemma-4-26b
Environment="PATH=/usr/local/bin:/usr/bin:/bin"

ExecStart=/usr/local/bin/llama-server \
  -m /home/dejavu/models/gemma-4-26b/gemma-4-26B-A4B-it-UD-Q4_K_M.gguf \
  --host 100.64.0.6 \
  --port 8080 \
  --api-key your-super-secret-key-1234567890abcdef \
  -t 4 \
  -tb 4 \
  -c 8192 \
  --mlock \
  --no-mmap \
  --parallel 1 \
  --batch-size 512 \
  --ubatch-size 512 \
  --cache-type-k q8_0 \
  --cache-type-v q8_0 \
  --no-warmup

Restart=always
RestartSec=10

StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=gemma-api

[Install]
WantedBy=multi-user.target

重载配置并启动服务:

sudo systemctl daemon-reload
sudo systemctl enable llama --now
sudo systemctl status llama
# 查看实时日志
sudo journalctl -u llama -f

至此,Gemma 4 模型已在 Tailnet 中就绪,其他服务可通过 OpenAI API 兼容格式调用。

usage.webp

但受限于 ARM 实例的物理核心与计算资源,实际应用场景中务必控制并发请求,建议采用队列机制确保每次仅处理单个任务。