Category: method

  • New method forecasts computation, energy costs for sustainable AI models

    New method forecasts computation, energy costs for sustainable AI models

    The process of updating deep learning/AI models when they face new tasks or must accommodate changes in data can have significant costs in terms of computational resources and energy consumption. Researchers have developed a novel method that predicts those costs, allowing users to make informed decisions about when to update AI models to improve AI sustainability.

    “There have been studies that focused on making deep learning model training more efficient,” says Jung-Eun Kim, corresponding author of a paper on the work and an assistant professor of computer science at North Carolina State University. “However, over a model’s life cycle, it will likely need to be updated many times. One reason is that, as our work here shows, retraining an existing model is much more cost effective than training a new model from scratch.

    “If we want to address sustainability issues related to deep learning AI, we must look at computational and energy costs across a model’s entire life cycle — including the costs associated with updates. If you cannot predict what the costs will be ahead of time, it is impossible to engage in the type of planning that makes sustainability efforts possible. That makes our work here particularly valuable.”

    Training a deep learning model is a computationally intensive process, and users want to go as long as possible without having to update the AI. However, two types of shifts can happen that make these updates inevitable. First, the task that the AI is performing may need to be modified. For example, if a model was initially tasked with only classifying digits and traffic symbols, you may need to modify the task to identify vehicles and humans as well. This is called a task shift.

    Second, the data users provide to the model may change. For example, you may need to make use of a new kind of data, or perhaps the data you are working with is being coded in a different way. Either way, the AI needs to be updated to accommodate the change. This is called a distribution shift.

    “Regardless of what is driving the need for an update, it is extremely useful for AI practitioners to have a realistic estimate of the computational demand that will be required for the update,” Kim says. “This can help them make informed decisions about when to conduct the update, as well as how much computational demand they will need to budget for the update.”

    To forecast what the computational and energy costs will be, the researchers developed a new technique they call the REpresentation Shift QUantifying Estimator (RESQUE).

    Essentially, RESQUE allows users to compare the dataset that a deep learning model was initially trained on to the new dataset that will be used to update the model. This comparison is done in a way that estimates the computational and energy costs associated with conducting the update.

    Those costs are presented as a single index value, which can then be compared with five metrics: epochs, parameter change, gradient norm, carbon and energy. Epochs, parameter change and gradient norm are all ways of measuring the amount of computational effort necessary to retrain the model.

    “However, to provide insight regarding what this means in a broader sustainability context, we also tell users how much energy, in kilowatt hours, will be needed to retrain the model,” Kim says. “And we predict how much carbon, in kilograms, will be released into the atmosphere in order to provide that energy.”

    The researchers conducted extensive experiments involving multiple data sets, many different distribution shifts, and many different task shifts to validate RESQUE’s performance.

    “We found that the RESQUE predictions aligned very closely with the real-world costs of conducting deep learning model updates,” Kim says. “Also, as I noted earlier, all of our experimental findings tell us that training a new model from scratch demands far more computational power and energy than retraining an existing model.”

    In the short term, RESQUE is a useful methodology for anyone who needs to update a deep learning model.

    “RESQUE can be used to help users budget computational resources for updates, allow them to predict how long the update will take, and so on,” Kim says.

    “In the bigger picture, this work offers a deeper understanding of the costs associated with deep learning models across their entire life cycle, which can help us make informed decisions related to the sustainability of the models and how they are used. Because if we want AI to be viable and useful, these models must be not only dynamic but sustainable.”

  • Method prevents an AI model from being overconfident about wrong answers

    Method prevents an AI model from being overconfident about wrong answers

    People use large language models for a huge array of tasks, from translating an article to identifying financial fraud. However, despite the incredible capabilities and versatility of these models, they sometimes generate inaccurate responses.

    On top of that problem, the models can be overconfident about wrong answers or underconfident about correct ones, making it tough for a user to know when a model can be trusted.

    Researchers typically calibrate a machine-learning model to ensure its level of confidence lines up with its accuracy. A well-calibrated model should have less confidence about an incorrect prediction, and vice-versa. But because large language models (LLMs) can be applied to a seemingly endless collection of diverse tasks, traditional calibration methods are ineffective.

    Now, researchers from MIT and the MIT-IBM Watson AI Lab have introduced a calibration method tailored to large language models. Their method, called Thermometer, involves building a smaller, auxiliary model that runs on top of a large language model to calibrate it.

    Thermometer is more efficient than other approaches — requiring less power-hungry computation — while preserving the accuracy of the model and enabling it to produce better-calibrated responses on tasks it has not seen before.

    By enabling efficient calibration of an LLM for a variety of tasks, Thermometer could help users pinpoint situations where a model is overconfident about false predictions, ultimately preventing them from deploying that model in a situation where it may fail.

    “With Thermometer, we want to provide the user with a clear signal to tell them whether a model’s response is accurate or inaccurate, in a way that reflects the model’s uncertainty, so they know if that model is reliable,” says Maohao Shen, an electrical engineering and computer science (EECS) graduate student and lead author of a paper on Thermometer.

    Shen is joined on the paper by Gregory Wornell, the Sumitomo Professor of Engineering who leads the Signals, Information, and Algorithms Laboratory in the Research Laboratory for Electronics, and is a member of the MIT-IBM Watson AI Lab; senior author Soumya Ghosh, a research staff member in the MIT-IBM Watson AI Lab; as well as others at MIT and the MIT-IBM Watson AI Lab. The research was recently presented at the International Conference on Machine Learning.

    Universal calibration

    Since traditional machine-learning models are typically designed to perform a single task, calibrating them usually involves one task-specific method. On the other hand, since LLMs have the flexibility to perform many tasks, using a traditional method to calibrate that model for one task might hurt its performance on another task.

    Calibrating an LLM often involves sampling from the model multiple times to obtain different predictions and then aggregating these predictions to obtain better-calibrated confidence. However, because these models have billions of parameters, the computational costs of such approaches rapidly add up.

    “In a sense, large language models are universal because they can handle various tasks. So, we need a universal calibration method that can also handle many different tasks,” says Shen.

    With Thermometer, the researchers developed a versatile technique that leverages a classical calibration method called temperature scaling to efficiently calibrate an LLM for a new task.

    In this context, a “temperature” is a scaling parameter used to adjust a model’s confidence to be aligned with its prediction accuracy. Traditionally, one determines the right temperature using a labeled validation dataset of task-specific examples.

    Since LLMs are often applied to new tasks, labeled datasets can be nearly impossible to acquire. For instance, a user who wants to deploy an LLM to answer customer questions about a new product likely does not have a dataset containing such questions and answers.

    Instead of using a labeled dataset, the researchers train an auxiliary model that runs on top of an LLM to automatically predict the temperature needed to calibrate it for this new task.

    They use labeled datasets of a few representative tasks to train the Thermometer model, but then once it has been trained, it can generalize to new tasks in a similar category without the need for additional labeled data.

    A Thermometer model trained on a collection of multiple-choice question datasets, perhaps including one with algebra questions and one with medical questions, could be used to calibrate an LLM that will answer questions about geometry or biology, for instance.

    “The aspirational goal is for it to work on any task, but we are not quite there yet,” Ghosh says.

    The Thermometer model only needs to access a small part of the LLM’s inner workings to predict the right temperature that will calibrate its prediction for data points of a specific task.

    An efficient approach

    Importantly, the technique does not require multiple training runs and only slightly slows the LLM. Plus, since temperature scaling does not alter a model’s predictions, Thermometer preserves its accuracy.

    When they compared Thermometer to several baselines on multiple tasks, it consistently produced better-calibrated uncertainty measures while requiring much less computation.

    “As long as we train a Thermometer model on a sufficiently large number of tasks, it should be able to generalize well across any new task, just like a large language model, it is also a universal model,” Shen adds.

    The researchers also found that if they train a Thermometer model for a smaller LLM, it can be directly applied to calibrate a larger LLM within the same family.

    In the future, they want to adapt Thermometer for more complex text-generation tasks and apply the technique to even larger LLMs. The researchers also hope to quantify the diversity and number of labeled datasets one would need to train a Thermometer model so it can generalize to a new task.

    This research was funded, in part, by the MIT-IBM Watson AI Lab.