llama-server 멀티모달 스파이크 — 측정값¶
scripts/spike_llama_mtmd.py이 b8987 prebuilt 바이너리를 maintainer의
M2 Pro / macOS 13.5 / 16 GB RAM에서 실행하여 생성. Commit 6
(LocalVisionBackend)이 이 contract 인용; commit 9 (eval)이 30-fixture
digest 세트의 실제 라텐시 측정.
핀된 contract¶
| 질문 | 답 |
|---|---|
| Endpoint 경로 | /v1/chat/completions (OpenAI 호환) |
| 이미지 payload | {"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,..."}} |
| 이미지 순서 | messages[0].content에 나열된 대로 프레임 간 보존 |
| Healthcheck | model + mmproj 로드 후 GET /health 200 반환 |
| Streaming | stream: false이면 choices[0].message.content (text) 반환 |
| 호출당 최대 이미지 | 최소 10 (production budget); 이상은 미테스트 |
| 서버 부팅 시간 | M2 Pro CPU에서 ~25초. M5+ Metal에서 더 빠름. |
측정된 라텐시¶
스파이크는 256 × 256 합성 JPEG와 max_tokens=5 사용. Production
입력은 896-px 키프레임 + 수백 토큰 디지스트 프롬프트라서, 여기 핀된
것은 contract이고 budget은 eval harness 도착 후 재측정.
{
"binary": "vendor/llama-bin/llama-b8987/llama-server",
"n_gpu_layers": 0,
"n_gpu_layers_note": "CPU on M2 Pro — pre-M5 Metal kernels miss bf16 ops in this prebuilt",
"health_ready": true,
"endpoint": "/v1/chat/completions",
"cold_no_images_s": 0.23,
"warm_1_image_s": 0.28,
"warm_5_images_s": 10.44,
"warm_10_images_s": 13.76
}
하드웨어 호환성 발견 (pre-M5 Metal)¶
b8987 prebuilt의 Metal 커널은 bf16 mat-mul 변형을 포함 — pre-M5 /
pre-A19 Apple Silicon GPU 드라이버는 ship하지 않음.
--n-gpu-layers -1로 서버를 띄우면 warmup 중에 abort:
ggml_metal_library_compile_pipeline: failed to compile pipeline:
base = 'kernel_mul_mv_ext_bf16_f32_r1_2',
name = 'kernel_mul_mv_ext_bf16_f32_r1_2_nsg=2_nxpsg=16'
ggml_metal_library_compile_pipeline: Function kernel_mul_mv_ext_bf16_f32_r1_2
was not found in the library
해결: --n-gpu-layers 0 (CPU only) 또는 bf16 ops 없이 llama.cpp
소스 빌드. Commit 6이 platform.mac_ver() + platform.machine()로
GPU layer 카운트 선택: M5+ → -1, 외 → 0. Commit 7의 설정 UI가
이를 status banner로 노출하여 구형 하드웨어 사용자가 로컬 디지스트가
느릴 때 Cue를 탓하지 않도록.
실행 명령 (핀)¶
llama-server \
--model "$MODEL" \
--mmproj "$MMPROJ" \
--host 127.0.0.1 \
--port "$PORT" \
--ctx-size 8192 \
--n-gpu-layers 0 \
--no-context-shift
Commit 6에서 추적되는 프로덕션 추가:
--log-disable— request / response access log 억제. b8987 prebuilt는--no-display-prompt를 받지 않음 (llama-server --help와 production-path 스모크에서 검증); 바이너리가 노출하는 유일한 로그 억제 플래그는--log-disable.- 8080이 아닌 런타임에 선택된 random high port.