HotCarbon 2024

Improving Carbon Emissions of Federated Large Language Model Inference through Classification of Task-Specificity

Geerd-Dietger Hoffmann (Green Coding Solutions GmbH), Verena Majuntke (HTW Berlin)

This transcript was made by AI. The open source speech recognition model Whisper (large-v3-turbo) transcribed the recording with faster-whisper. Names and technical terms were checked against the paper, but it can still contain mistakes. The recording is the reference.

0:01 Hello and welcome to my talk about improving carbon emissions of federated large language model inference through classification of task specificity. I'm Geerd-Dietger Hoffmann from Green Coding Solutions and I wrote this paper together with Verena Majuntke from the HTW in Berlin. So first of all let me set the frame on what we're going to talk about. So we've got an exponential rise of AI systems in general currently going on and ChatGPT sort of being the most dominant has 180 million active users as of April this year and only training the fairly small and old compared to nowadays model that is standard models nowadays produced 500 tons of CO2 and this doesn't include the embodied carbon so the resources that we use to produce all the chips the data centers the racks network equipment and so forth. So we're creating huge amounts of carbon only training these models and there's been very little research on the impact the inference stage so the answering phase has. All major companies are going to miss their self-set CO2 targets because of the rise of AI and while this is happening in the middle of an existential climate crisis with a very bleak outlook if we continue to doing the continue doing the things we're currently doing. So what is our contribution in this paper? We benchmarked eight open source LLMs

1:29 and for their resource usage on a wide variety of different prompts. We created a classifier system and we then did an empirical measurement to demonstrate that our solution really performs better than the other proposed solutions. When I talk about resource usage or energy usage in this context I mean SCI. So initially we used energy as the measurement and this wasn't very good as different models take different times to answer the prompt and the energy draw isn't constant in the answering process. So you could have two models one using the same amount of energy one using the resource for n seconds and the other one for x seconds. While they still consume the same amount of energy they use the resource for different amounts of time and obviously if you have shorter answering time you can the utilization of the machine goes up. So we decided to use the SCI. You have to note that the grid intensity we used a constant and the unit of work is the prompting process not loading the model into memory or anything heating up the caches or something. It's basically only the prompt to make this comparable. Also we use machine energy. We don't use only CPU or RAPL or something like that.

2:59 We use the complete machine. We use the specialized device to measure this. So we also include GPU, CPU, memory and so forth in the whole value. So how does our system work? We get a prompt. This goes into our classifier and the classifier then tells us which LLM to route this prompt to. It selects the fittest or most suitable LLM. When I talk about this it means the LLM that has the highest accuracy gives us basically a correct answer while having the lowest SCI using the least resources.

3:41 So to do this we selected five categories. Python code generation, mathematical understanding, natural language, SQL generation and translation. Whereas translation was German to English. We selected industry known data sets with high citation count and randomly selected 50 prompts from each category. We then gave we then asked or measured eight open source LLM measure models. So this gave gives us 2000 prompts measured and then we hand checked if the answers are correct. From each category we held five prompts back for the evaluation stage. So these are the eight models we selected. We made sure to include different parameter sizes and also different task specific models. So we really made sure that for example we had a translation model in there. The maximum parameter size was eight billion parameters based on the machine we're doing the measurements on. We couldn't use larger models unfortunately. So here as an example I'm showing the 25 evaluation prompts over the different models with the SCI values. If the answer wasn't correct we leave the value blank. We delete it. And here you see the matrix basically with prompts on the x-axis and different models on the y-axis and this will become important later on. What you can see is that for prompt one we have hugely different SCI values for the different for the prompts. So Gemma for example has

5:36 0.6 SCI value and tiny llama has 0.08. So there's a huge difference in SCI while giving the correct answer. What you can also see is that all models perform fairly bad in the math domain. We did some tests with larger models and the precision increases on larger models but for the setting we had this was what we could do. So if you look at accuracy on a per model basis you can see that llama is very good across the board. Whereas tiny llama is very good in code generation being a far smaller model but not performing as well in SQL generation for example. And now you can see on the x-axis the model categories differentiating. So if you look at llama 3 you can see that code generation has an SCI from 0.3 whereas translation has 0.09. So there's a huge difference in the model between the different categories or different tasks it has to perform. Also there's a huge difference between the different models. So if you look at code generation you can see that Gemma for example or has 0.5 in SCI and tiny llama 0.3. So what we saw earlier is true on average on all the prompts we put to the models.

7:11 So how does our classification process work? So we had the 250 measured prompts per category and we created embeddings for each of these prompts. We used the mxbai-embed-large model and we saved the embeddings into a database and now what happens when we see an unseen prompt is we create an embedding for that prompt. We get the closest known prompt from our database and look into our matrix and basically select the model that has the lowest SCI while still giving us a correct answer. And then we set we give that prompt to that model for answering. And what we can see is that we have a very very low SCI score second to to tiny llama so very low while still having a fairly good accuracy. And our research suggests that if we get more data or more prompts the accuracy will go up because currently we're very limited on the 250 sets that was a time limitation. But research shows that if we have more prompts we can the embedding model gets better. So what does the future work?

8:27 What are we currently working on? We obviously want more prompts and sort of get rid of the category because the categories don't really matter. It was to show that the models are different but if we have more prompts the embedding model will give us the correct or the fittest or the best model. Currently we only use one-shot prompts. What we want to do is have like a chat interface. Here we also want the possibility of basically trying to lowball an answer in this chat scenario and if the sentiment of the conversation turns negative we then give the chat to a better model in a higher accuracy but these normally then also use more resources. We want to play around with different model sizes and what we also want to create is a model that can estimate for different LLM models the resource is going to use to answer a given prompt. Thank you very much for listening. Have a nice day.