llama.cpp 没有发布官方 aarch64 的二进制,需要自己编译,好在 Termux 已经有编译好的包可用。
- 在 Termux 中安装 llama-cpp 软件
~ $ apt update
Get:1 https://mirrors.tuna.tsinghua.edu.cn/termux/apt/termux-main stable InRelease [14.0 kB]
...
Reading package lists... Done
~ $ apt install llama-cpp
The following additional packages will be installed:
libandroid-spawn
Suggested packages: llama-cpp-backend-vulkan llama-cpp-backend-opencl
The following NEW packages will be installed:
libandroid-spawn llama-cpp
...
Setting up llama-cpp (0.0.0-b8184-0) ...
如果找不到这个包,就先执行 apt update 更新目录。为简单起见,先不安装 llama-cpp-backend-vulkan,用 CPU 来执行 llama-cpp。
- 下载 Qwen3.5-0.8B-UD-Q4_K_XL.gguf 模型
~/model $ mkdir model
~/model $ cd model
~/model $ curl -LO https://hf-mirror.com/unsloth/Qwen3.5-0.8B-GGUF/resolve/main/Qwen3.5-0.8B-UD-Q4_K_XL.gguf
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed
100 532M 100 532M 0 0 4147k 0 0:02:11 0:02:11 --:--:-- 5141k
这个模型是 Q4 量化的,比原版减少了一半空间,而能力差不多。
- 用 llama-cli 交互工具加载模型并对话
~/model $ llama-cli -m Qwen3.5-0.8B-UD-Q4_K_XL.gguf --ctx-size 16384 -cnv
load_backend: loaded CPU backend from /data/data/com.termux/files/usr/bin/../lib/libggml-cpu.so
Loading model...
build : b0-unknown
model : Qwen3.5-0.8B-UD-Q4_K_XL.gguf
modalities : text
available commands:
/ex or Ctrl+C stop or exit
/regen regenerate the last response
/clear clear the chat history
/read add a text file
用因式分解法解方程 x^2-x-20=0
我们要解的是方程:x^2 - x - 20 = 0
1. 分析方程结构
这是一个一元二次方程。观察常数项是 -20,一次项系数是 1。我们需要找到两个数,乘积为 -20,和为 1。这两个数显然是 4 和 -5。 所以,我们可以将方程左边变形为:(x - 4)(x + 5) = x^2 + x - 20
2. 验证并求解
根据零乘性(Zero Product Property),如果两个因式的乘积为 0,那么其中一个因式必须为 0。 x - 4 = 0 或 x + 5 = 0 解得:x1 = 4, x2 = -5
3. 结论
方程的解为:x = 4 或 x = -5
[ Prompt: 45.1 t/s | Generation: 6.6 t/s ]
/exit Exiting... llama_memory_breakdown_print: | memory breakdown [MiB] | total free self model context compute unaccounted |
- Host | 1222 = 522 + 211 + 489 |
因为模型很小,智能比较弱,胡说一通后,勉强算对了。
- 利用 llama-server 内置的 web-ui 功能

