Skip to content
PodSubs
ShowsPeopleGuestsJobsNewsEvents
More
BlogPodCred
Menu
ShowsPeopleGuestsJobsNewsEventsBlogPodCredNetworksSign in
Join nowSign in
  • Shows
  • People
  • Jobs
  • News
  • More
    • Guests
    • Events
    • Blog
    • PodCred
    • Networks
    Join nowSign in

Learn AI in Bits

Learn AI in Bits artwork

075 - What is AI Attention?

Oct 5, 20265 minAudioSeason 1, Episode 75
ShareXLinkedInFacebookWhatsAppEmail

When an AI model reads a sentence, it doesn't treat every word as equally important. This episode explains attention, the mechanism that lets a model decide which parts of its context deserve more weight when computing what comes next, and one of the central ideas behind every modern Transformer-based language model. The episode walks through the basic calculation using three learned representations: query, key, and value. A query represents what a token is looking for, a key represents what another token offers for matching, and a value carries the information passed along if that token turns out to be relevant. The model compares a query against keys using a similarity score, scales those scores, and passes them through softmax so they turn into weights that sum to one. Those weights combine the value vectors into a new, context-aware representation, using the sentence "The animal didn't cross the road because it was tired" to show how surrounding words give the model clues about what a pronoun like "it" refers to. It also covers self-attention, where queries, keys, and values all come from the same sequence, and multi-head attention, where a Transformer runs several attention calculations in parallel so each head can specialize in a different kind of relationship in the data. A key constraint for text generation is causal masking, which stops a model from attending to tokens it hasn't generated yet, preserving the left-to-right nature of generation. Because full attention creates a relationship between every pair of positions in a sequence, its computational cost grows roughly with the square of sequence length, which is why longer context windows demand more compute and memory. The episode connects this to the engineering solutions that make it practical, citing PyTorch's scaled dot product attention and optimized kernels like FlashAttention, and traces the idea back to the 2017 paper "Attention Is All You Need," which introduced a Transformer architecture built entirely around attention instead of recurrence or convolution. The episode closes by tying attention to the show's earlier episodes on tokens and embeddings: tokens provide the pieces, embeddings turn them into numbers, and attention is what lets those numbers interact. Sources & References Vaswani et al.: Attention Is All You Need - https://arxiv.org/abs/1706.03762 PyTorch Documentation: scaled_dot_product_attention - https://docs.pytorch.org/docs/main/generated/torch.nn.functional.scaled_dot_product_attention.html PyTorch Tutorial: Implementing High-Performance Transformers with Scaled Dot Product Attention - https://docs.pytorch.org/tutorials/intermediate/scaled_dot_product_attention_tutorial PyTorch Tutorial: Accelerating PyTorch Transformers with Transformer building blocks - https://docs.pytorch.org/tutorials/intermediate/transformer_building_blocks.html Voice narration is AI-generated.

Audio and video play straight from the show's own hosting. PodSubs stores and serves no media.

Hosts and Guests

Nobody is credited on this episode yet.

Credit the people on this episode

Be the first to rate this episode

More episodes

All episodes
  1. 099 - How Does an LLM Generate Text?

    Nov 23, 20265 minAudio

    Follow a prompt through the inner workings of a large language model. This episode explains tokenization, embeddings, transformer layers, attention, logits, probability selection, and the KV cache. It also compares...

    Credit the people on this episode

  2. 098 - Product Managers: What AI Skills Are Companies Looking for?

    Nov 23, 20265 minAudio

    Explore the AI skills employers increasingly expect from product managers working on AI products. This episode covers core product management, AI literacy, model and agent fundamentals, evaluation, product metrics, and...

    Credit the people on this episode

  3. 097 - Developers: What AI Skills Are Companies Looking?

    Nov 23, 20266 minAudio

    Companies are looking for developers who can combine strong software fundamentals with practical AI skills. This episode looks at AI-assisted development, model APIs, RAG, agents, evaluation, debugging, and system...

    Credit the people on this episode

  4. 096 - Structured Outputs — How to Make AI Return Valid JSON

    Nov 22, 20265 minAudio

    Structured outputs help AI models return data that software can reliably read. This episode explains JSON, JSON Schema, and the difference between JSON mode and schema-constrained responses. It also compares how OpenAI,...

    Credit the people on this episode

  5. 095 - Function Calling: How AI Uses Tools

    Nov 22, 20265 minAudio

    Function calling lets AI models work with external tools, APIs, and business systems. This episode explains the tool-calling loop, how applications define and execute functions, and how OpenAI, Claude, Gemini, and...

    Credit the people on this episode