0Pricing
NLP Academy · บทเรียน

ภายในบล็อก Transformer

สถาปัตยกรรมทั้งหมดประกอบเข้าด้วยกันอย่างไร

ภายในบล็อก Transformer เป็นบทเรียน NLP Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน NLP Academy และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส NLP Academy มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

Stacking Blocks

A Transformer is built by stacking the same block many times. Each block refines the representation a little more. 🧱

Two Main Sublayers

Every block has two parts: a multi-head attention sublayer followed by a small feed-forward network applied to each position.

The Feed-Forward Network

The feed-forward sublayer is two linear layers with a nonlinearity between them, processing each token independently for extra power.

h = relu(x @ W1 + b1) @ W2 + b2

Residual Connections

Each sublayer wraps its input in a residual connection: add the input back to the output so gradients flow and nothing is lost.

out = x + sublayer(x)

Layer Normalization

After adding the residual, layer normalization rescales the values. This keeps activations stable and speeds up training.

out = layer_norm(x + sublayer(x))

Encoder Blocks

An encoder stack reads the input and builds rich context vectors. It uses self-attention so every token sees all the others.

Decoder Blocks

A decoder generates output one token at a time. It adds masked attention plus cross-attention back to the encoder.

Masked Attention

During generation, masking hides future tokens so the decoder cannot peek ahead and must predict the next word honestly.

Cross-Attention

Cross-attention lets the decoder query the encoder's outputs, connecting what it is writing to what it originally read.

Depth Brings Power

Stacking many blocks lets early layers catch simple patterns and later layers build abstract meaning, much like deep vision networks.

Encoder, Decoder, or Both

BERT uses only the encoder, GPT uses only the decoder, and translation models use both. The block is the shared building unit. 🚀

Quick Check

Let us check the block structure.

Recap

You assembled the Transformer block: attention plus feed-forward, wrapped in residuals and layer norm, stacked into encoders and decoders. ✨

คำถามที่พบบ่อย

บทเรียน “ภายในบล็อก Transformer” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “ภายในบล็อก Transformer” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส NLP Academy ให้อัปเกรดเป็น CoddyKit PRO คอร์ส NLP Academy มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “ภายในบล็อก Transformer”

สถาปัตยกรรมทั้งหมดประกอบเข้าด้วยกันอย่างไร คุณปฏิบัติ NLP Academy ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน NLP Academy หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน NLP Academy บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน

บทเรียน “ภายในบล็อก Transformer” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน NLP Academy นี้ได้ไหม

ได้ บทเรียน NLP Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. แนวคิดของแอตเทนชัน
  2. Self-Attention ทีละขั้น
  3. แอตเทนชันหลายหัวและตำแหน่ง
  4. ภายในบล็อก Transformer
← กลับไปที่ NLP Academy