Spooky Sale: 10% off Premium yearly · $118.80 for the first year · until Nov 6Get it

Deep-ML
Learn
Problems1,200+ hands-on ML problemsLearning PathA guided route through the fundamentalsLabsInteractive labs on real techniquesProjectsBuild a GPT, an RL agent, CUDA kernelsCollectionsCurated problem sets and videosMathPen-and-paper math for MLIntuitionInvent the idea behind the formula yourselfPlaylistsYour own problem lists, shareableStudy AssistantAn AI teacher that knows your progress
Interview Prep
Compete
ContestsFresh problem sets, ranked liveLeaderboardWhere you stand, globallyBuddiesSolve with a friend: streaks, a weekly board, chat
Discuss
Deep-Path
Premium
      Intuition
      84 of 102

      Listen and collect

      Each word also has a value: what it says. Here, cat says “tired”, mat says “soft”. Write attend(query, keys, values): what “it” collects by listening to every word with the shares from the last puzzle. Keys are one number per word this time (how much of an animal), so the shares are just the chances of keys @ query.

      “it” has to fill in the blank. cat says “tired”, mat says “soft”, sat says nothing, and “it” listens to each with the shares from the last puzzle (keys [2], [0], [−1], query [1]). What does “it” end up with?

      Each word says something. “it” has to fill in the blank.“the cat sat on the mat because it was ___”cattiredsoft84.4%sattiredsoft11.4%mattiredsoft4.2%it?tired?softwhat “it” collects
      Your functionattend(query, keys, values)
      querywhat "it" is looking fore.g. [1]
      keysone row per word, what each word ise.g. [[2], [0], [−1]]
      valuesone row per word, what each word sayse.g. [[1, 0], [0, 0], [0, 1]]
      returnsone row: what "it" collects
      solution.pyLoading Python
      Sign in for an AI hint
      ← Who should “it” listen to?Don’t peek →