fix: treat lfm2 as ambiguous model type (LLM + embedding + audio)#1036
Open
unstoppablesssss wants to merge 1 commit into
Open
fix: treat lfm2 as ambiguous model type (LLM + embedding + audio)#1036unstoppablesssss wants to merge 1 commit into
unstoppablesssss wants to merge 1 commit into
Conversation
…ants)
lfm2 was unconditionally classified as embedding model type, causing
LFM2.5 Instruct models (model_type: lfm2, arch: Lfm2ForCausalLM) to be
misdetected as embedding engines and fail on chat/completions requests.
LFM2 family has multiple variants:
- LFM2.5-1.2B-Instruct → LLM (CausalLM architecture)
- LFM2 embedding models → embedding
- LFM2 audio models → audio_sts (model_type: lfm_audio)
Move lfm2 from EMBEDDING_MODEL_TYPES to AMBIGUOUS_EMBEDDING_MODEL_TYPES
so architecture-based disambiguation applies (same pattern as qwen3,
gemma3-text). Also narrow the LFM2 audio catch-all from startswith('lfm')
to exact match on 'lfm_audio' to avoid misclassifying LFM2 LLM variants.
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.
Problem
LFM2.5 Instruct models (e.g. LFM2.5-1.2B-Instruct-MLX-4bit) are misdetected as embedding models and fail on /v1/chat/completions requests.
Root cause: lfm2 is listed in EMBEDDING_MODEL_TYPES, so any model with model_type: lfm2 is unconditionally classified as embedding — even when the architecture is Lfm2ForCausalLM (a standard LLM).
LFM2 family variants
Fix
Verification
Tested locally on oMLX 0.3.7 with LFM2.5-1.2B-Instruct-MLX-4bit:
Chat completions now work correctly.