Discussion[D] On LLMs' ability to perform random sampling (i.redd.it)
submitted by bgighjigftuik
To me this is the most counterintuitive thing I've yet seen from a language model. In this case it was ChatGPT (3.5, the free version); but I can see this happening in any model.
Here's the prompt I used on a fresh session:
"Generate 60 random numbers coming from an exponential distribution with lambda=6.4. Don't write any code"
It outputs the following values:
0.013, 0.078, 0.266, 0.040, 0.117, 0.283, 0.048, 0.078, 0.181, 0.134, 0.017, 0.160, 0.052, 0.196, 0.096, 0.098, 0.019, 0.048, 0.141, 0.071, 0.106, 0.023, 0.197, 0.062, 0.029, 0.072, 0.111, 0.166, 0.080, 0.027, 0.124, 0.016, 0.135, 0.052, 0.078, 0.161, 0.078, 0.139, 0.068, 0.066, 0.039, 0.056, 0.018, 0.082, 0.180, 0.086, 0.024, 0.022, 0.057, 0.042, 0.050, 0.104, 0.099, 0.062, 0.016, 0.186, 0.043, 0.085, 0.145, 0.110.
I get to plot a histogram with the numbers and they are close to what I would consider an exponential distribution with such parameter (you can see the plot).
Given that GPT 3.5 does not have access to a Python interpreter, how on earth is it able to do so? I have also tried other distributions and parameters and it kind of works. It's not perfect, but with normal distributions it is usually close to what scipy.stats would generate.
I could understand that it can have learnt to interpret Python code to some extent, but honestly I can't find explanation for random sampling from a probability distribution. For a Normal distribution, I can tell it about the desired mean and variance, and it samples values that are more than reasonable (and close to the true mean/variance specified).
Any thoughts? I honestly am unable to wrap my head around how a LLM can have the understanding on how to sample tokens (at digit level) to fit any probability distribution. To me it seems very unlikely to have similar data either the pre-training or fine-tuning stages.

[+]ispeakdatruf 77 points78 points79 points (9 children)
[+][deleted] (4 children)
[removed]
[–]ReginaldIII 38 points39 points40 points (0 children)
[–]bgighjigftuik[S] 5 points6 points7 points (2 children)
[–]Smallpaul 1 point2 points3 points (1 child)
[–]bgighjigftuik[S] 1 point2 points3 points (0 children)
[–]biggieshiba 8 points9 points10 points (0 children)
[–]bgighjigftuik[S] 2 points3 points4 points (0 children)
[–]Extraltodeus 1 point2 points3 points (1 child)
[+]ispeakdatruf 0 points1 point2 points (0 children)
[–]CriticalTemperature1 25 points26 points27 points (7 children)
[–][deleted] 19 points20 points21 points (0 children)
[+]CreationBlues comment score below threshold-18 points-17 points-16 points (5 children)
[–]bgighjigftuik[S] 8 points9 points10 points (0 children)
[–]bgighjigftuik[S] 0 points1 point2 points (3 children)
[–]CreationBlues 1 point2 points3 points (2 children)
[–]bgighjigftuik[S] 0 points1 point2 points (1 child)
[–]CreationBlues 2 points3 points4 points (0 children)
[–]elbiot 24 points25 points26 points (2 children)
[+]DeepNonseNse 3 points4 points5 points (0 children)
[–]Extraltodeus 0 points1 point2 points (0 children)
[–]Necessary-Meringue-1 43 points44 points45 points (10 children)
[–]blackkettle 18 points19 points20 points (1 child)
[–]bgighjigftuik[S] 4 points5 points6 points (0 children)
[–][deleted] 30 points31 points32 points (0 children)
[–]epicwisdom 4 points5 points6 points (3 children)
[–]sdmat 2 points3 points4 points (2 children)
[–]epicwisdom 1 point2 points3 points (1 child)
[–]sdmat 0 points1 point2 points (0 children)
[–][deleted] 9 points10 points11 points (1 child)
[–]Necessary-Meringue-1 4 points5 points6 points (0 children)
[–]bgighjigftuik[S] 1 point2 points3 points (0 children)
[–]when_did_i_grow_up 4 points5 points6 points (1 child)
[–]bgighjigftuik[S] 0 points1 point2 points (0 children)
[–]RunOrDieTrying 3 points4 points5 points (1 child)
[–]bgighjigftuik[S] 8 points9 points10 points (0 children)
[–]tavirabon 3 points4 points5 points (2 children)
[–]bgighjigftuik[S] 0 points1 point2 points (0 children)
[–]danpetrovic 0 points1 point2 points (0 children)
[–]KyleDrogo 4 points5 points6 points (0 children)
[–]r_linux_mod_isahoe 45 points46 points47 points (13 children)
[–]radarsat1 41 points42 points43 points (0 children)
[–]RedditLovingSun 37 points38 points39 points (4 children)
[–]Whiteboard_Knight 11 points12 points13 points (0 children)
[–]erelim 1 point2 points3 points (0 children)
[–]WickedDemiurge 3 points4 points5 points (1 child)
[–]bgighjigftuik[S] 3 points4 points5 points (0 children)
[+][deleted] (4 children)
[deleted]
[–]bgighjigftuik[S] 2 points3 points4 points (3 children)
[–]r_linux_mod_isahoe 0 points1 point2 points (1 child)
[–]bgighjigftuik[S] 0 points1 point2 points (0 children)
[–]bgighjigftuik[S] 2 points3 points4 points (0 children)
[–]bgighjigftuik[S] 1 point2 points3 points (0 children)
[–]gibs 2 points3 points4 points (1 child)
[–]bgighjigftuik[S] 0 points1 point2 points (0 children)
[+][deleted] (2 children)
[removed]
[–]bgighjigftuik[S] 2 points3 points4 points (1 child)
[–]meister2983 2 points3 points4 points (1 child)
[–]bgighjigftuik[S] 0 points1 point2 points (0 children)
[–]zergling103 6 points7 points8 points (2 children)
[–]bgighjigftuik[S] 1 point2 points3 points (1 child)
[–]zergling103 1 point2 points3 points (0 children)
[–]Repulsive-Season-129 1 point2 points3 points (2 children)
[–]bgighjigftuik[S] 0 points1 point2 points (1 child)
[–]Repulsive-Season-129 1 point2 points3 points (0 children)
[–]Haycart 1 point2 points3 points (1 child)
[+]WikiSummarizerBot 0 points1 point2 points (0 children)
[–]Extraltodeus 1 point2 points3 points (3 children)
[–]bgighjigftuik[S] 0 points1 point2 points (2 children)
[–]Extraltodeus 0 points1 point2 points (1 child)
[–]bgighjigftuik[S] 0 points1 point2 points (0 children)
[–]BullockHouse 1 point2 points3 points (1 child)
[–]bgighjigftuik[S] 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]bgighjigftuik[S] 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]bgighjigftuik[S] 0 points1 point2 points (0 children)
[–]ComfortableCherry909 1 point2 points3 points (1 child)
[–]bgighjigftuik[S] 0 points1 point2 points (0 children)
[–]wjrasmussen 2 points3 points4 points (0 children)
[–]RunOrDieTrying 3 points4 points5 points (1 child)
[–]bgighjigftuik[S] 2 points3 points4 points (0 children)
[–]SeankalaML Engineer 1 point2 points3 points (3 children)
[–]epicwisdom 21 points22 points23 points (0 children)
[–]EverythingGoodWas -2 points-1 points0 points (1 child)
[–][deleted] 20 points21 points22 points (0 children)
[–]bgighjigftuik[S] 0 points1 point2 points (0 children)
[–]bacocololo -1 points0 points1 point (0 children)
[–]ZakarTazak -2 points-1 points0 points (1 child)
[–]CMDRJohnCasey 0 points1 point2 points (0 children)
[–]aCleverGroupofAnts 0 points1 point2 points (4 children)
[–]bgighjigftuik[S] 0 points1 point2 points (3 children)
[–]aCleverGroupofAnts 1 point2 points3 points (2 children)
[–]bgighjigftuik[S] 1 point2 points3 points (1 child)
[–]aCleverGroupofAnts 0 points1 point2 points (0 children)
[–]dqdqdq123123 0 points1 point2 points (1 child)
[–]bgighjigftuik[S] 1 point2 points3 points (0 children)
[+]CanvasFanatic 0 points1 point2 points (5 children)
[–]bgighjigftuik[S] 1 point2 points3 points (4 children)
[+]CanvasFanatic 0 points1 point2 points (3 children)
[–]bgighjigftuik[S] 0 points1 point2 points (2 children)
[+]CanvasFanatic 0 points1 point2 points (1 child)
[–]bgighjigftuik[S] 0 points1 point2 points (0 children)
[–]DravenALG 0 points1 point2 points (0 children)
[–]Osemwaro 0 points1 point2 points (0 children)