KVMem is a memory virtualization framework designed to enable long-context language model inference on computers with limited graphics memory. It manages key-value caches across inference backends, reducing the amount of historical context that must remain in GPU memory. Its tiered memory architecture distributes cached information across graphics memory, system RAM, and SSD storage. Selective retrieval mechanisms restore relevant context as generation progresses. Users can configure context limits, memory quotas, GPU history budgets, and generation reserves. The framework integrates with inference engines including llama.cpp and NInfer. OpenAI-compatible API endpoints enable integration with external AI applications and support streaming responses. Available capabilities depend on the selected backend, model, and hardware configuration.
Features
- Key-value cache virtualization for running long-context language models on memory-constrained consumer hardware
- Tiered memory management across GPU memory, system RAM, and SSD storage
- Selective historical context retrieval with reusable generation workspace and configurable memory budgets
- Multiple inference backend integrations including llama.cpp and NInfer with backend-specific model compatibility
- OpenAI-compatible API endpoints supporting streaming responses and external AI application integration
- Configurable runtime settings with context limits, memory quotas, and GPU resource allocation controls