
343
11
장
표현 학습과 임베딩
11.5
지시 임베딩
지금까지 임베딩 모델이 의미 검색이나 패러프레이징과 같은 특정 작업을 해결하는 데 특화되
어 있다는 점을 살펴봤습니다. 최근에는 임베딩 모델과
6
장에서 논의한 지시 튜닝 개념을 연결
하는 방식이 등장했습니다. 사용 목적에 따라 같은 문서에 대해 다른 임베딩을 생성할 수 있는
임베딩 모델이 있다면 어떨까요?
그런 모델 중 하나가 인스트럭터
Instructor
입니다. 인스트럭터 임베딩은 인코딩 시 텍스트와 함께
도메인, 텍스트 유형(예: 문장, 단락 ), 작업을 선택적으로 지정하게 해 줍니다.
다음은 예시입니다.
!pip install InstructorEmbedding
from InstructorEmbedding import INSTRUCTOR
model = INSTRUCTOR(‘hkunlp/instructor-large’)
customized_embeddings = model.encode([
[‘Represent the question for retrieving supporting documents:’,
‘Who is the CEO of Apple’],
[‘Represent the sentence for retrieval:’,
‘Tim Cook is the CEO of Apple’],
[‘Represent ...