<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>KV Cache - 태그 - lee's blog</title><link>https://ken-0913.github.io/myblog/tags/kv-cache/</link><description>KV Cache - 태그 - 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>Mon, 10 Aug 2026 21:00:00 +0900</lastBuildDate><atom:link href="https://ken-0913.github.io/myblog/tags/kv-cache/" rel="self" type="application/rss+xml"/><item><title>LLM 스터디 2주차 - 단일 모델 LLM 서빙 서버 직접 만들어보기</title><link>https://ken-0913.github.io/myblog/posts/llm/llm-serving-single-model-lab/</link><pubDate>Mon, 10 Aug 2026 21:00:00 +0900</pubDate><author><name>ken-0913</name></author><guid>https://ken-0913.github.io/myblog/posts/llm/llm-serving-single-model-lab/</guid><description><![CDATA[<div class="featured-image">
                <img src="images/banners/llm-serving-single-model-lab-e6f25d84.png" referrerpolicy="no-referrer">
            </div><p>LLM 서빙은 보통 vLLM이나 TGI 같은 프레임워크를 가져다 쓴다. 하지만 그 안에서 무슨 일이 벌어지는지는 직접 만들어봐야 감이 온다. 이번 실습은 <strong>배칭 · 스트리밍 · 프로세스 격리</strong>를 손으로 구현한 서버를 띄우고, 로그를 읽어 동작을 확인하는 과정이다.</p>
<p>대상 코드는 책 <em>Hands-On LLM Serving and Optimization</em>의 공식 저장소 <a href="https://github.com/orca3/llm-model-inference" target="_blank" rel="noopener noreferrer">orca3/llm-model-inference</a> 중 <code>ch03/single_model_llm_serving</code>이다. 모델은 <strong>facebook/opt-125m</strong>을 쓴다. 작아서 6GB GPU에서도 충분히 돌아간다.</p>
<p>이 글의 모든 로그와 명령 결과는 <strong>RTX 3050 6GB 리눅스 머신에서 실제로 실행한 것</strong>이다.</p>]]></description></item><item><title>LLM 스터디 1주차 - Transformer격파하기</title><link>https://ken-0913.github.io/myblog/posts/llm/llm-series-all-in-one/</link><pubDate>Fri, 07 Aug 2026 20:00:00 +0900</pubDate><author><name>ken-0913</name></author><guid>https://ken-0913.github.io/myblog/posts/llm/llm-series-all-in-one/</guid><description><![CDATA[<div class="featured-image">
                <img src="images/banners/llm-series-all-in-one-85eb1b79.png" referrerpolicy="no-referrer">
            </div><h2 id="이-글의-구성" class="headerLink">
    <a href="#%ec%9d%b4-%ea%b8%80%ec%9d%98-%ea%b5%ac%ec%84%b1" class="header-mark"></a>이 글의 구성</h2><table>
	<thead>
			<tr>
					<th></th>
					<th>다루는 것</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td>1부</td>
					<td><a href="#1%eb%b6%80-%ec%9e%84%eb%b2%a0%eb%94%a9%ea%b3%bc-%ec%9c%84%ec%b9%98-%ec%a0%95%eb%b3%b4-token%ec%9d%84-%eb%b2%a1%ed%84%b0%eb%a1%9c-%eb%b0%94%ea%be%b8%ea%b8%b0" rel="">임베딩과 위치 정보 (Token을 벡터로 바꾸기)</a></td>
			</tr>
			<tr>
					<td>2부</td>
					<td><a href="#2%eb%b6%80-qkv%eb%a1%9c-%eb%ac%b8%eb%a7%a5%ec%9d%84-%ec%84%9e%eb%8a%94-self-attention" rel="">Q·K·V로 문맥을 섞는 self-attention</a></td>
			</tr>
			<tr>
					<td>3부</td>
					<td><a href="#3%eb%b6%80-multi-head-%eb%a7%88%eb%ac%b4%eb%a6%ac--concat%ea%b3%bc-w%e2%82%92" rel="">Multi-Head 마무리 — concat과 Wₒ</a></td>
			</tr>
			<tr>
					<td>4부</td>
					<td><a href="#4%eb%b6%80-%ea%b0%81-token%ec%9d%84-%eb%94%b0%eb%a1%9c-%ea%b0%80%ea%b3%b5%ed%95%98%eb%8a%94-mlp" rel="">각 Token을 따로 가공하는 MLP</a></td>
			</tr>
			<tr>
					<td>5부</td>
					<td><a href="#5%eb%b6%80-prefill-decode-kv-cache" rel="">prefill, decode, KV Cache</a></td>
			</tr>
			<tr>
					<td>6부</td>
					<td><a href="#6%eb%b6%80-%ec%b6%9c%eb%a0%a5%ec%b8%b5%ea%b3%bc-sampling--%eb%8b%a4%ec%8b%9c-%ea%b8%80%ec%9e%90%eb%a1%9c" rel="">출력층과 sampling — 다시 글자로</a></td>
			</tr>
	</tbody>
</table>
<h1 id="1부-임베딩과-위치-정보-token을-벡터로-바꾸기" class="headerLink">
    <a href="#1%eb%b6%80-%ec%9e%84%eb%b2%a0%eb%94%a9%ea%b3%bc-%ec%9c%84%ec%b9%98-%ec%a0%95%eb%b3%b4-token%ec%9d%84-%eb%b2%a1%ed%84%b0%eb%a1%9c-%eb%b0%94%ea%be%b8%ea%b8%b0" class="header-mark"></a>1부. 임베딩과 위치 정보 (Token을 벡터로 바꾸기)</h1><p>LLM은 글자를 직접 다루지 못한다. 오직 <strong>숫자(벡터)</strong> 만 계산할 수 있다.
그래서 첫 단계는 단어(정확히는 token)를 벡터로 바꾸는 것인데, 이를 <strong>embedding(임베딩)</strong> 이라 한다. 먼저 GPT-3를 예로 임베딩이 <strong>행렬 연산</strong>으로 어떻게 이뤄지는지 본다.</p>]]></description></item></channel></rss>