Files
alzeo/oc-lfm3.py
T
Hasan BasbunarandClaude Opus 5.5 4c031634ad v1.51: the Liquid AI LFM3 lane (lfm3), on vLLM's own nightly image, in every lane list
Liquid AI's LFM3 1.7B in its official NVFP4 (LiquidAI/LFM3-1.7B-NVFP4 at cfe4b5ea), served by
vllm/vllm-openai's nightly of commit 60bd6dd by digest, pulled as published: LFM3 came to vLLM on
2026-11-06 and is in no release. A text lane of its own on the text lanes' port, behind the proxy and
its key: the key by --config (redacted in vLLM's own log line), the vLLM lanes' middleware for every
route but /health and /metrics, its served name lfm3-1.7b, the model's whole window (262,144), the
qwen3 reasoning parser and the qwen3_coder tool-call parser its template's form asks for, the prompt
tokens details, its own vLLM, FlashInfer and Triton caches. --gpu-memory-utilization is LFM3_GMU, 0.75:
this nightly extends its KV cache into every byte left free after its warmup, and the reference box
kept 1,087 MiB available at its lowest with none set. The prefix cache at vLLM's default for this
hybrid model, measured 99 to 100 % of an agent's next turn.

One engine at a time: Conflicts= and After= with every engine unit, both ways. install-lfm3.sh on
vllm-lane.sh like the other vLLM lanes (--units-only, --prepare, --stage, --uninstall, the proof with a
tool call), refused on a 64 GB box (fits_64 False: no 64 GB share was measured); install.sh puts its
unit in on demand (--no-lfm3, --with-lfm3, --all-weights, 41 GB), switch-model.sh lfm3 fetches its
checkpoint in its own image and points opencode at it, uninstall.sh takes it all, check-pins.sh
checks its revision and its image, the cockpit's sudoers its unit.

Its clients: the opencode provider lfm3 (oc-lfm3.py, its window by oc-limits.sh), pi and omp. Its
template reads enable_thinking, true by default, and no level: opencode offers the high and none
variants, pi off and high alone (HELD_LEVELS maps every other level to null), the two states it holds.

Found on the way: the vLLM lanes' cache-report test now lists it, and its family tests, the lists'
counts and the --all-weights total (1235 GB) follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 15:38:53 +01:00

54 lines
2.1 KiB
Python

#!/usr/bin/env python3
"""The Liquid AI LFM3 lane's opencode provider, in one place.
install.sh's generator writes it into the opencode config once the lane is installed, and
switch-model.sh adds it to a config written before that, so both take it from here and the two
cannot drift.
Usage: oc-lfm3.py <base_url> <api-key file> <ctx> <out> <name>
prints {"provider": {"lfm3": ...}}, the shape oc-merge-limits.py --add-providers reads.
"""
import json
import sys
# LFM3's chat template (its checkpoint's, served as published, read at the pinned revision on 2026-11-16) reads
# enable_thinking, true by default, and no reasoning effort: the model reasons, or it does not (its generation prompt
# then holds an empty thought, measured: an answer with no <think>). Two variants, the two states it holds, the default
# first as a picker lists it, as on the Ornith lane, whose template reads the same switch alone; no level it cannot tell
# apart from these two.
VARIANTS = {
"high": {"chat_template_kwargs": {"enable_thinking": True}},
"none": {"chat_template_kwargs": {"enable_thinking": False}},
}
def provider(base_url, key_file, ctx, out, name):
"""The provider block. Text only: the model reads no image (its config, Lfm3ForCausalLM)."""
return {
"npm": "@ai-sdk/openai-compatible",
"name": "Liquid AI LFM3 (DGX Spark)",
"options": {"baseURL": base_url, "apiKey": f"{{file:{key_file}}}"},
"models": {"lfm3-1.7b": {
"name": name,
"limit": {"context": ctx, "input": ctx, "output": out},
"variants": {lvl: json.loads(json.dumps(v)) for lvl, v in VARIANTS.items()},
}},
}
def main():
if len(sys.argv) != 6:
print(__doc__.strip(), file=sys.stderr)
sys.exit(2)
base_url, key_file, ctx, out, name = sys.argv[1:6]
try:
ctx, out = int(ctx), int(out)
except ValueError:
print("ctx and out are token counts", file=sys.stderr)
sys.exit(2)
print(json.dumps({"provider": {"lfm3": provider(base_url, key_file, ctx, out, name)}}, indent=2))
if __name__ == "__main__":
main()