Skip to content

Feat: Improve Model Tier Recommendation for Apple Silicon#1299

Merged
rahulharpal1603 merged 4 commits into
AOSSIE-Org:mainfrom
rohan-pandeyy:feat/model-tier-recommendation-for-apple-silicon
Jun 6, 2026
Merged

Feat: Improve Model Tier Recommendation for Apple Silicon#1299
rahulharpal1603 merged 4 commits into
AOSSIE-Org:mainfrom
rohan-pandeyy:feat/model-tier-recommendation-for-apple-silicon

Conversation

@rohan-pandeyy

@rohan-pandeyy rohan-pandeyy commented May 30, 2026

Copy link
Copy Markdown
Member

Closes #1292

This pull request adds improved detection and reporting of Apple Silicon hardware in both the backend and frontend. The main changes include new utility functions to detect Apple Silicon and its performance tier, updating the hardware info API to include this data, and adjusting the frontend to display Apple Silicon chip names when present.

Apple Silicon Detection and Tiering:

  • Added detect_apple_silicon() and detect_apple_silicon_tier() functions to identify Apple Silicon chips and classify them as "small" (base M1/M2) or "medium" (Pro/Max/Ultra, M3+, or future chips) in hardware_detect.py.
  • Updated detect_hardware_tier() to return the Apple Silicon tier if detected, improving model recommendations for Mac users.

Backend API Enhancements:

  • Modified get_hardware_info() to include an apple_silicon field in the returned dictionary, exposing chip information to the frontend.

Frontend and Type Updates:

  • Updated the HardwareInfo TypeScript interface to include the new apple_silicon field.
  • Changed the hardware display in AIModelSetupStep.tsx to show the Apple Silicon chip name (if present) instead of GPU info, improving clarity for Mac users.

Screenshots/Recordings:

image

AI Usage Disclosure:

We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact. AI slop is strongly discouraged and may lead to banning and blocking. Do not spam our repos with AI slop.

Check one of the checkboxes below:

  • This PR does not contain AI-generated code at all.
  • This PR contains AI-generated code. I have read the AI Usage Policy and this PR complies with this policy. I have tested the code locally and I am responsible for it.

I have used the following AI models and tools: Claude, Gemini

Checklist

  • My PR addresses a single issue, fixes a single bug or makes a single improvement.
  • My code follows the project's code style and conventions
  • If applicable, I have made corresponding changes or additions to the documentation
  • If applicable, I have made corresponding changes or additions to tests
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contribution Guidelines
  • Once I submit my PR, CodeRabbit AI will automatically review it and I will address CodeRabbit's comments.
  • I have filled this PR template completely and carefully, and I understand that my PR may be closed without review otherwise.

Summary by CodeRabbit

  • New Features
    • Added automated Apple Silicon detection and reporting in diagnostics.
    • Improved hardware tier classification to recognize Apple Silicon tiers alongside existing RAM/GPU criteria.
    • Hardware display now surfaces Apple Silicon identification before GPU details for clearer system profiling.

@github-actions github-actions Bot added GSoC 2026 backend enhancement New feature or request labels May 30, 2026
@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d0b76a69-ff6c-4ad4-b3bc-16552a753e0d

📥 Commits

Reviewing files that changed from the base of the PR and between adbbb72 and 9378e0c.

📒 Files selected for processing (1)
  • backend/app/utils/hardware_detect.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • backend/app/utils/hardware_detect.py

Walkthrough

This PR adds Apple Silicon detection to backend hardware tiering and exposes the chip name; the frontend shows the detected Apple Silicon name in the onboarding hardware summary, falling back to GPU names or 'No dedicated GPU'.

Changes

Apple Silicon Detection Integration

Layer / File(s) Summary
Backend Apple Silicon Detection Helpers
backend/app/utils/hardware_detect.py
Imports platform and introduces detect_apple_silicon() to identify Apple Silicon chips via sysctl, and detect_apple_silicon_tier() to map chip families to hardware tiers; integrates Apple tier detection into detect_hardware_tier() with early return before RAM/GPU fallback.
Backend Hardware Info Exposure
backend/app/utils/hardware_detect.py
Updates get_hardware_info() to include "apple_silicon" field in the returned diagnostics dictionary.
Frontend Type and UI Integration
frontend/src/types/models.ts, frontend/src/components/OnboardingSteps/AIModelSetupStep.tsx
Adds `apple_silicon: string

Sequence Diagram(s)

sequenceDiagram
  participant Frontend
  participant Backend
  participant HardwareDetect
  participant Sysctl
  Frontend->>Backend: GET /api/hardware (onboarding)
  Backend->>HardwareDetect: detect_hardware_tier()
  HardwareDetect->>HardwareDetect: detect_apple_silicon_tier()
  HardwareDetect->>Sysctl: sysctl -n machdep.cpu.brand_string
  Sysctl-->>HardwareDetect: "Apple M3 Pro" (or fallback)
  HardwareDetect-->>Backend: tier + apple_silicon
  Backend-->>Frontend: 200 { hardware info including apple_silicon }
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested labels

Python, TypeScript/JavaScript

Poem

🐰 Silicon Apple trees now in sight,
From M-chips bright to tier just right,
Detect and display with grace untold,
A Mac recommendation worth its gold! 🍎

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: adding Apple Silicon detection and improved model tier recommendations for Apple Silicon machines.
Linked Issues check ✅ Passed The PR successfully implements all coding requirements from issue #1292: detect_apple_silicon() and detect_apple_silicon_tier() functions added with correct mapping logic, detect_hardware_tier() updated to consult Apple Silicon tier first, apple_silicon field exposed in get_hardware_info(), and frontend updated to display chip name.
Out of Scope Changes check ✅ Passed All changes are directly related to Apple Silicon detection and tiering as specified in issue #1292; no out-of-scope modifications were introduced.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@rohan-pandeyy rohan-pandeyy changed the title Feat/model tier recommendation for apple silicon Feat: Improve Model Tier Recommendation for Apple Silicon May 30, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@backend/app/utils/hardware_detect.py`:
- Around line 1-6: This module uses PEP 604 union syntax (e.g., annotations like
"str | None") but lacks the compatibility import; add "from __future__ import
annotations" as the very first line of backend/app/utils/hardware_detect.py
(before any other imports such as shutil, subprocess, platform, onnxruntime or
psutil) so functions and type hints in this file (e.g., any that use "|" unions)
work on Python 3.9.
- Around line 68-81: The function detect_apple_silicon_tier currently returns
"medium" by default for any Apple Silicon not matched as base M1/M2 small, which
contradicts issue `#1292`; update detect_apple_silicon_tier (using the chip
variable from detect_apple_silicon()) so that the final/default return is
"small" instead of "medium" while keeping existing logic that explicitly
classifies Pro/Max/Ultra as non-small.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 74b81545-d40a-4ea0-9ee8-f3535db5b6fd

📥 Commits

Reviewing files that changed from the base of the PR and between 27a9c6a and adbbb72.

📒 Files selected for processing (3)
  • backend/app/utils/hardware_detect.py
  • frontend/src/components/OnboardingSteps/AIModelSetupStep.tsx
  • frontend/src/types/models.ts

Comment thread backend/app/utils/hardware_detect.py
Comment thread backend/app/utils/hardware_detect.py
@rohan-pandeyy

Copy link
Copy Markdown
Member Author

How'd lint fail for a file that wasn't even touched?! 🤔

@rahulharpal1603 rahulharpal1603 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice

@rahulharpal1603 rahulharpal1603 merged commit 144786b into AOSSIE-Org:main Jun 6, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve Model Tier Recommendation for Apple Silicon

2 participants