• 8uurg@lemmy.world
      link
      fedilink
      English
      arrow-up
      29
      arrow-down
      1
      ·
      13 days ago

      An LLM is not inherently non-deterministic though - if you don’t randomly sample and instead have a fixed rule (which is what the recent fingerprint embedding approach does), if applied in all cases the output is deterministic, as the neural net at its core is deterministic function. A lot of the randomness beyond that is due to optimizations [source].

      LLMs are however unreliable at ‘compiling’. Whether or not it will be able to complete the requested task (translate human language into code) correctly it not guaranteed - at least nowhere near the compilers we use.

      • Natanael@infosec.pub
        link
        fedilink
        English
        arrow-up
        4
        ·
        13 days ago

        While they can be deterministic in runtime they can be compared to cryptographic hashes in that they come preloaded with pseudorandomness which will behave unpredictably

    • dwalin@lemmy.world
      link
      fedilink
      English
      arrow-up
      17
      arrow-down
      1
      ·
      13 days ago

      There is a parameter in llms called temperature. If you reduce it down to zero it will become deterministic. And probably even worse.

      • naught101@lemmy.world
        link
        fedilink
        English
        arrow-up
        14
        ·
        13 days ago

        If you do that it will basically produce the most average possible output, given the context. I don’t know if that’s going to be useful in a compiler context…

      • frongt@lemmy.zip
        link
        fedilink
        English
        arrow-up
        4
        arrow-down
        1
        ·
        13 days ago

        Yeah but the output would be crap. Just use the same prng seed and you’ll get reproducible output.

    • brucethemoose@lemmy.world
      link
      fedilink
      English
      arrow-up
      17
      arrow-down
      2
      ·
      edit-2
      13 days ago

      Technically, LLMs (and most ML models) are deterministic with the same input and same seed.

      I get what you mean though.

      • Scrollone@feddit.it
        link
        fedilink
        English
        arrow-up
        8
        ·
        edit-2
        13 days ago

        So does ChatGPT intentionally change seed at every interaction so it always spits two different outputs given the same input?

        • Scipitie@lemmy.dbzer0.com
          link
          fedilink
          English
          arrow-up
          14
          ·
          13 days ago

          In short: yes. You can tune these values when self hosting - it basically changes the b chance which tokens will be used under which circumstances.

        • brucethemoose@lemmy.world
          link
          fedilink
          English
          arrow-up
          5
          ·
          edit-2
          13 days ago

          Like Scipitie said, sort of.

          In the ChatGPT app, there’s tons of shuffling in the background, like context being injected, maybe sampling changed, agenic action, quantization… its “far” from the actual LLM, opaque by design, and as a result certainly not deterministic.

          You can sometimes get deterministic output with the OpenAI API, but it’s also dependent on nothing changing on their end. And their end changes a lot.

          But self hosting or using a more consistent provider will give you deterministic output.

    • sunbeam60@feddit.uk
      link
      fedilink
      English
      arrow-up
      7
      arrow-down
      1
      ·
      13 days ago

      Exactly this. If you made an LLM that had deterministic code output then I’m all up for saying “AI is a compiler for human language”. But until then AI is most definitely not a compiler.

        • sunbeam60@feddit.uk
          link
          fedilink
          English
          arrow-up
          1
          arrow-down
          1
          ·
          12 days ago

          No. Floating point arithmetic and ordering of operations won’t make 0.0 deterministic.

          • theunknownmuncher@lemmy.world
            link
            fedilink
            English
            arrow-up
            1
            ·
            edit-2
            12 days ago

            Um… yes. Matrix multiplication is deterministic, there’s nothing non-deterministic about an LLM, unless you artificially add randomness to them, like randomly selecting 1 of the top N ranked tokens.

            • sunbeam60@feddit.uk
              link
              fedilink
              English
              arrow-up
              1
              ·
              edit-2
              11 days ago

              The function is deterministic, agreed. The implementation is almost always not. Hardware floating point addition is not associative. So a GPU kernel that splits a reduction differently (ie interleaving it with anything else, like running your graphics, or sharing your work with other users on the same hardware) will produce different results over different runs even at temperature 0.0.

              Determinism is almost always impossible when dealing with floating point on a multi-process/multi-user system.

              There are attempts to create batch invariant language models (https://github.com/thinking-machines-lab/batch_invariant_ops) but all the major ones are not.