STEP 2 Chunk란 무엇인가What Is a Chunk ← 발표자료Slides
DH2026 Workshop · 보조자료Supplement

긴 글을 어떻게 나눌 것인가How Do You Cut Up a Long Document

RAG에서 청크(chunk)는 검색의 최소 단위다. 이 조각을 어떻게 만드느냐가 검색의 정확도와 답변의 전거를 함께 결정한다. 여기서는 가장 단순한 방법 — 글자 수로 자르기 — 를 실제로 해 보고, 왜 그것이 실패하는지 눈으로 확인한다.In RAG a chunk is the smallest unit of retrieval. How you cut these pieces decides both how well search works and what you can cite. Here we try the simplest method there is — cutting by character count — and watch it fail.
① 정의Definition

청크 — 검색할 수 있는 크기의 조각A Chunk Is a Searchable Piece

문서 하나를 통째로 검색에 넣을 수는 없다. 그래서 미리 여러 조각으로 나눠 두고, 질문이 오면 조각 단위로 찾는다. 그 조각이 청크다.You cannot feed a whole document into search. So you cut it into pieces beforehand and, when a question arrives, search piece by piece. Those pieces are chunks.

색인 카드 한 장A single index card

도서관 카드 목록을 떠올리면 쉽다. 책 한 권을 통째로 뒤지지 않고, 미리 만들어 둔 카드를 찾는다. 청크는 그 카드 한 장이고, 카드에 무엇을 적어 두느냐가 검색의 성패를 가른다.Think of a library card catalogue. You do not search the whole book; you search cards prepared in advance. A chunk is one such card — and what you write on it decides whether the search works.

② 이유Why

왜 나눠야 하는가 — 모델은 그렇게 크지 않다Why Cut at All — the Model Is Not That Big

오늘 쓰는 인코더 all-MiniLM-L6-v2가 한 번에 읽는 양은 256토큰이다. 그런데 우리 문서는 그보다 훨씬 크다.The encoder we use, all-MiniLM-L6-v2, reads at most 256 tokens at a time. Our document is a great deal larger than that.

1 / 197
문서 전체Whole document
244,337
자 · 51쪽 PDFcharacters · a 51-page PDF
토큰으로In tokens
50,340
WordPiece 실측measured with WordPiece
인코더 한도Encoder limit
256
토큰tokens
차이The gap
197×
나누지 않으면 0.5%만 읽힌다without cutting, only 0.5% is read
한 번에 못 읽는 정도가 아니라 197배다. 나누는 것은 선택이 아니라 전제다.It is not merely too long — it is 197 times too long. Cutting is not an option; it is a precondition.
③ 쓰임What for

청크는 나중에 무엇이 되는가What a Chunk Becomes

지금 만드는 조각은 파이프라인 끝까지 따라간다. 청크의 경계가 곧 전거의 단위가 된다.The pieces you cut now travel all the way to the end. A chunk boundary becomes a unit of citation.

청크Chunk
Chunk
→
벡터 384개384 numbers
Embed
→
검색 결과A search hit
Retrieve
→
답변의 근거A cited source
Cite
조각을 잘못 만들면
그 뒤 모든 단계가 그 조각 위에 세워진다.
Cut the pieces badly
and every later step is built on them.
④ 실험Experiment

그럼 몇 글자로 자를까So How Many Characters

가장 단순한 방법은 글자 수로 자르는 것이다. 그런데 몇 글자가 정답일까? 막대를 눌러 크기를 바꿔 보면, 답이 없다는 것이 드러난다.The simplest method is to cut by character count. But what is the right number? Click the bars to change it — and watch the question turn out to have no answer.

—
—
—
어떤 크기를 골라도 문장 중간 절단이 사라지지 않는다. 500자가 나쁜 값이어서가 아니다 — 길이는 의미의 경계를 모르기 때문이다.Whatever size you pick, the mid-sentence cuts do not go away. It is not that 500 is a poor number — length simply knows nothing about where meaning ends.
⑤ 결과Result

500자로 자른 결과 — 실제로 무슨 일이 일어났나Cut at 500 — What Actually Happened

워크숍 코드가 쓰는 설정 그대로다: chunk_size=500, chunk_overlap=50. 문서는 535개 조각이 되었다.These are the workshop’s own settings: chunk_size=500, chunk_overlap=50. The document became 535 pieces.

문장 중간에서 끝남Ends mid-sentence
82%
441 / 535
문장 중간에서 시작Starts mid-sentence
63%
337 / 535
표 숫자 나열 포함Contains table digits
16%
86 / 535
조판 지시문 포함Contains typesetting notes
5%
28 / 535

대표 사례Representative cases

직접 살펴보기Look for yourself

⑥ 진단Diagnosis

무엇이 무너졌나What Broke

문제 1 · 구조 무지Problem 1 · structure unknown

자(尺)는 의미를 모른다A ruler knows nothing about meaning

글자 수는 문장이 어디서 끝나는지, 소제목이 어디서 시작하는지 모른다. 그래서 한 문장이 두 조각으로 흩어지고, 소제목은 앞 조각 끝에 고아로 남는다.A character count cannot tell where a sentence ends or a heading begins. So one sentence scatters across two pieces, and a heading is left orphaned at the tail of the piece before it.

문제 2 · 원천 오염Problem 2 · contaminated source

본문이 아닌 것이 섞여 있다What is not body text got mixed in

추출된 텍스트에는 조판 지시문과 도표 축 숫자가 본문과 나란히 들어 있다. 무엇이 본문인지 모르는 채로 자르면 그것들이 그대로 검색 대상이 된다.The extracted text carries typesetting directives and chart-axis digits right beside the prose. Cut without knowing which is which, and all of it becomes searchable.

두 문제의 원인은 하나다.
문서의 구조를 모른다.
Both problems have one cause.
We do not know the document’s structure.
그러면 구조를 알면 된다. 그것이 STEP 3에서 하는 일이다 — 이 문서가 어떻게 생겼는지 먼저 읽고, 그 구조에 맞춰 자른다.Then learn the structure. That is what STEP 3 does — read how this document is built, and cut along those lines.
DH2026 Workshop · Build a Working RAG in Half a Day
이 페이지의 모든 수치는 Source/raw_text.txt를 실제로 분할해 계산했습니다 · 분할기 RecursiveCharacterTextSplitter · 토큰은 all-MiniLM-L6-v2의 WordPiece 실측Every figure here was computed by actually splitting Source/raw_text.txt · Splitter: RecursiveCharacterTextSplitter · Token counts use the real all-MiniLM-L6-v2 WordPiece vocabulary
← 발표자료로 돌아가기Back to the slides · STEP 3 · STEP 4