# RuntimeError: MPS backend out of memory (MPS allocated: 2.00 GB, limit: 2.00 GB)

- **ID:** `cuda/mps-memory-pressure`
- **Domain:** cuda
- **Category:** resource_error
- **Verification:** ai_generated
- **Fix Rate:** 85%

## 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.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| PyTorch 2.1.0 | active | — | — |
| macOS 14.0 | active | — | — |
| MPS 1.0 | active | — | — |

## Workarounds

1. **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.** (85% success)
   ```
   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.
   ```

## Dead Ends

- **** — The OS enforces a hard limit on MPS memory allocation. (90% fail)
- **** — This is a workaround, not a fix for GPU memory management. (50% fail)
