0Pricing
Deep Learning Academy · Ders

Sıra için Konumsal Kodlama

Dizi konumunu belirteçlere ekleyin.

Sıra için Konumsal Kodlama, CoddyKit'te ücretsiz bir Deep Learning Academy dersidir. Bu, 4 dersinin 3. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Deep Learning Academy öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Deep Learning Academy kursu toplamda 4 dersten oluşur.

Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.

Attention Ignores Order

Self-attention treats a sentence like a bag of tokens. Shuffle the words and the math barely changes, so the model has no built-in sense of order.

Order Carries Meaning

But order matters: "dog bites man" is not "man bites dog". We must hand the model some signal about each token's position.

Add, Do Not Append

The trick is to add a position vector directly to each token's embedding. Same shape, so attention sees content and place fused together.

x = token_emb + pos_emb

Sinusoidal Encoding

The original transformer used fixed sine and cosine waves of different frequencies, one pattern per dimension, to mark each position.

Why Sine Waves

Mixing frequencies gives every position a unique fingerprint, and the smooth waves let the model generalize to lengths it never saw in training.

The Formula

Even dimensions use sine, odd dimensions use cosine, with the wavelength growing across dimensions. That is the whole encoding recipe.

pe[:, 0::2] = torch.sin(pos / div)
pe[:, 1::2] = torch.cos(pos / div)

Relative Distance

A neat bonus: with sinusoids, the offset between two positions is easy to express, helping attention reason about relative distance.

Learned Positions

Modern models often skip sinusoids and use a learned embedding table, one trainable vector per position, just like word embeddings.

self.pos_emb = nn.Embedding(max_len, d_model)

Fixed vs Learned

Fixed sinusoids extrapolate to new lengths for free; learned tables fit your data but are capped at the maximum length you trained on.

Rotary Encoding

Newer transformers favor rotary position encoding, which rotates query and key vectors by an angle tied to position, baking order into attention itself.

Where It Goes

Whatever scheme you pick, positional info is injected once at the input, before the first attention layer ever runs.

Quick Check

Let's check why positional encoding exists.

Recap

You learned that attention ignores order, so we add positional encodings, whether sinusoidal, learned, or rotary, to tell tokens where they sit. Well done!

Sıkça Sorulan Sorular

“Sıra için Konumsal Kodlama” dersi ücretsiz mi?

Evet — “Sıra için Konumsal Kodlama” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Deep Learning Academy kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Deep Learning Academy kursu toplamda 4 dersten oluşur.

“Sıra için Konumsal Kodlama” dersinde ne öğreneceğim?

Dizi konumunu belirteçlere ekleyin. Deep Learning Academy ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.

Deep Learning Academy öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te Deep Learning Academy, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 3. dersidir.

“Sıra için Konumsal Kodlama” dersi ne kadar sürer?

Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.

Bu Deep Learning Academy dersinde kod yazıp çalıştırabilir miyim?

Evet. Her Deep Learning Academy dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.

Bu kursun tüm dersleri

  1. Kendine Dikkat: Sorgu, Anahtar ve Değer
  2. Ölçeklendirilmiş Nokta Çarpımı ve Çok Başlılık
  3. Sıra için Konumsal Kodlama
  4. Bir Transformer Kodlayıcı Bloğu Oluşturma
← Deep Learning Academy Sayfasına Dön