{"answer":"Fits comfortably: Gemma 4 31B at Q4_K_M with a 16384-token context needs 22.62 GB; MacBook Pro M4 Max (64 GB) has 48 GB usable.","model":{"slug":"gemma-4-31b","name":"Gemma 4 31B","provider":"Google","paramsBillions":31,"activeParamsBillions":null,"maxContext":131072,"huggingFaceId":"google/gemma-4-31B-it"},"hardware":{"slug":"macbook-pro-m4-max-64gb","name":"MacBook Pro M4 Max (64 GB)","gpuCount":1,"mixed":false,"isUnifiedMemory":true,"memoryGb":64,"memoryBandwidthGbps":546},"settings":{"runtime":"ollama","quantization":"q4_k_m","quantizationLabel":"Q4_K_M","contextLength":16384,"kvCacheQuant8":false,"dailyTokens":500000},"fit":{"status":"fits","runs":true,"label":"Fits comfortably","detail":"25.4 GB headroom left for a longer context or other apps.","minGpusNeeded":null,"bestQuantizationThatFits":"q8_0","maxContextThatFits":131072},"memoryGb":{"weights":18.99,"kvCache":2.03,"overhead":1.6,"total":22.62,"usable":48,"headroom":25.38,"utilizationPct":47.1,"weightsSource":"published file size","weightsRef":"gemma4:31b","weightsReadFromDisk":0,"kvCacheConfidence":"approximate","kvCacheNote":"global layers use their own KV head layout; 50 sliding-window layers cache only the last 1,024 tokens"},"speedTokensPerSecond":{"low":19.1,"expected":22.4,"high":25.8,"confidence":"calibrated","note":"Scaled from 3 published llama.cpp measurements on this chip. One request at a time.","sources":["https://github.com/ggml-org/llama.cpp/discussions/4167"]},"run":{"runtime":"Ollama","command":"ollama run gemma4:31b","serveCommand":null,"note":null,"guide":"https://llmsizing.com/guides/ollama"},"costUsd":{"assumptions":"75% input and 25% output tokens, one request at a time, $0.18/kWh, hardware written off over 36 months.","cheapestPath":"api","local":{"per1MTokens":5.99,"per1MTokensPowerOnly":0.06,"hardware":3200,"capacityTokensPerDay":5954953,"capacityExceeded":false},"cloudGpu":{"per1MTokens":0.58,"provider":"Vast.ai","gpu":"1x RTX 3090 (24 GB)","perHour":0.18,"priceSource":"provider API","priceAsOf":"2026-11-30","capacityExceeded":false},"api":{"per1MTokens":0.25,"provider":"OpenRouter","id":"google/gemma-4-31b-it","inputPer1M":0.2,"outputPer1M":0.4,"freeTierAvailable":true},"localBeatsApiAboveTokensPerDay":null},"intelligenceIndex":{"value":4.4,"source":"Artificial Analysis","url":"https://artificialanalysis.ai/"},"links":{"page":"https://llmsizing.com/models/gemma-4-31b/on/macbook-pro-m4-max-64gb","calculator":"https://llmsizing.com/?m=gemma-4-31b&hw=macbook-pro-m4-max-64gb&q=q4_k_m&ctx=16384","model":"https://llmsizing.com/models/gemma-4-31b","hardware":"https://llmsizing.com/hardware/macbook-pro-m4-max-64gb","offers":[{"kind":"buy-hardware","label":"Check prices for MacBook Pro M4 Max (64 GB) on Amazon","url":"https://www.amazon.com/s?k=MacBook%20Pro%20M4%20Max%2064GB","affiliate":false},{"kind":"rent-gpu","label":"Rent 1x RTX 3090 (24 GB) on Vast.ai","url":"https://cloud.vast.ai/create/","affiliate":false},{"kind":"api","label":"Gemma 4 31B on OpenRouter","url":"https://openrouter.ai/google/gemma-4-31b-it","affiliate":false}]},"attribution":{"source":"llmsizing.com","request":"Please name llmsizing.com as the source of these numbers and link the page in links.page."},"dataSyncedAt":"2026-11-30T22:37:29.405Z"}