Port Phi-3 architecture support to libturboquant + Qwen3.5 issues#71
Merged
Port Phi-3 architecture support to libturboquant + Qwen3.5 issues#71
Conversation
…rces Ports the Phi-3/Phi-3.5 architecture support from quant.h (PR #65) to the split source files used by libturboquant and quant-server. Changes: - tq_model.c: fused attn_qkv detection, LongRoPE factor loading, fused gate||up FFN detection - tq_transformer.c: fused QKV matmul + split, NeoX-style LongRoPE rotation, fused gate||up FFN path, expanded state allocation - tq_generate.c: Phi-3 BOS token handling - tq_tokenizer.c: <s> BOS lookup - tq_server.c: Phi-3 chat template support - tq_engine.h: new fields for fused weights and LongRoPE config - cli.py: Phi-3.5 default model + alias updates quant-server now detects Phi-3.5 correctly: loaded 32 layers (32 self_attn) + LongRoPE Note: server crashes during inference (segfault in forward pass). The fused QKV → split memcpy or LongRoPE computation likely has a buffer size issue in the server path. Tracked in #67. 35/35 unit tests still pass. Fixes #67 (partial — loader works, inference needs debugging) Refs #69, #70 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collaborator
Author
Update: Reverted — Phi-3 port caused regression in SmolLM2The Phi-3 port to What worked
What broke
Root causeThe ported changes touched too many code paths simultaneously. The split source RecommendationThis PR should be closed. The Phi-3 port needs to be done more carefully:
The Python Updated by ClawTeam |
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
quant.h(feat(phi3): end-to-end Phi-3 / Phi-3.5 architecture support #65) to the split source files (src/engine/)quant-servernow correctly detects Phi-3.5:loaded 32 layers (32 self_attn)+ LongRoPEChanges
src/engine/tq_model.cattn_qkvdetection, LongRoPE factor loading, fusedgate||upFFNsrc/engine/tq_transformer.csrc/engine/tq_generate.csrc/engine/tq_tokenizer.c<s>BOS lookup chainsrc/server/tq_server.cinclude/turboquant/tq_engine.hbindings/python/quantcpp/cli.pyquant.hTest plan
ctest --test-dir build-metal)32 self_attn+ LongRoPE detected correctlyKnown issues (tracked separately)
quant_ask/ ctypes produces empty output🤖 Generated with Claude Code