dots: public mirror (history reset after licence cleanup)

This commit is contained in:
Coja committed 2026-11-09 18:19:14 +01:00
commit 693822ad5f
226 files changed
+22502

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
[Unit]
Description=Evremap Service
After=multi-user.target
[Service]
WorkingDirectory=/
# Config path must stay absolute: this is a system unit running as root, so ~ or $HOME would resolve to /root.
ExecStart=bash -c "/usr/bin/evremap remap /home/anon/.config/evremap/evremap.toml -d 0"
Restart=always
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target
+60
View File
@@ -0,0 +1,60 @@
# The name of the device to remap.
# Run `sudo evremap list-devices` to see the devices available
# on your system.
device_name = "Logitech ERGO K860"
# If you have multiple devices with the same name, you can optionally
# specify the `phys` value that is printed by the `list-devices` subcommand
# phys = "usb-0000:07:00.3-2.1.1/input0"
# Configure CAPSLOCK as a Dual Role key.
# Holding it produces LEFTCTRL, but tapping it
# will produce ESC.
# Both `tap` and `hold` can expand to multiple output keys.
[[dual_role]]
input = "KEY_CAPSLOCK"
hold = ["KEY_LEFTCTRL"]
tap = ["KEY_ESC"]
# Turn RIGHT ALT into a vim-arrow layer.
# We first neuter it: instead of ever emitting KEY_RIGHTALT (which apps treat
# as "activate menu" on a bare tap), it becomes KEY_F13 -- a real keycode that
# is unbound in every app, so tapping or holding right alt alone does nothing.
# The chords below then turn F13 + h/j/k/l into the arrow keys.
[[dual_role]]
input = "KEY_RIGHTALT"
hold = ["KEY_F13"]
tap = ["KEY_F13"]
[[remap]]
input = ["KEY_F13", "KEY_H"]
output = ["KEY_LEFT"]
[[remap]]
input = ["KEY_F13", "KEY_J"]
output = ["KEY_DOWN"]
[[remap]]
input = ["KEY_F13", "KEY_K"]
output = ["KEY_UP"]
[[remap]]
input = ["KEY_F13", "KEY_L"]
output = ["KEY_RIGHT"]
[[remap]]
input = ["KEY_F13", "KEY_U"]
output = ["KEY_PAGEUP"]
[[remap]]
input = ["KEY_F13", "KEY_D"]
output = ["KEY_PAGEDOWN"]
# Word-wise motion: emit Ctrl+Arrow so it jumps by word.
[[remap]]
input = ["KEY_F13", "KEY_B"]
output = ["KEY_LEFTCTRL", "KEY_LEFT"]
[[remap]]
input = ["KEY_F13", "KEY_W"]
output = ["KEY_LEFTCTRL", "KEY_RIGHT"]
+11
View File
@@ -0,0 +1,11 @@
# fl runs the llama.cpp router as a systemd service (llama.service) — no launch abbr needed.
# Presets: ~/.config/llamacpp/config.ini; see ~/.config/llamacpp/README.md.
## GPU monitors — the RX 7600 XT also drives the display, so VRAM headroom is a safety matter
## (config.ini header: keep ≥ 2.5 GB free; GTT growth = VRAM spilling to RAM = the freeze precursor).
# vram : quick rocm-smi % view + who holds the render node. fuser prints its table on STDERR,
# so it must be 2>&1 — with 2>/dev/null the "LLM GPU usage" section is always empty.
abbr vram 'watch -c -d -n 1 \'echo "=== VRAM ==="; rocm-smi --showmemuse --showuse 2>/dev/null | grep -E "GPU use|Allocated|Read/Write"; echo ""; echo "=== LLM GPU usage ==="; fuser -v /dev/dri/renderD128 2>&1 | grep -iE "COMMAND|llama"\''
# vramx: absolute GiB used/free + GTT + temp straight from amdgpu sysfs (no ROCm), per-process VRAM
# via fdinfo, and which preset the router has resident. Body = gpumon.sh (runs bare too).
abbr vramx 'watch -c -d -n 1 ~/.config/llamacpp/gpumon.sh'
+372
View File
@@ -0,0 +1,372 @@
[ActivityManager]
_k_friendly_name=Activity Manager
switch-to-activity-a8fc2925-fa8d-449a-a9be-48ffe253c900=Meta+Shift+Tab,none,Switch to activity "Work"
switch-to-activity-c0551195-8905-4f5f-9be3-86124cedc90e=Meta+Tab,none,Switch to activity "Personal"
[KDE Keyboard Layout Switcher]
Switch keyboard layout to English (US)=none,none,Switch keyboard layout to English (US)
Switch keyboard layout to Serbian (Cyrillic, ZE and ZHE swapped)=none,none,Switch keyboard layout to Serbian (Cyrillic\\, ZE and ZHE swapped)
Switch keyboard layout to Serbian (Latin, with guillemets)=none,none,Switch keyboard layout to Serbian (Latin\\, with guillemets)
Switch to Last-Used Keyboard Layout=none,Meta+Alt+L,Switch to Last-Used Keyboard Layout
Switch to Next Keyboard Layout=none,Meta+Alt+K,Switch to Next Keyboard Layout
_k_friendly_name=Keyboard Layout Switcher
[kmix]
_k_friendly_name=KMix
decrease_microphone_volume=Microphone Volume Down,Microphone Volume Down,Decrease Microphone Volume
decrease_volume=Volume Down,Volume Down,Decrease Volume
decrease_volume_small=Shift+Volume Down,Shift+Volume Down,Decrease Volume by 1%
increase_microphone_volume=Microphone Volume Up,Microphone Volume Up,Increase Microphone Volume
increase_volume=Volume Up,Volume Up,Increase Volume
increase_volume_small=Shift+Volume Up,Shift+Volume Up,Increase Volume by 1%
mic_mute=Microphone Mute\tMeta+Volume Mute,Microphone Mute\tMeta+Volume Mute,Mute Microphone
mute=Volume Mute,Volume Mute,Mute
push_to_talk=none,none,Push to talk
[ksmserver]
Halt Without Confirmation=none,none,Shut Down Without Confirmation
Lock Session=Meta+L,Screensaver\tMeta+L,Lock Session
Log Out=Ctrl+Alt+Del,Ctrl+Alt+Del,Show Logout Screen
Log Out Without Confirmation=Meta+Del,none,Log Out Without Confirmation
LogOut=none,none,Log Out
Reboot=none,none,Reboot
Reboot Without Confirmation=none,none,Reboot Without Confirmation
Shut Down=none,none,Shut Down
_k_friendly_name=Session Management
[kwin]
Activate Window Demanding Attention=Meta+Ctrl+A,Meta+Ctrl+A,Activate Window Demanding Attention
Cycle Overview=none,none,Cycle through Overview and Grid View
Cycle Overview Opposite=none,none,Cycle through Grid View and Overview
Decrease Opacity=none,none,Decrease Opacity of Active Window by 5%
Edit Tiles=none,Meta+T,Toggle Tiles Editor
Expose=Ctrl+F9\tMeta+F9,Ctrl+F9\tMeta+F9,Toggle Present Windows (Current desktop)
ExposeAll=Launch (C)\tCtrl+F10\tMeta+F10,Launch (C)\tCtrl+F10\tMeta+F10,Toggle Present Windows (All desktops)
ExposeClass=Ctrl+F7\tMeta+F7,Ctrl+F7\tMeta+F7,Toggle Present Windows (Window class)
ExposeClassCurrentDesktop=none,none,Toggle Present Windows (Window class on current desktop)
Grid View=none,Meta+G,Toggle Grid View
Increase Opacity=none,none,Increase Opacity of Active Window by 5%
Kill Window=Meta+Ctrl+Esc,Meta+Ctrl+Esc,Kill Window
Move Tablet to Next LogicalOutput=none,none,Move the tablet to the next output
Move Tablet to Next Output=none,none,Move the tablet to the next output
MoveMouseToCenter=Meta+F6,Meta+F6,Center Pointer in Screen
MoveMouseToFocus=Meta+F5,Meta+F5,Center Pointer in Focused Window
MoveZoomDown=none,none,Move Zoomed Area Downwards
MoveZoomLeft=none,none,Move Zoomed Area to Left
MoveZoomRight=none,none,Move Zoomed Area to Right
MoveZoomUp=none,none,Move Zoomed Area Upwards
Overview=none,Meta+W,Toggle Overview
Setup Window Shortcut=none,none,Setup Window Shortcut
Show Desktop=Meta+D,Meta+D,Peek at Desktop
Switch One Desktop Down=Meta+Ctrl+Down,Meta+Ctrl+Down,Switch One Desktop Down
Switch One Desktop Up=Meta+Ctrl+Up\tMeta+Ctrl+Shift+Up,Meta+Ctrl+Up,Switch One Desktop Up
Switch One Desktop to the Left=Meta+Ctrl+Left,Meta+Ctrl+Left,Switch One Desktop to the Left
Switch One Desktop to the Right=Meta+Ctrl+Right,Meta+Ctrl+Right,Switch One Desktop to the Right
Switch Window Down=Ctrl+Alt+J\tCtrl+Alt+Down\tMeta+Shift+K\tMeta+Shift+Down\tMeta+Ctrl+J,Meta+Alt+Down,Switch to Window Below
Switch Window Left=Ctrl+Alt+H\tCtrl+Alt+Left\tMeta+Shift+H\tMeta+Shift+Left\tMeta+Ctrl+H,Meta+Alt+Left,Switch to Window to the Left
Switch Window Right=Ctrl+Alt+L\tCtrl+Alt+Right\tMeta+Shift+L\tMeta+Shift+Right\tMeta+Ctrl+L,Meta+Alt+Right,Switch to Window to the Right
Switch Window Up=Ctrl+Alt+K\tCtrl+Alt+Up\tMeta+Shift+J\tMeta+Shift+Up\tMeta+Ctrl+K,Meta+Alt+Up,Switch to Window Above
Switch to Desktop 1=Ctrl+F1\tMeta+1,Ctrl+F1\tMeta+F1,Switch to Desktop 1
Switch to Desktop 10=Meta+0,none,Switch to Desktop 10
Switch to Desktop 11=none,none,Switch to Desktop 11
Switch to Desktop 12=none,none,Switch to Desktop 12
Switch to Desktop 13=none,none,Switch to Desktop 13
Switch to Desktop 14=none,none,Switch to Desktop 14
Switch to Desktop 15=none,none,Switch to Desktop 15
Switch to Desktop 16=none,none,Switch to Desktop 16
Switch to Desktop 17=none,none,Switch to Desktop 17
Switch to Desktop 18=none,none,Switch to Desktop 18
Switch to Desktop 19=none,none,Switch to Desktop 19
Switch to Desktop 2=Ctrl+F2\tMeta+2,Ctrl+F2\tMeta+F2,Switch to Desktop 2
Switch to Desktop 20=none,none,Switch to Desktop 20
Switch to Desktop 21=none,none,Switch to Desktop 21
Switch to Desktop 22=none,none,Switch to Desktop 22
Switch to Desktop 23=none,none,Switch to Desktop 23
Switch to Desktop 24=none,none,Switch to Desktop 24
Switch to Desktop 25=none,none,Switch to Desktop 25
Switch to Desktop 3=Ctrl+F3\tMeta+3,Ctrl+F3\tMeta+F3,Switch to Desktop 3
Switch to Desktop 4=Ctrl+F4\tMeta+4,Ctrl+F4\tMeta+F4,Switch to Desktop 4
Switch to Desktop 5=Meta+5,none,Switch to Desktop 5
Switch to Desktop 6=Meta+6,none,Switch to Desktop 6
Switch to Desktop 7=Meta+7,none,Switch to Desktop 7
Switch to Desktop 8=Meta+8,none,Switch to Desktop 8
Switch to Desktop 9=Meta+9,none,Switch to Desktop 9
Switch to Next Desktop=Meta+Ctrl+Shift+L\tMeta+Ctrl+Shift+Right,none,Switch to Next Desktop
Switch to Next Screen=none,none,Switch to Next Screen
Switch to Previous Desktop=Meta+Ctrl+Shift+H\tMeta+Ctrl+Shift+Left,none,Switch to Previous Desktop
Switch to Previous Screen=none,none,Switch to Previous Screen
Switch to Screen 0=none,none,Switch to Screen 0
Switch to Screen 1=none,none,Switch to Screen 1
Switch to Screen 2=none,none,Switch to Screen 2
Switch to Screen 3=none,none,Switch to Screen 3
Switch to Screen 4=none,none,Switch to Screen 4
Switch to Screen 5=none,none,Switch to Screen 5
Switch to Screen 6=none,none,Switch to Screen 6
Switch to Screen 7=none,none,Switch to Screen 7
Switch to Screen Above=none,none,Switch to Screen Above
Switch to Screen Below=none,none,Switch to Screen Below
Switch to Screen to the Left=none,none,Switch to Screen to the Left
Switch to Screen to the Right=none,none,Switch to Screen to the Right
Toggle Night Color=none,none,Suspend/Resume Night Light
Toggle Show Compositing=none,none,Toggle “Show Compositing” effect
Toggle Window Raise/Lower=none,none,Toggle Window Raise/Lower
ToggleMouseClick=Meta+*,Meta+*,Toggle Mouse Click Animation
Walk Through Windows=Alt+Tab,Alt+Tab\tMeta+Tab,Walk Through Windows
Walk Through Windows (Reverse)=Alt+Shift+Tab,Alt+Shift+Tab\tMeta+Shift+Tab,Walk Through Windows (Reverse)
Walk Through Windows Alternative=none,none,Walk Through Windows Alternative
Walk Through Windows Alternative (Reverse)=none,none,Walk Through Windows Alternative (Reverse)
Walk Through Windows of Current Application=Alt+`,Alt+`\tMeta+`,Walk Through Windows of Current Application
Walk Through Windows of Current Application (Reverse)=Alt+~,Alt+~\tMeta+~,Walk Through Windows of Current Application (Reverse)
Walk Through Windows of Current Application Alternative=none,none,Walk Through Windows of Current Application Alternative
Walk Through Windows of Current Application Alternative (Reverse)=none,none,Walk Through Windows of Current Application Alternative (Reverse)
Window Above Other Windows=none,none,Keep Window Above Others
Window Below Other Windows=none,none,Keep Window Below Others
Window Close=Alt+F4\tMeta+Q,Alt+F4,Close Window
Window Custom Quick Tile Bottom=none,none,Custom Quick Tile Window to the Bottom
Window Custom Quick Tile Left=none,none,Custom Quick Tile Window to the Left
Window Custom Quick Tile Right=none,none,Custom Quick Tile Window to the Right
Window Custom Quick Tile Top=none,none,Custom Quick Tile Window to the Top
Window Fullscreen=Shift+F11\tAlt+Return,none,Make Window Fullscreen
Window Grow Horizontal=none,none,Expand Window Horizontally
Window Grow Vertical=none,none,Expand Window Vertically
Window Lower=none,none,Lower Window
Window Maximize=Meta+Return\tMeta+PgUp,Meta+PgUp,Maximize Window
Window Maximize Horizontal=none,none,Maximize Window Horizontally
Window Maximize Vertical=none,none,Maximize Window Vertically
Window Minimize=Meta+Esc\tMeta+PgDown,Meta+PgDown,Minimize Window
Window Move=Meta+Z,none,Move Window
Window Move Center=none,none,Move Window to the Center
Window No Border=none,none,Toggle Window Titlebar and Frame
Window On All Desktops=Meta+Shift+F,none,Keep Window on All Desktops
Window One Desktop Down=none,Meta+Ctrl+Shift+Down,Window One Desktop Down
Window One Desktop Up=none,Meta+Ctrl+Shift+Up,Window One Desktop Up
Window One Desktop to the Left=none,Meta+Ctrl+Shift+Left,Window One Desktop to the Left
Window One Desktop to the Right=none,Meta+Ctrl+Shift+Right,Window One Desktop to the Right
Window One Screen Down=none,none,Move Window One Screen Down
Window One Screen Up=none,none,Move Window One Screen Up
Window One Screen to the Left=none,none,Move Window One Screen to the Left
Window One Screen to the Right=none,none,Move Window One Screen to the Right
Window Operations Menu=Alt+F3,Alt+F3,Window Menu
Window Pack Down=Meta+Alt+Down,none,Move Window Down
Window Pack Left=Meta+Alt+Left,none,Move Window Left
Window Pack Right=Meta+Alt+Right,none,Move Window Right
Window Pack Up=Meta+Alt+Up,none,Move Window Up
Window Quick Tile Bottom=Meta+Down\tMeta+Alt+\\,\tMeta+Alt+K,Meta+Down,Quick Tile Window to the Bottom
Window Quick Tile Bottom Left=none,none,Quick Tile Window to the Bottom Left
Window Quick Tile Bottom Right=none,none,Quick Tile Window to the Bottom Right
Window Quick Tile Left=Meta+Left\tMeta+Alt+H,Meta+Left,Quick Tile Window to the Left
Window Quick Tile Right=Meta+Right\tMeta+Alt+L,Meta+Right,Quick Tile Window to the Right
Window Quick Tile Top=Meta+Up\tMeta+Alt+J,Meta+Up,Quick Tile Window to the Top
Window Quick Tile Top Left=none,none,Quick Tile Window to the Top Left
Window Quick Tile Top Right=none,none,Quick Tile Window to the Top Right
Window Raise=none,none,Raise Window
Window Resize=Meta+X,none,Resize Window
Window Restore=Meta+Backspace,Meta+Backspace,Restore Window
Window Shrink Horizontal=none,none,Shrink Window Horizontally
Window Shrink Vertical=none,none,Shrink Window Vertically
Window to Desktop 1=Meta+Ctrl+1,none,Window to Desktop 1
Window to Desktop 10=Meta+Ctrl+0,none,Window to Desktop 10
Window to Desktop 11=none,none,Window to Desktop 11
Window to Desktop 12=none,none,Window to Desktop 12
Window to Desktop 13=none,none,Window to Desktop 13
Window to Desktop 14=none,none,Window to Desktop 14
Window to Desktop 15=none,none,Window to Desktop 15
Window to Desktop 16=none,none,Window to Desktop 16
Window to Desktop 17=none,none,Window to Desktop 17
Window to Desktop 18=none,none,Window to Desktop 18
Window to Desktop 19=none,none,Window to Desktop 19
Window to Desktop 2=Meta+Ctrl+2,none,Window to Desktop 2
Window to Desktop 20=none,none,Window to Desktop 20
Window to Desktop 21=none,none,Window to Desktop 21
Window to Desktop 22=none,none,Window to Desktop 22
Window to Desktop 23=none,none,Window to Desktop 23
Window to Desktop 24=none,none,Window to Desktop 24
Window to Desktop 25=none,none,Window to Desktop 25
Window to Desktop 3=Meta+Ctrl+3,none,Window to Desktop 3
Window to Desktop 4=Meta+Ctrl+4,none,Window to Desktop 4
Window to Desktop 5=Meta+Ctrl+5,none,Window to Desktop 5
Window to Desktop 6=Meta+Ctrl+6,none,Window to Desktop 6
Window to Desktop 7=Meta+Ctrl+7,none,Window to Desktop 7
Window to Desktop 8=Meta+Ctrl+8,none,Window to Desktop 8
Window to Desktop 9=Meta+Ctrl+9,none,Window to Desktop 9
Window to Next Desktop=Meta+Ctrl+Alt+L\tMeta+Ctrl+Alt+Right,none,Window to Next Desktop
Window to Next Screen=none,Meta+Shift+Right,Move Window to Next Screen
Window to Previous Desktop=Meta+Ctrl+Alt+H\tMeta+Ctrl+Alt+Left,none,Window to Previous Desktop
Window to Previous Screen=none,Meta+Shift+Left,Move Window to Previous Screen
Window to Screen 0=none,none,Move Window to Screen 0
Window to Screen 1=none,none,Move Window to Screen 1
Window to Screen 2=none,none,Move Window to Screen 2
Window to Screen 3=none,none,Move Window to Screen 3
Window to Screen 4=none,none,Move Window to Screen 4
Window to Screen 5=none,none,Move Window to Screen 5
Window to Screen 6=none,none,Move Window to Screen 6
Window to Screen 7=none,none,Move Window to Screen 7
_k_friendly_name=KWin
disableInputCapture=Meta+Shift+Esc,Meta+Shift+Esc,Disable Active Input Capture
view_actual_size=Meta+),Meta+0,Zoom to Actual Size
view_zoom_in=Meta++,Meta++\tMeta+=,Zoom In
view_zoom_out=Meta+_,Meta+-,Zoom Out
[kwin][$InverseAction]
Cycle Overview=Cycle Overview Opposite
Increase Opacity=Decrease Opacity
MoveZoomDown=MoveZoomUp
MoveZoomLeft=MoveZoomRight
Switch One Desktop Down=Switch One Desktop Up
Switch One Desktop to the Left=Switch One Desktop to the Right
Switch Window Right=Switch Window Left
Switch Window Up=Switch Window Down
Switch to Next Screen=Switch to Previous Screen
Switch to Previous Desktop=Switch to Next Desktop
Switch to Screen Below=Switch to Screen Above
Switch to Screen to the Right=Switch to Screen to the Left
Walk Through Windows (Reverse)=Walk Through Windows
Walk Through Windows Alternative=Walk Through Windows Alternative (Reverse)
Walk Through Windows of Current Application (Reverse)=Walk Through Windows of Current Application
Walk Through Windows of Current Application Alternative (Reverse)=Walk Through Windows of Current Application Alternative
Window Grow Horizontal=Window Shrink Horizontal
Window Grow Vertical=Window Shrink Vertical
Window One Desktop Up=Window One Desktop Down
Window One Desktop to the Left=Window One Desktop to the Right
Window One Screen Up=Window One Screen Down
Window One Screen to the Right=Window One Screen to the Left
Window Pack Right=Window Pack Left
Window Pack Up=Window Pack Down
Window Raise=Window Lower
Window to Next Screen=Window to Previous Screen
Window to Previous Desktop=Window to Next Desktop
view_zoom_in=view_zoom_out
[mediacontrol]
_k_friendly_name=Media Controller
mediavolumedown=none,none,Media volume down
mediavolumeup=none,none,Media volume up
nextmedia=Media Next,Media Next,Media playback next
pausemedia=Media Pause,Media Pause,Pause media playback
playmedia=none,none,Play media playback
playpausemedia=Media Play,Media Play,Play/Pause media playback
previousmedia=Media Previous,Media Previous,Media playback previous
seekbackwardmedia=Media Rewind,Media Rewind,Media playback seek backward 5s
seekbackwardmedialong=none,none,Media playback seek backward 30s
seekforwardmedia=Media Fast Forward,Media Fast Forward,Media playback seek forward 5s
seekforwardmedialong=none,none,Media playback seek forward 30s
stopmedia=Media Stop,Media Stop,Stop media playback
[org_kde_powerdevil]
Decrease Keyboard Brightness=Keyboard Brightness Down,Keyboard Brightness Down,Decrease Keyboard Brightness
Decrease Screen Brightness=Monitor Brightness Down,Monitor Brightness Down,Decrease Screen Brightness
Decrease Screen Brightness Small=Shift+Monitor Brightness Down,Shift+Monitor Brightness Down,Decrease Screen Brightness by 1%
Hibernate=Hibernate,Hibernate,Hibernate
Increase Keyboard Brightness=Keyboard Brightness Up,Keyboard Brightness Up,Increase Keyboard Brightness
Increase Screen Brightness=Monitor Brightness Up,Monitor Brightness Up,Increase Screen Brightness
Increase Screen Brightness Small=Shift+Monitor Brightness Up,Shift+Monitor Brightness Up,Increase Screen Brightness by 1%
PowerDown=Power Down,Power Down,Power Down
PowerOff=Power Off,Power Off,Power Off
Sleep=Sleep,Sleep,Suspend
Toggle Keyboard Backlight=Keyboard Light On/Off,Keyboard Light On/Off,Toggle Keyboard Backlight
Turn Off Screen=none,none,Turn Off Screen
_k_friendly_name=Power Management
powerProfile=Battery,Battery\tMeta+B,Switch Power Profile
[plasmashell]
Slideshow Wallpaper Next Image=Meta+Ctrl+Alt+Shift+Right,none,Next Wallpaper Image
_k_friendly_name=plasmashell
activate application launcher=Meta,Meta\tAlt+F1,Activate Application Launcher
activate next task manager entry=Meta+Ctrl+PgDown,Meta+Ctrl+PgDown,Activate Next Task Manager Entry
activate previous task manager entry=Meta+Ctrl+PgUp,Meta+Ctrl+PgUp,Activate Previous Task Manager Entry
activate task manager entry 1=none,Meta+1,Activate Task Manager Entry 1
activate task manager entry 10=none,none,Activate Task Manager Entry 10
activate task manager entry 2=none,Meta+2,Activate Task Manager Entry 2
activate task manager entry 3=none,Meta+3,Activate Task Manager Entry 3
activate task manager entry 4=none,Meta+4,Activate Task Manager Entry 4
activate task manager entry 5=none,Meta+5,Activate Task Manager Entry 5
activate task manager entry 6=none,Meta+6,Activate Task Manager Entry 6
activate task manager entry 7=none,Meta+7,Activate Task Manager Entry 7
activate task manager entry 8=none,Meta+8,Activate Task Manager Entry 8
activate task manager entry 9=none,Meta+9,Activate Task Manager Entry 9
activate widget 47=none,none,Activate System Monitor Widget
activate widget 61=none,none,Activate Activity Pager Widget
activate widget 69=none,none,Activate System Monitor Widget
activate widget 70=none,none,Activate System Monitor Widget
clear history=none,none,Clear Notification History
clear-history=none,none,Clear Clipboard History
clipboard_action=none,none,Toggle Automatic Popping Up of Action Menu
cycle-panels=Meta+Alt+P,Meta+Alt+P,Move keyboard focus between panels
cycleNextAction=none,none,Next History Item
cyclePrevAction=none,none,Previous History Item
edit_clipboard=none,none,Edit Contents…
manage activities=none,Meta+Q,Show Activity Switcher
move active task to left=Meta+Ctrl+Shift+PgUp,Meta+Ctrl+Shift+PgUp,Move Active Task Manager Entry Backward
move active task to right=Meta+Ctrl+Shift+PgDown,Meta+Ctrl+Shift+PgDown,Move Active Task Manager Entry Forward
next activity=none,none,Walk through activities
previous activity=Meta+Shift+A,none,Walk through activities (Reverse)
repeat_action=Meta+Ctrl+R,none,Manually Invoke Action on Current Clipboard
show dashboard=Ctrl+F12,Ctrl+F12,Show Desktop
show-barcode=none,none,Show Barcode…
show-on-mouse-pos=Meta+V,Meta+V,Show Clipboard Items at Mouse Position
switch to next activity=none,none,Switch to Next Activity
switch to previous activity=none,none,Switch to Previous Activity
toggle do not disturb=none,none,Toggle do not disturb
[services][Alacritty.desktop]
_launch=Meta+Shift+T
[services][FreeTube.desktop]
_launch=Meta+F
[services][betterbird.desktop]
_launch=Meta+M
[services][chromium.desktop]
_launch=Meta+Shift+B
[services][com.mitchellh.ghostty.desktop]
_launch=none
[services][ferdium.desktop]
_launch=Meta+Y
[services][kitty.desktop]
_launch=Ctrl+Alt+T\tMeta+T
[services][librewolf.desktop]
_launch=Meta+B
[services][net.local.kitty-2.desktop]
_launch=Meta+I
[services][net.local.kitty-3.desktop]
_launch=Meta+O
[services][net.local.kitty.desktop]
_launch=Meta+R
[services][nvim.desktop]
_launch=Meta+C
[services][org.gajim.Gajim.desktop]
StartChat=Meta+G
[services][org.kde.krunner.desktop]
_launch=Search\tAlt+Space\tAlt+F2\tCtrl+Alt+S\tMeta+A\tMeta+S
[services][org.kde.plasma-systemmonitor.desktop]
_launch=Ctrl+Shift+Esc
[services][org.kde.spectacle.desktop]
RecordRegion=Meta+Shift+R
RecordWindow=none
RectangularRegionScreenShot=Meta+P
_launch=Print\tMeta+Shift+P\tMeta+Shift+S
[services][org.keepassxc.KeePassXC.desktop]
_launch=Meta+K
[services][st.desktop]
_launch=Meta+Ctrl+T
[services][systemsettings.desktop]
_launch=Tools
[services][thorium-browser.desktop]
_launch=Meta+Ctrl+B
+231
View File
@@ -0,0 +1,231 @@
# Local LLM server — setup & usage
llama.cpp in **router mode** serving ~10 model presets from one 16 GB GPU.
Last full tune: **2026-07-16** (decode numbers measured then via `bench.py`, unless a preset comment in `config.ini` says otherwise).
Last full clean sweep: **2026-08-08 03:22** — all 11 presets loaded and ran green (baseline 2.0 GB) after the week's coder-race/KV-fix/gemma-sidecar round.
- **Box**: AMD RX 7600 XT 16 GB (~288 GB/s; backend = Arch `llama-cpp` 0.5.0 + `ggml-vulkan` / RADV = llama.cpp **b11146** since 2026-10-02, **not** ROCm —
`rocm-smi` is only the VRAM monitor) + Ryzen 5600X (6 cores) + 48 GB RAM.
⚠ The GPU **also drives the display** — see [VRAM safety](#vram-safety-the-golden-rules).
- **Endpoints**: LAN `http://$SERVER:11343/v1` · remote `https://<own-domain>/api/v1`
(own reverse proxy to the same server; requires an API key. Only the LAN endpoint is keyless).
`$SERVER` = the box's LAN address.
- **Files here**: `config.ini` (model presets — the section names ARE the API model ids),
`bench.py` (safety-first benchmark), `bench-results.md` / `bench-history.md` (ledgers, generated).
## How it runs
systemd unit **`llama.service`** (on the server, under a dedicated service user) runs a script wrapping:
```
llama-server --port 11343 --host 0.0.0.0 --models-max 1 --models-preset ~/.config/llamacpp/config.ini
```
- Router mode: each requested model loads on demand in a child process.
- **`--models-max 1` is deliberate and load-bearing**: at most one model resident; requesting
another LRU-evicts the current one *first*. Anything ≥2 lets two ~13 GB models stack →
VRAM overcommit → GTT spill → **whole-PC freeze**. Do not raise it casually.
(`sleep-idle-seconds` per preset is the second line of defense.)
- Models live in `~/software/models/` (paths in `config.ini` must stay absolute — llama-server
does not expand `~` or env vars in preset values). mmproj/draft files must match the exact
filename in the preset (watch for trailing spaces when renaming downloads!).
**Deploying config changes**: this dir is stowed into `~/.config/llamacpp/` as per-file
symlinks, so on the server `dotsync` (pull; re-stows only if files were added/removed) then
`sudo systemctl restart llama.service` — the router reads presets once at startup.
After ANY preset change: restart + `./bench.py -m <changed-ids>` and check the guards.
**Upgrading llama.cpp itself** (2026-10-02, b10615 → b11146): Arch replaced `llama.cpp-vulkan`
with a unified `llama-cpp` package on top of the system `ggml`, whose backends are split out.
`sudo pacman -Syu ggml llama-cpp ggml-vulkan` — name **`ggml`** explicitly (it conflicts with
the old `ggml-cpu` without replacing it, and the removal prompt defaults to N), and **`ggml-vulkan`**
explicitly (only an optdepend — without it llama-server silently runs on the CPU backend).
Then restart, and `llama-server --list-devices` must show `Vulkan0`. `whisper-cpp` moves to the
same `ggml` (CPU backends are inside the base package) — restart its unit too.
## VRAM safety (the golden rules)
The amdgpu driver does not OOM cleanly — an overcommitted model spills into GTT (system RAM),
starves the desktop and freezes the PC (reboot). Hard-won rules:
1. Keep every preset's benched **VRAM free ≥ 2.5 GB** (idle desktop uses ~1.3 of 17.2).
2. File size > VRAM is **fine** for MoE — `n-cpu-moe N` keeps the first N layers' experts
in system RAM. It is the main tuning knob: higher = safer/slower, lower = faster.
3. Bench with a **clean baseline** (close the browser): a dirty baseline both skews the
margins and costs ~3–4 t/s of decode (GPU compute contention — measured 2026-07-08).
4. Bench after every change; config-edit without restart = numbers from the *old* config.
## Model roster (reference numbers = clean night sweeps, 2026-07-16)
| model id | decode t/s | ctx | extras | role |
|---|---|---|---|---|
| `gemma-4-E4B-it-UD-Q8_K_XL` | **57.3** | **96k** | vision, MTP, prefill 185 t/s | fast small generalist, long docs, images (ctx 96k ✓ 08-08, n_ctx_train 131072) |
| `Qwen3.6-35B-A3B-Thinking` | 38.8 | 24k | MTP, vision, reasoning (budget 8k = "medium") | **default model** in opencode/pi/aichat since 09-21; hard problems, slow-but-smart answers |
| `gpt-oss-20b` | 38.4 | **64k** | reasoning, tools | fast reasoning + tool use · fast long-context (37 t/s vs Coder-Next 16; 131k ruled out) |
| `gpt-oss-20b-low` | 37.2 | **64k** | reasoning LOW, TTFT 0.8 s | same model, snappy answers (no long preamble) |
| `Qwen3.6-35B-A3B-MTP-UD-IQ3_XXS` | 35.9 | 24k | MTP, vision, thinking OFF | **daily driver** — compact instant answers |
| `gemma-4-26B-A4B-it-UD-IQ4_XS` | 33.9 | 24k | vision, MTP | quality generalist + best vision |
| `Qwen3.5-9B-UD-Q6_K_XL` | 32.1 | 32k | vision, MTP, reasoning | small Qwen, quick tasks |
| `Qwen3-Coder-30B-Instruct-UD-Q3_K_XL` | **~30** clean / 27.0 evening @moe12 | 32k | — | **main agent coder** — won the 2026-08-06 quant race; moe12 verified evening 08-07 + clean 08-08 |
| `GLM-4.7-Flash-UD-Q4_K_XL` | **21.5** @moe22 | 24k | reasoning | quality coder (opencode subagents); KV fix + moe22 ✓ verified clean 08-08 |
| `GLM-4.7-Flash-UD-Q3_K_XL` | **26.0** @moe12 (2.0 daytime baseline; ~28 clean) | 24k | reasoning | **fast coder** — re-added 09-21 because Q4's 21.5 dragged in agent loops; 3-bit, evening-safe at moe12 (13.4 used / 3.8 free @2.0); Q4 stays for hard reviews |
| `Qwen3-Coder-Next-UD-IQ3_XXS` | 16.0 | **128k** | 80B-A3B | long-session coder (128k ctx) |
| `Qwen3.8-27B-UD-IQ3_XXS` | **36–37** on b11429 (10-22 ×2; was 15.5 on b11146, 10.9 base) | 24k | vision, MTP, hybrid reasoner @ **xhigh** | ⚠ **clean-desktop specialty** (kept 09-10 over the ≥22 gate — **the speed half is now passed 1.7× over**, since llama.cpp 0.6.0 halved the per-step MTP cost; role re-rank pending the user) — dense-27B quality; prefill still GDN-bound (~20–35). 2.7 GB free @1.3 baseline @24k (✓ 10-22 on b11429, `-n 512`, acceptance 0.89, len 2.78). The *felt* slowness is the **xhigh thinking preamble** (17.5 s before the first answer token on a trivial prompt; `reasoning_effort=low` measured 6.45 s at the same decode on 10-02 — siblings benched then removed by decision, the kwarg is one line if ever wanted); **never on a busy evening desktop** (~1 GB free = GTT freeze) |
| `Qwen3-Embedding-0.6B` | 33 (CPU) | 8k | CPU-only, `/v1/embeddings` | RAG/search embedder (not a chat model) |
| `Ornith-1.5-35B-A3B-IQ3_XXS` | **32.1** @moe16 | **32k** (10-22, unbenched) | MTP, vision, thinking | **agentic coder** (added 09-21) — Qwen3.5-MoE derivative claiming +15 Terminal-Bench / +5.6 SWE-bench over Qwen3.6-35B; the only coder with MTP; 13.8 used / 3.3 free @2.0 |
Expected run-to-run spread: MTP models swing ±15% with draft **acceptance rate** (content-
dependent); CPU-heavy presets (Coder-Next, embedder) dip under daytime CPU contention.
Treat clean night runs as the reference; don't retune on daytime deltas.
## Which model, when
- **Agent coding loops** (edit/test cycles): `Qwen3-Coder-30B` — best speed/quality balance at 32k.
- **Hard code, reviews, tricky bugs**: `GLM-4.7-Flash` — strongest 30B-class coder, slightly slower.
- **GLM at agent-loop speed**: `GLM-4.7-Flash-UD-Q3_K_XL` — same model, 3-bit, ~28 t/s; pick it
when the Q4's 21 t/s drags, keep Q4 for the review that has to be right.
- **Agentic coding with reasoning** (⚗ new, judge over the next weeks): `Ornith-1.5-35B-A3B` —
Qwen3.5-MoE derivative, 32 t/s *with* MTP and a thinking preamble (~4 s TTFT), vision. If its
launch numbers hold in practice it displaces GLM/Coder-30B for agent loops.
- **Marathon sessions / huge conversation history**: `Qwen3-Coder-Next` — 128k ctx at only
6 GB VRAM (hybrid attention). Caveat: ~33 t/s prefill means it's for *growing* sessions
(`cache-reuse` makes turns incremental), **not** for cold-dumping 100k tokens.
- **Everyday questions**: `Qwen3.6-35B-A3B` — no reasoning preamble, 36 t/s.
- **Hard reasoning**: `35B-Thinking` (quality) or `gpt-oss-20b` (speed + tool use).
Their multi-second TTFT is the reasoning phase streaming first — not a slow load.
For quick interactive gpt-oss answers use `gpt-oss-20b-low` (reasoning effort low).
- **Best single-model quality** (quiet desktop only): `Qwen3.8-27B` — dense 27B hybrid reasoner +
vision at **37 t/s since llama.cpp 0.6.0** (was ~15 on 0.5.0; prefill still GDN-bound on Vulkan),
but a busy evening desktop pushes it into GTT-freeze territory — check `rocm-smi` first.
- **Images**: `gemma-4-26B` for quality, `gemma-4-E4B` or `Qwen3.5-9B` for speed,
`Qwen3.6-35B` when you want the daily driver to see the screenshot.
- **Long one-shot documents**: `gemma-4-E4B` — 185 t/s prefill eats 64k in ~6 min
(Coder-Next would take ~30 min to prefill the same).
- **RAG embeddings**: point Open WebUI etc. at `Qwen3-Embedding-0.6B`. Runs on CPU by
design — 0 VRAM, can never contribute to an overcommit.
## Speech-to-text (separate service)
STT deliberately does **not** live in this router — it is a CPU-only whisper.cpp service on port
11345, documented in `../whisper/README.md`. Two reasons: `models-max 1` would make every
transcription LRU-evict the resident chat model, and llama.cpp decodes audio via miniaudio
(wav/mp3/flac only) while browsers record opus.
The router *does* answer `POST /v1/audio/transcriptions` — it rewrites the request into a chat
completion — so `gemma-4-E4B-it-UD-Q8_K_XL` (audio-capable via its mmproj) transcribes uploaded
wav/mp3/flac with no config change. Keep that as the fallback; mind the eviction.
## Text-to-speech (separate service)
TTS is **not servable from this router at all** — unlike STT, there is no fallback. `llama-server`
has `--model-vocoder` / `--tts-use-guide-tokens`, but exposes **no `/v1/audio/speech` route**:
the router 404s on it exactly like an undefined path, and `grep -rn "audio/speech"` over the
b10216 tree returns nothing — the only audio route registered is `/v1/audio/transcriptions` (STT).
Worse, `--model-vocoder` is accepted by the server and then **silently ignored**: it is registered
in the arg table and documented, but no server code path consumes it. `--help` listing it is not
evidence it works. `llama-tts` is a CLI. (All verified 2026-08-09.)
So TTS is a CPU-only Kokoro-82M service on port **11347**, documented in `../tts/README.md`
(repo-side only — not installed on fl yet). The `models-max 1` argument applies even harder there
than for STT: TTS fires on *every* response, so a resident preset would evict the chat model every
single turn.
## Client wiring
The same catalog is mirrored in every client — when adding/removing a preset, update all:
- `common/.config/opencode/opencode.json` (both providers + agent model overrides)
- `common/.pi/agent/models.json` (both providers; `contextWindow` = server `ctx-size`)
- `common/.config/aichat/config.yaml` (both clients)
- `wm/.config/aichat/config.yaml` — full-file overlay for the off-LAN host (default client `duskadiy`);
every aichat change must be mirrored here too (missed for GLM Q3 + Ornith until 09-21). With the
lw/ overlays that makes **seven** client files.
Rule: client model **id = config.ini section name**, client context ≤ server `ctx-size`.
The embedder is deliberately absent from chat clients.
2026-08-06: the coder id changed `…-IQ4_XS` → `…-UD-Q3_K_XL` in all six client files
(common + lw overlays) after the quant race; OWUI picks the new id up automatically from
the router, but chats/presets saved against the old id need re-picking.
2026-08-16: `Qwen3.8-27B-UD-IQ3_XXS` (⚗ candidate) added to all six client files.
2026-09-10: kept as ⚠ clean-desktop specialty after the gate bench finally ran on the v3 gguf
(14.5 t/s MTP / 10.9 base, 2.8 GB free @1.5); server ctx restored to 24576 = client ctx, no client edits.
2026-09-21: `GLM-4.7-Flash-UD-Q3_K_XL` (⚡ fast coder) added to all six client files next to the Q4.
2026-10-22: Qwen3.8-27B quant race opened (ISTA GSQ-RCO IQ3_XXS-mtp + DFlash2 sibling) — bench-only,
NO client edits until a candidate wins; see the watch list. Same night: fl found on llama.cpp 0.6.0
(b11429) and the Qwen3.8 incumbent re-measured 37.1 t/s (15.5 on b11146) — every MTP/hybrid preset
on the roster needs a re-sweep on this build; ledger numbers above it are from 0.5.0 unless dated 10-22.
2026-09-21: `Ornith-1.5-35B-A3B-IQ3_XXS` (agentic coder, thinking + vision) added to all six client files after passing its gate (32.1 t/s @moe16).
2026-09-21: default model → `Qwen3.6-35B-A3B-Thinking` everywhere (opencode global + plan/build/auto, pi defaultModel + thinking level medium, aichat common/lw/wm) — gemma-4-26B refused routine sysadmin work. Thinking preset gets `reasoning-budget 8192`. wm aichat caught up (GLM Q3, Ornith).
2026-10-22: Ornith in pi: `Compacting in OVERFLOW recovery` right after a truncated reply is pi's *truncated-reply* recovery, not a full window — pi clamps each request's `max_tokens` to `contextWindow − estimate − 4096`, which on 24k/4096 starts exactly at the compaction threshold, so the first request after a compaction (estimate gains the system prompt + tool schemas) can leave a thinking reply ~1024 answer tokens → `length` → compact + retry. `compaction-watch.ts` now names the case with numbers; `common/.pi/CLAUDE.md` > Compaction tuning has the arithmetic. Applied the same day, UNBENCHED: Ornith `ctx-size` 24576 → 32768 + the seven client files (pi/opencode/aichat, common+lw+wm; predicted ≈ 0.1 GB of KV on this hybrid arch) — restart llama.service, then `./bench.py -m Ornith-1.5-35B-A3B-IQ3_XXS`; gate and the revert path are in the preset comment.
2026-10-12: Ornith in pi: "Response was truncated before completion." = `finish_reason: length` — the `<think>` block counts against pi's 4096 `max_tokens` and the preset has no reasoning-budget. Fixed client-side: pi sends `thinking_budget_tokens` per thinking level on Ornith (`compat.thinkingTokenBudgetField` + `settings.json > thinkingBudgets`, common + lw). The preset deliberately keeps NO CLI reasoning-budget — it would override the per-request field (see the preset comment).
## Tuning cheat-sheet
- **`n-cpu-moe`** (MoE only): experts→CPU. The speed/VRAM dial. Measured curve is gentle —
tune in steps of 2–4 layers, re-bench, keep free ≥2.5 GB.
- **`ctx-size`**: KV cost varies wildly by arch — Coder-Next 64k→128k cost 0.5 GB (hybrid
attn); dense Qwens pay ~1 GB per 16k. Raise only after a bench shows the headroom.
- **Quants**: dense = bandwidth-bound, quant size sets speed directly (9B: Q8→Q6 = +87%
with MTP). MoE = buy quality with a bigger quant, pay in CPU offload (both coders run
4-bit now; 3-bit was only ~2 t/s faster). Coders want ≥4-bit; chat tolerates UD 3-bit.
- **MTP / spec decode** (`spec-type draft-mtp`): ~1.5–2× decode. Qwen3.5/3.6 embed the
head in the *MTP-repo* GGUF (same filename as plain repo — size is the tell);
gemma-4 uses a separate `mtp-*.gguf` draft file; Qwen3.8 ships the head in the
*main*-repo GGUFs for ≥ Q2_K_XL (≤ IQ2_S are stripped — use the repo's `MTP/mtp-*.gguf`
draft instead). On the hybrid 27B it is only +33% (10.9→14.5) and costs 1.5 GB: every
speculative step re-runs the Gated-DeltaNet layers. **No MTP possible yet for**:
GLM-4.7-Flash (conversion drops the head — expected ~1.5× when llama.cpp lands it),
Qwen3-Coder-Next (Qwen3-Next head exists upstream, no GGUF ships it), gpt-oss and
Qwen3-Coder-30B (no head exists). Recheck releases occasionally.
- **KV cache**: `q8_0` K / `q4_0` V everywhere except gpt-oss (attention-sink issues with
quantized KV — keep defaults there).
## Benchmarking
```
./bench.py # full sweep (add -x Qwen3-Embedding-0.6B — it can't chat)
./bench.py -m id1,id2 # just the changed presets
./bench.py -n 512 --ctx 16000 # longer gen + long-context decode column
```
⚠ **Benches need the server to themselves**: with `models-max 1`, a request for another
model arriving mid-load LRU **force-kills the loading instance** → fake "failed to load"
rows (and a dirty baseline). Close chat clients / OWUI before sweeping.
Safety-first: force-unloads resident models via the router API (`POST /models/unload`),
verifies a clean card with rocm-smi before every load, records a ⚠ row and skips
generation when a model lands too tight (free < 1.5 GB or GTT ballooning).
Results: `bench-results.md` (latest) + `bench-history.md` (append-only; diff runs there).
**Reading TTFT**: bench.py stamps it on the first non-empty `content` delta, so for thinking
models TTFT = prompt eval **plus the whole reasoning preamble**, and `0.00` means the answer never
started within `-n` tokens (thinking ate the budget). It is the column that compares
reasoning-effort siblings; for stable MTP decode numbers use `-n 512`.
## Watch list
- **GLM MTP in llama.cpp** — the single biggest pending win (primary coder ~22 → ~30+).
- **Qwen3.8-27B quant race (opened 2026-10-22, bench-only, not client-wired)** — two candidate
sections in `config.ini` after the incumbent: `Qwen3.8-27B-GSQ-RCO-IQ3_XXS` (ISTA-DASLab GSQ-RCO
file, 10.44 GB with MTP head = −0.49 GB vs unsloth v3) and its `-dflash` text-only sibling
(`z-lab/Qwen3.8-27B-DFlash2-GGUF` Q4_K_M drafter, `spec-draft-n-max 3`). Expected: +4 % decode and
+0.5 GB free from the file; +5–15 % over MTP from DFlash2 on RDNA3/Vulkan (not the paper's 1.8×).
Quality is unmeasured against our file — the user's own prompts decide. First run 10-22 03:14: both
candidates HTTP 400 = fl's config.ini not pulled yet (router: "model not found"); the incumbent in
the same run read **37.1 t/s on b11429** (see its row). Re-run 03:25, one session: incumbent 36.2 /
2.7 free, **GSQ 37.5 / 3.2 free** (+3.6 %, +0.5 GB — speed+VRAM passed, **quality call open**),
**DFlash2 15.4 / 1.9 free → dropped** (tombstoned in `config.ini`). Ruled out by the same
research: ByteShape IQ4_XS (13.1 GB), ISTA IQ3_S (12.1 GB with MTP, under the floor), the
adaptive KV-cache-streaming fork (CUDA-only, PCIe 5.0). Still open: #27408 (spec + mmproj → 500),
#28158 (Vulkan OOB draft token). Research + verdicts + download lines: the config block.
- **llama.cpp 0.7.0 (b11669) — HOLD fl at 0.6.0**: #30688, Vulkan draft-mtp decode 4× / prefill 6×
slower (target compute buffer lands in GTT = this box's freeze precursor). Every MTP preset on the
roster is exposed. When `pacman -Si llama-cpp` on fl shows 0.7.0, `IgnorePkg` it until fixed.
The 0.5.0 → 0.6.0 jump itself (Qwen3.8 15.5 → 37) is llama-side, best explained by #29856 (hybrid
graph reserve; the old 10.9 base was probably GTT-starved, not kernel-bound — see the preset block).
**ggml 0.26.0** (next `-Syu`): #30039 reports a −45 % prefill regression on a GDN hybrid — bench
Qwen3.8 before and after; downgrade ggml/ggml-vulkan from the pacman cache if prefill tanks.
- **Coder-Next 256k**: if the load log's `n_ctx_train` says 262144, ctx can likely double
again for ~1 GB (KV measured nearly flat).
> **vLLM on this box** (bench rig, docker/ROCm, never resident together with the router): see `../vllm/README.md`.
+322
View File
@@ -0,0 +1,322 @@
#!/usr/bin/env python3
"""
llama.cpp router benchmark → writes a results ledger for later tuning.
SAFETY-FIRST: this GPU also drives the display — VRAM overcommit spills to GTT and can
freeze the whole PC. The script therefore:
- records the BASELINE VRAM before touching anything (leftover model / browser skews everything)
- ensures a CLEAN card before EVERY load (incl. the first): resident models are force-unloaded
via the router API (POST /models/unload), then VRAM is verified with rocm-smi — the poll
covers driver reclaim lag, older builds without the endpoint (sleep-idle fallback), and
desktop apps the router doesn't own. Aborts if the card never drains.
- checks free VRAM right after a model mounts; too tight (--min-free-gb) or GTT ballooning
(--max-gtt-gb, measured against a PER-MODEL baseline — GTT reclaims slowly) → records a
⚠ row and skips generating; the sweep continues after the drain-wait
- refuses to sweep multiple models blind (no rocm-smi) unless --no-vram-ok
Per model it records decode/prefill t/s, TTFT, VRAM used/free, and the preset's knobs
(ctx, n-cpu-moe, spec-type) parsed from config.ini.
Output: bench-results.md (latest run, overwritten) + bench-history.md (every run, appended)
— both next to this script. Run ON the GPU box. Stdlib only.
./bench.py # all models the server lists
./bench.py -m id1,id2 # only these
./bench.py -x Qwen3-Coder-Next-UD-IQ3_XXS # skip some (e.g. not downloaded yet)
./bench.py -n 512 --ctx 16000 # longer gen + a long-context decode column
Compare a change: edit config.ini → reload server → re-run → diff runs in bench-history.md.
"""
import argparse, json, os, re, subprocess, sys, time, urllib.request, urllib.error
from datetime import datetime
HERE = os.path.dirname(os.path.abspath(__file__))
_smi_warned = False
def rocm_mem(kind="vram"):
"""(used_bytes, total_bytes) from rocm-smi for 'vram' or 'gtt'; (None, None) if unavailable."""
global _smi_warned
try:
out = subprocess.run(["rocm-smi", "--showmeminfo", kind],
capture_output=True, text=True, timeout=15).stdout
except Exception:
out = ""
def grab(pat):
m = re.search(pat + r"\s*:?\s*(\d+)", out)
return int(m.group(1)) if m else None
label = "VRAM" if kind == "vram" else "GTT"
used = grab(label + r" Total Used Memory \(B\)") or grab(r"Used Memory \(B\)")
total = grab(label + r" Total Memory \(B\)")
if kind == "vram" and total is None and not _smi_warned:
_smi_warned = True
print(" (rocm-smi not readable here — VRAM columns and freeze guards are OFF)", file=sys.stderr)
return used, total
def with_retries(fn, retries, wait, label=""):
"""Retry on 5xx/connection errors (model still mounting). A deterministic 'failed to
load' from the router is NOT retried — that's a broken preset, not a slow mount."""
last = None
for i in range(retries + 1):
try:
return fn()
except urllib.error.HTTPError as e:
if e.code < 500: # 4xx = real client error
raise
body = ""
try:
body = e.read().decode("utf-8", "ignore")
except Exception:
pass
if "failed to load" in body: # deterministic → don't burn retries
raise RuntimeError("model failed to load — check `journalctl -u llama.service`") from None
last = e
except (urllib.error.URLError, ConnectionError, TimeoutError) as e:
last = e
if i < retries:
print(f" … {label} not ready ({last}); waiting {wait}s (try {i + 1}/{retries})", file=sys.stderr)
time.sleep(wait)
raise last
def _open(url, key, payload=None, timeout=600):
data = json.dumps(payload).encode() if payload is not None else None
hdrs = {"Authorization": f"Bearer {key}"}
if data:
hdrs["Content-Type"] = "application/json"
return urllib.request.urlopen(urllib.request.Request(url, data=data, headers=hdrs), timeout=timeout)
def list_models(base, key):
d = json.load(_open(base.rstrip("/") + "/models", key))
return [m["id"] for m in d.get("data", [])]
def force_unload(base, key):
"""Ask the router to unload every resident model (POST /models/unload on the ROOT api,
not /v1). Harmless no-op on builds without the endpoint — callers fall back to polling."""
root = re.sub(r"/v1/?$", "", base.rstrip("/"))
try:
d = json.load(_open(root + "/models", key, timeout=30))
except Exception as e:
print(f" (router /models not readable: {e} — relying on sleep-idle drain)", file=sys.stderr)
return
for m in d.get("data", []):
st = m.get("status", "loaded") # b11146 sends {'value': 'loaded'|'sleeping'|'unloaded'}; older a string
st = st.get("value", "loaded") if isinstance(st, dict) else st
if st not in ("loaded", "loading"): # builds without 'status': try them all
continue
try:
_open(root + "/models/unload", key, {"model": m["id"]}, timeout=30).read()
except Exception:
pass # not loaded / endpoint missing — poll covers it
def parse_config(path):
"""{preset: {ctx, ncpumoe, spec}} from the router config.ini."""
sections, sec = {}, None
try:
lines = open(path, encoding="utf-8").read().splitlines()
except OSError:
return {}
for ln in lines:
s = ln.strip()
if s.startswith("[") and s.endswith("]"):
sec = s[1:-1]; sections[sec] = {}
elif sec and "=" in s and not s.startswith("#"):
k, v = s.split("=", 1)
sections[sec][k.strip()] = v.split("#", 1)[0].strip()
return {sec: {"ctx": kv.get("ctx-size", "-"),
"ncpumoe": kv.get("n-cpu-moe", "-"),
"spec": kv.get("spec-type", "-") or "-"}
for sec, kv in sections.items()}
def run(base, key, model, prompt, n, temp, timeout):
payload = {"model": model, "messages": [{"role": "user", "content": prompt}],
"max_tokens": n, "temperature": temp, "stream": True,
"stream_options": {"include_usage": True},
# llama.cpp extension: makes the server embed its own timings in the stream →
# the table shows the SAME predicted_per_second as the llama.cpp web UI
# (without it we fall back to wall-clock estimates, which read lower).
"timings_per_token": True}
t0 = time.perf_counter(); ttft = None; ntok = 0; usage = None; timings = None
for raw in _open(base.rstrip("/") + "/chat/completions", key, payload, timeout):
line = raw.decode("utf-8", "ignore").strip()
if not line.startswith("data:"):
continue
body = line[5:].strip()
if body == "[DONE]":
break
try:
c = json.loads(body)
except ValueError:
continue
ch = c.get("choices") or [{}]
if ch and ch[0].get("delta", {}).get("content"):
if ttft is None:
ttft = time.perf_counter() - t0
ntok += 1
if c.get("usage"):
usage = c["usage"]
if c.get("timings"):
timings = c["timings"]
total = time.perf_counter() - t0
comp = (usage or {}).get("completion_tokens") or ntok
ptok = (usage or {}).get("prompt_tokens")
gen_s = total - (ttft or total)
tg = comp / gen_s if gen_s > 0 else 0.0
pp = (ptok / ttft) if (ptok and ttft) else None
if timings: # llama.cpp's own numbers are authoritative when the router forwards them
tg = timings.get("predicted_per_second", tg)
pp = timings.get("prompt_per_second", pp)
ptok = timings.get("prompt_n", ptok)
return {"tg": tg, "pp": pp, "ttft": ttft or 0.0, "ptok": ptok or 0}
def wait_drain(drain_gb, window_s, label="", base=None, key=None):
"""Force-unload resident models via the router API, then poll until VRAM used drops
below drain_gb (card is clean) or the window expires."""
used, _ = rocm_mem()
if base and used is not None and used > drain_gb * 1e9:
force_unload(base, key)
end = time.time() + window_s
announced = False
while used is not None and used > drain_gb * 1e9 and time.time() < end:
if not announced:
print(f" … waiting for VRAM to drain before {label} ({gb(used)} used)", file=sys.stderr)
announced = True
time.sleep(5)
used, _ = rocm_mem()
return used
def gb(b):
return f"{b / 1e9:.1f} GB" if b else "-"
def main():
ap = argparse.ArgumentParser()
ap.add_argument("-u", "--url", default="http://192.168.0.204:11343/v1")
ap.add_argument("-k", "--key", default="no-key-required")
ap.add_argument("-m", "--models", default="all", help="comma-separated ids, or 'all'")
ap.add_argument("-x", "--skip", default="", help="comma-separated ids to skip")
ap.add_argument("-n", "--tokens", type=int, default=256)
ap.add_argument("-t", "--temp", type=float, default=0.3)
ap.add_argument("--ctx", type=int, default=0, help="also record decode at ~this many prompt tokens")
ap.add_argument("--timeout", type=int, default=600, help="per-request stall timeout (s)")
ap.add_argument("--config", default=os.path.join(HERE, "config.ini"))
ap.add_argument("--out", default=os.path.join(HERE, "bench-results.md"))
ap.add_argument("--history", default=os.path.join(HERE, "bench-history.md"))
ap.add_argument("--retries", type=int, default=4, help="retries while a model is still mounting")
ap.add_argument("--retry-wait", type=int, default=15, help="seconds between retries")
ap.add_argument("--drain-gb", type=float, default=4.0,
help="VRAM considered 'clean' below this (raise it if your desktop alone uses more)")
ap.add_argument("--min-free-gb", type=float, default=1.5,
help="SAFETY: stop the sweep if a loaded model leaves less VRAM free than this")
ap.add_argument("--max-gtt-gb", type=float, default=2.0,
help="SAFETY: flag a model if GTT grows more than this over baseline (= VRAM spilling to RAM)")
ap.add_argument("--unload-wait", type=int, default=360,
help="after a too-tight model, wait up to this long for it to unload before continuing "
"(sleep-idle-seconds keeps models resident up to 300s)")
ap.add_argument("--no-vram-ok", action="store_true",
help="allow a multi-model sweep even though rocm-smi (and thus the freeze guards) is unavailable")
a = ap.parse_args()
models = list_models(a.url, a.key) if a.models == "all" else [m.strip() for m in a.models.split(",")]
skip = {s.strip() for s in a.skip.split(",") if s.strip()}
models = [m for m in models if m not in skip]
cfg = parse_config(a.config)
used0, total_vram = rocm_mem("vram")
if total_vram is None and len(models) > 1 and not a.no_vram_ok:
sys.exit("ABORT: rocm-smi is not readable here, so the VRAM/GTT freeze guards can't work.\n"
"Run this ON the GPU box, bench a single model with -m <id>, or pass --no-vram-ok to accept the risk.")
if used0 is not None and used0 > a.drain_gb * 1e9:
print(f"⚠ baseline VRAM used is already {gb(used0)} — a leftover model (sleep-idle keeps them "
f"up to 5 min) or desktop apps (browser!). Results/safety margins will be skewed; "
f"ideally close GPU apps or wait, then re-run.", file=sys.stderr)
task = "Write a Python function that merges two sorted lists, with a short docstring and one example."
filler = ("The quick brown fox jumps over the lazy dog. " * max(1, a.ctx // 9)) if a.ctx else None
cols = ["model", "cfg ctx", "n-cpu-moe", "spec", "decode t/s", "prefill t/s", "TTFT s", "VRAM used", "VRAM free"]
if a.ctx:
cols.append(f"decode@{a.ctx // 1000}k")
latest = open(a.out, "w", encoding="utf-8")
hist = open(a.history, "a", encoding="utf-8")
meta = (f"_Run {datetime.now():%Y-%m-%d %H:%M} · server `{a.url}` · VRAM total {gb(total_vram)} · "
f"baseline used {gb(used0)} · gen {a.tokens} tok · guards: free≥{a.min_free_gb} GB, GTT+≤{a.max_gtt_gb} GB_")
def emit(line, both=True):
print(line)
latest.write(line + "\n"); latest.flush()
if both:
hist.write(line + "\n"); hist.flush()
latest.write("# llama.cpp benchmark results (latest run)\n\n")
hist.write(f"\n## run {datetime.now():%Y-%m-%d %H:%M}\n\n")
emit(meta + "\n")
emit("| " + " | ".join(cols) + " |")
emit("|" + "|".join(["---"] * len(cols)) + "|")
for m in models:
c = cfg.get(m, {})
base_cells = [m, c.get("ctx", "-"), c.get("ncpumoe", "-"), c.get("spec", "-")]
# A CLEAN card before EVERY load (incl. the first): force-unload via the router API,
# then verify with rocm-smi — double residency = bogus numbers or a freeze.
u = wait_drain(a.drain_gb, a.unload_wait, m, a.url, a.key)
if u is not None and u > a.drain_gb * 1e9:
emit("")
emit(f"_⚠ aborted before {m}: VRAM still {gb(u)} used after {a.unload_wait}s — something "
f"won't unload (leftover model / GPU apps). If that's your normal desktop, raise --drain-gb._")
print(f"\n⚠ aborted: card not clean ({gb(u)} used).", file=sys.stderr)
break
gtt_pre, _ = rocm_mem("gtt") # per-model GTT baseline — GTT reclaims slowly across swaps
try:
# warmup — retries wait out the mount; 'failed to load' aborts immediately
with_retries(lambda: run(a.url, a.key, m, "hi", 8, a.temp, a.timeout), a.retries, a.retry_wait, m)
used, _ = rocm_mem("vram")
gtt, _ = rocm_mem("gtt")
free = (total_vram - used) if (total_vram and used) else None
gtt_delta = (gtt - gtt_pre) if (gtt is not None and gtt_pre is not None) else None
reason = None
if free is not None and free < a.min_free_gb * 1e9:
reason = f"only {gb(free)} VRAM free"
elif gtt_delta is not None and gtt_delta > a.max_gtt_gb * 1e9:
reason = f"GTT grew {gb(gtt_delta)} = spilling to system RAM"
if reason:
# Too tight — do NOT generate (allocates more). Record the row; the sweep continues
# once this model has fully unloaded (see below).
hint = ("raise n-cpu-moe" if c.get("ncpumoe", "-") != "-"
else "lower ctx / smaller quant / add n-cpu-moe if MoE")
cells = base_cells + [f"⚠ {reason} — SKIPPED ({hint})", "", "", gb(used), gb(free)]
if a.ctx:
cells.append("")
else:
r = with_retries(lambda: run(a.url, a.key, m, task, a.tokens, a.temp, a.timeout),
a.retries, a.retry_wait, m)
cells = base_cells + [f"{r['tg']:.1f}", (f"{r['pp']:.0f}" if r['pp'] else "-"),
f"{r['ttft']:.2f}", gb(used), gb(free)]
if a.ctx:
rc = with_retries(lambda: run(a.url, a.key, m, filler + "\n\n" + task, a.tokens, a.temp, a.timeout),
a.retries, a.retry_wait, m)
cells.append(f"{rc['tg']:.1f}")
except Exception as e:
err = f"HTTP {e.code} (check server log)" if isinstance(e, urllib.error.HTTPError) else f"ERROR {e}"
cells = base_cells + [err] + [""] * (len(cols) - len(base_cells) - 1)
emit("| " + " | ".join(str(x) for x in cells) + " |")
# (no post-row wait needed: the pre-load drain above protects the next iteration,
# including after ⚠-tight rows where generation was skipped)
latest.write("\n_Tuning hints: **VRAM free** = headroom to raise `ctx-size` or lower `n-cpu-moe` "
"(more experts on GPU → faster). Low decode t/s on an offloaded MoE → lower `n-cpu-moe` "
"if free allows. High **baseline used** invalidates the run. For spec/MTP models, check "
"the server log's acceptance rate._\n")
latest.close(); hist.close()
print(f"\nwrote {a.out} (+ appended {a.history})")
if __name__ == "__main__":
main()
+952
View File
@@ -0,0 +1,952 @@
# llama.cpp model config — AMD RX 7600 XT · 16 GB (17.16 GB total) · backend = Arch llama.cpp-vulkan
# (RADV, device Vulkan0 — NOT ROCm/HIP; rocm-smi is used for monitoring only)
# ═════════════════════════════════════════════════════════════════════════════
# ⚠⚠ VRAM SAFETY — READ THIS. This GPU ALSO DRIVES THE DISPLAY. If a model asks for
# more VRAM than is free, the amdgpu driver does NOT OOM cleanly — it spills into system RAM
# (GTT), which starves the desktop and FREEZES THE WHOLE PC (reboot required).
# → TARGET ≥ ~2.5 GB free (≤ ~14.5 GB used). HARD FLOOR 1.5 GB (bench.py guard stops there).
# Idle desktop uses ~1.3 GB of 17.16 — but a browser/leftover model can hold 1-3 GB more,
# so measure with a CLEAN baseline (bench.py prints "baseline used"; close GPU apps first;
# sleep-idle keeps a model resident up to 5 min after last use).
# → Verify with bench.py → ledger: bench-results.md (latest) + bench-history.md (all runs).
# → If a model is tight: LOWER ctx-size, or RAISE n-cpu-moe (MoE), or use a smaller quant.
# The values below are deliberately CONSERVATIVE after freeze incidents — raise ctx
# only after bench.py confirms the headroom.
# ═════════════════════════════════════════════════════════════════════════════
# Speed notes: decode is memory-bandwidth-bound (~288 GB/s). Prefer MoE (few active
# params). For MoE that doesn't fit, n-cpu-moe offloads expert FFNs to CPU (48 GB RAM) —
# this is FASTER than letting VRAM spill to GTT, and frees VRAM. threads = 6 (5600X cores).
# Runtime: `sudo rocm-smi --setperflevel high`; `watch -n1 rocm-smi --showmeminfo vram`.
# ─────────────────────────────────────────────────────────────────────────────
# Coding models
# ─────────────────────────────────────────────────────────────────────────────
[Qwen3-Coder-Next-UD-IQ3_XXS]
# ⭐ Big-context coder: Qwen3-Coder-Next 80B-A3B (3B active), Qwen3-Next hybrid attn → cheap KV.
# Weights ~30 GB: ALL experts on CPU (n-cpu-moe 99), only attention+KV on GPU → low VRAM, safe.
# Needs a CURRENT llama.cpp build (Qwen3-Next arch). ⬇ DOWNLOAD unsloth/Qwen3-Coder-Next-GGUF:UD-IQ3_XXS.
# Froze the PC before at n-cpu-moe 48 / ctx 131072 (overcommit) — keep it conservative, verify, then raise ctx.
model = /home/anon/software/models/Qwen3-Coder-Next-UD-IQ3_XXS.gguf
ctx-size = 131072 # ✓ VERIFIED @131072/moe99 (2026-07-16): 15.7 t/s, 6.0 GB used / 11.2 free —
# full 128k at a comfortable margin. Settled.
n-gpu-layers = 99
n-cpu-moe = 99 # ALL experts on CPU — settled AGAIN 2026-08-08 after a two-round
# experiment, CLOSED: GPU experts barely move this model.
# moe56 (04:11) = NO-OP: 6.0 used ≈ moe99's 5.8, all numbers flat →
# only ~48 MoE layers exist; moe ≥ 48 ≡ all-on-CPU. (Also: the old
# "moe48/131k froze the PC" lore was ctx-KV overcommit in a pre-
# quantized-KV config, not expert placement.)
# moe40 (04:37) = 8 layers on GPU, 10.2 used / 6.9 free: prefill
# 33→36 (+9%), decode 16.4 (noise) — 4.2 GB for a rounding error.
# The shallow curve says don't chase it: cache-reuse already makes
# growing sessions incremental, and the 6 GB footprint IS the niche.
# MEASURED (07-16): moe99 = 14.3-16.4 t/s vs moe36@65536 = 16.9.
threads = 6
# no-mmap TRIED AND REVERTED 2026-07-18: llama.cpp's log hint suggested it (CPU experts +
# mmap = page-fault churn), but reading 26 GB fully resident exceeds the router's load
# patience → "failed to load". Retry only if the router ever gets a load-timeout knob.
flash-attn = on
cache-type-k = q8_0
cache-type-v = q4_0
batch-size = 2048
ubatch-size = 256 # small compute buffer = less VRAM
cache-reuse = 256
defrag-thold = 0.1
temp = 0.7 # unsloth default 1.0/top-p0.95/top-k40/min-p0.01 — lower = more deterministic
top-p = 0.95
top-k = 40
min-p = 0.01
jinja = on
sleep-idle-seconds = 300
# ─── RETIRED 2026-07-16: [DeepSeek-Coder-V2-Lite-Instruct-Q8_0] ──────────────────────────
# Mid-2024 model, outclassed by GLM-4.7-Flash + both Qwen coders. Bench kept skipping it
# (~15.3 GB fixed footprint; measured 2026-07-03 that ctx/moe knobs barely move it — only fix
# was a Q4_K_M requant, not worth it as the 4th-best coder). Removed from opencode/pi/aichat.
# File can be deleted from the models dir: DeepSeek-Coder-V2-Lite-Instruct-Q5_K_M.gguf
# ─── RETIRED 2026-08-06: [Qwen3-Coder-30B-Instruct-IQ4_XS] ───────────────────────────────
# Lost the 2026-08-06 quant race to UD-Q3_K_XL@moe10 (31.3 vs 23.0 t/s, +36%, three
# consistent sweeps; it also failed twice to load on ~3.2 GB evening baselines at moe20 =
# 14.1-14.3 used). Clients rewired to Qwen3-Coder-30B-Instruct-UD-Q3_K_XL same day — the
# extended quality trial was deliberately skipped (user call; revert path = git, one commit).
# ⚠ OWUI chats/presets saved against this id need re-picking after the restart.
# File can be deleted from the models dir: Qwen3-Coder-30B-A3B-Instruct-IQ4_XS.gguf
# Reference numbers: moe24 = 21.1 t/s, 11.9/5.3 · moe20 = 23.2 (2026-07-16), 22.0-23.0 (2026-08-05/06)
[Qwen3-Coder-30B-Instruct-UD-Q3_K_XL]
# ⭐ MAIN AGENT CODER — took the slot 2026-08-06 after winning the quant race: 31.3 t/s @moe10
# vs IQ4_XS@moe20 = 23.0 (+36%, three consistent sweeps); Q3_K_S dominated (tombstone below).
# Same 32k ctx and sampling as the retired IQ4_XS — clients only needed the id swap.
# ⚠ QUALITY TRIAL SKIPPED (user call, 2026-08-06): Q3-on-MoE damage looks like wrong API
# signatures / off-by-one logic, NOT word salad — if opencode sessions smell off, the
# IQ4_XS preset + client wiring are one `git revert` away (and the .gguf may still be on
# disk). UD protects attn/shared tensors; the experts are still 3-bit.
# RACE NUMBERS: moe24 = 22.2 · moe16 = 25.1 (07-16) / 25.5 / 26.3 · moe10 = 31.3 (15.0 used /
# 2.1 free @3.1 GB baseline; replicate 30.9 @1.8 free under a 13.9 leftover-model baseline).
model = /home/anon/software/models/Qwen3-Coder-30B-A3B-Instruct-UD-Q3_K_XL.gguf
ctx-size = 32768
n-gpu-layers = 99
n-cpu-moe = 12 # ✓ VERIFIED @moe12 (2026-08-07, 2.9 GB EVENING baseline): 27.0 t/s,
# 14.2 used / 3.0 free — loaded fine in exactly the regime that killed
# IQ4_XS@moe20 twice; the insurance works. Cost vs moe10 (31.3 clean race)
# was ~4 t/s, more than the ~1 estimated — evening compute contention
# likely eats 2-3 of that; confirmed: CLEAN (2026-08-08 02:45, 1.9
# baseline) = 29.5 t/s, 13.2 used / 4.0 free — evening cost was indeed
# contention. Settled: moe12 = 29.5 clean / 27.0 evening, always loads.
threads = 6
flash-attn = on
cache-type-k = q8_0
cache-type-v = q4_0
batch-size = 2048
ubatch-size = 1024 # ✓ SETTLED 2026-08-08: prefill 74 → 89-92 t/s (+24%), decode unchanged,
# buffer +0.5 GB. FINAL GATE PASSED (14:43 sweep, 3.0 GB dirty baseline =
# evening-class): loaded and ran at 14.6 used / 2.6 free. If a worse
# evening (3.3+) ever fails the load: revert to 512, or pay one moe
# step (12→13).
cache-reuse = 256
defrag-thold = 0.1
temp = 0.15
top-p = 0.8
top-k = 20
min-p = 0
repeat-penalty = 1.05
jinja = on
sleep-idle-seconds = 300
# ─── RETIRED 2026-08-06: [Qwen3-Coder-30B-Instruct-Q3_K_S] ───────────────────────────────
# Dominated in the quant race: 30.9 t/s @moe8 (15.2 used / 2.0 free, replicate 30.9) = a tie
# with UD-Q3_K_XL@moe10 (31.3) at equal headroom, from a strictly worse quant (plain Q3_K_S,
# no UD-protected attn/shared tensors). No axis where it wins. Was never client-wired.
# File can be deleted from the models dir: Qwen3-Coder-30B-A3B-Instruct-Q3_K_S.gguf
# ─────────────────────────────────────────────────────────────────────────────
# General Qwen models (35B-A3B is fast MoE; the dense 27Bs are inherently VRAM-tight)
# ─────────────────────────────────────────────────────────────────────────────
[Qwen3.6-35B-A3B-MTP-UD-IQ3_XXS]
# ⭐ Fast NON-THINKING daily driver: Qwen3.6-35B-A3B (MoE, 3B active) — the "bigger Qwen3
# Instruct". Compact precise answers, no reasoning preamble. (Alias kept for clients.)
# File is flat + named without "MTP" (unsloth MTP-repo naming). If the load log complains
# there is no MTP head in this file, comment the two spec- lines out (plain repo file).
model = /home/anon/software/models/Qwen3.6-35B-A3B-UD-IQ3_XXS.gguf
mmproj = /home/anon/software/models/mmproj-Qwen3.6-35B-A3B-F16.gguf # vision ✓ VERIFIED 2026-07-18:
# 13.9 used / 3.3 free (2.8 dirty baseline), decode unchanged at 36-37 t/s.
spec-type = draft-mtp
spec-draft-n-max = 2
reasoning-budget = 0 # hard-disable thinking → instant compact answers. Delete to allow /think.
# ⚠ if startup says "option 'reasoning_budget' not recognized" → remove this line.
ctx-size = 24576 # raised from 16384 (bench @16384: 4.8 GB free) — bench to confirm ≥2.5 free
n-gpu-layers = 99
n-cpu-moe = 16 # MEASURED @24: 19.8 t/s (MTP working!), 10.6 used / 6.6 free → pull experts onto GPU
threads = 6
flash-attn = on
cache-type-k = q8_0
cache-type-v = q4_0
batch-size = 2048
ubatch-size = 512
cache-reuse = 256
defrag-thold = 0.1
temp = 0.7
top-p = 0.8
top-k = 20
min-p = 0
repeat-penalty = 1.05
jinja = on
sleep-idle-seconds = 120
[Qwen3.6-35B-A3B-Thinking]
# Same GGUF as above with reasoning ENABLED (no reasoning-budget line) — fills the "thinking
# model" slot at zero disk cost. Qwen thinking-mode sampling: temp 0.6 / top-p 0.95, no
# repeat-penalty. Slower per answer (reasoning preamble) — use for hard problems.
model = /home/anon/software/models/Qwen3.6-35B-A3B-UD-IQ3_XXS.gguf
mmproj = /home/anon/software/models/mmproj-Qwen3.6-35B-A3B-F16.gguf # vision ✓ VERIFIED 2026-07-18:
# 13.9 used / 3.3 free (2.8 dirty baseline), decode unchanged at 36-37 t/s.
spec-type = draft-mtp
spec-draft-n-max = 2
reasoning-budget = 8192 # "MEDIUM" thinking (added 2026-09-21 when this became the default model in
# opencode/pi/aichat): caps runaway 15-20k-token think loops, leaves 16k of
# the 24k ctx for prompt+answer; normal traces (0.5-5k) are untouched. The
# Qwen3.6 template knows only enable_thinking on/off (no reasoning_effort
# levels — verified in the gguf header), so this budget IS the depth knob.
# -1 = unlimited (old behaviour), 0 = the MTP alias. b10615's server README
# documents N>0; if startup rejects it → set -1 and update llama.cpp.
ctx-size = 24576 # thinking eats ctx — same footprint as the non-thinking preset
n-gpu-layers = 99
n-cpu-moe = 16
threads = 6
flash-attn = on
cache-type-k = q8_0
cache-type-v = q4_0
batch-size = 2048
ubatch-size = 512
cache-reuse = 256
defrag-thold = 0.1
temp = 0.6
top-p = 0.95
top-k = 20
min-p = 0
jinja = on
sleep-idle-seconds = 120
# ─── RETIRED 2026-07-03: [Qwen3.6-27B-UD-IQ3_XXS] ────────────────────────────────────────
# The 27B files (plain AND MTP) were deleted from the models dir — preset removed so the
# router doesn't advertise a dead model. To bring it back: re-download (MTP-repo files are
# named WITHOUT "MTP"), restore the preset, re-add the id to opencode/pi/aichat lists.
# ─── RETIRED 2026-07-16: [Qwen3.5-27B-UD-Q3_K_XL] ────────────────────────────────────────
# Dense 27B: 16.2 GB used / 0.9 free even @8192 (under the 1.5 floor) and ~10 t/s ceiling on
# this card. Role covered by Qwen3.6-35B-A3B (MoE, 2× faster). Removed from opencode/pi/aichat.
# File can be deleted from the models dir: Qwen3.5-27B-UD-Q3_K_XL.gguf
[Qwen3.5-9B-UD-Q6_K_XL]
# Small fast Qwen + MTP. Replaces Qwen3.5-9B-Q8_0 (retired 2026-07-16: Q8 was quality-overkill
# and bandwidth-slow at 17.2 t/s — delete Qwen3.5-9B-Q8_0.gguf; also delete the interim
# Qwen3.5-4B-UD-Q6_K_XL.gguf, superseded by this).
# ⬇ FILE MUST COME FROM unsloth/Qwen3.5-9B-MTP-GGUF (8.99 GB — MTP head embedded, filename
# identical to the plain repo!). If the load log complains there is no MTP head in this
# file, it's the plain-repo file — comment the two spec- lines out.
# ✓ VERIFIED (2026-07-16): 32.2 t/s (MTP working — nearly 2× the Q8's 17.2), prefill 83,
# 12.4 used / 4.8 free @32768. TTFT ~3.7 s = the model thinking (reasoning streams first).
model = /home/anon/software/models/Qwen3.5-9B-UD-Q6_K_XL.gguf
mmproj = /home/anon/software/models/Qwen3.5-9B-MTP-mmproj-F16.gguf # vision (from the MTP repo)
spec-type = draft-mtp
spec-draft-n-max = 3 # ⚗→✓ KEPT (04:11): 33.8 t/s vs 32.0-33.1 @n=2 — small real win.
# Revert to 2 if a future sweep drops below 32.
ctx-size = 32768 # raise toward 65536 once bench confirms free ≥2.5 GB
n-gpu-layers = 99
flash-attn = on
cache-type-k = q8_0
cache-type-v = q4_0 # q4 V to save VRAM
batch-size = 2048
ubatch-size = 512
cache-reuse = 256
defrag-thold = 0.1
temp = 0.7
top-p = 0.8
top-k = 20
min-p = 0
repeat-penalty = 1.05
jinja = on
sleep-idle-seconds = 60
[Qwen3.8-27B-UD-IQ3_XXS]
# ⚠ CLEAN-DESKTOP SPECIALTY — KEPT by user decision 2026-09-10 despite failing the ≥22 t/s speed
# gate (14.5 t/s MTP / 10.9 base; 2.8 GB free @1.5 baseline @16k). Pick it ONLY on a quiet
# desktop: at a 3+ GB evening baseline it lands ~1 GB free = GTT-spill/freeze territory. Role:
# slow-but-smart dense-27B answers + vision. Origin (added 2026-08-16): dense 27B, but NOT like the two
# retired dense 27Bs: hybrid attention (only 16 of 64 layers full-attn, rest linear/SSM →
# cheap KV, Coder-Next-style) AND an embedded MTP head — VERIFIED in the gguf header:
# qwen35.nextn_predict_layers = 1, block_count = 65 (64+1), arch "qwen35" = the same
# draft-mtp path the working 9B preset uses. Hybrid reasoner (thinking ON by default,
# reasoning_effort tunable via chat-template-kwargs if a -low alias is ever wanted),
# vision, n_ctx_train = 262144.
# Speed math: dense 11.9 GB weights on ~288 GB/s ≈ 14-16 t/s base; MTP should lift to
# ~22-30 = roster-competitive IF the draft engages. If it doesn't, this lands in
# retired-dense-27B territory (~10-14) → retire again, quality won't pay for the speed.
# ⚠ BENCH HISTORY — still no green row, decode/MTP UNMEASURED after 5 attempts:
# · 08-16 14:59/15:19/15:29 (3.3-3.5 DIRTY baseline): 16.5-16.7 used / 0.4-0.7 free, guard
# skipped gen every time. Implied footprint 13.2 GB — MISLEADING, see below.
# · 08-17 10:31: ERROR conn-refused = bench raced llama.service coming up after boot.
# · 08-17 10:38 (1.9 near-clean baseline): 15.9 used / 1.3 free — guard floor missed by
# 0.2. TRUE footprint = 14.0 GB over baseline; the dirty runs looked 0.8 smaller because
# ROCm silently spilled that much to GTT (the exact freeze precursor the guards watch).
# · 08-17 10:43 (post-trim, 10.0 leftover start, partial drain): 15.8 / 1.4 — floor missed
# by 0.1. Trim verified live via router args; ~2.4 effective baseline poisoned it again.
# · 08-17 10:53 (1.9 baseline, NO leftovers — a genuine desktop-idle run): 15.8 / 1.4,
# floor missed by 0.1 again. DECISIVE: trimmed footprint 13.9 vs untrimmed 14.0 — both
# knobs together saved 0.1 GB. ctx/ubatch do NOT move this model (fixed SSM-state +
# big-vocab buffers). Absolute best case ≈ 2.0 free at a pristine 1.3 baseline @16k —
# permanently below the 2.5 target. → RETIREMENT RECOMMENDED 2026-08-17; decode/MTP
# never measured, academic at these margins. Third dense ~27B to die on this card,
# first one killed by fixed buffers rather than bandwidth.
# Consequences: full-ctx even on a 1.3 CLEAN night = ~15.3 used / 1.9 free (runs, but
# under the 2.5 target). EVENING regime can never fit this quant — that needs ≤ UD-IQ2_M,
# a quality gutting. → 08-17: TRIMMED FOR THE GATE BENCH: ctx 24576→16384 (~-0.25) +
# ubatch 512→256 (~-0.3-0.5) → predicted ~15.2 used / ~2.0 free @1.9 baseline. Clients
# still say 24576 — deliberately NOT re-wired for a temporary trim; do not use from
# clients anyway until this passes (a busy-desktop pick is one tab from the GTT freeze).
# DECISION GATE (superseded by the 09-10 user decision below): MTP ≥ ~22 t/s keeps it (clean-desktop specialty, restore ctx
# 24576 + re-check), anything less → retire + delete (dense 27Bs die on this card).
# ↻ REOPENED 2026-09-09 — the file on disk is STALE: unsloth re-quantized the whole repo as
# "Dynamic v3" on 2026-08-19, three days AFTER the 08-16 download (~10% better accuracy at
# equal size, per unsloth). Verified via the HF tree API at the pre/post commits:
# UD-IQ3_XXS 11.91 → 10.93 GB (SAME filename — re-download overwrites in place, no client
# or section changes); UD-Q2_K_XL 10.68 → 9.83; UD-IQ2_M DELETED (gone as an option);
# UD-IQ2_S 8.37 / UD-IQ2_XXS 7.27 are new 2-bit tiers. Header range-read 09-09: v3
# IQ3_XXS and Q2_K_XL both still carry nextn_predict_layers = 1 (MTP head embedded);
# unsloth stripped the head from ≤ IQ2_S only and ships MTP/mtp-Qwen3.8-27B-Q4_0.gguf
# as a separate model-draft for those (gemma-4 style).
# Predicted with v3 IQ3_XXS (footprint 14.0 − 0.98 ≈ 13.0; bench.py GB = decimal):
# @1.9 real-idle baseline ≈ 14.8–15.0 used / 2.2–2.4 free · @1.3 pristine ≈ 14.2 / ~2.9.
# Clears the 1.5 floor by ~0.8 even at 1.9 → the gen bench can FINALLY run; still ~0.1–0.3
# under the 2.5 target on a real idle desktop, clears it outright on a pristine one. Overhead datum: a third-party paired bench measured
# draft-mtp at ~+0.75 GB on this model (unsloth docs: "1-2 GB extra headroom") — a good
# part of the "fixed" ~2.1 GB is MTP + KV, not only SSM-state/vocab buffers.
# NEXT STEP (recommended, NOT yet done): re-download v3 IQ3_XXS on fl (verify 10.93 GB /
# 10.18 GiB before restarting), dotsync, restart llama.service, clean-baseline bench.
# Then the gate above decides — with one refinement: free 2.0–2.5 at ≥22 t/s = user's call
# between "clean-desktop specialty" and stepping down to v3 UD-Q2_K_XL (predicted ~13.7 /
# 3.5 @1.9 — needs the section-rename round across the six client files; sequence it
# after any in-flight client edits). Decode < 22 → retire regardless of VRAM.
# No in-family alternative: the Qwen3.8 lineup is 27B dense, Flash-Next 125B-A6B (smallest
# GGUF 72.5 GB, 75 GB RAM floor even with mmap'd n-gram tables — out on 48+16),
# 2.4T-A95B and Max. No 3.8 MoE in the 35B-A3B class exists; watch HF.
# ✦ GATE BENCH RAN 2026-09-10 02:36 (v3 file, sha verified; 2.1 baseline): 14.9 used / 2.2 free
# (footprint 12.8 — VRAM half of the gate PASSED, borderline) but decode 14.8 t/s, prefill 19,
# TTFT 11.7 s → speed half FAILED. Server log: MTP head loaded, draft acceptance 0.80
# (157/195, mean len 2.6) — so MTP IS engaging; at 2.6 tok/step that is ~175 ms per step ≈
# 3–4× a plain forward pass. NOTE the box runs the Arch llama.cpp-vulkan package (RADV,
# device Vulkan0) — NOT HIP/ROCm (this header said "ROCm" until 09-10); rocm-smi = monitoring only.
# [10-02: that package is gone — now Arch `llama-cpp` 0.5.0 (b11146) + `ggml-vulkan`, see RE-PROBE below]
# Suspects: the 48 GatedDeltaNet layers on the Vulkan backend (upstream #20354: missing/slow
# GDN shader → CPU fallback) and/or recurrent-state checkpoint/restore per speculative step
# (~150 MiB for this model; reported net-negative on hybrid 27Bs). The hybrid 35B-A3B does
# 37 t/s on the same backend, so it is size-specific, not Vulkan-generic.
# A/B NEXT: [Qwen3.8-27B-UD-IQ3_XXS-nomtp] (TEMP alias, used 03:19 then removed) measures
# base decode; base ≥ 18 → MTP is the net negative here, run without it (frees ~0.75 GB);
# base ≈ 9 → the GDN path is the wall → retire. Also read "graph splits" from the load log.
# cache_reuse is inert here ("not supported by multimodal") — true for every mmproj preset.
# Re-run 03:07 @0.9 PRISTINE baseline: 15.0 t/s / 17 pp / 13.9 used / 3.3 free (footprint 13.0)
# — reproducible; the VRAM half is now fully closed, only the speed half is open.
# ✦ A/B 2026-09-10 03:19 (@1.5 baseline, same run): MTP 14.5 t/s / 30 pp / 14.3 used / 2.8 free
# vs NO-MTP 10.9 t/s / 34 pp / 12.8 used / 4.4 free. → MTP WORKS (+33%, matches the sudoingX
# paired benches) and costs 1.5 GB VRAM; the wall is the BASE: 10.9 t/s = 119 GB/s effective
# (41% of the card's 288) — the 48 GatedDeltaNet layers on the Vulkan/RADV backend, exactly
# the #20354 datum (Qwen3.5-27B ≈ 11.8 t/s on Strix Halo, either backend). Prefill 30-34 on
# a fully-GPU model is the same wall (the hybrid 35B-A3B daily driver's 64 pp is GDN-bound
# too). "graphs reused" 97-260 in the log → not a graph-rebuild problem. Nothing in this
# preset can move it; a bigger K-quant (faster dequant on Vulkan) does not fit. Perfect-
# kernel ceiling on this card ≈ 20 base / ~27 MTP — an upstream Vulkan gated_delta_net
# shader improvement COULD flip it; nothing else can.
# VERDICT 2026-09-10: gate FAILED on speed (14.5 < 22) with the VRAM half passed (2.8 free
# @1.5). Per the gate → retire. Re-probe only after a llama.cpp-vulkan bump whose changelog
# touches gated_delta_net / Vulkan GDN: `./bench.py -m Qwen3.8-27B-UD-IQ3_XXS`.
# → USER DECISION 2026-09-10: KEEP as clean-desktop specialty (overrides the gate). ctx restored
# to 24576 (clients already say 24576), ubatch stays 256 (prefill is GDN-bound, the bigger
# buffer buys nothing), MTP stays (+33% for 1.5 GB). ✓ CONFIRMED @24576 2026-09-10 03:51
# (1.6 baseline): 15.1 t/s / 31 pp / 14.6 used / 2.5 free — footprint 13.0, exactly as
# predicted; free = the 2.5 target at a normal idle, ~2.8 pristine, ~0.8 on a 3.3 evening.
# ✦ RE-PROBE 2026-10-02 03:11 on llama.cpp b11146 = Arch `llama-cpp 0.5.0` + `ggml-vulkan 0.25.3`
# (the `llama.cpp-vulkan b10615` package is gone; `ggml` conflicts with the old `ggml-cpu` and
# does not replace it → name it: `sudo pacman -Syu ggml llama-cpp ggml-vulkan`, answer y twice;
# `ggml-vulkan` is only an optdepend — without it the server silently runs on CPU).
# 4.0 DIRTY baseline: 14.8 t/s / 18 pp / 14.4 used / 2.8 free. Decode IDENTICAL to 09-10
# (14.5–15.1) → the build moves nothing on speed, as predicted. VRAM columns INVALID this run:
# 14.4 used at a 4.0 baseline = model "added" 10.4 GB < its own 10.93 GB file — amdgpu evicted
# the desktop's allocations to GTT to make room (the 08-16 masking effect, 3 GB this time);
# footprint stays 13.0 from the clean 09-10 runs. TTFT 0.00 — decoded in the 03:34 entry
# below (NOT a bench quirk, as this line first claimed).
# Re-run 03:16 @1.8 normal-idle baseline: 13.8 t/s / 33 pp / 14.7 used / 2.4 free → footprint
# 12.9, VRAM half exactly as on 09-10 (2.5 @1.6); 13.8 is inside the ±15% MTP acceptance
# swing (14.5–15.1 before). b11146 confirmed NEUTRAL on both speed and VRAM for this preset.
# Third run 03:19 @1.7: 12.5 t/s / 38 pp / TTFT 17.1 / 14.7 used / 2.4 free. Three back-to-back
# runs → decode BAND 12.5–14.8 with VRAM identical each time; prefill 18→33→38 = Vulkan
# pipeline warm-up on the first load after the restart, decode drift = acceptance at temp 1.0
# over 256 tokens (±15% documented) and possibly GPU heat after 3 consecutive loads.
# ✦ DEFINITIVE 2026-10-02 03:34, -n 512 @1.7 baseline: 15.5 t/s / 38 pp / TTFT 20.6 / 14.7 used /
# 2.5 free. Server log: eval 442 tok @ 15.50 t/s (64.5 ms/tok), draft acceptance 0.842
# (278/330), mean len 2.68, graphs reused 163 → MTP = 1.42× over the 10.9 base. The 256-token
# runs under-read (short window + acceptance noise). REFERENCE: 15.5 (10.9 w/o MTP).
# TTFT DECODED (bench.py stamps ttft on the first non-empty `content` delta; reasoning deltas
# do not count): TTFT = prompt eval + the whole THINKING preamble. 17.1 s / 20.6 s ≈ 230-300
# tokens of xhigh thinking on the bench's trivial prompt; "0.00" on the 256-token runs =
# thinking consumed the entire budget and no answer was ever produced. The GGUF's embedded
# template (header read 10-02) defaults reasoning_effort to XHIGH — heaviest of
# xhigh/medium/low — and this preset passes nothing, so every answer pays it. That, not the
# 15 t/s, is why it feels slow. → sibling presets benched 03:49 (next entry), then removed.
# ✦ SIBLING BENCH 2026-10-02 03:49, -n 512 @1.9: xhigh 16.2 t/s / TTFT 17.5 s / 14.9 used / 2.2
# free; -low 15.9 t/s / TTFT 6.45 s / 15.0 / 2.1 → reasoning_effort=low cuts the preamble 63%
# at identical decode. -medium SKIPPED by the guard (15.7 used / 1.4 free at load) = VRAM
# drain lag after two back-to-back loads, not a medium cost (same weights). → USER DECISION
# 10-02: both siblings REMOVED from the config. The lever remains one line on THIS preset —
# chat-template-kwargs = {"reasoning_effort":"low"} (or "medium") — or per request via
# chat_template_kwargs; xhigh stays the default here.
# What b11146 DOES carry for this preset: #27812 (merged 08-28) fixes the Vulkan graph
# optimizer reordering nodes that alias Qwen3.8's recurrent state — on b10615 that meant
# possible wrong tokens at temp 0 and acceptance numbers "that mean nothing"; everything from
# 10-02 on is from a correct build. Also DFlash2 support (#27342, 08-27). NOT in b11146:
# RDNA3 int8 coopmat prefill kernels (#27952, 09-24 — K-quant/q8 tensors only, not IQ3_XXS
# blocks anyway) and the GDN tune (#29476, 09-29 — an Intel fix, AMD measured flat).
# CORRECTION to the 09-10 suspects: the Vulkan GDN shader has existed since 2026-03
# (#20334 → #20662 → #24581); there is no CPU fallback — 10.9 base IS the RDNA3 kernel
# ceiling. The remaining lever is speculative acceptance LENGTH, not the kernel:
# z-lab/Qwen3.8-27B-DFlash2-GGUF (Q4_K_M 1.14 GB drafter, mrope-fixed 08-24) — upstream
# 10.4 → 18.9 t/s (1.81×, AL ≈ 5) on this model vs MTP's 1.33× here (AL 2.6). Costs: the
# drafter + ~150 MiB recurrent rollback plane PER draft token → spec-draft-n-max 3–4 fits
# the MTP envelope, the default 7 does not. DFlash + mmproj = open #27408 (image requests
# stall/500) → any trial is a separate TEXT-ONLY preset; this one keeps MTP + vision.
# Open on Vulkan for MTP and DFlash alike: #28158 — intermittent draft token id 248320
# (= n_vocab) → HTTP 500 "Invalid input batch", mostly after very long prompts. If seen: that.
# ✦ 2026-10-22 QUANT RACE OPENED (reddit tip: ByteShape / ISTA 3-bit quants + DFlash2 + KV streaming):
# two bench-only candidate sections follow this preset — [Qwen3.8-27B-GSQ-RCO-IQ3_XXS] (ISTA file,
# −0.49 GB, MTP) and its -dflash text-only sibling; the research + verdicts live in that block.
# ⚠ llama.cpp 0.7.0 (b11669) = #30688, Vulkan draft decode 4× slower (compute buffer lands in GTT):
# hold fl at 0.6.0 until fixed — hits EVERY MTP preset here, not only this one.
# ✦ BUILD DATUM 2026-10-22 03:15 — fl turned out to be on 0.6.0 (b11429) + ggml-vulkan 0.25.3-2 (the
# SAME kernels as 10-02): bench 37.1 t/s / 21 pp / TTFT 3.3 / 14.4 used / 2.7 free @1.3 (-n 512).
# Server: 221 tok @ 37.07, draft acceptance 0.892 (141/158), mean len 2.78 → ~75 ms per
# speculative step vs ~173 on b11146 — a llama.cpp-side change (b11147..b11429), NOT the Vulkan
# kernels (ggml is a separate package, unchanged). A 4096-token think-run: 27.3 t/s @ acceptance
# 0.51 / len 2.02 = the same ~74 ms step; acceptance sags over long thinking. Footprint 13.1,
# unchanged. → the ≥22 gate is PASSED 1.7× over; the 'clean-desktop specialty' verdict's SPEED half
# is obsolete (the VRAM half — never on a busy desktop — still stands). Role re-rank = user's call.
# 03:25 re-run: 36.2 / 45 pp / TTFT 8.6 / 14.5 / 2.7 — reproducible.
# CAUSE (researched 10-22; a hypothesis — no PR in b11147..b11429 claims any such gain): Arch's llama-cpp
# links the SYSTEM ggml (-DLLAMA_USE_SYSTEM_GGML=ON), so every ggml-side Vulkan PR (#29476 GDN tune,
# #29280 descriptor reuse, FA work) is EXCLUDED — those ship in ggml 0.26.0, not on fl yet. Best fit:
# #29856 (10-03) "gather the recurrent states once so the reserve covers every split" — on 0.5.0 the
# hybrid graph was silently re-reserved after the first speculative step and the target compute
# buffer could land partly in GTT = the #30688 mechanism seen from the other side. The arithmetic
# agrees: the old no-MTP base (10.9 t/s = 92 ms/token) was SLOWER than today's whole MTP step (75 ms
# for ≥3 verified tokens + 2 draft passes), so the "10.9 base = the GDN kernel wall" story above is
# SUSPECT: that base was most likely GTT-starved, not kernel-bound. Cheap check whenever the card is
# free: a TEMP -nomtp alias on 0.6.0 — ~22–26 t/s confirms it, ~11 refutes it. #27694 (probabilistic
# drafter, 10-02) explains acceptance 0.84 → 0.89, not the step time. (Also learned: the 9B is hybrid
# too, 24 GDN + 8 attn per #30039 — the "regular-attention qwen35" remark further down is wrong.)
# ⚠ ggml 0.26.0 (the next -Syu brings ggml + ggml-vulkan 0.26.0-1, SOVERSION-compatible, unrebuilt):
# #30039 reports −45 % PREFILL on a GDN hybrid with b11429 binaries, TG flat → bench this preset right
# before and after that upgrade; if prefill tanks, downgrade ggml/ggml-vulkan from the pacman cache.
# REFERENCE from here: 37.1 (b11429). Every other MTP/hybrid preset needs a re-sweep on this build.
# ⚠ Needs a CURRENT llama.cpp build: first "qwen35" file HERE with ssm.*/hybrid-attn keys
# (the 9B is regular-attention qwen35). If the load fails with unknown-architecture /
# missing-tensor errors, update llama.cpp on fl before touching this preset.
# ⬇ DOWNLOAD from unsloth/Qwen3.8-27B-GGUF (NO separate MTP repo — unlike Qwen3.5/3.6, the
# head ships in the MAIN repo's ggufs for ≥ Q2_K_XL; ≤ IQ2_S need MTP/mtp-Qwen3.8-27B-Q4_0.gguf):
# Qwen3.8-27B-UD-IQ3_XXS.gguf (10.93 GB Dynamic v3 since 2026-08-19 — the 08-16 download
# is the 11.91 GB v2; RE-FETCH. UD-IQ4_XS 14.3 GB and
# UD-Q3_K_XL 13.15 = dead on arrival, no n-cpu-moe escape)
# mmproj-Qwen3.8-27B-F16.gguf ← mmproj-F16.gguf (928 MB — unchanged; rename; watch trailing spaces)
model = /home/anon/software/models/Qwen3.8-27B-UD-IQ3_XXS.gguf
mmproj = /home/anon/software/models/mmproj-Qwen3.8-27B-F16.gguf
spec-type = draft-mtp
spec-draft-n-max = 2 # ⚠ if the load log says this file has no MTP head, comment the two
# spec- lines out — and expect ~14 t/s, probably not worth keeping.
ctx-size = 24576 # RESTORED 2026-09-10 (16384 was the 08-17 gate-bench trim): matches
# the clients. KV is cheap (16 full-attn layers × 4 kv-heads × 256
# head_dim ≈ 26 KB/token at q8/q4): 16k→24k cost +0.3 → MEASURED
# 09-10 @1.6 baseline: 14.6 used / 2.5 free. n_ctx_train 262144.
n-gpu-layers = 99 # dense: no n-cpu-moe escape — ctx/quant are the only knobs
threads = 6
flash-attn = on
cache-type-k = q8_0
cache-type-v = q4_0 # hybrid arch takes mixed KV like Coder-Next (GLM's same-type
# rejection was MLA-specific). If load fails at context creation:
# try v = q8_0, then delete both lines (f16 — KV small enough here).
batch-size = 2048
ubatch-size = 256 # KEPT at 256 (512 before the 08-17 trim): prefill is GDN-bound on the
# Vulkan backend (30-34 t/s either way), so the bigger compute buffer
# buys nothing measurable and VRAM is the binding constraint here.
cache-reuse = 256
defrag-thold = 0.1
no-mmproj-offload = true # vision encoder on CPU → ~1 GB freed, same as the 26B
temp = 1.0 # card: thinking mode 1.0/0.95/20/0 — thinking IS the default mode
top-p = 0.95
top-k = 20
min-p = 0
jinja = on
sleep-idle-seconds = 120
# ═══ QUANT RACE 2026-10-22 — Qwen3.8-27B third-party 3-bit quants + DFlash2 (bench-only, NOT client-wired) ═══
# Trigger: r/LocalLLaMA 2026-09-24 "Qwen-3.8-27B is good enough that I stopped using API": a 16 GB user
# (RTX 5060 Ti, CUDA, PCIe 5.0 x8, display on the iGPU) runs ByteShape IQ4_XS + DFlash2 + Raymond's
# KV-cache streaming; a reply says "try the ISTA IQ3_S / XXS — more speed and context, couldn't tell a
# difference in quality". What survives contact with THIS box (16 GB + display, Vulkan/RADV, PCIe 4.0 x8):
# · KV-cache streaming (troed → RaymondHuang210129/llama.cpp-adaptive-kv-streaming): OUT. CUDA-only —
# the README lists Vulkan as "memory-infrastructure tests only" (no attention path), ROCm = one
# unreviewed PR for gfx1201; both authors say PCIe 5.0 is required (PCIe 4.0 users: 2–4 t/s @192k);
# no upstream PR (discussion #28216 only). And it is a 160k+ tool — clients run this model at 24k.
# · ByteShape (byteshape/Qwen3.8-27B-GGUF, proprietary "ShapeLearn" per-tensor mixed types, the IQ*
# labels are size classes; MTP head kept, quantized IQ3/IQ4 vs Q6_K/Q8_0 elsewhere): IQ4_XS-3.84bpw
# 13.08 GB → OUT (ceiling here ≈ 11 GB file); the commenter's own file is troed's 12.25 GB
# ASCII-vocab-pruned build (248320 → 129006 tokens) → OUT twice. Same size class as the incumbent:
# IQ3_S-3.23bpw 11.035 GB (vendor blog: 98.7 % of BF16 task avg vs 93.6 % for unsloth UD-IQ3_XXS —
# vendor numbers; the one independent KLD run ranks their IQ4_XS BELOW unsloth's UD-IQ4_XS, 0.050 vs
# 0.019), IQ3_XS-3.01bpw 10.353 GB, IQ3_XXS-2.88bpw 9.919 GB. Optional third runner, see below.
# · ISTA (ISTA-DASLab/Qwen3.8-27B-GSQ-RCO-GGUF: GSQ = learned per-coordinate grids, RCO = per-tensor
# type under a size budget, standard GGUF block types, imatrix ~90 % English — discussion #7 reports
# degraded Chinese; "-mtp" files carry the head, +0.35 GB, weights identical):
# IQ3_S-mtp 12.12 GB → footprint ≈ 14.2 → ~1.4 free @1.6 = UNDER THE 1.5 FLOOR. Plain IQ3_S 11.77
# fits only WITHOUT any drafter (~3.4 free) at ~10 t/s → no. Both reddit comments measured "more
# speed and context" against a 13 GB file, not against a 3-bit one.
# IQ3_XXS-mtp 10.443 GB = 0.49 GB under the incumbent → the one ISTA file with a case here.
# Quality evidence (nobody measured it against OUR unsloth v3 file): ISTA card wiki-ppl 7.20 vs
# BF16 7.05, AIME25/GPQA-D/LCBv6 within 1–2 pts of BF16; ByteShape's blog scores it 94.4 vs 93.6
# for UD-IQ3_XXS (= equal); Agention's KLD table puts it at 0.11, ~2× their own IQ3_XXS. Thread:
# one user "ISTA even at lower quants did better", troed "tried it, not as good for my use".
# → bench.py settles speed + VRAM only; the quality half is the user's own prompts, both files.
# · DFlash2 (z-lab/Qwen3.8-27B-DFlash2-GGUF: 1.92B block-diffusion drafter, 5 layers, 2048-token
# sliding window, no own embeddings/output head; Q4_K_M 1.143 GB; llama.cpp support since b10658 =
# already in fl's b11146): acceptance length ~5.4 vs the MTP head's 2.6 here. RDNA3/Vulkan reports
# (PR #27342 thread): 7900 XTX RADV n-max 3 = +4–12 % decode over MTP, prefill −1 to −12 %; Strix
# Halo RADV n-max 4 = 19–23 t/s vs MTP 20; R9700 n-max 4 = 52 vs 47; a net LOSS once layers spill.
# Expect +5–15 % over the incumbent (37.1 on b11429, 10-22), NOT the paper's 1.8× — every verified draft token
# re-runs the 48 GDN layers. Acceptance falls with context (5090 datum: 31–36 % at 23–63k vs MTP
# 55 %) = why the redditor says "at low context".
# VRAM: drafter 1.14 GB + (1 + n-max) × ~150 MiB recurrent-state snapshots (n-max 3 ≈ 0.6 GB) +
# drafter KV — the MTP head measured 1.5 GB against a ~0.7 estimate, so budget ~2 GB and let the
# bench.py guard decide; the ISTA file's −0.49 GB is what buys the margin. Default n-max 7 = OUT.
# Text-only: #27408 (spec + mmproj → image requests 500) still open → NO mmproj on that preset.
# #28158 (Vulkan: draft token id 248320 → HTTP 500, rare, very long prompts) still open.
# Build window: #29226 (b11132) broke drafters WITH embeddings but WITHOUT an output head (fixed by
# #30111, b11512); the z-lab drafter has neither → should not be hit. FIRST GATE regardless:
# "draft acceptance" in the server log > 0 (0.00 = that class of breakage → drop the sibling).
# ⚠ BUILD: fl = llama-cpp 0.6.0-1 (b11429) + ggml 0.25.3-2 + ggml-vulkan 0.25.3-2, CONFIRMED 10-22 (the
# b11146 → b11429 move alone took the incumbent 15.5 → 37.1, see its block). Arch extra also has
# ggml/ggml-vulkan 0.26.0 (#27952 int8 coopmat prefill, #29476 GDN tune) — the next -Syu brings them
# = another variable, bench before/after. Upstream 0.7.0 (b11669) = #30688: Vulkan
# draft-mtp decode 4× / prefill 6× SLOWER, the target compute buffer re-allocated into GTT — on this
# box that is the freeze precursor, and it hits every MTP preset on the roster. When
# `pacman -Si llama-cpp` on fl shows 0.7.0: HOLD (IgnorePkg = llama-cpp ggml ggml-vulkan) until fixed.
# Race on the current build first (one variable per run); the ggml 0.26.0 bump is a separate round.
# PLAN (clean baseline, -n 512, incumbent re-run in the SAME session — the 10-02 band was 12.5–15.5):
# 1. download (below) · 2. `sudo systemctl restart llama.service` ·
# 3. ./bench.py -n 512 -m Qwen3.8-27B-UD-IQ3_XXS,Qwen3.8-27B-GSQ-RCO-IQ3_XXS,Qwen3.8-27B-GSQ-RCO-IQ3_XXS-dflash
# 4. quality: the same 3–4 real prompts (incl. non-English) against incumbent vs GSQ.
# GATE: GSQ-mtp ≥ incumbent decode (expected ~+4 %) with free ≥ 2.5 → quality is the user's call →
# if it wins, either point the incumbent section's `model =` at the GSQ file (keeps the client id,
# accepted misnomer) or rename = the seven-client-file round. DFlash sibling: acceptance > 0 AND
# decode ≥ 1.10 × the SAME-SESSION incumbent AND free ≥ 2.5 → keep as the text-only fast sibling
# (wire into clients then); else drop. Loser files: delete from ~/software/models (10.4 + 1.1 GB).
# ✦ RACE RUN 2026-10-22 03:25 @1.3 baseline, -n 512, all three in ONE session (rows in bench-history.md):
# incumbent UD-IQ3_XXS ....... 36.2 t/s / 45 pp / TTFT 8.6 / 14.5 used / 2.7 free
# GSQ-RCO-IQ3_XXS (MTP) ...... 37.5 / 44 / 7.0 / 14.0 / 3.2 → +3.6 % decode, +0.5 GB free = exactly the
# file-size prediction. Speed + VRAM half of the gate PASSED. OPEN: the quality half (same 3–4 real
# prompts, one non-English, against both; nobody has measured ISTA vs unsloth v3 at this size).
# GSQ -dflash ................ 15.4 / 32 / 18.0 / 15.3 / 1.9 → −59 % vs its own MTP row and under the
# 2.5 target → DROPPED (tombstone below). Read the acceptance line once: `journalctl -u llama.service
# --since 03:25 | grep 'draft acceptance'` — 0.00 = the #29226-window bug (fix #30111 = b11512 sits in
# 0.7.0 behind #30688 → re-probe only on a fixed 0.7.x); > 0 = block-drafting re-runs the 48 GDN
# layers per verified block and loses on this card (the RX 9070 XT datum in #25117 said the same)
# → closed for good. Either way nothing to tune: n-max 2 only shrinks the loss.
# NEXT: quality call → if GSQ wins, point the incumbent's `model =` at the GSQ file (keeps the client
# id; the section name becomes a misnomer) or do the seven-client rename round, then delete the
# unsloth file; if not, delete the GSQ file and the section. The DFlash2 drafter can go now.
# ⬇ DOWNLOAD on fl — curl straight into the models dir (the HF cache has root-owned dirs from docker):
# cd ~/software/models
# curl -L -o Qwen3.8-27B-GSQ-RCO-IQ3_XXS-mtp.gguf https://huggingface.co/ISTA-DASLab/Qwen3.8-27B-GSQ-RCO-GGUF/resolve/main/Qwen3.8-27B-GSQ-RCO-IQ3_XXS-mtp.gguf
# (dropped 10-22, only for a re-probe) curl -L -o Qwen3.8-27B-DFlash2-Q4_K_M.gguf https://huggingface.co/z-lab/Qwen3.8-27B-DFlash2-GGUF/resolve/main/Qwen3.8-27B-DFlash2-Q4_K_M.gguf
# stat -c '%s %n' Qwen3.8-27B-GSQ-RCO-IQ3_XXS-mtp.gguf Qwen3.8-27B-DFlash2-Q4_K_M.gguf # 10442827840 · 1143006816
# (mmproj: ISTA ships the same BF16 encoder — the existing mmproj-Qwen3.8-27B-F16.gguf is reused)
[Qwen3.8-27B-GSQ-RCO-IQ3_XXS]
# ⚗ RACE CANDIDATE 2026-10-22 — bench-only, NOT in any client file. = the incumbent preset with the ISTA
# file swapped in (MTP head Q6_K, same as unsloth's). Predicted @1.6 baseline @24k: ~14.1 used /
# ~3.0 free (incumbent 14.4 / 2.7), decode ~38–39 (incumbent 37.1 on b11429) — bandwidth × file size, nothing
# else moves. Knobs deliberately identical to the incumbent (n-max 2) for a clean A/B.
# ✓ MEASURED 2026-10-22 03:25 @1.3: 37.5 t/s / 44 pp / TTFT 7.0 / 14.0 used / 3.2 free (incumbent 36.2 /
# 2.7 in the same run). Speed + VRAM passed; QUALITY CALL PENDING — not client-wired until then.
model = /home/anon/software/models/Qwen3.8-27B-GSQ-RCO-IQ3_XXS-mtp.gguf
mmproj = /home/anon/software/models/mmproj-Qwen3.8-27B-F16.gguf
spec-type = draft-mtp
spec-draft-n-max = 2
ctx-size = 24576
n-gpu-layers = 99
threads = 6
flash-attn = on
cache-type-k = q8_0
cache-type-v = q4_0
batch-size = 2048
ubatch-size = 256
cache-reuse = 256
defrag-thold = 0.1
no-mmproj-offload = true
temp = 1.0
top-p = 0.95
top-k = 20
min-p = 0
jinja = on
sleep-idle-seconds = 120
# ─── DROPPED 2026-10-22 03:25: [Qwen3.8-27B-GSQ-RCO-IQ3_XXS-dflash] (DFlash2 text-only sibling) ─────
# 15.4 t/s / 32 pp / 15.3 used / 1.9 free vs 37.5 / 3.2 for the same file with its MTP head — the
# z-lab block drafter is a net loss on this card (see the RACE RUN entry above for the two possible
# causes and the only re-probe condition: a 0.7.x build that carries #30111 without #30688).
# Removed as a loadable section on purpose: OWUI lists every router id, and 1.9 free on a busy
# desktop is the GTT freeze. File can be deleted from the models dir: Qwen3.8-27B-DFlash2-Q4_K_M.gguf
# Keys as benched (n-max 3, no mmproj — #27408):
# model = /home/anon/software/models/Qwen3.8-27B-GSQ-RCO-IQ3_XXS-mtp.gguf
# model-draft = /home/anon/software/models/Qwen3.8-27B-DFlash2-Q4_K_M.gguf
# spec-type = draft-dflash
# spec-draft-n-max = 3
# ctx-size = 24576
# n-gpu-layers = 99
# threads = 6
# flash-attn = on
# cache-type-k = q8_0
# cache-type-v = q4_0
# batch-size = 2048
# ubatch-size = 256
# cache-reuse = 256
# defrag-thold = 0.1
# temp = 1.0
# top-p = 0.95
# top-k = 20
# min-p = 0
# jinja = on
# sleep-idle-seconds = 120
# ─── optional 3rd runner (not added — copy the GSQ section if wanted): ByteShape IQ3_S-3.23bpw ────
# 11.035 GB = the incumbent's size, vendor-claimed best quality in the class, MTP head kept (IQ3-quantized).
# model = /home/anon/software/models/Qwen3.8-27B-IQ3_S-3.23bpw.gguf
# curl -L -o Qwen3.8-27B-IQ3_S-3.23bpw.gguf https://huggingface.co/byteshape/Qwen3.8-27B-GGUF/resolve/main/Qwen3.8-27B-IQ3_S-3.23bpw.gguf # 11035354496 B
# ─── RETIRED 2026-07-16: [Qwen3.6-27B-Uncensored-HauhauCS-Aggressive-IQ3_M] ──────────────
# Dense: 10 t/s, 2.0 GB free (under the 2.5 target) and unfixable — bandwidth-bound, smaller
# quant would cost the quality that justified it. Removed from opencode/pi/aichat.
# File can be deleted from the models dir: Qwen3.6-27B-Uncensored-HauhauCS-Aggressive-IQ3_M.gguf
# ─────────────────────────────────────────────────────────────────────────────
# Gemma models
# ─────────────────────────────────────────────────────────────────────────────
[gemma-4-26B-A4B-it-UD-IQ4_XS]
# MoE (4B active) + MTP + vision. ~13.5 GB weights → tight. Projector on CPU (no-mmproj-offload).
# From unsloth/gemma-4-26B-A4B-it-qat-GGUF: mmproj-F16.gguf + mtp-gemma-4-26B-A4B-it.gguf.
# ⬇ SOURCES — local name ← upstream (PLAIN repo unsloth/gemma-4-26B-A4B-it-GGUF; the qat
# repo has NO IQ4_XS, its only main is qat-UD-Q4_K_XL 14.25 GB — see decision note below):
# gemma-4-26B-A4B-it-UD-IQ4_XS.gguf ← gemma-4-26B-A4B-it-UD-IQ4_XS.gguf (13.6 GB)
# ✓ current: the 2026-08-05 dl has the Jul 17 template
# mmproj-gemma-4-26B-A4B-it-F16.gguf ← mmproj-F16.gguf (1.19 GB)
# mtp-gemma-4-26B-A4B-it.gguf ← MTP/mtp-gemma-4-26B-A4B-it-Q8_0.gguf (462 MB)
# Keep LOCAL names stable; re-fetch the upstream names above when repos update. Pair main
# and drafter from the SAME repo — the two repos' drafters are different extractions.
# ✓ FIXED 2026-08-08 03:15: matched plain-repo sidecars cured the "Invalid input batch."
# 500s — root cause CONFIRMED as the cross-repo drafter mismatch (old qat-repo mtp under
# the new plain main). Re-benched 32.8 t/s @moe13, 12.1 used / 5.0 free, MTP ✓ — same
# speed as pre-update (32.7), template fix now in place. The *.gguf.bak sidecars are
# deletable once vision + opencode tool-calling are smoke-tested.
# (QAT quality upgrade = separate decision: main → qat-UD-Q4_K_XL, +0.7 GB, moe 13→~16, and
# a section/client id rename round. Not part of this fix.)
# ⚠ vision + MTP together is heavy — if it OOMs/freezes, add n-cpu-moe or drop MTP (keep vision).
model = /home/anon/software/models/gemma-4-26B-A4B-it-UD-IQ4_XS.gguf
mmproj = /home/anon/software/models/mmproj-gemma-4-26B-A4B-it-F16.gguf
model-draft = /home/anon/software/models/mtp-gemma-4-26B-A4B-it.gguf
spec-type = draft-mtp
spec-draft-n-max = 2
reasoning-budget = 0 # added 2026-08-09: the Jul-17 official template makes gemma-4 DELIBERATE
# on hard prompts (probe: 700 tok = 100% reasoning_content, content
# EMPTY, finish=length) — that ate pi's 4096 maxTokens cap and returned
# truncated nothing. Same fix as the 35B daily driver. ⚠ if startup says
# option not recognized, remove; if it loads but a hard probe still emits
# reasoning_content, the gemma template ignores the budget → remove and
# raise client maxTokens to 8192 instead.
ctx-size = 24576 # MEASURED @16384/moe16: 29.6 t/s, 10.7 used / 6.5 free → sliding-window KV is
# cheap, take the ctx back (clients already assume 24576)
# n_ctx_train = 262144 (08-08 load log) — huge ctx headroom exists if a
# long-context vision need ever appears; bench stepwise, free ≥ 2.5.
n-gpu-layers = 99
n-cpu-moe = 13 # MEASURED @16: 26.4 t/s, 11.9 used / 5.2 free → pull ~3 expert layers onto GPU for speed
threads = 6
flash-attn = on
jinja = on # OpenAI-style tool calling (opencode build/plan default to this preset)
cache-type-k = q8_0
cache-type-v = q4_0
batch-size = 2048
ubatch-size = 512
cache-reuse = 256
defrag-thold = 0.1
no-mmproj-offload = true # vision encoder on CPU → frees ~1 GB
temp = 1.0
top-p = 0.95
top-k = 64
sleep-idle-seconds = 60
[gemma-4-E4B-it-UD-Q8_K_XL]
# ~5-7 GB — small/fast, lots of headroom, safe at big ctx.
# Vision: the HF repo ships mmproj-{BF16,F16,F32}.gguf — use F16 (990 MB), saved AS the exact
# path below (rename it; if the path doesn't exist the model fails to load / vision silently
# missing depending on router). Verify: startup log shows the mmproj load, and an image request
# answers instead of erroring "image input is not supported".
# NOTE: repo got Google's chat-template update ~2026-05 — if the main gguf predates that, re-download it too.
model = /home/anon/software/models/gemma-4-E4B-it-UD-Q8_K_XL.gguf
mmproj = /home/anon/software/models/mmproj-gemma-4-E4B-it.gguf
model-draft = /home/anon/software/models/mtp-gemma-4-E4B-it.gguf # ✓ MEASURED (2026-07-18): 57.3 t/s —
# +50% over 38.4 without the draft, 10.5 used / 6.6 free. Fastest model on the box.
spec-type = draft-mtp
spec-draft-n-max = 2
reasoning-budget = 0 # added 2026-08-09, same reason as the 26B: gemma-4 deliberates on hard
# prompts since the Jul-17 template (this is what caused the 20-second
# aichat -e "think" preambles on 2026-08-05). Fast models answer NOW.
# ⚠ same caveats as the 26B — remove if not recognized / not honored.
ctx-size = 98304 # ⚗→✓ CLOSED 2026-08-08: 58.2-60.4 t/s, 10.3-10.6 used / 6.5-6.9 free
# @98304, and n_ctx_train = 131072 confirmed (upstream config.json
# max_position_embeddings) — 98304 is inside training range, no RoPE
# risk. 131072 is the hard ceiling if ever needed (~+0.5-1 GB KV).
n-gpu-layers = 99
flash-attn = on
jinja = on # OpenAI-style tool calling (doc-writer agent defaults to this preset)
cache-type-k = q8_0
cache-type-v = q8_0
batch-size = 2048
ubatch-size = 1024
cache-reuse = 256
defrag-thold = 0.1
temp = 1.0
top-p = 0.95
top-k = 64
sleep-idle-seconds = 30
# ─────────────────────────────────────────────────────────────────────────────
# Ornith (Qwen3.5-MoE derivative)
# ─────────────────────────────────────────────────────────────────────────────
[Ornith-1.5-35B-A3B-IQ3_XXS]
# ✓ KEPT 2026-09-21 (gate passed: 32.1 t/s MTP, 13.8 used / 3.3 free @moe16) — Ornith-1.5-35B-A3B (ornith-ai / DeepReinforce, MIT,
# released ~2026-08-24): Qwen3.5-MoE architecture (qwen35moe: 40 layers, hybrid GDN 3:1, 256
# experts / 8 active + shared, ~3B active, vision, n_ctx_train 262144), continued-pretrained and
# RL'd with a self-improvement loop. Card claims it beats Qwen3.6-35B-A3B on every coding/agentic
# bench (Terminal-Bench 2.1 67.8 vs 52.5, SWE-bench Verified 79 vs 73.4). Same shape as the daily
# driver → same recipe: MTP draft + experts on CPU. Role if it passes: AGENTIC CODER (the only
# coder here with MTP — Coder-30B 30 t/s and GLM Q3 26 t/s have none) and/or daily driver.
# MTP head VERIFIED in the gguf header 09-21 (nextn_predict_layers = 1, block_count 41 = 40+1) —
# present in bartowski's plain quants and the official Q4_K_M alike; no "-MTP" repo needed.
# Thinking is ON by default (<think> block; card sampling 0.6/0.95/20). Kept ON for the coder
# role; an instruct alias = same file + `reasoning-budget = 0` exactly like the daily driver.
# VRAM: file is +1.27 GB vs the daily driver's 14.07 → start at moe20 (≈ Qwen@moe16 footprint:
# predicted ~13.9 used / ~3.3 free @2.0 baseline). Until downloaded, sweep with `-x` this id.
# GATE: MTP decode ≥ ~30 t/s AND free ≥ 2.5 → keep; step moe 20→16 while free ≥ 2.5; then wire
# the six client files + README row. Anything less → retire + delete (the Qwen stays).
# ✓ LOADED + BENCHED 2026-09-21 17:31 @moe20 (2.0 baseline): 27.9 t/s / 52 pp / 12.4 used / 4.8
# free → footprint only 10.4 GB (predicted 11.9). MTP draft active (spec column). Speed gate
# not met yet but 2.3 GB of headroom is unused → step moe 20→16 (= daily driver; the Qwen went
# 19.8→35.9 t/s over moe 24→16). Predicted @moe16: ~13.8 used / ~3.4 free @2.0.
# ✓ GATE PASSED 17:34 @moe16 (2.0 baseline): 32.1 t/s / 74 pp / TTFT 3.9 s (thinking preamble) /
# 13.8 used / 3.3 free — prediction exact. Both gate halves met → wired into the six client
# files + README 09-21. KEEP moe16 (= daily-driver envelope; moe14 ≈ +1-2 t/s for the last
# 0.8 GB of margin — not on an evening box). Draft acceptance not recorded yet (grep the log).
# Role: agentic coder with reasoning — the only coder here with MTP (Coder-30B 30, GLM Q3 26).
# Instruct alias (reasoning-budget = 0, same file) still optional — add if agent loops want
# the ~4 s thinking TTFT gone.
# ⚠ NO reasoning-budget LINE IN THIS PRESET, ON PURPOSE (2026-10-12): pi caps the think block
# PER REQUEST (`thinking_budget_tokens`, from pi settings.json > thinkingBudgets, tested on
# b11429: budget 40 → trace cut at ~40 tokens, answer still arrives, finish_reason stop) and
# llama.cpp IGNORES that field whenever the preset sets a CLI --reasoning-budget. Adding one
# here "like the Thinking preset" silently disables the pi knob and brings back pi's
# "Response was truncated before completion." (= finish_reason length: think block + answer
# > the client's 4096 max_tokens). An instruct alias (budget 0) in a SEPARATE section is fine.
# ⚠ 2026-10-22: pi's "Compacting in OVERFLOW recovery" on this preset is NOT this window filling
# up — pi clamps each request's max_tokens to contextWindow − estimate − 4096, which on
# 24k/4096 starts exactly at its compaction threshold; the first request after a compaction
# (estimate gains the system prompt + tool schemas) can leave the thinking reply ~1024 answer
# tokens → finish_reason length → pi compacts again and retries. Arithmetic + options in
# common/.pi/CLAUDE.md > Compaction tuning > max_tokens clamp.
# APPLIED 2026-10-22 (same day, unbenched): ctx-size 24576 → 32768 here + 32768 in the seven
# client files (pi contextWindow both blocks common+lw, opencode limit.context common+lw,
# aichat max_input_tokens 30000 common+lw+wm). Threshold and clamp in pi now sit at 24576,
# above anything a fresh post-compaction context reaches. Predicted cost ≈ 0.1 GB: hybrid
# GDN 3:1 = 10 attention layers with small GQA, ~8 KB/token of q8/q4 KV → ~70 MB for +8192,
# plus a few MB of FA scratch — read the "KV self size" line in the load log to confirm.
# GATE on the first load: `sudo systemctl restart llama.service`, then
# `./bench.py -m Ornith-1.5-35B-A3B-IQ3_XXS` — free ≥ 2.5 at the 2.0 baseline and decode
# ≈ 32 t/s → keep; else back to 24576 in all eight files (the router reads presets once at
# startup, and pi at 32k against a 24k server produces REAL overflow recoveries).
# ⬇ DOWNLOAD from bartowski/Ornith-1.5-35B-A3B-GGUF (imatrix; the official repo has only Q4_K_M+
# ≥ 21.7 GB, unsloth has no 1.5 quants yet):
# Ornith-1.5-35B-A3B-IQ3_XXS.gguf 15,340,447,392 B · sha256 8918ccb9ee29abe3875efec0c3e86f0e35ef0b8a03e3f0e1c422869859a518d0
# mmproj-Ornith-1.5-35B-A3B-f16.gguf 899,283,296 B · sha256 815c9a671991aceeef46ca1aa103b64499db8cfadf21c83005a20ed839d53c7c
model = /home/anon/software/models/Ornith-1.5-35B-A3B-IQ3_XXS.gguf
mmproj = /home/anon/software/models/mmproj-Ornith-1.5-35B-A3B-f16.gguf
spec-type = draft-mtp
spec-draft-n-max = 2
ctx-size = 32768 # 24576 → 32768 on 2026-10-22 for pi's max_tokens clamp (⚠ note above);
# UNBENCHED until the next restart — gate free ≥ 2.5 @2.0, decode unchanged;
# n_ctx_train 262144, KV is cheap here (hybrid GDN, ~8 KB/token)
n-gpu-layers = 99
n-cpu-moe = 16 # ✓ KEEP (09-21: 32.1 t/s, 13.8 used / 3.3 free @2.0; moe20 was 27.9 /
# 12.4 / 4.8). = daily-driver envelope; moe14 not worth the margin.
threads = 6
flash-attn = on
cache-type-k = q8_0
cache-type-v = q4_0 # mixed KV is fine on this arch (daily driver runs the same)
batch-size = 2048
ubatch-size = 512
cache-reuse = 256 # inert under mmproj ("not supported by multimodal") — kept for parity
defrag-thold = 0.1
temp = 0.6 # model card, general use: 0.6 / 0.95 / 20 (1.0 only for bench reproduction)
top-p = 0.95
top-k = 20
min-p = 0
jinja = on
sleep-idle-seconds = 120
# ─────────────────────────────────────────────────────────────────────────────
# GLM
# ─────────────────────────────────────────────────────────────────────────────
[GLM-4.7-Flash-UD-Q4_K_XL]
# 30B-A3B MoE, QUALITY coder. Upgraded UD-Q3_K_XL (~14 GB) → UD-Q4_K_XL (17.5 GB, unsloth's
# recommended quant) 2026-07-16, benched clean same day. 2026-09-21: the Q3 quant is BACK as the
# separate fast-coder preset [GLM-4.7-Flash-UD-Q3_K_XL] below (21.5 t/s here was too slow for
# daily agent use) — keep BOTH files; this one stays for hard reviews.
# Tuning trajectory: Q3@moe9 = 28.2 t/s → Q4@moe24 = 17.9 (measured 2026-07-16) → now moe18,
# lower stepwise toward 16 while bench keeps free ≥2.5 GB.
model = /home/anon/software/models/GLM-4.7-Flash-UD-Q4_K_XL.gguf
ctx-size = 24576 # MEASURED @16384/moe24 (Q3): 9.5 GB used, 7.6 free
# n_ctx_train = 202752 (08-08 load log) — MLA KV is compact, ctx could
# go far higher if opencode subagent sessions ever outgrow 24k.
n-gpu-layers = 99
n-cpu-moe = 22 # lowered 24→22 on 2026-08-08: both step-down gates passed post-KV-fix —
# clean sweep @24 = 20.5 t/s, 12.0 used / 5.2 free (02:45, 1.9 baseline);
# elevated-baseline load @24 = 18.7, 13.0/4.2 (@2.9). moe22 est ~21.5
# clean / ~19.5-20 evening, ~12.7 used clean / ~14.0 evening → inside the
# coder-proven evening envelope (14.2 loads). ✓ CLEAN VERIFIED (02:58,
# 2.0 baseline): 21.5 t/s, 12.8 used / 4.4 free — est was 21.5, exact.
# Evening observation pending; revert to 24 if an evening bench shows
# free < 2.5. moe20 stays gated (~14.4-14.7 evening = borderline vs the
# coder's 15.2 evening death).
# (08-05/07 "failures" were the mixed-KV rejection below, not VRAM.)
# Trajectory: Q3@moe9 = 28.2 → Q4@moe24 = 17.9 (07-16) → 18.7/20.5 post-KV-fix.
threads = 6
flash-attn = on
cache-type-k = q8_0
cache-type-v = q8_0 # was q4_0 — BROKE 2026-08-08: a llama.cpp upgrade (the one deprecating
# defrag-thold) enforces same-type K/V for this model (deepseek2/MLA
# conversion; MLA KV is compact, mixed types unsupported). Every load
# since failed at context creation regardless of VRAM. Only THIS preset
# was affected — the other k-q8/v-q4 presets are regular-attention archs.
# If q8/q8 still refuses: delete both cache-type lines (f16 default; MLA
# KV is small enough that the cost is minor at 24576 ctx).
batch-size = 2048
ubatch-size = 512
cache-reuse = 256
defrag-thold = 0.1
# MTP: GLM-4.7-Flash HAS an MTP head upstream (num_nextn_predict_layers: 1) but the GGUF
# conversion (deepseek2 arch) drops those tensors and llama.cpp draft-mtp only supports
# Qwen3.5/3.6 + Gemma 4 so far (PRs #22673/#23398). No mtp-*.gguf exists to download —
# recheck when llama.cpp lands GLM MTP support.
temp = 0.6 # unsloth rec: 0.7/top-p 1.0 (tool-calling) or 1.0/0.95 (general); no repeat-penalty
top-p = 0.95
min-p = 0.01
jinja = on
reasoning-preserve = true # ⚗ option ACCEPTED by the build (loaded + ran 20.9 t/s, 04:11 sweep).
# BEHAVIOR flag — judge multi-turn subagent quality in opencode over the
# next days; remove if reasoning bleed ever pollutes final answers.
sleep-idle-seconds = 60
[GLM-4.7-Flash-UD-Q3_K_XL]
# ⚡ FAST CODER — same GLM-4.7-Flash, 3-bit. RE-ADDED 2026-09-21: the user found the Q4 preset's
# 21.5 t/s (22 expert layers in RAM) too slow for agent loops; this quant fit far more of the
# experts on the GPU and was the fastest coder this box ever ran. HISTORY (07-16, pre-KV-fix
# era): Q3@moe9 = 28.2-29.7 t/s, @moe12 = 28.1, @moe24 = 18.9 (9.5 used / 7.6 free @16k).
# Quality: UD 3-bit — "coders want ≥4-bit" (README) is why Q4 exists; pick Q3 for speed, Q4 for
# hard reviews. Same deepseek2/MLA arch → same-type KV (q8/q8) is mandatory here too.
# GATE: keep if bench ≥ ~27 t/s AND free ≥ 2.5 GB @ a ≤1.9 baseline. Start at moe12 (safe),
# step to moe9 if free allows (~+0.75 GB per 3 layers on GPU, +~1 t/s).
# ✓ BENCHED 2026-09-21 16:29 (2.0 DAYTIME baseline): 26.0 t/s / 46 pp / 13.4 used / 3.8 free →
# footprint 11.4 GB. Speed = July's 28.1 minus the usual busy-desktop tax (clean-night
# reference still to record); VRAM passes with room. +21% over the Q4's 21.5.
# Re-run 16:34 (2.1 baseline): 25.9 t/s / 65 pp / 13.5 used / 3.7 free — reproducible; the
# first run's 46 pp was CPU contention (prefill now matches the Q4's ~60).
# DECISION: KEEP moe12, do NOT step to moe9. This preset's job is EVENING agent loops, so the
# evening envelope rules: 11.4 + 3.3 evening baseline = 14.7 used / 2.5 free = exactly the
# target; moe9 would be ~15.4 used on a busy evening = the coder's old death zone, for ~+1 t/s.
# Want more speed on a QUIET desktop? A same-file alias at moe6 (~+1.5 GB, maybe ~29-30) is the
# gpt-oss-low pattern — not added; ask.
# ⬇ DOWNLOAD unsloth/GLM-4.7-Flash-GGUF (repo unchanged since 2026-02-12):
# GLM-4.7-Flash-UD-Q3_K_XL.gguf — 13,782,004,064 B (13.78 GB)
# sha256 582728c0f6931a1cf734d5a7cf60ec73522fb79811e004cbc12476dd69b033bf
model = /home/anon/software/models/GLM-4.7-Flash-UD-Q3_K_XL.gguf
ctx-size = 24576 # = clients (MLA KV is compact; n_ctx_train 202752)
n-gpu-layers = 99
n-cpu-moe = 12 # ✓ KEEP (09-21: 26.0 t/s, 13.4 used / 3.8 free @2.0 daytime). Evening-
# safe (~14.7 used @3.3). moe9 = +~1 t/s for ~15.4 evening → no.
threads = 6
flash-attn = on
cache-type-k = q8_0
cache-type-v = q8_0 # MLA: mixed K/V types are rejected at context creation (see Q4 preset)
batch-size = 2048
ubatch-size = 512
cache-reuse = 256
defrag-thold = 0.1
temp = 0.6 # mirrors the Q4 preset (unsloth: 0.7/top-p 1.0 tools, 1.0/0.95 general)
top-p = 0.95
min-p = 0.01
jinja = on
reasoning-preserve = true # mirrors the Q4 preset — same behaviour flag, same review caveat
sleep-idle-seconds = 60
# ─────────────────────────────────────────────────────────────────────────────
# Utility & candidates
# ─────────────────────────────────────────────────────────────────────────────
[Qwen3-Embedding-0.6B]
# Embeddings-only, for RAG/semantic search (OWUI etc. via /v1/embeddings) — NOT a chat model,
# so it is deliberately absent from the opencode/pi/aichat chat lists.
# Qwen3-Embedding requires last-token pooling. ~0.7 GB — tiny, loads fast.
# (Q8_0 is effectively lossless for a 0.6B embedder — the f16 file is redundant, delete it.)
# CPU-ONLY on purpose: a 0.6B embeds fast on 6 cores, and 0 VRAM means it can never stack
# with a chat model into an overcommit (and never suffers/causes eviction pressure).
model = /home/anon/software/models/Qwen3-Embedding-0.6B-Q8_0.gguf
embeddings = true
pooling = last
ctx-size = 8192
n-gpu-layers = 0
flash-attn = on
batch-size = 8192 # embed long chunks in one pass
ubatch-size = 1024
threads = 6
sleep-idle-seconds = 60
[gpt-oss-20b]
# OpenAI gpt-oss-20b — MoE 21B / 3.6B active, reasoning + tool use (enabled 2026-07-16, NOT
# BENCHED yet). OpenAI post-trained it in MXFP4, so there is exactly ONE sensible GGUF:
# ggml-org/gpt-oss-20b-GGUF → gpt-oss-20b-mxfp4.gguf (~12.1 GB). Requants are never better —
# the old gpt-oss-20b-Q3_K_M.gguf can be deleted.
# Harmony chat template → jinja required. Default KV types kept (gpt-oss attention sinks have
# had issues with quantized KV — verify before adding cache-type lines).
model = /home/anon/software/models/gpt-oss-20b-mxfp4.gguf
ctx-size = 65536 # ⚗→✓ VERIFIED @65536 (04:11): 37.3/37.4 t/s unchanged, 14.0 used / 3.2
# free — the fast long-context option is real (37 t/s vs Coder-Next 16).
# 131072 is OFF the table: 32k→65k cost +1.2 GB (KV slope steepens past
# the sliding window) → 131k would land under 2.5 free. Client caps
# raised 32k→64k on 2026-08-08.
n-gpu-layers = 99
n-cpu-moe = 4 # ✓ SETTLED. MEASURED @6: 31.3 t/s · @4 (2026-07-16): 38.1 t/s, 12.7 used /
# 4.5 free — fastest model in the lineup. TTFT (~3-7 s) is the model THINKING
# (harmony reasoning streams as reasoning_content first) — not a slow load.
threads = 6
flash-attn = on
batch-size = 2048
ubatch-size = 512
cache-reuse = 256
defrag-thold = 0.1
temp = 1.0
top-p = 1.0
jinja = on
sleep-idle-seconds = 120
[gpt-oss-20b-low]
# Same GGUF, reasoning effort LOW — zero disk cost (like the 35B-Thinking alias, inverted).
# Cuts the multi-second thinking preamble for light/interactive use; keep [gpt-oss-20b]
# (default = medium effort) for hard problems. ⚠ if startup says the option is not
# recognized, the llama.cpp build predates chat-template-kwargs — comment that line out.
model = /home/anon/software/models/gpt-oss-20b-mxfp4.gguf
chat-template-kwargs = {"reasoning_effort":"low"}
ctx-size = 65536 # ⚗→✓ VERIFIED @65536 (04:11): 37.3/37.4 t/s unchanged, 14.0 used / 3.2
# free — the fast long-context option is real (37 t/s vs Coder-Next 16).
# 131072 is OFF the table: 32k→65k cost +1.2 GB (KV slope steepens past
# the sliding window) → 131k would land under 2.5 free. Client caps
# raised 32k→64k on 2026-08-08.
n-gpu-layers = 99
n-cpu-moe = 4
threads = 6
flash-attn = on
batch-size = 2048
ubatch-size = 512
cache-reuse = 256
defrag-thold = 0.1
temp = 1.0
top-p = 1.0
jinja = on
sleep-idle-seconds = 60
# ─────────────────────────────────────────────────────────────────────────────
# Notes
# ─────────────────────────────────────────────────────────────────────────────
# n-cpu-moe N : offload the first N MoE layers' experts to CPU. Higher = less VRAM (safer) but
# slower. On this display-driving GPU, a bit of offload is FAR better than a freeze.
# Only applies to MoE models (dense models ignore it — reduce ctx instead).
# override-tensor : finer control, e.g. `blk\.(1[2-9]|[2-9][0-9])\.ffn_.*_exps=CPU`.
# After ANY change: reload the server and run bench.py — keep every "VRAM free" ≥ ~2.5 GB.
+70
View File
@@ -0,0 +1,70 @@
#!/bin/sh
# gpumon.sh — one screen of GPU state for fl (RX 7600 XT · amdgpu · Vulkan backend).
#
# watch -c -d -n 1 ~/.config/llamacpp/gpumon.sh (fish abbr `vramx`, fl/.config/fish/host.fish)
# ~/.config/llamacpp/gpumon.sh (one shot)
#
# Why not rocm-smi: `--showmemuse` gives percentages and hides GTT. The freeze mode on this box is
# VRAM overcommit spilling into GTT (system RAM) — see the config.ini header — so GTT and the
# absolute free-VRAM figure (the ≥ 2.5 GB gate) are the numbers that matter. amdgpu exposes both
# in sysfs: instant, no ROCm needed. Per-process VRAM comes from /proc/<pid>/fdinfo (kernel
# drm-usage-stats), readable only for your own processes unless root. llama.service runs as the
# login user (anon), so its children show up; if they ever don't:
# systemctl show -p User llama.service and run this with sudo.
# No absolute GTT alarm on purpose: bench.py judges GTT as a delta over a per-model baseline
# (a browser-heavy desktop legitimately sits on a few GB) — `watch -d` shows the movement.
#
# GPUMON_HOST overrides the router host (default 127.0.0.1) — for a dry run from another box.
dev=/sys/class/drm/renderD128/device
host=${GPUMON_HOST:-127.0.0.1}
port=11343
echo "=== GPU (amdgpu sysfs) ==="
if [ -r "$dev/mem_info_vram_used" ]; then
temp=$(cat "$dev"/hwmon/hwmon*/temp1_input 2>/dev/null | head -n 1)
awk -v u="$(cat "$dev/mem_info_vram_used")" -v t="$(cat "$dev/mem_info_vram_total")" \
-v g="$(cat "$dev/mem_info_gtt_used" 2>/dev/null)" -v gt="$(cat "$dev/mem_info_gtt_total" 2>/dev/null)" \
-v b="$(cat "$dev/gpu_busy_percent" 2>/dev/null)" -v m="$(cat "$dev/mem_busy_percent" 2>/dev/null)" \
-v c="${temp:-0}" 'BEGIN {
G = 1073741824
free = (t - u) / G
flag = free < 1.5 ? " <<< HARD FLOOR (bench.py guard)" : free < 2.5 ? " <-- below the 2.5 GB target" : ""
printf "VRAM %5.2f / %5.2f GiB free %5.2f GiB%s\n", u / G, t / G, free, flag
printf "GTT %5.2f / %5.2f GiB (VRAM spilled to RAM — must not grow while a model is resident)\n", g / G, gt / G
printf "busy gpu %3d%% mem %3d%% edge %d°C\n", b, m, c / 1000
}'
else
echo "no amdgpu sysfs under $dev — not the fl box, or the GPU is not renderD128"
fi
echo
echo "=== processes holding the GPU (VRAM from fdinfo · RSS · uptime; own-user only unless root) ==="
# fuser puts the PID list on stdout (the pretty table of -v goes to stderr, hence no -v here).
pids=$(fuser /dev/dri/renderD128 /dev/dri/card* 2>/dev/null | tr ' ' '\n' | grep -E '^[0-9]+$' | sort -un)
if [ -z "$pids" ]; then
echo "(nothing visible — no /dev/dri here, or the GPU users belong to another user)"
else
for p in $pids; do
[ -r "/proc/$p/fdinfo" ] || continue
# one drm client can be reachable through several fds — dedupe by drm-client-id, then sum
vram=$(awk 'FNR == 1 { cid = "" }
/^drm-client-id:/ { cid = $2 }
/^drm-(total|memory)-vram:/ { v[cid] = $2 }
END { for (k in v) s += v[k]; printf "%.2f", s / 1048576 }' /proc/"$p"/fdinfo/* 2>/dev/null)
name=$(cat /proc/"$p"/comm 2>/dev/null)
alias=$(tr '\0' '\n' < /proc/"$p"/cmdline 2>/dev/null | awk '$0 == "--alias" { getline; print; exit }')
set -- $(ps -o rss=,etime= -p "$p" 2>/dev/null | awk '{ printf "%.1f %s", $1 / 1048576, $2 }')
printf '%7s GiB %7s %-16s rss %5s GiB up %-11s %s\n' "$vram" "$p" "$name" "${1:-?}" "${2:-?}" "$alias"
done | sort -rn | head -n 15
fi
echo
echo "=== router $host:$port — preset status (anything not unloaded; the sysfs line above is the truth for VRAM) ==="
if out=$(curl -sf -m 1 "http://$host:$port/models" 2>/dev/null); then
printf '%s' "$out" \
| jq -r '.data[] | select(.status.value != "unloaded") | "\(.status.value)\t\(.id)"' 2>/dev/null \
| { grep . || echo "(nothing resident)"; }
else
echo "(router not answering — systemctl status llama.service)"
fi
+206
View File
@@ -0,0 +1,206 @@
# vLLM on fl (docker, ROCm) — side by side with the llama.cpp router, never at the same time
Added 2026-10-21 to answer one question: **how does vLLM compare with llama.cpp on this card, on the
same models?** It is a bench rig, not a second production endpoint. Nothing here was run on fl yet —
fl has no sshd, so every command below is for you to run there; the first run will find the rough edges.
- **Box**: the same fl as the router — RX 7600 XT 16 GB (gfx1102, RDNA3), 5600X, 48 GB RAM. The card
drives the display. llama.cpp runs the Arch Vulkan build; vLLM needs ROCm, which comes **inside the
docker image** — nothing ROCm is installed on the host.
- **Files**: `vllm.ini` (presets, same `key = --flag` convention as `../llamacpp/config.ini`),
`vllmctl.py` (start/stop with the VRAM guards), `bench-vs.py` (one table for both engines).
- **Port 11348**. Not in the router, not in any client list (opencode/pi/aichat/OWUI) on purpose.
## ⚠ The one rule: one engine resident at a time
vLLM pre-allocates `gpu-memory-utilization` × 16 GiB at startup and keeps it, idle or not. The router
loads models lazily on request. So while vLLM is up, **any client request to :11343** makes the router
load a model on top of it → overcommit → GTT spill → frozen PC (the same failure `--models-max 1`
guards against). Unloading resident models is not enough; the clients on the LAN are the problem.
`vllmctl.py up` therefore refuses while `llama.service` is active. The sequence is always:
```fish
~/.config/vllm/vllmctl.py up <preset> --stop-router # sudo systemctl stop llama.service, then start vLLM
# … use / bench vLLM …
~/.config/vllm/vllmctl.py down # stop container, wait for VRAM to drain
sudo systemctl start llama.service # router back for the LAN
```
The other order is the only one that should fail safely: vLLM compares its requested budget against
free VRAM at startup and aborts when a router model is resident ("free memory … is less than desired
GPU memory utilization" — reported by users, not something verified on this card). Everything else freezes.
## What "same models" means here, and the size surprise
llama.cpp runs GGUF; vLLM runs Hugging Face safetensors (bf16 / AWQ / GPTQ / compressed-tensors).
The GGUF files cannot be loaded natively, so the pairs below are **the same model at a vLLM-native
quant**, not the same files (same-file GGUF loading is phase 2, see the end).
Sizes from the HF API, 2026-10-21 — the "4-bit" vLLM checkpoints are **10–11.5 GB** because embeddings,
lm_head and the vision tower stay bf16. They are bigger than the Q6/Q8 GGUFs they pair with, so on
16 GB they are **clean-desktop only**, at `gpu-memory-utilization` ≈ 0.78 and 16k context:
| pair | llama.cpp preset (ledger) | vLLM preset (`vllm.ini`) | vLLM weights | fits? |
|---|---|---|---|---|
| smoke | — | `Qwen3-0.6B-smoke` = `Qwen/Qwen3-0.6B` | 1.5 GB | yes — proves docker+GPU+image |
| gemma-4-E4B | `gemma-4-E4B-it-UD-Q8_K_XL` — 57 t/s **with MTP**, 96k ctx, ~7 GB | ~~`google/gemma-4-E4B-it-qat-w4a16-ct`~~ | 11.5 GB | **✗ no** (2026-10-21): vLLM needs ~16 GiB before any KV — the bf16 per-layer embedding table (262144 × 42 × 256 × 2 B = 5.6 GB) is held twice. Tombstone in the ini. |
| Qwen3.5-9B | `Qwen3.5-9B-UD-Q6_K_XL` — 32 t/s **with MTP**, 32k ctx, 9 GB | `Qwen3.5-9B-w4a16` = `RedHatAI/Qwen3.5-9B-quantized.w4a16` | 11.0 GB | the last viable pair: 0.75 on a 2.1 GB desktop, 0.78 clean; prefill batch 512 |
**Cannot be compared on this card at all**: every 30B+ MoE (Coder-30B, GLM-4.7-Flash, Qwen3.6-35B,
Ornith, gemma-4-26B), Coder-Next 80B and Qwen3.8-27B — they only fit llama.cpp through `n-cpu-moe`
expert offload into RAM, which vLLM does not have (its MoE CPU-offload RFC died stale; the only
option is whole-weight `cpu_offload_gb`, which is slow). gpt-oss-20b (MXFP4, ~13 GB) is marginal and
its RDNA3 kernel status is unknown — not in the ini.
**Why the "docker should just work" expectation does not hold here**: of the three first-day failures,
one was the image (no gfx1102 kernels → the override, solved) and two were memory. vLLM keeps
everything in VRAM — bf16 embeddings, fp32 logits during profiling, CUDA-graph memory — on a card that
also drives the desktop. No image changes a model's memory need; the ROCm images on Docker Hub are the
right ones.
So the comparison is **not apples to apples** and the table says so: llama.cpp rows run Q8/Q6 with a
speculative MTP draft at a bigger context; vLLM rows run int4 without speculation at 16k. Read it as
"what each engine delivers on this card for this model", not as a kernel shoot-out.
## Setup on fl (once)
```fish
sudo pacman -S docker # ~20 GB free disk for the ROCm image + 25 GB for two models
sudo systemctl enable --now docker
sudo usermod -aG docker anon # then log out / in (or `newgrp docker`)
cd ~/.dots && ./install.sh # links ~/.config/vllm/* (new files are not live until re-stow)
~/.config/vllm/vllmctl.py pull # vllm/vllm-openai-rocm:v0.32.0 (ROCm 10.0; 11.6 GB download, ~25 GB on disk)
~/.config/vllm/vllmctl.py gpu-check # torch sees the card? prints device name + gfx arch
```
`gpu-check` must print `cuda available: True`, a `gfx1100` device (that is the override at work) and
`torch kernel: ok`. **The override is required** (found 2026-10-21): `v0.32.0` carries no gfx1102 code
objects, and a kernel launch without one aborts the process *silently* — the engine core vanishes, the
API server only says `Failed core proc(s): {}`, and even the `print`s before the abort are lost to
stdout buffering. `[global] env.HSA_OVERRIDE_GFX_VERSION = 11.0.0` presents the card as gfx1100 (RX 7900),
whose RDNA3 code runs on this chip. Nothing else on the host changes.
Then the smoke test (tiny model, 30 % of the card, proves the whole path before any big download —
✓ passed 2026-10-21: 154.9 t/s decode, 1462 t/s prefill, TTFT 0.02 s, 7.7 GB used incl. a 2.9 GB desktop):
```fish
~/.config/vllm/vllmctl.py up Qwen3-0.6B-smoke --stop-router
curl -s localhost:11348/v1/chat/completions -H 'content-type: application/json' \
-d '{"model":"Qwen3-0.6B-smoke","messages":[{"role":"user","content":"hi"}],"max_tokens":20}'
~/.config/vllm/vllmctl.py down; sudo systemctl start llama.service
```
First start of any model compiles Triton kernels: minutes, with `vllmctl.py up` echoing the log tail
every 30 s.
**Tags and updates.** `<tag>` is the part after the colon: `latest` = newest stable release (was
`v0.32.0` on 2026-10-18, ROCm 10.0), `nightly` = today's main branch (18 GB), `latest-rocm72` /
`nightly-rocm72` = the same on the older ROCm 7.2 stack (smaller, 12 GB), `…-base` = without vLLM
itself. The ini pins `v0.32.0` so a re-pull cannot silently change the engine under a bench run. To
update: pick the new `vX.Y.Z` on hub.docker.com/r/vllm/vllm-openai-rocm/tags, put it in `[global] image`,
`vllmctl.py pull`, then `vllmctl.py down` / `up` — the container is recreated from the image on every
`up`. Afterwards `docker image prune -f` drops the superseded layers (`docker images` shows what is kept).
`HF_TOKEN` is only needed for gated repos; none of the three presets is gated. If one ever is,
`hf auth login` on fl writes `~/.cache/huggingface/token`, which the mounted cache hands to the container.
## Running the benchmark
Two phases, because the engines cannot be resident together. Do both on a **clean desktop** (close the
browser; `vramx` must show ≤ ~1.5 GB used) — the vLLM presets leave ~2 GB free at 0.78 and an evening
desktop does not fit.
```fish
# phase 1 — vLLM (router stopped by --stop-router; first run also downloads the model)
~/.config/vllm/vllmctl.py up gemma-4-E4B-it-w4a16 --stop-router
~/.config/vllm/bench-vs.py -t vllm:gemma-4-E4B-it-w4a16 --ctx 8000 --concurrency 4
~/.config/vllm/vllmctl.py down
~/.config/vllm/vllmctl.py up Qwen3.5-9B-w4a16 # router is still stopped
~/.config/vllm/bench-vs.py -t vllm:Qwen3.5-9B-w4a16 --ctx 8000 --concurrency 4
~/.config/vllm/vllmctl.py down
# phase 2 — llama.cpp (vLLM down, router back)
sudo systemctl start llama.service
~/.config/vllm/bench-vs.py -t llamacpp:gemma-4-E4B-it-UD-Q8_K_XL -t llamacpp:Qwen3.5-9B-UD-Q6_K_XL --ctx 8000 --concurrency 4
```
Every row lands in `bench-vs-history.md` (append) and the latest run in `bench-vs-results.md`, same
folder. The guards: a `llamacpp` target is skipped while vLLM answers `/health`; a `vllm` target is
skipped while the router has a model loaded or `llama.service` is active (`--force` overrides both).
**How to read it**
- `decode t/s` is usage tokens over wall time after the first token, measured the same way on both
engines; llama.cpp's own `timings` number is in parentheses so rows match `../llamacpp/bench-results.md`.
- Thinking is **off** on both (`chat_template_kwargs.enable_thinking=false`) and a reasoning delta counts
as first token, so TTFT compares the engines, not the preamble lengths. `--think` reverts that.
- `spec` shows the MTP draft on the llama.cpp side; vLLM rows have none unless the preset sets
`speculative-config`. Expect the gemma/Qwen llama.cpp rows to carry a 1.5–2× draft bonus.
- `agg t/s @N` is continuous batching's home turf — and llama-server still won it (85 vs 61 at 4
streams): its default slot count on b11146 is evidently > 1, so no `parallel` key is needed.
- `--ctx 8000` adds decode at an 8k prompt — the number that matters for agent loops.
## Results
**2026-10-21, Qwen3.5-9B, same evening, same script, thinking off, 256 tok, 0.6 GB desktop:**
| engine · checkpoint | spec | decode t/s | prefill t/s | TTFT s | decode @8k prompt | 4 streams agg t/s | VRAM used |
|---|---|---|---|---|---|---|---|
| vLLM · RedHatAI w4a16 @0.80, 16k, batch 512 | — | 29.4 | **181** | **0.17** | 16.0 | 60.6 | 12.5 GB |
| llama.cpp · UD-Q6_K_XL, 32k | MTP draft | **61.3** | 114 | 0.27 | **51.1** | **85.4** | 10.9 GB |
What it says, for this card:
- **Decode**: llama.cpp wins 2× single-stream and 3× at an 8k prompt. Most of the 2× is the MTP draft
(the ledger's pre-MTP Q8 number was 17 t/s in July; a no-draft Q6 today is probably ~30, i.e. parity
with vLLM). The 8k gap is not MTP: vLLM's decode halves with context here (16.0 vs 29.4) while
llama.cpp loses 17 % — on RDNA3 vLLM's attention path is the Triton generic one, llama.cpp's is a
tuned Vulkan kernel.
- **Prefill**: vLLM +59 % even with its batch capped at 512 for memory. This is its real strength on
the box, and it shows in TTFT.
- **Concurrency**: the column that was supposed to be vLLM's — it batched 4 streams to 2× its single
(60.6), but llama-server served the same 4 at 85.4. Its default slot count is evidently > 1 on this
build, so the README's "llama.cpp serializes" caveat does not hold; it does not need a `parallel` key.
- **Memory**: vLLM holds 1.6 GB more for a model with 2 GB less context, and only runs on a ≤ 0.6 GB
desktop. 0.75 was 0.11 GiB short of KV room; 0.80 is the setting.
**Verdict**: no vLLM model earns a roster slot on fl; the bench rig stays, the router stays, llama-swap
is not needed. The one follow-up that could move the decode column is MTP in vLLM (the knob is in
the ini) — but it cannot touch the memory column or the MoE roster, so it is curiosity, not a decision.
## When it does not start
- **`No available memory for the cache blocks`** (seen 2026-10-21, gemma @0.73/8k on a 2.1 GB desktop):
the model loaded, but budget − weights − activation reservations left nothing for KV. What vLLM
reserved is in the log: `docker logs vllm 2>&1 | grep -iE 'profil|kv cache|weights take|peak'`.
Cheapest fixes first: text-only (`limit-mm-per-prompt` all zero — skips the image/audio encoder
warmup, now in both presets), smaller `max-num-batched-tokens` (2048, now in both presets), lower
`max-num-seqs`; then a cleaner desktop so the projection allows 0.78–0.82; last resort the smaller
GPTQ checkpoint. `--set key=val` tries any of these without editing the ini.
- **`ABORT: projected free …`**: the desktop is using more than the preset assumes. Close GPU apps or
take the suggested utilization it prints. `--force` exists; the freeze is real.
- **compressed-tensors / "no kernel" for int4 on ROCm**: both real presets use compressed-tensors
pack-quantized. If this image lacks a ROCm kernel for it, swap in the GPTQ alternative noted in the
ini (`Vishva007/gemma-4-E4B-it-W4A16-AutoRound-GPTQ`, 10.0 GB) — different kernel path.
- **Hangs / garbage output**: RDNA3 attention backend. Set `env.VLLM_ATTENTION_BACKEND = TRITON_ATTN`
explicitly; option names moved between versions — `vllmctl.py exec vllm serve --help` shows this image's.
- **GTT growing during a run** (`vramx`, the GTT line): the budget is leaking into system RAM — stop,
lower the utilization. Do not wait for the desktop to stutter.
- **Root-owned files in `~/.cache/huggingface`**: the container runs as root, so its downloads land
root-owned in anon's HF cache. Harmless for the rig; `sudo chown -R anon: ~/.cache/huggingface` if
the host-side `hf` tooling complains.
- **Container died**: `docker logs vllm` (the container is kept after a crash; `vllmctl.py up` shows
the tail and removes it on the next start).
## Phase 2 — if the numbers justify more
1. **Same-file GGUF in vLLM**: GGUF loading moved to an out-of-tree `vllm-gguf-plugin`; it is
"highly experimental and under-optimized" per vLLM's docs and needs a custom image layer
(`pip install vllm-gguf-plugin`), plus `--tokenizer <base repo>`. Untested on ROCm. It would make the
weights identical — and show vLLM's unoptimized path, so interpret carefully.
2. **MTP in vLLM**: `RedHatAI/Qwen3.5-9B-quantized.w4a16` ships `model_mtp.safetensors`; the
commented `speculative-config` in the ini is the knob (syntax per this image's `--help`).
3. **Permanent coexistence**: replace the router's `--models-preset` mode with llama-swap (AUR
`llama-swap-bin`), which spawns llama-server *or* the vLLM container per model id, one at a time,
with a `ttl` idle unload. Same host/port/model ids for every client. Only worth it if a vLLM model
earns a place in the daily roster.
+258
View File
@@ -0,0 +1,258 @@
#!/usr/bin/env python3
"""
bench-vs — the SAME prompt through llama.cpp (router :11343) and vLLM (:11348), one table.
Measures per target: decode t/s, prefill t/s, TTFT, VRAM used/free (amdgpu sysfs, no root needed),
optionally decode at a long prompt (--ctx) and aggregate throughput under N parallel requests
(--concurrency). Method = ../llamacpp/bench.py (streamed chat completion, usage.completion_tokens
over wall time after the first token), applied identically to both engines; llama.cpp's own
`timings` figure is shown in parentheses so rows stay comparable with bench-results.md.
Thinking is OFF by default on both engines (chat_template_kwargs.enable_thinking=false) and the
first reasoning_content delta counts as the first token anyway — a reasoning preamble of different
length per engine would otherwise poison TTFT. --think re-enables it.
GUARDS (the card drives the display; two resident engines = GTT spill = frozen PC):
- a llamacpp target is refused while vLLM answers /health (stop it: ./vllmctl.py down)
- a vllm target is refused while the router reports a loaded model or llama.service is active
./bench-vs.py -t vllm:gemma-4-E4B-it-w4a16 # vLLM up (vllmctl.py up …), router stopped
./bench-vs.py -t llamacpp:gemma-4-E4B-it-UD-Q8_K_XL # vLLM down, router started
./bench-vs.py -t llamacpp:Qwen3.5-9B-UD-Q6_K_XL --ctx 8000 --concurrency 4
Output: bench-vs-results.md (latest) + bench-vs-history.md (append), next to this script. Stdlib only.
"""
import argparse, json, os, re, subprocess, sys, threading, time, urllib.request, urllib.error
from datetime import datetime
HERE = os.path.dirname(os.path.abspath(__file__))
DRM = "/sys/class/drm/renderD128/device"
URLS = {"llamacpp": "http://127.0.0.1:11343/v1", "vllm": "http://127.0.0.1:11348/v1"}
TASK = "Write a Python function that merges two sorted lists, with a short docstring and one example."
def sysfs(name):
try:
return int(open(os.path.join(DRM, name)).read().strip())
except (OSError, ValueError):
return None
def gb(b):
return f"{b / 1e9:.1f} GB" if b is not None else "-"
def http(url, key, payload=None, timeout=600):
data = json.dumps(payload).encode() if payload is not None else None
hdrs = {"Authorization": f"Bearer {key}"}
if data:
hdrs["Content-Type"] = "application/json"
return urllib.request.urlopen(urllib.request.Request(url, data=data, headers=hdrs), timeout=timeout)
def parse_ini(path):
sections, sec = {}, None
try:
lines = open(path, encoding="utf-8").read().splitlines()
except OSError:
return {}
for ln in lines:
s = ln.strip()
if not s or s.startswith("#"):
continue
if s.startswith("[") and s.endswith("]"):
sec = s[1:-1]; sections[sec] = {}
elif sec and "=" in s:
k, v = s.split("=", 1)
sections[sec][k.strip()] = v.split(" #", 1)[0].split("\t#", 1)[0].strip()
return sections
def run(base, key, model, prompt, n, temp, timeout, think):
payload = {"model": model, "messages": [{"role": "user", "content": prompt}],
"max_tokens": n, "temperature": temp, "stream": True,
"stream_options": {"include_usage": True},
"timings_per_token": True} # llama.cpp extension, ignored by vLLM
if not think:
payload["chat_template_kwargs"] = {"enable_thinking": False} # both engines accept it; templates without it ignore it
t0 = time.perf_counter(); ttft = None; ntok = 0; usage = None; timings = None
for raw in http(base.rstrip("/") + "/chat/completions", key, payload, timeout):
line = raw.decode("utf-8", "ignore").strip()
if not line.startswith("data:"):
continue
body = line[5:].strip()
if body == "[DONE]":
break
try:
c = json.loads(body)
except ValueError:
continue
ch = c.get("choices") or [{}]
d = ch[0].get("delta", {}) if ch else {}
if d.get("content") or d.get("reasoning_content") or d.get("reasoning"):
if ttft is None:
ttft = time.perf_counter() - t0
ntok += 1
if c.get("usage"):
usage = c["usage"]
if c.get("timings"):
timings = c["timings"]
total = time.perf_counter() - t0
comp = (usage or {}).get("completion_tokens") or ntok
ptok = (usage or {}).get("prompt_tokens")
gen_s = total - (ttft or total)
tg = comp / gen_s if gen_s > 0 else 0.0
pp = (ptok / ttft) if (ptok and ttft) else None
srv = timings.get("predicted_per_second") if timings else None # llama.cpp's own number, for the ledger
return {"tg": tg, "pp": pp, "ttft": ttft or 0.0, "ptok": ptok or 0, "ctok": comp, "wall": total, "srv": srv,
"t0": t0, "t1": t0 + total}
def with_retries(fn, retries, wait, label=""):
last = None
for i in range(retries + 1):
try:
return fn()
except urllib.error.HTTPError as e:
body = e.read().decode("utf-8", "ignore")[:300]
if e.code < 500 or "failed to load" in body.lower():
raise
last = e
except (urllib.error.URLError, ConnectionError, TimeoutError) as e:
last = e
if i < retries:
print(f" … {label}: not ready ({last}); retry in {wait}s", file=sys.stderr)
time.sleep(wait)
raise last
def vllm_up(url):
try:
return http(re.sub(r"/v1/?$", "", url) + "/health", "x", timeout=3).status == 200
except Exception:
return False
def _status(m):
"""Router /models status: newer builds send {'value': 'loaded'|'sleeping'|'unloaded'|…}, older a string."""
st = m.get("status", "loaded")
return st.get("value", "loaded") if isinstance(st, dict) else st
def router_loaded(url):
try:
d = json.load(http(re.sub(r"/v1/?$", "", url) + "/models", "x", timeout=3))
return [m["id"] for m in d.get("data", []) if _status(m) in ("loaded", "loading")]
except Exception:
return []
def router_active():
try:
r = subprocess.run(["systemctl", "is-active", "llama.service"], capture_output=True, text=True, timeout=10)
except (OSError, subprocess.TimeoutExpired):
return False
return r.stdout.strip() == "active"
def main():
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
ap.add_argument("-t", "--target", action="append", required=True,
help="engine:model, engine = llamacpp | vllm (repeatable)")
ap.add_argument("--url", action="append", default=[], help="engine=URL override, e.g. vllm=http://host:11348/v1")
ap.add_argument("-k", "--key", default="no-key-required")
ap.add_argument("-n", "--tokens", type=int, default=256)
ap.add_argument("--temp", type=float, default=0.3)
ap.add_argument("--ctx", type=int, default=0, help="also record decode at ~this many prompt tokens")
ap.add_argument("--concurrency", type=int, default=0, help="also record aggregate t/s with N parallel requests")
ap.add_argument("--think", action="store_true", help="leave the model's thinking ON (default: off on both engines)")
ap.add_argument("--timeout", type=int, default=600)
ap.add_argument("--retries", type=int, default=4); ap.add_argument("--retry-wait", type=int, default=15)
ap.add_argument("--force", action="store_true", help="skip the two-engines-resident guards")
ap.add_argument("--out", default=os.path.join(HERE, "bench-vs-results.md"))
ap.add_argument("--history", default=os.path.join(HERE, "bench-vs-history.md"))
a = ap.parse_args()
urls = dict(URLS)
for u in a.url:
k, v = u.split("=", 1); urls[k] = v
llcfg = parse_ini(os.path.join(HERE, "..", "llamacpp", "config.ini"))
vlcfg = parse_ini(os.path.join(HERE, "vllm.ini"))
total = sysfs("mem_info_vram_total")
if total is None:
print(" (amdgpu sysfs not readable here — VRAM columns are OFF; run this ON fl for them)", file=sys.stderr)
filler = ("The quick brown fox jumps over the lazy dog. " * max(1, a.ctx // 9)) if a.ctx else None
cols = ["engine", "model", "cfg ctx", "spec", "decode t/s", "prefill t/s", "TTFT s", "VRAM used", "VRAM free"]
if a.ctx:
cols.append(f"decode@{a.ctx // 1000}k")
if a.concurrency:
cols.append(f"agg t/s @{a.concurrency}")
latest = open(a.out, "w", encoding="utf-8"); hist = open(a.history, "a", encoding="utf-8")
def emit(line):
print(line); latest.write(line + "\n"); latest.flush(); hist.write(line + "\n"); hist.flush()
latest.write("# llama.cpp vs vLLM (latest run)\n\n"); hist.write(f"\n## run {datetime.now():%Y-%m-%d %H:%M}\n\n")
emit(f"_Run {datetime.now():%Y-%m-%d %H:%M} · gen {a.tokens} tok · temp {a.temp} · thinking "
f"{'ON' if a.think else 'OFF'} · VRAM total {gb(total)} · baseline used {gb(sysfs('mem_info_vram_used'))} · "
f"decode = usage tokens / wall after first token on BOTH engines (llama.cpp's own timings in parentheses)_\n")
emit("| " + " | ".join(cols) + " |"); emit("|" + "|".join(["---"] * len(cols)) + "|")
for t in a.target:
eng, _, model = t.partition(":")
if eng not in urls or not model:
emit(f"| {eng} | {model} | bad target — use engine:model with engine in {list(urls)} |"); continue
base = urls[eng]
# guards
if not a.force:
if eng == "llamacpp" and vllm_up(urls["vllm"]):
emit(f"| llamacpp | {model} | ⚠ SKIPPED: vLLM is up on {urls['vllm']} — loading a router model on top = freeze. "
f"`vllmctl.py down` first |"); continue
if eng == "vllm":
loaded = router_loaded(urls["llamacpp"])
if loaded or router_active():
emit(f"| vllm | {model} | ⚠ SKIPPED: router loaded={loaded or '-'} active={router_active()} — "
f"stop llama.service before benching vLLM |"); continue
if eng == "llamacpp":
c = llcfg.get(model, {})
cfgctx, spec = c.get("ctx-size", "-"), (c.get("spec-type") or "-")
else:
c = vlcfg.get(model, {})
cfgctx = c.get("max-model-len", "-")
spec = "mtp" if c.get("speculative-config") else "-"
cells = [eng, model, cfgctx, spec]
try:
with_retries(lambda: run(base, a.key, model, "hi", 8, a.temp, a.timeout, a.think), a.retries, a.retry_wait, model)
used = sysfs("mem_info_vram_used")
r = with_retries(lambda: run(base, a.key, model, TASK, a.tokens, a.temp, a.timeout, a.think), a.retries, a.retry_wait, model)
dec = f"{r['tg']:.1f}" + (f" ({r['srv']:.1f})" if r["srv"] else "")
cells += [dec, f"{r['pp']:.0f}" if r["pp"] else "-", f"{r['ttft']:.2f}", gb(used),
gb(total - used) if (total and used is not None) else "-"]
if a.ctx:
rc = run(base, a.key, model, filler + "\n\n" + TASK, a.tokens, a.temp, a.timeout, a.think)
cells.append(f"{rc['tg']:.1f}")
if a.concurrency:
res = [None] * a.concurrency
def worker(i):
res[i] = run(base, a.key, model, TASK + f" (variant {i})", a.tokens, a.temp, a.timeout, a.think)
th = [threading.Thread(target=worker, args=(i,)) for i in range(a.concurrency)]
for x in th: x.start()
for x in th: x.join()
ok = [x for x in res if x]
wall = max(x["t1"] for x in ok) - min(x["t0"] for x in ok)
cells.append(f"{sum(x['ctok'] for x in ok) / wall:.1f}" if wall > 0 else "-")
except Exception as e:
err = f"HTTP {e.code} {e.read().decode('utf-8', 'ignore')[:120]!r}" if isinstance(e, urllib.error.HTTPError) else f"ERROR {e}"
cells = cells[:4] + [err] + [""] * (len(cols) - 5) # same width whether it died early or in the --ctx/--concurrency pass
emit("| " + " | ".join(str(x) for x in cells) + " |")
latest.write("\n_llama.cpp rows run with the preset's MTP draft when `spec` says so; vLLM rows have no speculation "
"unless `spec` = mtp. `agg t/s @N` = N parallel requests, completion tokens over the wall time of "
"the whole batch (llama-server's default slot count serves them in parallel too)._\n")
latest.close(); hist.close()
print(f"\nwrote {a.out} (+ appended {a.history})")
if __name__ == "__main__":
main()
+92
View File
@@ -0,0 +1,92 @@
# vLLM presets for fl — AMD RX 7600 XT · 16 GB · docker image vllm/vllm-openai-rocm
# Same convention as ../llamacpp/config.ini: section name = served model id, `key = value` = `--key value`.
#
# ⚠ ONE ENGINE AT A TIME. vLLM pre-allocates `gpu-memory-utilization` × 16 GiB at startup and KEEPS it.
# Any llama.cpp load on top (a client hitting :11343 is enough) overcommits → GTT spill → PC freeze.
# `vllmctl.py up` refuses to start while llama.service is active — stop the router first
# (`vllmctl.py up <preset> --stop-router`), start it again after `vllmctl.py down`.
#
# Sections:
# [global] container/runtime knobs (NOT vllm flags) — see vllmctl.py
# [<preset>] one `vllmctl.py up <preset>`:
# model HF repo id, or /models/<dir> (models-dir is mounted at /models, read-only)
# any other key → `--key value` for `vllm serve`; `true` → bare `--key`; `false` → omitted
# served-model-name defaults to the section name (what clients and bench-vs.py use)
# x-* vllmctl-only metadata (x-weights-gb feeds the VRAM projection)
# env.NAME = value container environment (per preset; [global] env.* apply to all)
#
# VRAM MATH (vllmctl prints it before every start, aborts under reserve-gb unless --force):
# budget = gpu-memory-utilization × 17.16 GB (vLLM's total = the card's total, same as sysfs)
# budget must hold weights + activations + KV cache; everything above it + the desktop must stay
# under 16 GB with ≥ reserve-gb free. 0.75 → 12.9 GB budget → ~2.9 GB free on a 1.3 GB clean desktop.
# A busy evening desktop (3+ GB) does NOT fit any of the real models below — clean desktop only.
# Sizes measured 2026-10-21 from the HF API: the 4-bit vLLM checkpoints are 10-11.5 GB because
# embeddings, lm_head and the vision tower stay bf16 — bigger than the Q6/Q8 GGUFs they pair with.
[global]
image = vllm/vllm-openai-rocm:v0.32.0 # = `latest` on 2026-10-18 (ROCm 10.0, 11.6 GB download); update = bump this + `vllmctl.py pull`
container = vllm
port = 11348 # whisper = 11345/11346, kokoro = 11347
models-dir = /home/anon/software/models # mounted at /models (ro) — share the GGUF dir
hf-cache = /home/anon/.cache/huggingface # mounted at /root/.cache/huggingface (downloads + token)
router = http://127.0.0.1:11343 # llama.cpp router root (for the resident-model gate)
reserve-gb = 2.0 # abort if projected free VRAM < this (bench.py floor 1.5, target 2.5)
drain-gb = 4.0 # "card is clean" threshold before starting (same as bench.py)
health-timeout = 1800 # s — first start compiles Triton kernels, be patient
gpu-memory-utilization = 0.75 # default; presets override
# REQUIRED on this card (✓ verified 2026-10-21): v0.32.0 ships no gfx1102 code objects — without the
# override every GPU kernel launch aborts the process SILENTLY (the engine core just vanishes, the
# API server reports "Failed core proc(s): {}"). gfx1100 (RX 7900) code runs on gfx1102, same RDNA3 ISA.
env.HSA_OVERRIDE_GFX_VERSION = 11.0.0
# Attention backend knobs (ROCm; names moved between versions — `vllmctl.py exec vllm serve --help`):
# env.VLLM_ATTENTION_BACKEND = TRITON_ATTN # the default on RDNA; set explicitly if a hang points at attention
# ─── 1. smoke test — tiny, certain to be supported; proves docker + GPU + image + override ────
# ✓ 2026-10-21: 154.9 t/s decode · 1462 t/s prefill · TTFT 0.02 s · 7.7 GB used incl. a 2.9 GB desktop.
[Qwen3-0.6B-smoke]
model = Qwen/Qwen3-0.6B
gpu-memory-utilization = 0.30
max-model-len = 4096
x-weights-gb = 1.5
# ─── 2. gemma-4-E4B — ✗ DOES NOT FIT vLLM ON THIS CARD (2026-10-21), tombstone kept for the math ──
# Pairs with llama.cpp [gemma-4-E4B-it-UD-Q8_K_XL] (57 t/s with MTP, 96k ctx). google/gemma-4-E4B-it-qat-w4a16-ct
# is 11.5 GB, and the second try (text-only, batch 2048, @0.73 on a 2.1 GB desktop) ended with
# "Available KV cache memory: -4.44 GiB" after an OOM on a 5,637,144,576-byte allocation. That is exactly
# Gemma 4's per-layer embedding table: 262144 vocab × 42 layers × 256 × 2 bytes (bf16). vLLM holds it
# in bf16 AND needs a second buffer of the same size → ~16 GiB before any KV block. No util, batch or
# desktop fixes that; the GPTQ/AWQ alternatives carry the same bf16 table. llama.cpp fits because the
# GGUF stores the table quantized, once. A different image changes nothing here.
# [gemma-4-E4B-it-w4a16]
# model = google/gemma-4-E4B-it-qat-w4a16-ct
# gpu-memory-utilization = 0.78
# max-model-len = 16384
# max-num-seqs = 4
# max-num-batched-tokens = 2048
# limit-mm-per-prompt = {"image": 0, "audio": 0, "video": 0}
# x-weights-gb = 11.5
# ─── 3. Qwen3.5-9B — pairs with llama.cpp [Qwen3.5-9B-UD-Q6_K_XL] (32 t/s with MTP, 32k ctx) ──
# Red Hat's llm-compressor int4 (compressed-tensors). 10.95 GB + a 0.49 GB MTP head file.
# Alternative (real AWQ, Triton kernels on ROCm): QuantTrio/Qwen3.5-9B-AWQ — 12.4 GB, too big for 0.78.
# The last viable "same model" pair: no per-layer table, but a 248k vocab → the fp32 logits buffer
# during profiling is max-num-batched-tokens × 248k × 4 B (2048 → 2.0 GB, 512 → 0.5 GB). Start small.
# On a 2.1 GB desktop the projection allows 0.75 (`--set gpu-memory-utilization=0.75`) → ~1.9 GB for
# activations + graphs + KV. If "No available memory for the cache blocks" again: `--set enforce-eager=true`
# (drops the CUDA-graph memory, costs decode speed), then a cleaner desktop for 0.78.
# ✓ RUNS 2026-10-21 @0.80 (0.75 was 0.11 GiB short of KV room): 29.4 t/s decode · 181 prefill · TTFT 0.17 ·
# decode@8k 16.0 · 4-stream aggregate 60.6 · 12.5 GB used on a 0.6 GB desktop. Same evening, llama.cpp
# [Qwen3.5-9B-UD-Q6_K_XL] with its MTP draft: 61.3 · 114 · 0.27 · 51.1 · 85.4 · 10.9 GB. See README.
[Qwen3.5-9B-w4a16]
model = RedHatAI/Qwen3.5-9B-quantized.w4a16
gpu-memory-utilization = 0.80 # needs a ≤ 0.6 GB desktop (projection: 2.9 GB free); 0.75 fails on KV room
max-model-len = 16384
max-num-seqs = 4
max-num-batched-tokens = 512 # caps the profiling logits buffer (prefill t/s cost — note it in the ledger)
limit-mm-per-prompt = {"image": 0, "video": 0} # text-only bench (Qwen3.5 has no audio input)
x-weights-gb = 11.0
# NEXT (the one knob that could change the verdict): MTP speculative decoding — the repo ships
# model_mtp.safetensors and llama.cpp's 2× comes from exactly this. Costs ~0.5 GB weights + draft
# state → try @0.82 on a clean desktop. Syntax per `vllmctl.py exec vllm serve --help`:
# ./vllmctl.py up Qwen3.5-9B-w4a16 --set gpu-memory-utilization=0.82 --set 'speculative-config={"method": "mtp", "num_speculative_tokens": 2}'
# speculative-config = {"method": "mtp", "num_speculative_tokens": 2}
+398
View File
@@ -0,0 +1,398 @@
#!/usr/bin/env python3
"""
vllmctl — run vLLM (docker, ROCm) on fl WITHOUT freezing the box.
The RX 7600 XT drives the display; VRAM overcommit spills to GTT and freezes the PC. vLLM grabs
`gpu-memory-utilization` × total VRAM at startup and keeps it, so this script gates every start:
1. llama.service must be STOPPED (or --stop-router): a LAN client hitting :11343 would make the
router load a model on top of vLLM = the freeze. --unsafe-keep-router skips this gate.
2. the card must be clean (VRAM used ≤ drain-gb; resident router models are unloaded via its API).
3. projected free VRAM = total − used − budget must be ≥ reserve-gb (else abort, --force overrides).
Presets live in vllm.ini next to this file (same key = --flag convention as llamacpp/config.ini).
./vllmctl.py up <preset> [--stop-router] [--force] [--dry-run] start, wait for /health
./vllmctl.py down stop, wait for VRAM to drain
./vllmctl.py status | logs | pull | gpu-check | exec <cmd...>
Stdlib only. Run ON fl.
"""
import argparse, grp, json, os, re, shlex, subprocess, sys, time, urllib.request, urllib.error
HERE = os.path.dirname(os.path.abspath(__file__))
INI = os.path.join(HERE, "vllm.ini")
DRM = "/sys/class/drm/renderD128/device"
# ─── ini ────────────────────────────────────────────────────────────────────────────────────
def parse_ini(path):
"""{section: {key: value}} — inline `# comments` stripped, order kept."""
sections, sec = {}, None
for ln in open(path, encoding="utf-8").read().splitlines():
s = ln.strip()
if not s or s.startswith("#"):
continue
if s.startswith("[") and s.endswith("]"):
sec = s[1:-1]; sections[sec] = {}
elif sec and "=" in s:
k, v = s.split("=", 1)
sections[sec][k.strip()] = v.split(" #", 1)[0].split("\t#", 1)[0].strip()
return sections
def build_args(preset):
"""vllm serve args from a preset section (x-* and env.* are not flags)."""
args = []
for k, v in preset.items():
if k.startswith("x-") or k.startswith("env."):
continue
if v.lower() == "false":
continue
if v.lower() == "true":
args.append(f"--{k}")
else:
args += [f"--{k}", v]
return args
# ─── gpu / router ───────────────────────────────────────────────────────────────────────────
def sysfs(name):
try:
return int(open(os.path.join(DRM, name)).read().strip())
except (OSError, ValueError):
return None
def vram():
"""(used, total, gtt_used) bytes from amdgpu sysfs; None where unreadable."""
return sysfs("mem_info_vram_used"), sysfs("mem_info_vram_total"), sysfs("mem_info_gtt_used")
def gb(b):
return f"{b / 1e9:.1f} GB" if b is not None else "-"
def http(url, payload=None, timeout=10):
data = json.dumps(payload).encode() if payload is not None else None
hdrs = {"Content-Type": "application/json"} if data else {}
return urllib.request.urlopen(urllib.request.Request(url, data=data, headers=hdrs), timeout=timeout)
def _status(m):
"""Router /models status: newer builds send {'value': 'loaded'|'sleeping'|'unloaded'|…}, older a string."""
st = m.get("status", "loaded")
return st.get("value", "loaded") if isinstance(st, dict) else st
def router_loaded(root):
"""ids the llama.cpp router reports as loaded ([] if unreachable)."""
try:
d = json.load(http(root.rstrip("/") + "/models", timeout=5))
except Exception:
return []
return [m["id"] for m in d.get("data", []) if _status(m) in ("loaded", "loading")]
def router_unload(root):
for m in router_loaded(root):
try:
http(root.rstrip("/") + "/models/unload", {"model": m}, timeout=30).read()
except Exception:
pass
def router_active():
try:
r = subprocess.run(["systemctl", "is-active", "llama.service"], capture_output=True, text=True, timeout=10)
except (OSError, subprocess.TimeoutExpired):
return False
return r.stdout.strip() == "active"
def router_hint():
return "" if router_active() else "\n (llama.service is STOPPED → sudo systemctl start llama.service to bring the router back)"
def wait_drain(drain_gb, window_s, label):
used, _, _ = vram()
end = time.time() + window_s
said = False
while used is not None and used > drain_gb * 1e9 and time.time() < end:
if not said:
print(f" … waiting for VRAM to drain {label} ({gb(used)} used)"); said = True
time.sleep(5)
used, _, _ = vram()
return used
# ─── docker ─────────────────────────────────────────────────────────────────────────────────
def docker(*args, check=True, capture=True):
return subprocess.run(["docker", *args], check=check, capture_output=capture, text=True)
def container_state(name):
r = docker("inspect", "-f", "{{.State.Status}}", name, check=False)
return r.stdout.strip() if r.returncode == 0 else None
def gpu_flags():
flags = ["--device", "/dev/kfd", "--device", "/dev/dri", "--group-add", "video",
"--cap-add", "SYS_PTRACE", "--security-opt", "seccomp=unconfined", "--ipc=host"]
try:
flags += ["--group-add", str(grp.getgrnam("render").gr_gid)] # Arch: /dev/dri/renderD128 is group render
except KeyError:
pass
return flags
def run_cmd(g, name, preset, envs):
cmd = ["docker", "run", "-d", "--name", g["container"], *gpu_flags(),
"-p", f'{g["port"]}:8000',
"-v", f'{g["models-dir"]}:/models:ro',
"-v", f'{g["hf-cache"]}:/root/.cache/huggingface']
for k, v in envs.items():
cmd += ["-e", f"{k}={v}"]
cmd.append(g["image"])
cmd += ["--host", "0.0.0.0", "--port", "8000", "--served-model-name", preset.get("served-model-name", name)]
cmd += build_args({k: v for k, v in preset.items() if k != "served-model-name"})
return cmd
ROOT_CAUSE = re.compile(r"hipError|HSA_STATUS|code object|gfx\d+|no kernel image|EngineCore.*(ERROR|Error|error)"
r"|^\S*(ERROR|CRITICAL)|RuntimeError|ValueError|NotImplementedError|OutOfMemory|Killed|Segmentation"
r"|free memory|not supported|Unsupported|Traceback|memory profiling|kv cache memory|weights take|peak", re.I)
def root_cause(lines):
"""The lines that explain a dead engine core: known ROCm/vLLM failure signatures, the FIRST
traceback's error line, and the last 8 lines — not the parent's 40-line stack trace."""
out, seen = [], set()
for l in lines:
if ROOT_CAUSE.search(l) and "api_server" not in l and "core_client" not in l and "launch_core_engines" not in l:
key = l.strip()[:120]
if key not in seen:
seen.add(key); out.append(l.rstrip())
if len(out) >= 30:
break
return out + ["…"] + [l.rstrip() for l in lines[-8:]]
# ─── commands ───────────────────────────────────────────────────────────────────────────────
def cmd_up(a, cfg):
g = cfg["global"]
if a.preset not in cfg or a.preset == "global":
sys.exit(f"unknown preset {a.preset!r}; have: {', '.join(k for k in cfg if k != 'global')}")
preset = dict(cfg[a.preset])
preset.update(dict(kv.split("=", 1) for kv in a.set)) # --set gpu-memory-utilization=0.73 --set max-model-len=8192
preset.setdefault("gpu-memory-utilization", g.get("gpu-memory-utilization", "0.75"))
envs = {k[4:]: v for k, v in g.items() if k.startswith("env.")}
envs.update({k[4:]: v for k, v in preset.items() if k.startswith("env.")})
envs.update(dict(e.split("=", 1) for e in a.env))
util = float(preset["gpu-memory-utilization"])
reserve = float(a.reserve if a.reserve is not None else g.get("reserve-gb", 2.0))
drain = float(g.get("drain-gb", 4.0))
cmd = run_cmd(g, a.preset, preset, envs)
print("docker command:\n " + " ".join(shlex.quote(c) for c in cmd) + "\n")
if a.dry_run:
return
st = container_state(g["container"])
if st == "running":
sys.exit(f"container {g['container']} is already running — `vllmctl.py down` first")
if st: # leftover from a crash: its log is the evidence, show the tail, then clear the name
r = docker("logs", "--tail", "15", g["container"], check=False)
print(f"removing old container ({st}); its last lines were:\n" + "\n".join(" | " + l for l in (r.stdout + r.stderr).strip().splitlines()[-15:]))
docker("rm", g["container"], check=False)
# 1. clean card — unload resident router models through its API while it is still up, then drain
if router_active():
router_unload(g["router"])
used = wait_drain(drain, 180, "before start")
used, total, gtt = vram()
if used is None or total is None:
if not a.force:
sys.exit(f"ABORT: cannot read {DRM}/mem_info_vram_* — no VRAM guard, not starting blind (--force overrides)")
print("⚠ FORCED without a VRAM guard (sysfs unreadable)"); used, total = 0, 1
if used > drain * 1e9 and not a.force:
sys.exit(f"ABORT: card not clean — {gb(used)} VRAM used (> drain-gb {drain}). Leftover model / GPU apps?")
# 2. projection — abort here costs nothing, llama.service is still running
budget = util * total
free_after = total - used - budget
weights = float(preset.get("x-weights-gb", 0) or 0) * 1e9
print(f"VRAM: total {gb(total)} · used now {gb(used)} (GTT {gb(gtt)}) · vLLM budget {util:.2f} × total = {gb(budget)}"
f"\n → projected free {gb(free_after)} (reserve {reserve} GB)")
if weights:
room = budget - weights
print(f" budget − weights {gb(weights)} = {gb(room)} for activations + KV cache"
+ (" ⚠ < 1 GB: expect 'no memory for KV cache' → raise util or lower max-model-len" if room < 1e9 else ""))
if free_after < reserve * 1e9:
suggest = max(0.0, (total - used - reserve * 1e9) / total)
msg = (f"projected free {gb(free_after)} < reserve {reserve} GB. Max safe gpu-memory-utilization right now "
f"= {suggest:.2f} (desktop is using {gb(used)}).")
if not a.force:
sys.exit("ABORT: " + msg + f"\n → free the desktop (vramx) or `--set gpu-memory-utilization={suggest:.2f}` "
f"(+ `--set max-model-len=8192` if weights leave < 1 GB); --force to start anyway.")
print("⚠ FORCED: " + msg)
# 3. router gate — the only thing that stops a LAN client from loading a model on top of vLLM
if router_active():
if a.stop_router:
print("stopping llama.service (sudo) …")
subprocess.run(["sudo", "systemctl", "stop", "llama.service"], check=True)
elif a.unsafe_keep_router:
print("⚠ llama.service stays ACTIVE: any client request to :11343 while vLLM runs = GTT freeze.")
else:
sys.exit("ABORT: llama.service is active. Any client request to :11343 would load a model on top "
"of vLLM and freeze the PC.\n → re-run with --stop-router (sudo systemctl stop llama.service), "
"or --unsafe-keep-router if you really know nothing will call the router.")
used2, _, _ = vram()
if used2 is not None and used2 > used + 1e9: # a client loaded something between projection and stop
print(f"⚠ VRAM grew to {gb(used2)} meanwhile — vLLM's own free-memory check should refuse; watch the start")
# 4. start + wait
cid = subprocess.run(cmd, check=True, capture_output=True, text=True).stdout.strip()
print(f"started {cid[:12]} — waiting for http://127.0.0.1:{g['port']}/health (timeout {g.get('health-timeout', 1800)} s; "
f"first start compiles kernels)")
end = time.time() + int(g.get("health-timeout", 1800))
last_log, shown = 0, set()
while time.time() < end:
st = container_state(g["container"])
if st != "running":
r = docker("logs", g["container"], check=False)
print("root cause candidates (full log: docker logs " + g["container"] + "):")
for l in root_cause((r.stdout + r.stderr).splitlines()):
print(" | " + l[:200])
sys.exit(f"ABORT: container is {st or 'gone'}. If a line names gfx1102 / 'code object' / hipErrorNoBinaryForGpu: "
f"uncomment env.HSA_OVERRIDE_GFX_VERSION = 11.0.0 in [global] and retry." + router_hint())
try:
if http(f"http://127.0.0.1:{g['port']}/health", timeout=3).status == 200:
break
except Exception:
pass
if time.time() - last_log > 30:
r = docker("logs", "--tail", "3", g["container"], check=False)
tail = (r.stdout + r.stderr).strip().splitlines()[-3:]
for t in tail:
if t not in shown: # only lines not printed before (compile phases are quiet for minutes)
print(" | " + t[:160]); shown.add(t)
last_log = time.time()
time.sleep(3)
else:
sys.exit("ABORT: no /health within the timeout — `vllmctl.py logs`, then `vllmctl.py down`" + router_hint())
used, total, gtt = vram()
print(f"UP. VRAM used {gb(used)} / free {gb(total - used)} · GTT {gb(gtt)}")
try:
ids = [m["id"] for m in json.load(http(f"http://127.0.0.1:{g['port']}/v1/models")).get("data", [])]
print(f"models: {', '.join(ids)} → http://192.168.0.204:{g['port']}/v1")
except Exception as e:
print(f"(/v1/models not readable yet: {e})")
print(f"next: ./bench-vs.py -t vllm:{preset.get('served-model-name', a.preset)} · when done: ./vllmctl.py down")
def cmd_down(a, cfg):
g = cfg["global"]
st = container_state(g["container"])
if st:
print(f"stopping {g['container']} ({st}) …")
docker("stop", "-t", "60", g["container"], check=False)
docker("rm", g["container"], check=False)
else:
print("container not running")
used = wait_drain(float(g.get("drain-gb", 4.0)), 120, "after stop")
used, total, gtt = vram()
print(f"VRAM used {gb(used)} / free {gb(total - used) if total and used is not None else '-'} · GTT {gb(gtt)}")
if not router_active():
print("llama.service is stopped → `sudo systemctl start llama.service` to bring the router back")
def cmd_status(a, cfg):
g = cfg["global"]
used, total, gtt = vram()
print(f"container {g['container']}: {container_state(g['container']) or 'not running'}")
print(f"VRAM used {gb(used)} / total {gb(total)} · GTT {gb(gtt)}")
print(f"llama.service: {'ACTIVE' if router_active() else 'stopped'} · loaded: {router_loaded(g['router']) or '-'}")
try:
ids = [m["id"] for m in json.load(http(f"http://127.0.0.1:{g['port']}/v1/models", timeout=3)).get("data", [])]
print(f"vLLM :{g['port']} serving: {', '.join(ids)}")
except Exception:
print(f"vLLM :{g['port']}: not answering")
def cmd_logs(a, cfg):
os.execvp("docker", ["docker", "logs", "-f", "--tail", "100", cfg["global"]["container"]])
def cmd_pull(a, cfg):
os.execvp("docker", ["docker", "pull", cfg["global"]["image"]])
GPU_CHECK = r"""
import os, torch
print('HSA_OVERRIDE_GFX_VERSION =', os.environ.get('HSA_OVERRIDE_GFX_VERSION', '(unset)'))
print('cuda available:', torch.cuda.is_available())
p = torch.cuda.get_device_properties(0)
print('device:', torch.cuda.get_device_name(0) or '(no name)', p.gcnArchName, f'{p.total_memory / 1e9:.1f} GB')
print('torch kernel …', end=' ', flush=True) # a hard abort here (no code object for this arch) prints nothing more
x = torch.ones(1024, device='cuda'); torch.cuda.synchronize(); print('ok', x.sum().item())
import vllm._C # noqa
ops = sorted({s.name.split('::', 1)[1] for s in torch._C._jit_get_all_schemas() if s.name.startswith('_C::')})
print(f'vllm _C ops registered: {len(ops)}')
f16 = dict(device='cuda', dtype=torch.float16)
probes = {'silu_and_mul': lambda: torch.ops._C.silu_and_mul(torch.empty(4, 8, **f16), torch.randn(4, 16, **f16)),
'gelu_fast': lambda: torch.ops._C.gelu_fast(torch.empty(4, 8, **f16), torch.randn(4, 8, **f16)),
'rms_norm': lambda: torch.ops._C.rms_norm(torch.empty(4, 8, **f16), torch.randn(4, 8, **f16), torch.ones(8, **f16), 1e-6)}
for name, fn in probes.items():
if name in ops:
print(f'vllm custom op {name} …', end=' ', flush=True); fn(); torch.cuda.synchronize(); print('ok -> the image has kernels for this arch')
break
else:
print('none of the probe ops exist in this build; first ops:', ops[:15])
"""
def cmd_gpu_check(a, cfg):
"""Does the image see the card? Prints torch's device name + arch (needs no model)."""
g = cfg["global"]
envs = [x for k, v in g.items() if k.startswith("env.") for x in ("-e", f"{k[4:]}={v}")]
envs += [x for e in a.env for x in ("-e", e)]
code = GPU_CHECK
cmd = ["docker", "run", "--rm", *gpu_flags(), *envs, "--entrypoint", "python3", g["image"], "-u", "-c", code]
print(" ".join(shlex.quote(c) for c in cmd))
os.execvp("docker", cmd)
def cmd_exec(a, cfg):
g = cfg["global"]
if container_state(g["container"]) == "running":
os.execvp("docker", ["docker", "exec", "-it", g["container"], *a.cmd])
envs = [x for k, v in g.items() if k.startswith("env.") for x in ("-e", f"{k[4:]}={v}")]
os.execvp("docker", ["docker", "run", "--rm", "-it", *gpu_flags(), *envs, "--entrypoint", a.cmd[0], g["image"], *a.cmd[1:]])
def main():
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
ap.add_argument("--ini", default=INI)
sub = ap.add_subparsers(dest="cmd", required=True)
up = sub.add_parser("up"); up.add_argument("preset")
up.add_argument("--stop-router", action="store_true", help="sudo systemctl stop llama.service first")
up.add_argument("--unsafe-keep-router", action="store_true", help="leave llama.service running (freeze risk)")
up.add_argument("--force", action="store_true", help="ignore the VRAM projection / clean-card checks")
up.add_argument("--reserve", type=float, help="override reserve-gb")
up.add_argument("--dry-run", action="store_true", help="print the docker command only")
up.add_argument("--env", action="append", default=[], metavar="KEY=VAL", help="extra container env (e.g. HSA_OVERRIDE_GFX_VERSION=11.0.0)")
up.add_argument("--set", action="append", default=[], metavar="KEY=VAL", help="override a preset key for this start (e.g. gpu-memory-utilization=0.73)")
sub.add_parser("down"); sub.add_parser("status"); sub.add_parser("logs"); sub.add_parser("pull")
gc = sub.add_parser("gpu-check"); gc.add_argument("--env", action="append", default=[], metavar="KEY=VAL")
ex = sub.add_parser("exec"); ex.add_argument("cmd", nargs=argparse.REMAINDER)
a = ap.parse_args()
cfg = parse_ini(a.ini)
if "global" not in cfg:
sys.exit(f"{a.ini}: no [global] section")
{"up": cmd_up, "down": cmd_down, "status": cmd_status, "logs": cmd_logs, "pull": cmd_pull,
"gpu-check": cmd_gpu_check, "exec": cmd_exec}[a.cmd](a, cfg)
if __name__ == "__main__":
main()
+193
View File
@@ -0,0 +1,193 @@
# Speech-to-text — setup & usage
whisper.cpp serving Whisper models over an **OpenAI-compatible** transcription endpoint, so Open WebUI's
mic button works against local hardware. Added **2026-08-08**.
- **Box**: same fl server as the LLM router — but this runs **entirely on CPU** (Ryzen 5600X, 6 cores).
- **Files here**: `whisper@.service` (one template unit) + one `<instance>.env` per model.
Models live with the GGUFs in `~/software/models/`.
| instance | endpoint | model | speed / use |
|---|---|---|---|
| **`whisper@turbo`** | `http://$SERVER:11345/v1` | `ggml-large-v3-turbo-q5_0` (574 MB) | **default** — best accuracy, multilingual, ~15 s per request. This is what OWUI points at. |
| `whisper@small` | `http://$SERVER:11346/v1` | `ggml-small.en-q5_1` (181 MB) | English-only, ~5x lighter. Point a client here when latency beats accuracy. |
Both run at once — together they're well under 1 GB of RAM and **zero VRAM**, so there is no reason to
stop one to use the other. Adding a third is a new `.env` file plus `systemctl enable --now whisper@<name>`.
## How it runs
Template unit **`whisper@.service`** (a dedicated service user), from `/usr/bin/whisper-server` (Arch `extra/whisper-cpp`).
Each instance reads `~/.config/whisper/<instance>.env`:
```
WHISPER_MODEL=/home/<user>/software/models/ggml-large-v3-turbo-q5_0.bin
WHISPER_PORT=11345
WHISPER_LANG=auto
```
which expands to:
```sh
whisper-server --model $WHISPER_MODEL \
--host 0.0.0.0 --port $WHISPER_PORT \
--inference-path /v1/audio/transcriptions \
--convert --tmp-dir /run/whisper-<instance> \
--no-gpu --threads 6 --language $WHISPER_LANG
```
It is a template rather than N copied units on purpose: the `--tmp-dir` bug below had to be found once
and fixed once, and that only stays true while there is exactly one `ExecStart` in the repo.
| flag | why |
|---|---|
| `--no-gpu` | **Load-bearing.** 0 VRAM — see below. |
| `--convert` | ffmpeg transcodes webm/opus/ogg → 16 kHz wav. Browsers record opus; whisper.cpp reads wav. **Requires ffmpeg on the box.** |
| `--inference-path` | `--request-path` defaults to empty, so this alone puts the route at `/v1/audio/transcriptions` — exactly where OWUI posts. |
| `--tmp-dir` | **Required.** Defaults to `"."`, i.e. the CWD — which is `/` here, and unwritable. Without it every request returns `FFmpeg conversion failed.`, plain wav included. `RuntimeDirectory=whisper-%i` creates and owns `/run/whisper-<instance>`. |
| `--language` | `auto` for multilingual models; `en` for `.en` models, where detection is pointless. |
| `--threads 6` | all cores; `Nice=5` yields to the router's CPU-offloaded experts. |
| ports `11345`/`11346` | clear of `11343` (router), **`11344` (the standalone embedding llama-server)** and `11434` (Ollama). Router *children* take random ephemeral ports (32768+), so low ports are safe from them — but run `ss -ltnp` before claiming one. |
Keyless on the LAN, same posture as the router. If this ever leaves the trusted LAN it needs a proxy
with auth in front — whisper-server has no `--api-key`.
**Deploying changes**: `/etc/systemd/system/whisper@.service` is a symlink to the file in the repo, so a
`git pull` edit is on disk immediately — but systemd caches unit files, so it still needs a reload.
(Copying into `/etc` instead would work, but then every repo edit silently drifts.) On the server:
```sh
dotsync # nudges you if this dir changed
sudo systemctl daemon-reload
sudo systemctl restart whisper@turbo whisper@small
```
Editing only an `.env` needs no `daemon-reload` — just restart that instance.
First install (stow does not install units):
```sh
yay -S whisper-cpp ffmpeg
curl -L -o ~/software/models/ggml-large-v3-turbo-q5_0.bin \
https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-large-v3-turbo-q5_0.bin
curl -L -o ~/software/models/ggml-small.en-q5_1.bin \
https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-small.en-q5_1.bin
# Point systemd at the REAL file in the repo, NOT the stowed symlink: stow already made
# ~/.config/whisper/whisper@.service a symlink, and systemctl rejects those with
# "Failed to link unit: Refusing to operate on linked unit file"
sudo systemctl link (readlink -f ~/.config/whisper/whisper@.service) # fish
sudo systemctl enable --now whisper@turbo whisper@small
```
## Why this is NOT a llama.cpp router preset
The router *does* expose `POST /v1/audio/transcriptions` (it rewrites the request into a chat completion
with the prompt "Transcribe audio to text"), and `gemma-4-E4B` genuinely accepts audio input. Tempting —
but two reasons it stays a separate service. Don't re-litigate this without re-checking both:
1. **`--models-max 1` eviction.** Every transcription would LRU-evict the resident chat model, and the
next chat message would reload it (~17.5 GB for GLM) with a cold prompt cache. Fine for a one-off
file; unusable for talking to a model.
2. **Format.** llama.cpp decodes audio via miniaudio — **wav/mp3/flac only**. OWUI's mic records
`audio/webm; codecs=opus` and its own transcode-to-mp3 step depends on ffprobe being usable inside
the OWUI AppImage; when that fails it silently forwards the opus file. `--convert` here makes the
question moot.
Third reason, softer: an LLM asked to transcribe can paraphrase or answer the audio instead of
transcribing it, and the `gemma-4-E4B` preset samples at temp 1.0. Whisper is purpose-built and boring.
**Still available as a fallback** for wav/mp3/flac (no config change needed), if these services are down:
```sh
curl -F file=@clip.wav -F model=gemma-4-E4B-it-UD-Q8_K_XL \
http://$SERVER:11343/v1/audio/transcriptions
```
## Open WebUI wiring
Admin Settings → **Audio** → Speech-to-Text:
| field | value |
|---|---|
| STT Engine | `OpenAI` |
| Base URL | `http://$SERVER:11345/v1` — no trailing path, OWUI appends `/audio/transcriptions`. Swap `11345`→`11346` for the fast instance. |
| API Key | any non-empty string (`none`) — ignored by whisper-server, but OWUI needs it set |
| STT Model | `whisper-1` — ignored by whisper-server; must not be blank |
| Request format | leave default (`multipart`) |
OWUI sends multipart `model` + optional `language` + `file`; whisper-server reads the fields it knows
and ignores the rest. Note it joins segments with newlines, so long dictations arrive in the composer
with line breaks mid-sentence.
## Verifying
```sh
systemctl status whisper@turbo whisper@small
rocm-smi --showmeminfo vram # must be UNCHANGED vs before the services started
curl -F file=@sample.wav http://$SERVER:11345/v1/audio/transcriptions # → {"text": "…"}
ffmpeg -i sample.wav -c:a libopus sample.webm # the case that actually matters:
curl -F file=@sample.webm http://$SERVER:11345/v1/audio/transcriptions # proves --convert
curl -F file=@sample.webm -F model=whisper-1 -F language=en \
http://$SERVER:11346/v1/audio/transcriptions # OWUI's exact shape
```
Then: with a chat model loaded, transcribe and confirm `http://$SERVER:11343/v1/models` still
shows it `ready`/`sleeping` — **not** `unloaded`. That is the whole point of the separate service.
**Measured 2026-08-08** (6 threads, CPU, 11 s JFK sample, `--convert` in the path):
| model | per request | verdict |
|---|---|---|
| `large-v3-turbo-q5_0` (574 MB) | **~15.2 s** | accurate; too slow to dictate into comfortably |
| `small.en-q5_1` (181 MB) | **~2.2 s** | **~7x faster.** Word-for-word identical to turbo on the JFK sample — only punctuation differs (`And so my fellow Americans` vs turbo's `And so, my fellow Americans,`). |
Runs were tight: small.en 2.16 / 2.16 / 2.20 s over three passes, turbo 15.1-15.2 s over three.
The webm/opus path costs nothing extra (2.19 s with `--convert` + OWUI's field shape).
**On this evidence turbo is hard to justify as the default** — 13 seconds per utterance buys a comma on
clean audio. Where it should still win is names, jargon, accents and non-English speech, which the JFK
sample cannot show. If small.en holds up on real dictation, point OWUI at `:11346` and demote turbo to
the second instance (or just swap the ports in the two `.env` files).
The cost is **flat** for both models: whisper pads every request to a 30 s window, so a 3 s clip costs
what a 30 s one does (turbo 15.1 s vs 15.2 s; small.en 2.08 s vs 2.20 s). It is a fixed toll per
utterance, not a rate — which is why the model is the only thing that moves it.
Flash-attention is already on by default in whisper-server, and the `parakeet-*` binaries in the package
have no server integration, so **model size is the only real dial**.
A/B any candidate without touching a service:
```sh
curl -LO https://github.com/ggml-org/whisper.cpp/raw/master/samples/jfk.wav # known text
time whisper-cli -m ~/software/models/ggml-small.en-q5_1.bin -f jfk.wav -t 6 -nt
time whisper-cli -m ~/software/models/ggml-base.en-q5_1.bin -f jfk.wav -t 6 -nt
```
## Troubleshooting
- **Every request returns `{"error":"FFmpeg conversion failed."}`, wav included** → the temp dir is not
writable by the service user. Check `--tmp-dir /run/whisper-<instance>` is in ExecStart and that
`RuntimeDirectory=` created it (`ls -ld /run/whisper-turbo`). ffmpeg itself is fine — the startup log
says `ffmpeg is available.` either way.
- **`Failed to load environment files`** → the instance has no `.env` (`whisper@foo` needs `foo.env`),
or the repo was not re-stowed after adding it (`install.sh` links new files; `dotsync` does it for you).
- **webm/opus uploads fail, wav works** → ffmpeg missing or `--convert` dropped. `ffmpeg -version` on
the box; the journal logs the conversion command on each non-wav request.
- **VRAM moved when transcribing** → `--no-gpu` lost, or the package was rebuilt with a GPU backend.
Fix immediately; this is the freeze scenario.
- **Empty / hallucinated text on near-silence** → whisper's classic failure. Try VAD:
download `ggml-silero-v5.1.2.bin` and add `--vad --vad-model …` to the template.
- **Still too slow** → next step down is `ggml-base.en-q5_1.bin` (56 MB, ~4x lighter again) at a real
cost in accuracy on names and jargon. New `.env`, or edit `small.env`.
- **OWUI: "Server Connection Error"** → base URL has a trailing `/audio/transcriptions` (it appends that
itself), or the port is not reachable from the client host.
## Watch list
- `whisper-cpp` also ships **`parakeet-cli`** — NVIDIA Parakeet is much faster than Whisper on CPU for
English. No server front-end upstream yet (`examples/` has `parakeet-cli` but no server path); worth
rechecking, it would be the real fix for the 15 s toll.
- **TTS** (the other half of voice chat) is unconfigured — OWUI can drive its own, or llama.cpp can
serve OuteTTS via `--model-vocoder`. Separate job.
+6
View File
@@ -0,0 +1,6 @@
# FAST instance (port 11346) — English-only, ~5x lighter than turbo.
# Same API; point a client at :11346 instead of :11345 when latency matters more than accuracy.
# For a multilingual equivalent use ggml-small-q5_1.bin and set WHISPER_LANG=auto.
WHISPER_MODEL=/home/anon/software/models/ggml-small.en-q5_1.bin
WHISPER_PORT=11346
WHISPER_LANG=en
+6
View File
@@ -0,0 +1,6 @@
# DEFAULT instance (port 11345) — the one Open WebUI points at.
# Best accuracy, multilingual. Measured 2026-08-08: ~15.1 s per request, FLAT (whisper pads every
# clip to a 30 s window, so a 3 s utterance costs the same as a 30 s one).
WHISPER_MODEL=/home/anon/software/models/ggml-large-v3-turbo-q5_0.bin
WHISPER_PORT=11345
WHISPER_LANG=auto
+48
View File
@@ -0,0 +1,48 @@
[Unit]
Description=whisper.cpp STT server "%i" (CPU-only) — OpenAI-compatible /v1/audio/transcriptions
Documentation=file:///home/anon/.config/whisper/README.md
After=network-online.target
Wants=network-online.target
[Service]
User=anon
Group=anon
WorkingDirectory=/
# TEMPLATE UNIT — one file, N instances. `systemctl start whisper@small` reads its model/port/language
# from ~/.config/whisper/small.env. Deliberately not N copies of this unit: the --tmp-dir bug below had
# to be found once and fixed once, and that only holds if there is exactly one ExecStart in the repo.
EnvironmentFile=/home/anon/.config/whisper/%i.env
# whisper-server's --tmp-dir defaults to "." — with WorkingDirectory=/ that means it tries to write
# uploads and ffmpeg output into the filesystem root, and every request dies with
# {"error":"FFmpeg conversion failed."} (yes, even plain wav: --convert pipes everything to ffmpeg)
# RuntimeDirectory= creates /run/whisper-<instance>, owned by this user, wiped on stop. Per-instance so
# two servers can never collide on a temp filename.
RuntimeDirectory=whisper-%i
RuntimeDirectoryMode=0700
#
# ⚠⚠ --no-gpu IS LOAD-BEARING. The GPU on this box drives the display AND holds a 13-15 GB chat model;
# ROCm does not OOM cleanly, it spills to GTT and freezes the whole PC. Whisper is CPU-only BY
# DESIGN (same rule as the Qwen3-Embedding preset): 0 VRAM means it can never stack into an
# overcommit, and it never evicts / gets evicted by the router. Do not remove.
# --convert shells out to ffmpeg (webm/opus/ogg -> 16 kHz wav). This is the whole reason the Open WebUI
# mic button works — the browser records opus, whisper.cpp reads wav.
# --inference-path puts the route exactly where OWUI posts (--request-path defaults to empty), so a
# client's base URL is http://192.168.0.204:<port>/v1 .
ExecStart=/usr/bin/whisper-server \
--model ${WHISPER_MODEL} \
--host 0.0.0.0 --port ${WHISPER_PORT} \
--inference-path /v1/audio/transcriptions \
--convert \
--tmp-dir /run/whisper-%i \
--no-gpu \
--threads 6 \
--language ${WHISPER_LANG}
Restart=always
RestartSec=2
# Yield to the llama.cpp router: its CPU-offloaded MoE experts (n-cpu-moe) want the same 6 cores.
Nice=5
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target