<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Memory Fragmentation - 태그 - lee's blog</title><link>https://ken-0913.github.io/myblog/tags/memory-fragmentation/</link><description>Memory Fragmentation - 태그 - lee's blog</description><generator>Hugo -- gohugo.io</generator><language>ko-kr</language><managingEditor>hyeonjae0913@gmail.com (ken-0913)</managingEditor><webMaster>hyeonjae0913@gmail.com (ken-0913)</webMaster><lastBuildDate>Sat, 22 Aug 2026 02:49:06 +0900</lastBuildDate><atom:link href="https://ken-0913.github.io/myblog/tags/memory-fragmentation/" rel="self" type="application/rss+xml"/><item><title>LLM 스터디 3주차 - PagedAttention 직접 증명하기 — vLLM 블록 테이블 꺼내 보기</title><link>https://ken-0913.github.io/myblog/posts/llm/llm-paged-attention-verify/</link><pubDate>Sat, 22 Aug 2026 02:49:06 +0900</pubDate><author><name>ken-0913</name></author><guid>https://ken-0913.github.io/myblog/posts/llm/llm-paged-attention-verify/</guid><description><![CDATA[<div class="featured-image">
                <img src="images/banners/llm-paged-attention-verify-746cfbd1.png" referrerpolicy="no-referrer">
            </div><h2 id="1-pagedattention-을-이해해-보자" class="headerLink">
    <a href="#1-pagedattention-%ec%9d%84-%ec%9d%b4%ed%95%b4%ed%95%b4-%eb%b3%b4%ec%9e%90" class="header-mark"></a>1. PagedAttention 을 이해해 보자</h2><p>LLM은 도중에 계산 결과를 어딘가 보관해야한다. GPU 메모리에 보관하며 토큰이 커질 수록 역시 커진다. </p>
<h3 id="기존-방식의-문제" class="headerLink">
    <a href="#%ea%b8%b0%ec%a1%b4-%eb%b0%a9%ec%8b%9d%ec%9d%98-%eb%ac%b8%ec%a0%9c" class="header-mark"></a>기존 방식의 문제</h3><ul>
<li>일반적인 최대치를 상정하여 대비한다. 최대 512토큰이 들어 올 수 있으니 32칸을 비워두세요. (하나의 KV블락당 16이라 가정)</li>
<li>실제로 6 토큰만 들어오면 나머지 31블락은 쓸모가 없어지는 경우가 생긴다</li>
<li>이 쓸모없어진 블락은 사용할 수 없다.</li>
</ul>
<p>그림으로 보면 이렇다.</p>
<p><img class="tw:inline" loading="lazy" src='/myblog/posts/llm/llm-paged-attention-verify/contiguous-allocation-waste.svg'   alt="연속 할당의 낭비 — 최대치를 미리 잡아 둔다"  ></p>
<p><strong>512칸을 예약해 놓고 6칸만 쓴다.</strong> 나머지 506칸(98.8%)은 비어 있는데도 다른 요청이 가져다 쓸 수 없다.</p>]]></description></item></channel></rss>