STEP 4 청크에 전거가 실리는 법How Provenance Rides Along ← 발표자료Slides
DH2026 Workshop · 보조자료Supplement

청크 하나의 생김새What a Chunk Actually Looks Like

STEP 3에서 만든 XML을 구조 그대로 잘라 청크를 만든다. 이때 Goal 번호·이름·쪽수·소제목이 청크에 함께 실린다. 그 실린 정보가 나중에 답변 아래 붙는 전거가 된다. 여기서는 청크 하나를 열어 그 안을 그대로 본다.We cut chunks from the XML along the structure it already declares. As we do, the Goal number, its name, the page range and the heading ride along with each chunk. That is what later appears as the citation beneath an answer. Here we open one chunk and look inside, unedited.
① 절단Cutting

XML 구조를 그대로 따른다We Follow the Structure Already There

새로 자를 곳을 정하지 않는다. <subsection> 경계가 이미 있으므로 그 경계가 곧 청크 경계다. 소제목 108개가 청크의 출발점이 된다.We do not decide where to cut. The <subsection> boundaries already exist, so those are the chunk boundaries. All 108 subsections become the starting point.

workshop_code.md4-1
for goal in root.findall("goal"):
    for sub in goal.findall("subsection"):
        heading = sub.get("heading")          # 소제목the heading
        body    = [p.text for p in sub.findall("paragraph")]
자를 곳을 찾지 않는다. 이미 적혀 있다.We do not look for the cut. It is already written down.
② 출처Origin

메타데이터는 어디서 오는가Where Does the Metadata Come From

청크에 붙는 정보는 새로 만든 것이 아니다. 전부 XML에 이미 적혀 있던 것을 옮겨 담을 뿐이다. 오른쪽 항목에 마우스를 올려 보라 — 왼쪽에서 그 출처가 빛난다.None of it is invented. Every field was already written in the XML; we merely carry it across. Hover a field on the right and watch its source light up on the left.

◧ XML 원본The XML source
<goal number="1" name="No poverty" pages="10-11">
  <subsection heading="Working poverty rate has decreased worldwide but per…">
    <paragraph>Worldwide, working poverty has significantly declined over the past 25 yea…</paragraph>
    <paragraph>Eastern and South-Eastern Asia and Central and Southern Asia have made sig…</paragraph>
  </subsection>
</goal>
◨ 청크의 metadataThe chunk’s metadata
idG01-S03Goal 번호 + 순번으로 생성built from the Goal number and sequence
goal1goal 태그의 numberthe goal tag’s number
goal_nameNo povertygoal 태그의 namethe goal tag’s name
pages10-11goal 태그의 pagesthe goal tag’s pages
headingWorking poverty rate has decreased worldwide but persist…subsection 태그의 headingthe subsection tag’s heading
서지 사항을 옮겨 적는 일Copying down the bibliographic details

인용문을 카드에 옮길 때 저자·서명·권차·쪽수를 함께 적어 두는 것과 같다. 나중에 그 카드만 보고도 원문으로 돌아갈 수 있어야 하기 때문이다. metadata는 그 서지 사항이다.It is what you do when copying a quotation onto a card: write the author, title, volume and page alongside it, so that the card alone can take you back to the source. The metadata is that note.

③ 실물The thing itself

청크 하나를 그대로 열어 보면Opening One Chunk, Unedited

아래는 sdg_chunks.jsonl의 한 줄을 그대로 옮긴 것이다. 가공하지 않았다. 청크 하나는 metadata와 text 두 부분으로 되어 있다.Below is one line of sdg_chunks.jsonl, exactly as it is on disk. A chunk has two parts: metadata and text.

sdg_chunks.jsonl · G01-S03 153단어 · words · 203토큰 tokens

    
■ metadata · 전거provenance

Goal 번호·이름·쪽수·소제목. 검색되지 않는다. 그러나 결과가 뽑힐 때 반드시 따라온다 — STEP 9의 출처 표시와 STEP 10의 답변 각주가 전부 여기서 나온다.Goal number, name, pages, heading. None of it is searched. But it always comes along with a hit — the source lines in STEP 9 and the citations under the STEP 10 answer all come from here.

■ text · 검색 대상what is searched

소제목 + 본문. 이 부분만 384개 숫자로 바뀐다. 소제목이 여기에도 들어 있는데, 나뉜 조각이 맥락을 잃지 않도록 앞에 붙여 둔 것이다.Heading plus body. Only this becomes 384 numbers. The heading appears here too — placed in front so that a split piece does not lose its topic.

④ 분할Splitting

너무 길면 나눈다 — 전거는 그대로 둔 채Too Long? Split It — but Leave the Provenance Alone

인코더가 한 번에 읽는 양은 256토큰이다. 넘으면 뒷부분이 잘린 채 벡터가 되므로, 172단어(소제목 포함)를 넘으면 문단 경계에서 나눈다. 이때 heading·goal·pages는 건드리지 않는다.The encoder reads at most 256 tokens. Beyond that the tail is silently dropped before the vector is made, so anything over 172 words (heading included) is split at a paragraph boundary. The heading, goal and pages are left untouched.

소제목Subsections
108
XML의 subsectionin the XML
청크Chunks
176
분할 후after splitting
분할 없이 유지Kept whole
47
한도 안에 들어옴already within the limit
최대 토큰Largest chunk
249
한도 256 이내within the 256 limit
나뉘어도 출처는 하나다. 두 조각 모두 같은 Goal, 같은 쪽, 같은 소제목을 가리킨다 — part만 다르다.Split or not, the source is one. Both pieces point at the same Goal, the same pages, the same heading — only part differs.
⑤ 탐색Browse

176개를 직접 살펴보기Look Through All 176

—

    
⑥ 정리In sum

이 조각이 끝까지 간다This Piece Goes All the Way

metadata는 검색되지 않는다.
그러나 결과에는 반드시 따라온다.
Metadata is never searched.
But it always arrives with the result.

지금 만든 청크 176개가 STEP 5에서 벡터가 되고, STEP 6에서 색인에 담기고, STEP 9에서 검색되어, STEP 10의 답변 아래 출처 세 줄로 나타난다. 그 세 줄에 적히는 내용이 지금 이 metadata다.These 176 chunks become vectors in STEP 5, enter the index in STEP 6, get retrieved in STEP 9, and surface as three source lines beneath the STEP 10 answer. What is written on those lines is this metadata.

다음은 STEP 5 — 이 text가 384개의 숫자로 바뀐다.Next is STEP 5 — this text becomes 384 numbers.
DH2026 Workshop · Build a Working RAG in Half a Day
이 페이지의 청크는 Source/sdg_chunks.jsonl을 가공 없이 그대로 실었습니다 · 토큰은 all-MiniLM-L6-v2의 WordPiece 실측The chunks on this page are reproduced verbatim from Source/sdg_chunks.jsonl · Token counts use the real all-MiniLM-L6-v2 WordPiece vocabulary
← 발표자료로 돌아가기Back to the slides · STEP 3 · STEP 5