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
      32 of 102

      Confident or cautious

      A language model has written The weather today is and scores the next word: sunny 2, cloudy 1, snowy −1. Write chances(scores, temperature): turn the scores into chances, where temperature sets how bold the model is. Cold: confident, it almost always picks its top word. Hot: cautious, it hedges and spreads its chances out. Temperature 1 is the model as it is.

      A model finishes a sentence by drawing the next word by its chances. At temperature 1 the chances are the plain ones from “Scores into chances”. A temperature knob should make it play safe (cold) or take chances (hot): your function gives the chances at any temperature.

      The model has scored three next words. It finishes the sentence by drawing one.“The weather today is …”temperature 1 · as it issunny70.5%cloudy25.9%snowy3.5%6 endings it wrote… is … is … is … is … is … is temperature 0.1 · coldsunny?cloudy?snowy?what a weather report wants… is … is … is … is … is … is temperature 10 · hotsunny?cloudy?snowy?what a poem wants… is … is … is … is … is … is
      Your functionchances(scores, temperature)
      scoresone number per word, higher = more likelye.g. [2, 1, −1]
      temperaturehow bold to be (1 = the model as it is)e.g. 1
      returnsone chance per word
      solution.pyLoading Python
      Sign in for an AI hint
      ← Yes or no chancesToo big for the computer →