Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: rank Latest Unsloth Models by trending weighed against release age (#13969)

Michael Han7bee02dd3d56
diff --git a/studio/frontend/src/features/hub/catalog/models-toolbar.tsx b/studio/frontend/src/features/hub/catalog/models-toolbar.tsx
index 7bc1daa7114..211a6c49abc 100644
--- a/studio/frontend/src/features/hub/catalog/models-toolbar.tsx
+++ b/studio/frontend/src/features/hub/catalog/models-toolbar.tsx
@@ -53,6 +53,7 @@ const SORT_OPTIONS: ReadonlyArray<{
value: HfSortKey;
label: string;
}> = [
+ { value: "fresh", label: "Latest" },
{ value: "createdAt", label: "Newest" },
{ value: "trendingScore", label: "Trending" },
{ value: "downloads", label: "Most downloads" },
@@ -239,12 +240,15 @@ export const ModelsToolbar = memo(function ModelsToolbar({
const sortOptions = useMemo<HubOption<HfSortKey>[]>(
() =>
SORT_OPTIONS.filter(
- (option) => hubSource !== "modelscope" || option.value !== "createdAt",
+ (option) =>
+ // Latest ranks Hugging Face models; datasets and ModelScope have no such ranking.
+ !(option.value === "fresh" && (isDataset || hubSource === "modelscope")) &&
+ (hubSource !== "modelscope" || option.value !== "createdAt"),
).map((option) => ({
value: option.value,
label: option.label,
})),
- [hubSource],
+ [hubSource, isDataset],
);
// pl-4 / pr-3.5: the model picker's dropdown insets, so the two read alike.
const triggerBase = cn(
@@ -499,7 +503,7 @@ export const ModelsToolbar = memo(function ModelsToolbar({
className="size-3.5 shrink-0"
/>
<span className="truncate">
- {sortOptions.find((option) => option.value === sortBy)
+ {SORT_OPTIONS.find((option) => option.value === sortBy)
?.label ?? sortBy}
</span>
</span>
diff --git a/studio/frontend/src/features/hub/hooks/use-discover-search.ts b/studio/frontend/src/features/hub/hooks/use-discover-search.ts
index 53300e6397e..c12f9e36ebe 100644
--- a/studio/frontend/src/features/hub/hooks/use-discover-search.ts
+++ b/studio/frontend/src/features/hub/hooks/use-discover-search.ts
@@ -17,6 +17,7 @@ import {
type HfSortDirection,
type HfSortKey,
type HfTaskFilter,
+ hubListingSort,
useHubModelSearch,
} from "./use-hub-model-search";
import {
@@ -149,7 +150,7 @@ export function useDiscoverSearch({
// and returns [] when false, so a backoff blanked every rendered row.
enabled: isDiscoverTab && isDatasetMode,
paused: !canProbe,
- sortBy,
+ sortBy: hubListingSort(sortBy),
sortDirection: direction,
});
diff --git a/studio/frontend/src/features/hub/hooks/use-hub-model-search.ts b/studio/frontend/src/features/hub/hooks/use-hub-model-search.ts
index 020dd45c57b..b3230abefbc 100644
--- a/studio/frontend/src/features/hub/hooks/use-hub-model-search.ts
+++ b/studio/frontend/src/features/hub/hooks/use-hub-model-search.ts
@@ -21,6 +21,7 @@ import { EMBEDDING_TAGS, estimateSizeFromDtypes } from "../lib/hf-model-meta";
import { mergeTaskIterators } from "../lib/merge-task-iterators";
import { detectBaseModel } from "../lib/model-capabilities";
import { isGgufLike } from "../lib/model-identifiers";
+import { type FreshRankable, rankFresh } from "../lib/fresh-ranking";
import { fetchWithTimeout } from "../lib/network";
import {
type UnslothSupport,
@@ -46,6 +47,7 @@ const ALL_FIELDS = [
"createdAt",
"downloadsAllTime",
"gguf",
+ "trendingScore",
] as unknown as (
| "safetensors"
| "tags"
@@ -59,6 +61,8 @@ export { classifyUnslothSupport };
export type { UnslothSupport, UnslothSupportStatus };
export type HfSortKey =
+ // Not a Hub sort: trending weighed against age, ranked here (lib/fresh-ranking.ts).
+ | "fresh"
| "trendingScore"
| "downloads"
| "likes"
@@ -66,6 +70,11 @@ export type HfSortKey =
| "createdAt";
export type HfSortDirection = "desc" | "asc";
+
+/** The Hub's own sort for a listing; fresh is ranked from a newest-first one. */
+export function hubListingSort(sortBy: HfSortKey): Exclude<HfSortKey, "fresh"> {
+ return sortBy === "fresh" ? "createdAt" : sortBy;
+}
export type HfTaskFilter = PipelineType | readonly PipelineType[] | undefined;
function normalizeTaskFilter(task: HfTaskFilter): readonly PipelineType[] {
@@ -153,7 +162,7 @@ function makeSortFetch(
url.searchParams.set("num_parameters", parameterFilter);
if (sortBy && !url.searchParams.has("sort")) {
- url.searchParams.set("sort", sortBy);
+ url.searchParams.set("sort", hubListingSort(sortBy));
}
const effectiveSort = (url.searchParams.get("sort") ?? sortBy) as
| HfSortKey
@@ -465,6 +474,57 @@ export interface HfModelSearchChannel {
idSuffix?: string;
}
+const FRESH_POOL = 100;
+
+/** Ranks the newest and most trending together, then the rest by date. */
+async function* freshChannelIterator(
+ channel: HfModelSearchChannel,
+ opts: Omit<Parameters<typeof createChannelIterator>[1], "sortBy" | "task"> & {
+ tasks?: readonly PipelineType[];
+ },
+): AsyncGenerator<unknown> {
+ const { tasks = [], ...listingOpts } = opts;
+ const listing = (sortBy: HfSortKey) =>
+ mergeTaskIterators(
+ tasks,
+ (task, signal) =>
+ createChannelIterator(channel, {
+ ...listingOpts,
+ sortBy,
+ sortDirection: "desc",
+ signal,
+ task,
+ }),
+ opts.signal,
+ );
+ const newest = listing("createdAt");
+ // Read by hand: breaking out of a for-await would close the listing the tail continues.
+ // The task listings alternate, so each task gets a full pool of its own.
+ const poolSize = FRESH_POOL * Math.max(1, tasks.length);
+ const take = async (iter: AsyncGenerator<unknown>) => {
+ const items: unknown[] = [];
+ while (items.length < poolSize) {
+ const next = await iter.next();
+ if (next.done) break;
+ items.push(next.value);
+ }
+ return items;
+ };
+ const trending = listing("trendingScore");
+ const [byDate, byTrend] = await Promise.all([take(newest), take(trending)]);
+ void trending.return(undefined);
+ const pool = new Map<string, FreshRankable>();
+ for (const model of [...byDate, ...byTrend]) {
+ const name = (model as { name?: string }).name;
+ if (name && !pool.has(name)) pool.set(name, model as FreshRankable);
+ }
+ yield* rankFresh([...pool.values()], Date.now());
+ for await (const model of newest) {
+ const name = (model as { name?: string }).name;
+ if (!name || !pool.has(name)) yield model;
+ }
+}
+
function createChannelIterator(
channel: HfModelSearchChannel,
opts: {
@@ -474,8 +534,12 @@ function createChannelIterator(
accessToken?: string;
signal: AbortSignal;
parameterFilter?: string;
+ task?: PipelineType;
},
): AsyncGenerator<unknown> {
+ if (opts.sortBy === "fresh") {
+ return freshChannelIterator(channel, opts);
+ }
const channelTags =
channel.tags && channel.tags.length ? [...channel.tags] : undefined;
const queryString = opts.query || channel.query || undefined;
@@ -485,6 +549,7 @@ function createChannelIterator(
...(queryString ? { query: queryString } : {}),
...(channel.owner ? { owner: channel.owner } : {}),
...(channelTags ? { tags: channelTags } : {}),
+ ...(opts.task ? { task: opts.task } : {}),
},
additionalFields: ALL_FIELDS,
fetch: makeSortFetch(
@@ -493,7 +558,7 @@ function createChannelIterator(
opts.signal,
opts.parameterFilter,
),
- sort: opts.sortBy,
+ sort: hubListingSort(opts.sortBy),
...(opts.accessToken
? { credentials: { accessToken: opts.accessToken } }
: {}),
@@ -537,7 +602,7 @@ async function* channelUnslothFirstIterator(
opts.signal,
opts.parameterFilter,
),
- sort: opts.sortBy,
+ sort: hubListingSort(opts.sortBy),
...creds,
}) as AsyncGenerator<unknown>;
let count = 0;
@@ -569,7 +634,7 @@ async function* channelUnslothFirstIterator(
opts.signal,
opts.parameterFilter,
),
- sort: opts.sortBy,
+ sort: hubListingSort(opts.sortBy),
...creds,
}) as AsyncGenerator<unknown>;
for await (const model of generalIter) {
@@ -757,6 +822,19 @@ export function useHubModelSearch(
},
);
}
+ // Browsing only: a typed search keeps the search paths below (Unsloth floated, tasks checked client-side).
+ if (sortBy === "fresh" && !trimmed) {
+ return freshChannelIterator(
+ { owner: unslothOnly ? "unsloth" : undefined },
+ {
+ sortDirection,
+ accessToken,
+ signal,
+ parameterFilter: filterRange,
+ tasks: normalizeTaskFilter(task),
+ },
+ );
+ }
if (!trimmed) {
// No query: show priority models first (with full metadata), then general unsloth listing
if (stablePriorityIds && stablePriorityIds.length > 0) {
@@ -800,7 +878,7 @@ export function useHubModelSearch(
taskSignal,
filterRange,
),
- sort: sortBy,
+ sort: hubListingSort(sortBy),
...(accessToken ? { credentials: { accessToken } } : {}),
}) as AsyncGenerator<unknown>,
signal,
@@ -813,7 +891,7 @@ export function useHubModelSearch(
search: { query: searchQuery, owner: "unsloth" },
additionalFields: ALL_FIELDS,
fetch: makeSortFetch(sortBy, sortDirection, signal, filterRange),
- sort: sortBy,
+ sort: hubListingSort(sortBy),
...(accessToken ? { credentials: { accessToken } } : {}),
}) as AsyncGenerator<unknown>;
}
diff --git a/studio/frontend/src/features/hub/hub-page.tsx b/studio/frontend/src/features/hub/hub-page.tsx
index e10ffb85568..8b671670ed0 100644
--- a/studio/frontend/src/features/hub/hub-page.tsx
+++ b/studio/frontend/src/features/hub/hub-page.tsx
@@ -898,11 +898,14 @@ export function ModelsPage() {
const requestedSort: HfSortKey =
isFeedMode && liveListChannel ? liveListChannel.sort : sortBy;
- // ModelScope has no creation-date sort; its closest is last modified.
+ // ModelScope has neither a creation-date sort nor trending; its closest is last modified.
const effectiveSort: HfSortKey =
- hubSource === "modelscope" && requestedSort === "createdAt"
+ hubSource === "modelscope" &&
+ (requestedSort === "createdAt" || requestedSort === "fresh")
? "lastModified"
- : requestedSort;
+ : isDatasetMode && requestedSort === "fresh"
+ ? "createdAt"
+ : requestedSort;
const effectiveDirection: HfSortDirection = isFeedMode ? "desc" : direction;
// The format dropdown always filters the visible list, including the feed's "Latest" list, so
// the default (Recommended) hides unrunnable checkpoints and picking a format changes the rows.
diff --git a/studio/frontend/src/features/hub/lib/channels.ts b/studio/frontend/src/features/hub/lib/channels.ts
index b3f98a08895..4edb8ff7c09 100644
--- a/studio/frontend/src/features/hub/lib/channels.ts
+++ b/studio/frontend/src/features/hub/lib/channels.ts
@@ -48,9 +48,8 @@ export const CHANNEL_PRESETS: readonly ChannelPreset[] = [
hint: "Freshly released models from the Unsloth channel.",
owner: "unsloth",
format: "all",
- // Newest by creation date so the feed shows freshly released models, not
- // ones merely re-touched (lastModified).
- sort: "createdAt",
+ // Trending weighed against release age (lib/fresh-ranking.ts).
+ sort: "fresh",
},
{
id: "unsloth-safetensors",
diff --git a/studio/frontend/src/features/hub/lib/fresh-ranking.ts b/studio/frontend/src/features/hub/lib/fresh-ranking.ts
new file mode 100644
index 00000000000..c7807c0dbf8
--- /dev/null
+++ b/studio/frontend/src/features/hub/lib/fresh-ranking.ts
@@ -0,0 +1,57 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+/** The Latest feed's order: trending, decayed by age, as Hacker News ranks stories. */
+
+export interface FreshRankable {
+ createdAt?: string | Date;
+ updatedAt?: string | Date;
+ likes?: number;
+ trendingScore?: number;
+}
+
+const DAY_MS = 86_400_000;
+/** Higher sinks older models faster; 1.6 still keeps a week-old hit above a day-old model nobody likes. */
+const GRAVITY = 1.6;
+const AGE_OFFSET_DAYS = 2;
+const TREND_OFFSET = 2;
+/** At least this many likes, nearly all of them recent, before likes may vouch for the date. */
+const RECENT_LIKES_MIN = 5;
+const RECENT_LIKES_SHARE = 0.8;
+
+function ageDays(value: string | Date | undefined, now: number): number | null {
+ if (value === undefined) {
+ return null;
+ }
+ const time = new Date(value).getTime();
+ return Number.isFinite(time) ? Math.max(0, (now - time) / DAY_MS) : null;
+}
+
+/** The Hub has no publish date and createdAt predates a private-until-launch repo going public; nearly all-recent likes mean it just went public, so its last change dates it. */
+export function releaseAgeDays(model: FreshRankable, now: number): number {
+ const created = ageDays(model.createdAt, now);
+ const updated = ageDays(model.updatedAt, now);
+ const likes = model.likes ?? 0;
+ const trending = model.trendingScore ?? 0;
+ const recentlyPublic =
+ likes >= RECENT_LIKES_MIN && trending >= RECENT_LIKES_SHARE * likes;
+ if (recentlyPublic && updated !== null) {
+ return created === null ? updated : Math.min(created, updated);
+ }
+ return created ?? updated ?? Number.POSITIVE_INFINITY;
+}
+
+export function freshScore(model: FreshRankable, now: number): number {
+ const age = releaseAgeDays(model, now);
+ return (
+ ((model.trendingScore ?? 0) + TREND_OFFSET) /
+ (age + AGE_OFFSET_DAYS) ** GRAVITY
+ );
+}
+
+export function rankFresh<T extends FreshRankable>(models: readonly T[], now: number): T[] {
+ return models
+ .map((model) => ({ model, score: freshScore(model, now) }))
+ .sort((a, b) => b.score - a.score)
+ .map(({ model }) => model);
+}
diff --git a/studio/frontend/tests/hub-fresh-ranking.test.ts b/studio/frontend/tests/hub-fresh-ranking.test.ts
new file mode 100644
index 00000000000..e07312c0453
--- /dev/null
+++ b/studio/frontend/tests/hub-fresh-ranking.test.ts
@@ -0,0 +1,105 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+// The Latest feed ranks trending against release age, not by repo creation date alone.
+
+import assert from "node:assert/strict";
+import test from "node:test";
+
+import {
+ freshScore,
+ rankFresh,
+ releaseAgeDays,
+} from "../src/features/hub/lib/fresh-ranking.ts";
+import { readSrc } from "./helpers/kit.ts";
+
+const NOW = Date.parse("2026-10-15T23:00:00Z");
+const daysAgo = (days: number) => new Date(NOW - days * 86_400_000).toISOString();
+
+// Shapes from the Hub's unsloth listing on 2026-10-15.
+const museSpark = {
+ name: "Muse-Spark-Open-816B-A42B-GGUF",
+ createdAt: daysAgo(26.5),
+ updatedAt: daysAgo(0.2),
+ likes: 47,
+ trendingScore: 47,
+};
+const nemotronBolt = {
+ name: "NVIDIA-Nemotron-3.5-Bolt-74B-A9B-GGUF",
+ createdAt: daysAgo(1.3),
+ updatedAt: daysAgo(0.2),
+ likes: 40,
+ trendingScore: 40,
+};
+const embeddingGemma = {
+ name: "embeddinggemma-2-GGUF",
+ createdAt: daysAgo(9.5),
+ updatedAt: daysAgo(8.7),
+ likes: 314,
+ trendingScore: 87,
+};
+const qwenOld = {
+ name: "Qwen3.8-27B-GGUF",
+ createdAt: daysAgo(63.6),
+ updatedAt: daysAgo(56),
+ likes: 5123,
+ trendingScore: 120,
+};
+const quietNew = {
+ name: "LTX-2.5-FP8",
+ createdAt: daysAgo(2.9),
+ updatedAt: daysAgo(2.9),
+ likes: 1,
+ trendingScore: 1,
+};
+const retouched = {
+ name: "Qwen-Image-2512-FP8",
+ createdAt: daysAgo(288),
+ updatedAt: daysAgo(2.7),
+ likes: 0,
+ trendingScore: 0,
+};
+
+test("a repo kept private until launch is dated by its launch, not its creation", () => {
+ assert.ok(releaseAgeDays(museSpark, NOW) < 1);
+ assert.ok(Math.abs(releaseAgeDays(embeddingGemma, NOW) - 9.5) < 0.01);
+ // Re-touching an old repo nobody likes does not make it new.
+ assert.ok(releaseAgeDays(retouched, NOW) > 280);
+});
+
+test("trending and age are weighed together", () => {
+ const ranked = rankFresh(
+ [qwenOld, quietNew, retouched, embeddingGemma, nemotronBolt, museSpark],
+ NOW,
+ ).map((model) => model.name);
+ assert.deepEqual(ranked.slice(0, 3), [museSpark.name, nemotronBolt.name, embeddingGemma.name]);
+ // A two-month-old hit stays below this week's models, and an untouched old repo ranks last.
+ assert.ok(ranked.indexOf(qwenOld.name) > ranked.indexOf(embeddingGemma.name));
+ assert.equal(ranked.at(-1), retouched.name);
+ assert.ok(freshScore(quietNew, NOW) > 0);
+});
+
+test("the Latest feed uses the fresh ranking, which no Hub request ever sends", () => {
+ assert.match(readSrc("features/hub/lib/channels.ts"), /id: "unsloth-latest",[\s\S]*?sort: "fresh",/);
+ const hook = readSrc("features/hub/hooks/use-hub-model-search.ts");
+ assert.match(hook, /if \(opts\.sortBy === "fresh"\) \{\n\s*return freshChannelIterator\(channel, opts\);/);
+ assert.match(hook, /url\.searchParams\.set\("sort", hubListingSort\(sortBy\)\)/);
+ assert.doesNotMatch(hook, /sort: (opts\.)?sortBy,/);
+});
+
+test("Latest picked from the sort menu, outside any section, ranks the same way", () => {
+ const hook = readSrc("features/hub/hooks/use-hub-model-search.ts");
+ assert.match(
+ hook,
+ /if \(sortBy === "fresh" && !trimmed\) \{[\s\S]*?freshChannelIterator\(\n\s*\{ owner: unslothOnly \? "unsloth" : undefined \},[\s\S]*?tasks: normalizeTaskFilter\(task\),/,
+ );
+ assert.match(hook, /const poolSize = FRESH_POOL \* Math\.max\(1, tasks\.length\);/);
+ // The task scopes both candidate listings, not only the ranked result.
+ assert.match(hook, /\.\.\.\(opts\.task \? \{ task: opts\.task \} : \{\}\),/);
+});
+
+test("datasets and ModelScope never offer Latest", () => {
+ const toolbar = readSrc("features/hub/catalog/models-toolbar.tsx");
+ assert.match(toolbar, /!\(option\.value === "fresh" && \(isDataset \|\| hubSource === "modelscope"\)\)/);
+ assert.match(readSrc("features/hub/hub-page.tsx"), /isDatasetMode && requestedSort === "fresh"\n\s*\? "createdAt"/);
+});
diff --git a/studio/frontend/tests/model-search-filters.test.ts b/studio/frontend/tests/model-search-filters.test.ts
index 8f530b1099c..cc816f1da95 100644
--- a/studio/frontend/tests/model-search-filters.test.ts
+++ b/studio/frontend/tests/model-search-filters.test.ts
@@ -318,6 +318,7 @@ function channelIterator(listings: Record<string, unknown[]>) {
"makeSortFetch",
"UNSLOTH_CHANNEL_PREFETCH",
"UNSLOTH_FILTER_REJECT_LIMIT",
+ "hubListingSort",
`${
ts.transpileModule(source.slice(start, end), {
compilerOptions: { target: ts.ScriptTarget.ES2022 },
@@ -330,6 +331,7 @@ function channelIterator(listings: Record<string, unknown[]>) {
() => undefined,
60,
limit,
+ (sortBy: string) => sortBy,
);
return { fn, limit };
}