Skip to content

Studio: improve memory estimate spacing, alignment, and guidance - #10591

Merged
danielhanchen merged 19 commits into
shimmyshimmer/resident-memory-fitfrom
shimmyshimmer/memory-estimate-layout
Sep 9, 2026
Merged

danielhanchen merged 19 commits into
shimmyshimmer/resident-memory-fitfrom
shimmyshimmer/memory-estimate-layout

Conversation

@shimmyshimmer

@shimmyshimmer shimmyshimmer commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

Estimated Memory Usage crowded its heading, values, and breakdown into a small area. Give the heading its own row and align the memory figures with the neighboring settings in both the model picker and sidebar run settings.

  • Use 32 px tall, 80 px wide read-only value boxes with equal horizontal padding, centered text, and a normal cursor. Keep them inside the panel padding and align their right edges with the other controls.
  • Reduce the gap above the figures, balance the spacing around the divider, and remove space left by the collapsed breakdown.
  • Align the disclosure arrow with Model and put breakdown captions on separate lines.
  • Fit the displayed precision to the available width. Retain units and round every lower-bound label down. Expose the full value through a keyboard-accessible tooltip.
  • Show RAM for CPU-only estimates, Unified or Shared for shared pools, and GPU plus Total for GPU-backed loads.
  • Shorten guidance, identify the pool under pressure, and avoid guarantees about loading or paging. When both pools are pressured, including a physical overflow in either pool, recommend reducing overall demand rather than moving layers between them.

Memory accounting is reviewed separately in #10627. This PR targets its branch so the diff contains only the UI, guidance, and their tests. Merge #10627 first, then retarget this PR to main.

Validation: Nine targeted pressure and guidance regressions pass, including GPU overflow with pressured RAM and host overflow with pressured VRAM. Earlier RAM-only and lower-bound checks also pass. Application and test type checking pass. Earlier browser checks covered narrow and wide panels, enlarged text, light and dark themes, and keyboard tooltips. No CI or full suites were awaited.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-09T14:57:16.759004Z 989a524 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 52cb209fa1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 6b4381179f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: b841c1c56e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

The value pill was 92px to match the numeric inputs beside it, but those
right-align their contents while this one centres, so the fixed width read
as padding around the number rather than alignment. Narrow it to 80px and
trim the surrounding gaps; the row is justify-between, so the right edges
still line up with the Auto and dtype controls.
These verdicts are measured against what is FREE right now, not against
capacity, but the copy said only "Memory is tight". On a 64 GB machine
holding a 25 GB load that reads as false, and the note never said which
memory it meant.

Name the pool and the fact that it fits, so the reading is about the
moment rather than the machine. Not "does not fit what is free": pressure
starts at 85% of free, where the load does still fit, and the existing
guard on that wording stays green.
Studio unloads the resident model before the replacement allocates, so the
memory it holds returns to the pool first. The free-memory verdicts charged
it anyway, which counted a model against itself: opening Run settings for
the model already loaded warned that its footprint would not fit the memory
that same footprint was occupying. On a 64 GB Mac a 25.61 GiB load saw
25.53 GiB free and read as exceeding it.

Price the resident copy at the settings it loaded with and credit it to the
free-memory questions. Capacity is untouched, since unloading frees memory
rather than adding any, and growth over what comes back still warns. Only
settled estimates are credited, so a stale price cannot silence a real
warning.

Reloading the same model somewhere else is unaffected: switching to a
DIFFERENT model still charges the outgoing one, which needs the resident
footprint from the backend.
@shimmyshimmer

Copy link
Copy Markdown
Member Author

Pushed three commits after testing this on a 64 GB M-series machine.

Spacing. The value box was 92 px to match the numeric inputs beside it, but those right-align their contents while this one centers, so the fixed width read as padding around the number rather than alignment. Narrowed to 80 px and trimmed the gap above the figures. The row is justify-between, so the right edges still line up with Auto and the dtype selector.

"Memory is tight" was misleading. With a 25.61 GiB load on a 64 GB machine the panel said memory was tight. The verdict is measured against free memory rather than capacity, so it was not wrong about the number, but the note never said which memory it meant and reads as false next to a 64 GB machine. Each pressure note now names its pool.

Kept the wording off "does not fit what is free" on purpose: pressure starts at 85% of free, where the load does still fit, so the absolute claim would be wrong in that band. The existing test guarding that phrasing catches it.

The bigger one: a reload was charged for its own resident copy. The reason the warning fired at all was that the model was already loaded. Its 25.61 GiB was counted as used, leaving 25.53 GiB free, so the estimate came out at ratio 1.003 against memory its own resident copy was holding. Studio unloads before it reloads, so those bytes come back before the new load allocates. The panel was warning about a state that cannot exist at load time.

resolveMemoryFit now credits the resident copy back to the free-memory questions, priced at the settings it loaded with. Capacity verdicts are untouched, since unloading frees memory rather than adding any. Growth past what comes back still warns, which is why this is a credit rather than just suppressing the note when the model is active.

Two things left open:

  • Switching to a different model still charges the outgoing one. The panel has no estimate for a config it is not showing, so fixing that properly needs the resident footprint reported from the backend.
  • psutil's available memory on macOS excludes reclaimable file cache and compressed memory, so it reported 40.92 GiB available on this machine with only 19.49 GiB in use. These readings run conservative on macOS independently of any of the above.

7,140 tests pass, 7 of them new. Type check, build, bundle budget, and translation parity all pass, and Biome is unchanged from the previous head.

The margin was already down to 2px; the rest of the space came from the
heading row's own min-height rather than from spacing between the rows.
Drop the margin and take the row to 28px. It stays full-width clickable,
so the disclosure target is unaffected.
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 9, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 9, 2026
@danielhanchen

Copy link
Copy Markdown
Member

Confirmed the free-memory verdicts in studio/frontend/src/features/model-picker/model-config/memory-fit.ts still charge a reload for the resident copy Studio unloads first, so the credit is the part I want. The spacing, tooltip and guidance rewrites ride along in the same branch though; could you split those out so the fit change can be reviewed on its own?

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@shimmyshimmer
shimmyshimmer changed the base branch from main to shimmyshimmer/resident-memory-fit September 9, 2026 13:52
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

# Conflicts:
#	studio/frontend/src/features/model-picker/components/model-config-page.tsx
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

1 similar comment
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 28d4d0fb3e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

return {
tone: "warn",
text: "More than this GPU holds. Layers will spill to system RAM, or the context will be fitted down to what fits.",
text: "Exceeds GPU memory. Try Auto context or fewer GPU layers; loading may still fail.",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid offloading GPU overflow into pressured RAM

When the GPU footprint exceeds physical VRAM while the host share also exceeds currently usable RAM, this branch wins before the hostPressured check and recommends fewer GPU layers. For example, a 30 GiB GPU share plus 5 GiB host share on a 24 GiB GPU with only 2 GiB usable RAM reaches this text, but moving the GPU overage into RAM worsens the host shortfall and may cause the load to be refused. Condition this placement advice on spare host availability, or use guidance that reduces overall demand when both pools are pressured.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

1 similar comment
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

1 similar comment
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 989a524b3a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit a2288be into shimmyshimmer/resident-memory-fit Sep 9, 2026
3 of 39 checks passed
@danielhanchen
danielhanchen deleted the shimmyshimmer/memory-estimate-layout branch September 9, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants