사람은 “빈곤”과 “가난”이 비슷하다는 걸 안다. 기계는 모른다. 기계에게 두 글자는 서로 다른 기호일 뿐이다.A person knows that “poverty” and “destitution” are close in meaning. A machine does not. To it they are simply two different symbols.
“working poverty”와 “extreme poverty”는 글자가 다르다. 얼마나 다른지는 셀 수 없다. 비슷함에 정도를 매길 방법이 없다.“working poverty” and “extreme poverty” are different strings. How different cannot be counted. Similarity has no degree.
각 문장에 좌표를 주면 사이의 거리가 나온다. 가까우면 비슷하고 멀면 다르다 — 비슷함이 수치가 된다.Give each sentence a coordinate and you get a distance between them. Near means alike, far means unalike — similarity becomes a number.
지도 위 한 점은 숫자 둘로 적는다. 공간 속 한 점은 셋으로 적는다. 숫자를 더 많이 쓰면 더 많은 축을 가진 공간의 한 점이 된다. 그게 전부다.A point on a map takes two numbers. A point in space takes three. Use more numbers and you have a point in a space with more axes. That is all there is to it.
도서관은 책마다 청구기호를 붙여 자리를 정한다. 주제가 비슷하면 옆자리에 놓인다. 임베딩도 같은 일을 한다 — 다만 자리를 정하는 것이 사서가 아니라 학습된 모델이고, 서가가 384차원일 뿐이다.A library gives each book a call number and thereby a place; books on kindred subjects end up side by side. Embedding does the same — except the placement is decided by a trained model rather than a librarian, and the shelf has 384 dimensions.
실제 청크 하나(G01-S03)를 넣어 따라가 보자.Let us follow one real chunk — G01-S03 — through.
모델은 단어가 아니라 토큰 단위로 읽는다. 자주 쓰는 말은 통째로, 드문 말은 조각으로 나뉜다. 금색이 쪼개진 조각, 청록은 문장의 시작과 끝을 알리는 특수 토큰이다.The model reads tokens, not words. Common words stay whole; rarer ones break into pieces. Gold marks a broken-off piece, teal the special tokens that mark where the text begins and ends.
토큰마다 숫자 384개가 나오므로 203 × 384 표가 된다. 그런데 우리에게 필요한 건 문장 하나에 좌표 하나다. 그래서 세로로 평균을 내어 한 줄로 접는다.Each token yields 384 numbers, so you get a 203 × 384 table. But what we need is one coordinate for one passage. So we average down the columns and fold it into a single row.
# 203개 토큰의 같은 자리끼리 평균average the same position across all 203 tokens vector = tokens.mean(axis=0) # (203, 384) → (384,) vector = vector / norm(vector) # 길이를 1로scale to length 1
아래가 G01-S03의 실제 벡터다. 가공하지 않은 값 그대로다.Below is the actual vector for G01-S03 — the raw values, unedited.
절반 가까이가 음수다. 그런데 음수는 “없음”이 아니라 “반대쪽”이다. 위도 −37도가 “위도가 모자란다”는 뜻이 아니라 남반구를 가리키듯, 각 차원은 원점을 기준으로 양쪽으로 뻗은 축이고 음수는 그 반대편이다.Nearly half of them are negative. But a negative is not “less than nothing” — it is “the other side”. Latitude −37 does not mean a shortage of latitude; it means the southern hemisphere. Each dimension is an axis running both ways from the origin, and a negative value simply points the other way.
정규화하면 벡터는 384차원 구(球) 위의 한 점이 된다. 그 구에서 모든 좌표가 양수인 영역은 전체의 1/2384 — 사실상 0이다. 음수가 없는 쪽이 오히려 불가능하다.Normalised, the vector is a point on a 384-dimensional sphere. On that sphere the region where every coordinate is positive is 1/2384 of the whole — effectively nothing. Having no negatives is the impossible case.
음수가 있어야 두 벡터가 정반대를 가리킬 수 있다. 전부 양수라면 모든 벡터가 한 귀퉁이에 몰려서 서로 구별되지 않는다. “뜻이 정반대”가 “거리가 가장 멀다”로 나타나려면 음수가 있어야 한다.Negatives are what let two vectors point in opposite directions. If everything were positive, every vector would huddle in one corner and none could be told apart. “Opposite in meaning” can only show up as “farthest away” if negatives exist.
위도 37도라는 숫자만으로는 어디인지 알 수 없다. 경도와 함께 놓여야 서울이 된다. 384개의 숫자도 마찬가지다 — 함께 있을 때만 자리를 가리킨다.Latitude 37 on its own tells you nothing; only with a longitude does it become Seoul. The 384 numbers are the same — they name a place only together.
말로만 하면 믿기 어렵다. 실제 176개 벡터로 확인해 보자. 청크를 하나 고르면, 그 벡터에서 가장 가까운 셋과 가장 먼 하나를 보여준다.Claims are cheap. Let us check against all 176 real vectors. Pick a chunk and see its three nearest neighbours and its single farthest one.
둘이나 셋이면 그림으로 그릴 수 있어 편할 텐데, 왜 384개일까. 줄여 보면 답이 나온다. 아래는 같은 벡터를 몇 차원까지만 남겼을 때 “가장 가까운 이웃이 같은 Goal인 비율”이다.Two or three would be drawable and convenient — so why 384? Reduce them and the answer appears. Below is the share of chunks whose nearest neighbour shares their Goal, when only the first so many dimensions are kept.
아래는 176개 청크를 3차원에 눌러 담은 것이다. 색은 Goal이고, 끌어서 돌려 볼 수 있다. 2차원(정확도 19%)보다는 낫지만 여전히 37%에 그친다.Here are all 176 chunks pressed into three dimensions. Colour is the Goal, and you can drag to rotate. Better than two dimensions (19%), but still only 37%.
이제 청크 176개가 각각 384개의 숫자를 갖게 되었다. STEP 6에서는 이 좌표들을 찾기 쉽게 정리해 둔다 — 그것이 벡터 데이터베이스다. STEP 7에서는 질문도 같은 방법으로 좌표가 되고, STEP 8에서 둘 사이의 거리를 손으로 재 본다.Each of the 176 chunks now carries 384 numbers. STEP 6 files those coordinates so they can be found — that is the vector store. In STEP 7 the question becomes a coordinate the same way, and in STEP 8 we measure the distance between them by hand.
Source/sdg_embeddings.jsonl의 실제 값입니다 · 토큰은 all-MiniLM-L6-v2의 WordPiece 실측 · 차원 축소는 주성분분석(PCA)Vectors are the real values in Source/sdg_embeddings.jsonl · Tokens use the actual all-MiniLM-L6-v2 WordPiece vocabulary · Dimensionality reduction by PCA