bug: MistralForCausalLM models misclassified as EMBEDDING due to GetArchitecture() fallback
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start with pkg/hfutil/modelconfig/mistral.go and trace GetArchitecture() into determineModelCapabilitiesFromHF() in pkg/modelagent/config_parser.go. Reproduce the imports for the two Mistral causal-LM models and e5-mistral, then verify that the causal-LM models receive TEXT_GENERATION while e5-mistral remains EMBEDDING.
Written by the indexing model from the issue text.
Description
Summary
When importing mistralai/Mistral-7B-Instruct-v0.3 or mistralai/Mistral-Nemo-Instruct-2407 from HuggingFace, OME classifies both as EMBEDDING instead of TEXT_GENERATION. Chat/completions requests against the resulting endpoint return:
400 Bad Request: importedModel does not support any of: [TextToText, ImageTextToText]
Both models have "architectures": ["MistralForCausalLM"] in their HF config.json and should be TEXT_GENERATION.
Root Cause
Two code locations interact to produce the bug:
1. pkg/hfutil/modelconfig/mistral.go — GetArchitecture() fallback
func (c *MistralConfig) GetArchitecture() string {
if len(c.Architectures) > 0 {
return c.Architectures[0]
}
return "MistralModel" // ← dangerous fallback
}
If Architectures is empty (e.g. JSON parsing fails, field missing, or struct mismatch), the method silently returns "MistralModel".
2. pkg/modelagent/config_parser.go — determineModelCapabilitiesFromHF()
if strings.Contains(strings.ToLower(architecture), "embedding") ||
strings.Contains(strings.ToLower(architecture), "sentence") ||
strings.Contains(strings.ToLower(modelType), "bert") ||
// Special case for known embedding models
(strings.Contains(strings.ToLower(modelType), "mistral") &&
strings.Contains(strings.ToLower(architecture), "mistralmodel")) {
return append(capabilities, string(v1beta1.ModelCapabilityEmbedding))
}
When the fallback fires, modelType = "mistral" and architecture = "MistralModel" satisfy the special-case condition, and the model is classified as EMBEDDING.
The intended path for intfloat/e5-mistral-7b-instruct (a genuine embedding model) is correct: its HF config has architectures: [] or uses the base MistralModel architecture, so the fallback correctly labels it. The problem is that causal-LM models whose Architectures field fails to populate get the same treatment.
Repro
Import either of these models via the OME model-agent and check the resulting ClusterBaseModel.spec.modelCapabilities:
mistralai/Mistral-7B-Instruct-v0.3—architectures: ["MistralForCausalLM"]— classified asEMBEDDING❌mistralai/Mistral-Nemo-Instruct-2407—architectures: ["MistralForCausalLM"]— classified asEMBEDDING❌intfloat/e5-mistral-7b-instruct— embedding model — classified asEMBEDDING✅
Expected Behaviour
| Model | Architecture (HF) | Expected capability |
|---|---|---|
mistralai/Mistral-7B-Instruct-v0.3 |
MistralForCausalLM |
TEXT_GENERATION |
mistralai/Mistral-Nemo-Instruct-2407 |
MistralForCausalLM |
TEXT_GENERATION |
intfloat/e5-mistral-7b-instruct |
MistralModel |
EMBEDDING |
Proposed Fix
Change the GetArchitecture() fallback from "MistralModel" to "" so a missing/unparsed Architectures field does not accidentally satisfy the embedding special-case:
func (c *MistralConfig) GetArchitecture() string {
if len(c.Architectures) > 0 {
return c.Architectures[0]
}
return "" // don't assume MistralModel; let caller treat as unknown
}
Alternatively, tighten the special-case check in config_parser.go to require the architecture to be exactly "MistralModel" (case-insensitive) rather than a substring match, and only when Architectures was explicitly set (not via fallback).
Additional Context
autoSelectisfalseon thevllm-e5-mistral-7b-instructruntime and the two runtimes use distinctmodelArchitecturevalues (MistralModelvsMistralForCausalLM), so runtime auto-selection is not affected — the runtimes cannot be confused with each other.- The misclassification only affects capability gating at the endpoint level (chat vs embedding API routing).
- Dominant language
- Go
- Stars
- 509
- Forks
- 97
- Avg merge
- 10h 4m
- Merged PRs (30d)
- 175
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ome-projects/ome
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
ome-projects/ome#837 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 65/100
ome-projects/ome#836 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
ome-projects/ome#834 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 47/100
ome-projects/ome#833 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
ome-projects/ome#789 ·
All issues in ome-projects/ome
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
kind/cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kubernetes-sigs/kueue#15947 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sympozium-ai/sympozium#627 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100