diff --git a/studio/backend/utils/models/model_config.py b/studio/backend/utils/models/model_config.py index cd0eb106b8..f5b8dfc823 100644 --- a/studio/backend/utils/models/model_config.py +++ b/studio/backend/utils/models/model_config.py @@ -962,6 +962,18 @@ def list_gguf_variants( ) ) + # Sort: recommended first, then UD variants by size, then non-UD by size. + best_file = _pick_best_gguf([v.filename for v in variants]) + best_quant = _extract_quant_label(best_file) if best_file else None + + def _sort_key(v: GgufVariantInfo) -> tuple: + is_recommended = v.quant == best_quant + is_ud = v.quant.startswith("UD-") + # (0, ...) recommended | (1, 0, size) other UD | (1, 1, size) non-UD + return (0 if is_recommended else 1, 0 if is_ud else 1, v.size_bytes) + + variants.sort(key=_sort_key) + return variants, has_vision