• Treczoks@lemmy.world
    link
    fedilink
    arrow-up
    4
    ·
    2 days ago

    As it largely depends on the prompt, no. I’ve seen prompts that ate kilotokens and took ages, and others that barely scratched the budget and returned immediately.

    You simply cannot give a generalized answer here.

    It’s like asking “How much does a visit to the ER cost?” It depends on if they have to put on a band aid, or put you in the ICU for a few weeks.

  • General_Effort@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    2 days ago

    As you can tell from the previous answers: It depends.

    The bigger an LLM is, the more power it uses. AI models can be quantized or distilled to yield smaller but less capable models. Providers may try to route you to the cheapest model that can handle your prompt.

    Another question is the length of the output. The length of the input matters less but might be relevant for processing long texts.

    The energy used for training is relatively insignificant once you average it over its lifetime. The energy efficiency of a particular data center will certainly matter more.

    Providers like OpenAI claim that the typical query uses about 0.3Wh. That’s about the same as an idling phone charger uses in an hour; ie charger plugged into the outlet but not into the phone.

  • fizzle@quokk.au
    link
    fedilink
    English
    arrow-up
    29
    ·
    3 days ago

    Most of the power consumption comes from training and optimising models. You only interact with the finished product, so power per query is very low compared to that required to develop the LLM.

    • spectrums_coherence@piefed.social
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 days ago

      As far as I know it is still much more expensive compare to alternatives like grammar checker and web search. Especially give that model already searches the web on its own in many queries.

      Just because inference is more efficient than an training, which consumes energy on the scale of nation states, doesn’t mean inference itself is econonical.

    • lime!@feddit.nu
      link
      fedilink
      arrow-up
      11
      arrow-down
      1
      ·
      3 days ago

      while this is true in isolation, the amount of users means that inference now uses more power than training for the large actors.

      • Michal@programming.dev
        link
        fedilink
        arrow-up
        8
        ·
        3 days ago

        The question is about per-prompt, so number of users is not relevant. What may be more relevant is number of tokens in and out.

        If anything, number of users will decrease power use per prompt due to economy of scale.

  • Scrubbles@poptalk.scrubbles.tech
    link
    fedilink
    English
    arrow-up
    14
    ·
    3 days ago

    You’re looking for tokens. Prompts are broken down into tokens, which then are used to generate tokens in response. All are represented by large integers. The common metric is tokens/second, and if utilized correctly the GPU should pin at 100% usage while generating tokens. Calculate how many tokens per second it’s generating and how many tokens you’re using, times the wattage per second and you’re good.

  • lime!@feddit.nu
    link
    fedilink
    arrow-up
    14
    ·
    edit-2
    3 days ago

    sure, hardware wattage × time taken per prompt. which model specifically are you referring to and on what hardware?

    Edit:

    say, for example, that i’m running a model that takes ten seconds to respond on my Radeon 7900 XTX. it’s power limited to 300W, but the rest of the system also pulls power during runtime so let’s call it 400.

    to get watt-hours we take watts times hours. one second is 1/3600th of an hour.

    that comes out to 400 × 10 ÷ 3600 ≈ 1.11Wh. so that’s equivalent of leaving a 6W LED light on for about 11 minutes, or an old-fashioned incandescent bulb on for 80 seconds.

  • tal@lemmy.today
    link
    fedilink
    English
    arrow-up
    3
    ·
    3 days ago

    accurate

    I’d say “no”, if this is from a cloud LLM provider, and you want a lot of precision.

    • There are a number of factors like K-V caching that can affect the computation cost of a given prompt that you aren’t going to have absolute control over.

    • You don’t know where the machine lives that is running the prompt. Cooling is going to be a meaningful contributor to the amount of energy used. Even if an LLM provider wants to give you that information, it’s going to vary to some degree based on, say, ambient temperature.

    • You don’t know what internal changes are being made for hardware settings. Like, IIRC Nvidia GPUs can be run at different power restriction levels. At lower power levels, they will run more efficiently. It could be — not saying that this is being done ATM — that an LLM cloud provider could choose to throttle power usage to reduce their costs when overall load is low.

    • You don’t know what software optimizations are being made.

    You might get approximate numbers from a provider, and those might be good enough for your use. Like, if someone just wants to know, say, about how much power generation infrastructure is required, it may not be necessary to be spot-on. And I’m sure that you can put some upper and lower bounds on the real value.

    If you’re running an LLM on your own hardware, then you can measure it and constrain the way in which it is computed not to change and such, so then you can probably get values as accurately as you want.

  • tyrant@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    3 days ago

    I’d imagine it depends on the size of the llm. My local llm is about 20gb and pegs the GPU for maybe 5-10 seconds (6700xt 12gb) so you could probably extrapolate from that based on that. I’m sure these giant AI gpus would be more efficient though so maybe not.