feat: quant-server-unified — server built directly on quant.h#79
Merged
feat: quant-server-unified — server built directly on quant.h#79
Conversation
New server binary that compiles against quant.h instead of libturboquant, eliminating the sync-divergence bug (#77, #78). Key results (Apple M3, 16GB): SmolLM2-1.7B: 23 tok/s (was: garbage via libturboquant) Phi-3.5-mini: 6.5 tok/s (was: crash or garbage via libturboquant) Build: cc -O2 -o quant-server-unified tools/quant_server_unified.c -lm -lpthread Features: - OpenAI-compatible API (/v1/chat/completions, /v1/models, /health) - SSE streaming (stream: true) - CORS headers - Auto-detect Phi-3 chat template vs ChatML - Template token filtering (<|im_end|>, <|end|>, etc.) - Mutex-serialized inference (safe for concurrent HTTP clients) - Graceful port-in-use error No libturboquant dependency. No Metal/CUDA (pure CPU NEON). Single file, zero external dependencies beyond libc. Fixes #77 (SmolLM2 numerical instability in libturboquant) Refs #78 (quant.h as single source of truth) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
New server binary that compiles against
quant.hdirectly, eliminating the sync-divergence bug betweenquant.handlibturboquant(#77, #78).Problem
quant-server(libturboquant) produces garbage for SmolLM2-1.7B due to numerical instability at layer 7 (max=18,359). The same model works perfectly viaquant.h. Root cause: split sources have diverged fromquant.h.Solution
Single-file server (
tools/quant_server_unified.c) that#include "quant.h"directly:Benchmark (Apple M3, 16GB)
Features
/v1/chat/completions(OpenAI compatible)/v1/models,/healthstream: true)Test plan
Fixes #77
Refs #78
🤖 Generated with Claude Code