LFM3-1.7B-Looped / scripts /compose-loop.yaml
vaultpls's picture
LFM3-1.7B-Looped: layers 8-11 run twice at half step (training-free depth loop), Q8_0 GGUF + bf16
830e33a verified
Raw History Blame Contribute Delete
1.94 kB
services:
# ── LFM3-1.7B with a training-free depth loop (arXiv 2605.23872) ──
# Window [8-11] executed twice, each application contributing half a residual
# step (damped Euler, K=2). Baked as a plain 28-layer GGUF: the window's
# post_attention_norm / post_ffw_norm weights are scaled by 0.5 in both the
# original layers and the copies, which is exact (both HF and llama.cpp apply
# them as RMSNorm on the branch output, before the residual add).
#
# Build the file with:
# python3 scripts/loop_gguf_k.py base.gguf \
# loop.gguf 8 11 2 0.5
# python3 scripts/check_loop_gguf.py base.gguf \
# loop.gguf 8 11 2 0.5
#
# Measured (RTX 4070, Q8_0, -ngl 99): pp512 18184 -> 16699 t/s, tg128
# 160.3 -> 142.6 t/s (-8.2% / -11.1%), params 1.73B -> 1.97B.
# ARC-Easy 5-shot 1000q: 60.8% -> 69.2%. GSM8K 80q: 67.5% -> 61.3% (n.s.).
lfm3-1.7b-loop:
# build this image as described in REPRODUCE.md (llama.cpp master >= 1014775c8 + CUDA runtime)
image: lfm3-llama:master-1014775c8
container_name: lfm3-1.7b-loop
restart: unless-stopped
ports:
- "8080:8080"
volumes:
- ./models:/models:ro
entrypoint:
- /opt/llama/llama-server
- -m
- /models/LFM3-1.7B-loop-8-11-Q8_0.gguf
- --alias
- lfm3-1.7b-loop
- --jinja
- -ngl
- "99"
- -fa
- "on"
- --parallel
- "${LFM3_NP:-8}"
- --kv-unified
- --temp
- "0.1"
- --top-k
- "50"
# NOTE: no --repeat-penalty here: it costs ~5% decode (135 -> 128.6 t/s measured)
# and agents send their own sampling params anyway.
- --metrics
command:
- --host
- 0.0.0.0
- --port
- "8080"
- -c
- "${LFM3_CTX:-262144}"
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]