SShortSingh.
Back to feed

How to Size the KV Cache for Local LLMs Before It Runs Your GPU Out of Memory

0
·5 views

A common cause of local LLM load failures is not the model weights but the key-value cache, which stores per-token attention tensors and grows linearly with context length. The cache size can be estimated from the number of layers, key/value heads, head dimension, and bytes per element, with grouped-query attention sharply reducing the footprint. Worked examples for two 7B models show that a 32K context can require roughly 1.75 GiB or 4 GiB of VRAM for the cache alone at f16 precision. Quantizing the cache saves less than the common rule of thumb suggests, because block-scaling overhead in formats like q8_0 and q4_0 reduces the savings slightly. The article notes that these figures exclude weights, compute buffers, and runtime overhead, which must be added when planning memory on consumer GPUs.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Prerendering One Page Per Device in Next.js and Matching the Cache Key

A developer explains how to prerender a static marketing page separately for each device type in the Next.js App Router, rather than serving one page to everyone. The approach lets the browser handle the choice, since the page has no per-visitor content and can be built once. A page opts in with a marker export and refuses to render at its original path, so only device-specific URLs serve it. A generator script reads the marked pages and creates one wrapper route per device, along with a list of cacheable paths. The script is set to run before development and build steps so the generated routes stay current.

0
ProgrammingDEV Community ·

Choosing between extend, regenerate, and section edit for short soundtrack beds

A developer describes replacing regenerate-from-zero with three distinct operations when a demo video's soundtrack is nearly right but not shippable. Extend suits cases where the motif works but the track is too short, while section edit fixes one problematic region and full regeneration is reserved for wrong direction in mood, genre, or vocals. The author recommends concrete prompt practices, such as stating target length, naming elements that must stay, and forbidding new hooks. They also advise checking results against the video timeline, limiting candidate counts, and defining acceptance criteria before using any tool. The approach is presented as a practical workflow for quickly moving from a usable short clip to a track that matches the edit.

0
ProgrammingDEV Community ·

Fundsroom Explains Workflow-First Design for EduRoom and ERP Inventory Software

Fundsroom argues that useful software should be built around the underlying operational workflow rather than around a list of features. Its EduRoom platform links training sessions, FundsAI-based student evaluation, real business tasks, and completion tracking into one structured internship process. In its ERP inventory workflow, stock receipt, inventory recording, batch tracking, availability updates, and reorder monitoring are connected, with RFID optionally linking physical tags to digital records. The post recommends that developers first define triggers, responsibilities, required data, exception handling, and user visibility before choosing features. The company presents this approach as a way to make software support accurate and efficient work.

0
ProgrammingDEV Community ·

15 Free SEO Tools for Digital Marketers in 2026

Santhosh Jose, a freelance digital marketer from Kannur, has put together a list of 15 free SEO tools aimed at beginners, freelancers and small business owners. He notes that many tools labeled free restrict their best features behind paywalls, so his selection focuses on tools whose free versions are genuinely usable. The list is organized around keyword research, technical audits and site performance, with each tool described by its purpose, ideal user and free-tier limits. He cautions that free plans change often and readers should check official websites for current limits.