Skip to main content

Transparent unified-memory fit estimates for local AI models

Project description

๐Ÿฉบ Mac AI Doctor

A transparent first opinion on whether a local AI model fits your Apple Silicon Mac.

Mac AI Doctor (maid) reads small metadata filesโ€”never model weightsโ€”and estimates weight, KV-cache, runtime, and safety-margin memory. It reports a range rather than fake precision.

              demo/llama-8b
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Weights        โ”‚      4.77 GB โ”‚
โ”‚ KV cache       โ”‚      0.54 GB โ”‚
โ”‚ Runtime        โ”‚      1.25 GB โ”‚
โ”‚ Peak range     โ”‚ 7.21โ€“8.20 GB โ”‚
โ”‚ Available      โ”‚     16.0 GB  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ COMFORTABLE ยท high confidence โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Good fit. Keep normal apps modest.             โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Install

This project uses uv. Install it first, then use either a packaged release or a checkout.

# Package install (once published)
uv tool install mac-ai-doctor
# Development checkout
git clone https://github.com/barvhaim/mac-ai-doctor.git
cd mac-ai-doctor
uv sync --group dev

Use

uv run maid system
uv run maid check meta-llama/Llama-3.1-8B-Instruct
uv run maid check ~/Models/model-q4.gguf --memory-gb 16 --context 8192
uv run maid compare org/model-a org/model-b --memory-gb 32 --concurrency 2
uv run maid recommend --memory-gb 16 --task coding
uv run maid check MODEL --json

On Linux or when detection fails, pass --memory-gb. --kv-dtype accepts fp32, fp16, bf16, int8, or q8. For deterministic offline demos/tests, check and compare include a hidden --fixture FILE option using the documented fixture shape in tests/fixtures/.

What it reads (and what it does not)

For Hugging Face and MLX repositories, the tool requests config.json, an optional model.safetensors.index.json, and the model API's file-size listing. It never downloads weight contents. For local GGUF files it reads only the 24-byte fixed header and uses file size. Local directories/config files are also supported. Dense and MoE architecture fields are parsed; MoE active parameters are informational because all expert weights still need memory.

No credentials are collected. Normal Hugging Face HTTP requests reveal the same network metadata as any web request (IP and user-agent) to Hugging Face.

Formula and policy

Decimal GB are used. When metadata permits:

weights = stored_weight_bytes ร— 1.06
KV = 2 ร— layers ร— KV_heads ร— head_dim ร— context ร— concurrency ร— dtype_bytes
runtime = max(1 GB, weights ร— 12%) + 0.25 GB ร— concurrency
low..high = subtotal ร— 1.10 .. subtotal ร— 1.25

COMFORTABLE means the high estimate is at most 80% of unified memory; TIGHT fits but leaves less than 20%; UNLIKELY exceeds memory; UNKNOWN means weight size is unavailable. Confidence reflects metadata completenessโ€”not prediction accuracy. Unified memory is shared by macOS, apps, GPU, and model runtime. Implementations differ, memory mapping can help, and multimodal image encoders may add memory not exposed in text config metadata. Treat this as screening, then verify with your actual runtime. The tool intentionally makes no tokens/second prediction.

JSON

--json emits schema version 1.0, model metadata, inputs, component estimates, range, headroom, verdict, confidence, and assumptions. Fields that cannot be supported are null, never invented.

Troubleshooting

  • Cannot detect memory: pass --memory-gb N; automatic detection requires macOS.
  • 401/403 or gated model: authenticate/access the model or use a downloaded config.json.
  • No weight size: use a repository with safetensors index/API sizes or a local GGUF.
  • GGUF rejected: versions 2 and 3 are supported; verify the file is complete.
  • Very long context looks large: KV memory grows linearly with context and concurrency.

Development

uv sync --group dev
uv run ruff check . && uv run mypy src && uv run pytest
uv build

See CONTRIBUTING.md. MIT licensed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mac_ai_doctor-0.1.0.tar.gz (48.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mac_ai_doctor-0.1.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file mac_ai_doctor-0.1.0.tar.gz.

File metadata

  • Download URL: mac_ai_doctor-0.1.0.tar.gz
  • Upload date:
  • Size: 48.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mac_ai_doctor-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7ecb89990e77018364f4c423c4028d902a6fa1e0b27a4ac4dfd6a8e1bbf58b79
MD5 06a8c5a927defa9e86383d49160dac3b
BLAKE2b-256 78afd522128e6d9fe09bc4c2f9ed28f3f042775bc0bc1e59e4052afb1b145f53

See more details on using hashes here.

File details

Details for the file mac_ai_doctor-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mac_ai_doctor-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mac_ai_doctor-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1d1995a17a86ae78dcae575faabd2f63704c376c7114af9345b824cccdc45e19
MD5 7337878d87a489ba6abf71033dd9f687
BLAKE2b-256 4bad245647649a52906660e6e9847ec0d835430bc6f0b61c17e516e1f2d4bfce

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page