많은 애플리케이션은 수십억 개의 임베딩을 생성해야 합니다. 앞서 살펴봤듯이, 현대 임베딩은
때때로 수천 개의 차원을 가지기도 합니다. 각 차원이
float32
로 표현된다면 차원당
4
바이트의
메모리가 필요합니다. 따라서
768
개 차원을 가진
all
-
mpnet
-
base
-
v2
모델에서 생성된
1
억
개 벡터를 저장하려면 거의
300GB
의 메모리가 필요합니다.
일반적으로 한 문장은
40
토큰을 넘지 않지만, 이를
768
차원의 벡터로 표현하는 경우가 흔합니
다. 과연
40
개의 토큰을 표현하는 데
768
차원이 필요할까요? 현실적으로는 임베딩 학습이 매
우 비효율적이어서 많은 차원이 실제로는 크게 도움이 되지 않을 때가 많습니다.
따라서 임베딩 크기를 최적화하고 저장과 계산 요구 사항을 줄이기 위해 여러 임베딩 잘라내기
및 양자화 접근법이 개발되었습니다. 수백만 개 이상의 벡터가 있는 환경에서 작업한다면 이런
기법이 매우 유용할 가능성이 높습니다. 이런 접근법 중 몇 가지를 살펴보겠습니다.
11.6.1
마트료시카 임베딩
마트료시카
Matryoshka
임베딩은 러시아 전통 인형인 마트료시카
28
에서 이름을 따왔습니다. 이 인
형들은 크기가 작아지는 순서로 서로의 안에 들어가는 구조로 만들어집니다. 마트료시카 임베
딩은
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.