{
  "id": "cuda/mps-memory-pressure",
  "signature": "RuntimeError: MPS backend out of memory (MPS allocated: 2.00 GB, limit: 2.00 GB)",
  "signature_zh": "运行时错误：MPS后端内存不足（MPS已分配：2.00 GB，限制：2.00 GB）",
  "regex": "RuntimeError: MPS backend out of memory",
  "domain": "cuda",
  "category": "resource_error",
  "subcategory": null,
  "root_cause": "Apple MPS (Metal Performance Shaders) backend has a fixed memory limit that can be exhausted by large models or batch sizes, even on unified memory systems.",
  "root_cause_type": "generic",
  "root_cause_zh": "Apple MPS（Metal Performance Shaders）后端有固定的内存限制，即使是在统一内存系统上，大型模型或批量大小也可能耗尽内存。",
  "versions": [
    {
      "version": "PyTorch 2.1.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "macOS 14.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "MPS 1.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The OS enforces a hard limit on MPS memory allocation.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This is a workaround, not a fix for GPU memory management.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Reduce batch size or model size. For example, in PyTorch, set `batch_size = 16` or use gradient accumulation: `optimizer.step()` after multiple `loss.backward()` calls.",
      "success_rate": 0.85,
      "how": "Reduce batch size or model size. For example, in PyTorch, set `batch_size = 16` or use gradient accumulation: `optimizer.step()` after multiple `loss.backward()` calls.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Reduce batch size or model size. For example, in PyTorch, set `batch_size = 16` or use gradient accumulation: `optimizer.step()` after multiple `loss.backward()` calls."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://pytorch.org/docs/stable/mps.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.85,
  "resolvable": "partial",
  "first_seen": "2023-12-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}