Skip to Content
Scikit-Learn과 PyTorch를 활용한 실전 머신러닝
book

Scikit-Learn과 PyTorch를 활용한 실전 머신러닝

by Aurélien Géron
October 2025
Intermediate to advanced
878 pages
16h 9m
Korean
O'Reilly Media, Inc.
Content preview from Scikit-Learn과 PyTorch를 활용한 실전 머신러닝

15장. 자연어 처리와 챗봇을 위한 트랜스포머

이 작품은 AI를 사용하여 번역되었습니다. 여러분의 피드백과 의견을 환영합니다: translation-feedback@oreilly.com

2017년의 획기적인 논문 에서 "주의력만 있으면 된다"라는 제목의 논문이 발표되었습니다 .1 Google 연구팀은 신경망 기계 번역(NMT)()의 최신 기술을 크게 개선한 새로운 신경망 아키텍처( )인 Transformer를 제안했습니다. 간단히 말해 Transformer 아키텍처는 14장에서 영어-스페인어 번역을 위해 구축한 것과 매우 유사한 인코더-디코더 모델이며, 정확히 동일한 방식으로 사용할 수 있습니다( 그림 15-1 참조):

  1. 소스 텍스트는 인코더로 이동하여 문맥화된 임베딩(토큰당 하나씩)을 출력합니다.

  2. 인코더의 출력은 지금까지 번역된 텍스트(시퀀스 시작 토큰부터 시작)와 함께 디코더에 공급됩니다.

  3. 디코더는 각 입력 토큰에 대해 다음 토큰을 예측합니다.

  4. 디코더가 출력한 마지막 토큰이 번역에 추가됩니다.

  5. 시퀀스 끝 토큰이 생성될 때까지 2~4단계를 반복하여 한 번에 하나의 추가 토큰씩 전체 번역을 생성합니다. 훈련 중에는 이미 전체 번역(타깃)이 있으므로 2단계(시퀀스 시작 토큰부터 시작)에서 디코더에 공급되며 4단계와 5단계는 필요하지 않습니다.

Diagram illustrating the Transformer model's process for translating English to Spanish, showing how the encoder generates contextual embeddings and the decoder predicts the next token in the translated sequence.
그림 15-1. 영어-스페인어 번역에 트랜스포머 모델 사용

새로운 기능은 무엇일까요? 블랙박스 내부에는 이전 인코더-디코더와 몇 가지 중요한 차이점이 있습니다. 결정적으로 트랜스포머 아키텍처에는 리커런트 또는 컨볼루션 레이어가 없으며, 규칙적인 고밀도 레이어와 멀티헤드 어 텐션(MHA) 이라는 새로운 종류의 주의 메커니즘이 결합된 몇 가지 기능이 추가되었습니다.2 이 모델은 반복적이지 않기 때문에 RNN처럼 사라지거나 폭발하는 기울기 문제가 발생하지 않으며, 더 적은 단계로 훈련할 수 있고, 여러 GPU에서 병렬화하기가 더 쉬우며, 놀라울 정도로 잘 확장됩니다. 또한, 멀티헤드 주의 덕분에 이 모델은 RNN보다 장거리 패턴을 훨씬 더 잘 포착할 수 있습니다.

트랜스포머 아키텍처는 또한 매우 다재다능한 것으로 밝혀졌습니다. 처음에는 NMT용으로 설계되었지만 연구원들은 다른 많은 언어 작업에 맞게 아키텍처를 빠르게 조정했습니다. 2018년은 "NLP를 위한 이미지넷의 순간"이라고 불릴 정도였습니다. 2018년 6월, OpenAI는 Transformer의 디코더 모듈만을 기반으로 한 첫 번째 GPT 모델 을 출시했습니다. 이 모델은 대규모 텍스트 말뭉치에 대해 사전 훈련을 받았으며, 텍스트 생성 능력은 전례가 없었고 문장을 자동 완성하고 스토리를 만들어내며 일부 질문에 대한 답변도 할 수 있었습니다. 또한 GPT는 다양한 언어 작업을 수행하도록 미세 조정할 수 있었습니다. 불과 몇 달 후, 구글은 트랜스포머의 ...

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.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’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
QuotationMarkI 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
QuotationMarkI’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
QuotationMarkI'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.
Mark W.
Embedded Software Engineer

You might also like

잘되는 머신러닝 팀엔 이유가 있다

잘되는 머신러닝 팀엔 이유가 있다

데이비드 탄, 에이다 양, 데이비드 콜스
생성형 AI를 위한 프롬프트 엔지니어링

생성형 AI를 위한 프롬프트 엔지니어링

제임스 피닉스, 마이크 테일러

Publisher Resources

ISBN: 0642572270094