From 2914f90d929dad7262cb44ab29cc99fde6632491 Mon Sep 17 00:00:00 2001 From: zaneni6 Date: Wed, 25 Nov 2026 10:05:04 -0700 Subject: [PATCH] fix(devkit bench): "smallest first" orders by footprint, not download size When shared engine code changes, the pull request bench samples each engine's smallest model, smallest first, within PR_CAP. It ordered by the catalog's download size. The dflash drafts list only their own 270 MB but run in nemotron3.5-bolt:e4b's 8.7 GB, so they ranked smallest. On #1131 (npu_utils.hpp, every family) they took two of the four places, ahead of qwen3.5:0.8b and gemma3:1b. size_of() now takes the footprint (GB, every NPU catalog entry has one) and falls back to the download size. With #1131's inputs the bench picks inkling-2:mini, qwen3:0.6b, qwen3.5:0.8b and lfm2.5-it:1.2b. Co-Authored-By: Claude --- .github/script/ci/test_devkit_bench.py | 18 ++++++++++++++++++ .github/script/devkit-bench/select_models.py | 18 ++++++++++++++---- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/.github/script/ci/test_devkit_bench.py b/.github/script/ci/test_devkit_bench.py index 8f0b8dd52..a537545e7 100644 --- a/.github/script/ci/test_devkit_bench.py +++ b/.github/script/ci/test_devkit_bench.py @@ -450,6 +450,20 @@ def test_refresh_benches_the_whole_assigned_set(self): self.assertEqual(res["dropped"], []) self.assertIn("embed-gemma:300m", res["skipped"]) + def test_smallest_is_by_footprint(self): + # A draft package lists a small download but runs in its base model's + # memory: the footprint (GB) orders it, the size only without one. + catalog = select_models.changes.load_catalog(json.dumps({"models": { + "draft": {"e4b": {"size": 2.7e8, "footprint": 8.7, "details": {"family": "draft"}}}, + "tiny": {"1b": {"size": 6e8, "footprint": 0.65, "details": {"family": "tiny"}}}, + "nofoot": {"2b": {"size": 2e9, "details": {"family": "nofoot"}}}, + }})) + self.assertEqual(select_models.ordered(["draft:e4b", "tiny:1b", "nofoot:2b"], catalog), + ["tiny:1b", "nofoot:2b", "draft:e4b"]) + self.assertEqual(select_models.size_of("draft:e4b", catalog), 8.7e9) + self.assertEqual(select_models.size_of("nofoot:2b", catalog), 2e9) + self.assertEqual(select_models.size_of("nosuch:1b", catalog), 0.0) + def test_real_maps_load(self): engines = select_models.changes.DevkitEngines.parse( (REPO / "flm-dev-kit/FLM_DLL/engines.json").read_text(encoding="utf-8")) @@ -461,6 +475,10 @@ def test_real_maps_load(self): res = select_models.select(mode="pr", catalog=catalog, engines=engines, assignment=assignment, families=engines.all_families()) self.assertLessEqual(len(res["models"]), select_models.PR_CAP) + # Shared code samples the engines' smallest models, by what they run + # in: no 8.7 GB dflash draft ahead of the sub-1 GB models. + footprints = [float(catalog[m["model"]].get("footprint") or 0) for m in res["models"]] + self.assertLess(max(footprints), 2.0, res["models"]) def run(**kw): diff --git a/.github/script/devkit-bench/select_models.py b/.github/script/devkit-bench/select_models.py index 48cad430a..dd0d1fd76 100644 --- a/.github/script/devkit-bench/select_models.py +++ b/.github/script/devkit-bench/select_models.py @@ -73,10 +73,20 @@ def benchable(mid: str, catalog: dict[str, dict]) -> bool: def size_of(mid: str, catalog: dict[str, dict]) -> float: - try: - return float(catalog.get(mid, {}).get("size") or 0) - except (TypeError, ValueError): - return 0.0 + """What "smallest first" orders by, in bytes: the model's footprint (GB, + the memory it runs in), else its download size. The download size alone + misleads for a model that reuses another's package: the dflash drafts + list 270 MB of their own files but run in the 8.7 GB of + nemotron3.5-bolt:e4b.""" + entry = catalog.get(mid, {}) + for key, scale in (("footprint", 1e9), ("size", 1.0)): + try: + value = float(entry.get(key) or 0) * scale + except (TypeError, ValueError): + value = 0.0 + if value > 0: + return value + return 0.0 def ordered(models: Iterable[str], catalog: dict[str, dict]) -> list[str]: