From 99c743fff653161edaade239844508c6aadddf45 Mon Sep 17 00:00:00 2001 From: Jacob Fu <141651335+FuJacob@users.noreply.github.com> Date: Mon, 1 Jun 2026 08:23:55 -0700 Subject: [PATCH] Re-tune onboarding model recommendations for the base-model tiers The recommender's warning copy and memory thresholds were sized for the old ~3-5 GB instruct models. The base-model tiers are much smaller (quick 0.8 GB, everyday 1.4 GB, powerful 2.6 GB), so the Powerful disable floor of 10 GB wrongly excluded stock 8 GB Macs that can comfortably run a 2.6 GB model. Lower the Powerful disable floor to 8 GB (only sub-8 GB, effectively pre-Apple-Silicon, Macs are now excluded) and derive the '~X GB' sizes in the warning copy from the model catalog via approximateSizeLabel, so the copy stays accurate as the catalog changes instead of repeating stale hardcoded numbers. Warn ceilings are unchanged. --- .../OnboardingTemplateRecommender.swift | 30 ++++++++++++------- .../OnboardingTemplateRecommenderTests.swift | 9 ++++-- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/Cotabby/Support/OnboardingTemplateRecommender.swift b/Cotabby/Support/OnboardingTemplateRecommender.swift index ab112462..feadee05 100644 --- a/Cotabby/Support/OnboardingTemplateRecommender.swift +++ b/Cotabby/Support/OnboardingTemplateRecommender.swift @@ -6,14 +6,17 @@ import Foundation /// inputs (`HardwareCapability`, Apple Intelligence availability) so the onboarding UI can stay a /// thin renderer and the decisions can be unit-tested without a host. enum OnboardingTemplateRecommender { - /// Below this much memory, the Powerful template's ~5 GB model leaves too little headroom (the - /// resident model plus OS would dominate an 8 GB machine), so it is disabled rather than offered - /// as a trap. Chosen above 8 so stock 8 GB Macs are excluded while any 12 GB+ config is allowed. - static let powerfulDisableBelowGigabytes = 10.0 - /// Between the disable floor and this ceiling, Powerful is allowed but flagged as potentially slow. + /// Below this much memory, the Powerful tier's model leaves too little headroom and is disabled + /// rather than offered as a trap. The base-model tiers are far smaller than the old ~5 GB models, + /// so the floor is 8: only sub-8 GB Macs (effectively pre-Apple-Silicon) are excluded, while every + /// 8 GB+ machine may run it. Sizes for the copy are read from the catalog, not hardcoded here. + static let powerfulDisableBelowGigabytes = 8.0 + /// Between the disable floor and this ceiling, Powerful is allowed but flagged as potentially slow + /// under memory pressure from other apps. 16 GB and up is treated as comfortable. static let powerfulWarnBelowGigabytes = 16.0 - /// Below this, the Everyday open-source path (~3 GB model) is flagged as potentially slow. Only - /// relevant when Apple Intelligence is unavailable; the Apple Intelligence path has no such cost. + /// Below this, the Everyday open-source tier is flagged as potentially slow, and it is also the + /// cutoff below which Quick becomes the recommended default. Only relevant when Apple Intelligence + /// is unavailable; the Apple Intelligence path has no per-tier memory cost. static let everydayWarnBelowGigabytes = 8.0 /// Resolves the model and behavior flags for a template under an explicitly chosen engine. @@ -63,14 +66,14 @@ enum OnboardingTemplateRecommender { break case .everyday: if gigabytes < everydayWarnBelowGigabytes { - warning = "Uses a ~3 GB model, which may run slowly on this Mac." + warning = "Uses a \(modelSizeLabel(for: template)) model, which may run slowly on this Mac." } case .powerful: if gigabytes < powerfulDisableBelowGigabytes { isDisabled = true - warning = "Needs more memory than this Mac has (uses a ~5 GB model)." + warning = "Needs more memory than this Mac has (uses a \(modelSizeLabel(for: template)) model)." } else if gigabytes < powerfulWarnBelowGigabytes { - warning = "Uses a ~5 GB model; may run slowly with less than 16 GB of memory." + warning = "Uses a \(modelSizeLabel(for: template)) model; may run slowly with less than 16 GB of memory." } } } @@ -103,4 +106,11 @@ enum OnboardingTemplateRecommender { private static func downloadableModel(filename: String) -> DownloadableRuntimeModel? { RuntimeModelCatalog.downloadableModels.first { $0.filename == filename } } + + /// Human-readable size of the GGUF a template installs, read from the catalog so warning copy stays + /// in sync with the actual model instead of a hardcoded number. Falls back to a generic phrase if + /// the filename is missing from the catalog. + private static func modelSizeLabel(for template: OnboardingTemplate) -> String { + downloadableModel(filename: template.openSourceModelFilename)?.approximateSizeLabel ?? "local" + } } diff --git a/CotabbyTests/OnboardingTemplateRecommenderTests.swift b/CotabbyTests/OnboardingTemplateRecommenderTests.swift index 1ede3f37..3db599d5 100644 --- a/CotabbyTests/OnboardingTemplateRecommenderTests.swift +++ b/CotabbyTests/OnboardingTemplateRecommenderTests.swift @@ -60,9 +60,11 @@ final class OnboardingTemplateRecommenderTests: XCTestCase { // MARK: - availability gating (Open Source engine) func testPowerfulDisabledOnLowMemoryMacOpenSource() { + // Sub-8 GB Macs (effectively pre-Apple-Silicon) cannot comfortably hold the model, so Powerful + // is excluded there. let availability = OnboardingTemplateRecommender.availability( for: .powerful, - hardware: hardware(gigabytes: 8), + hardware: hardware(gigabytes: 6), engine: .llamaOpenSource ) @@ -71,9 +73,12 @@ final class OnboardingTemplateRecommenderTests: XCTestCase { } func testPowerfulWarnsBetweenDisableFloorAndComfortCeiling() { + // 8 GB is the disable floor: allowed, not excluded, but still flagged below the 16 GB comfort + // ceiling. This pins that a stock 8 GB Mac can run the Powerful base model (the smaller + // base-model tiers no longer need the old 10 GB floor). let availability = OnboardingTemplateRecommender.availability( for: .powerful, - hardware: hardware(gigabytes: 12), + hardware: hardware(gigabytes: 8), engine: .llamaOpenSource )