New LLM optimization technique slashes memory costs
venturebeat.com
venturebeat.com
The articles use very similar verbiage.
> The context window can be considered the model’s working memory
Snip
> Universal transformer memory optimizes prompts using neural attention memory models (NAMMs), simple neural networks that decide whether to “remember” or “forget” each given token stored in the LLM’s memory.
snip
> Meanwhile, by discarding unnecessary tokens, NAMM enabled the LLM model to save up to 75% of its cache memory while performing the tasks.
You just have to be familiar with the wording in the space and read enough literature. Here’s more direct wording from the NAMM paper:
> NAMMs use evolution to optimize the performance of LMs by pruning their KV cache memory. Evolved NAMMs can be zero-shot transferred to other transformers, even across input modalities and task domains.
This is all related work about shrinking the size of the KV cache as the context grows both due to memory and it also has a speed up effect since you’re not having to attend all the tokens (O(n) -> sublinear with the size of the context).
Context is critical in the LLM answering correctly and remembering all the information given to it + everything it said. Typical limits for open models these days are 128k but with techniques like this it could scale even further allowing better performance on thing like code completion.
When you hear something like "it's attending all previous tokens" IMHO it's not strictly the correct explanation since you're attending through latent space which doesn't actually correspond 1:1 with tokens but is a multidimensional representation of that token & all preceding tokens as understood by that attention head. But conceptually it's how it's described because the size of your context goes up by 1 tensor for every token you process, even though applying attention actually ends up changing all tensors in the KV cache (hence self-attention). Also important to note that each attention head within each layer has it's own KV cache. LLMs are an autoregressive family of models where the output of each layer feeds into the input of the next and each layer has a transformer performing attention. That's another reason why it's not strictly correct to think of it as tokens make up your context because there's actually many many contexts within a transformer model. That's why your 128k context window can be ~15 GiB for a naiive inference implementation - 128k context window * 1024 * 1024-element tensor * 2 bytes per tensor * 8 attention heads * 8 layers (or something along those lines). And that's what this work is talking about shrinking (as does the HeadKV).
> tokens would be included in a more fuzzy way, and that when requests are sent it would result in loading slightly different tokens into the cache
The entire process of LLMs is generally actually 100% deterministic based on the same inputs & given a fixed seed for the RNG (modulo bugs in the inference math / bugs in HW/SW for the accelerator). Some inference implementations don't guarantee this property in the face of concurrent requests & you can't control the seed for hosted LLMs which is why it seems like random responses for the same query.
https://matt.might.net/articles/why-infinite-or-guaranteed-f...
The extent to which using both the techniques together will help will depend on how much overlap there is between the information each ends up discarding.
Even if the data centers didn't keep up with available capacity, energy demanding industry move to and expand with sources of power, like aluminum production.
And certainly nobody is building one in the next 3-4 years; they'd be lucky to finish the paperwork in that time.
What is actually going to power them is solar, wind, and batteries: https://www.theverge.com/2024/12/10/24317888/googles-data-ce...
https://www.theguardian.com/technology/2024/sep/15/data-cent...
Electric cars are causing exactly the same problem.
Also the "recs" appear to be based on a lie. Overall, an increase in load can only be green if there is added new green generation to service that load.
The alternatives for these data centres are either build renewables or not build the data centres, both of which are better.
Currently about a third of the energy consumption of a data center spent on cooling (heat dissipation)? And that's with the use of a huge heat sink, the earth.
Not building new, but I think Microsoft paying to restart a reactor at Three Mile Island for their datacenter is much more significant than you make the deals sound:
https://www.theguardian.com/environment/2024/sep/20/three-mi...
Are you willing to bet that they won’t have 3 mile island operational by 2030?
The reactor they’re restarting was operational just five years ago. It’s not a fully decommissioned or melted down reactor and it’s likely all their licensing is still valid so the red tape, especially environmental studies, is mostly irrelevant. Getting that reactor back up and running will be a lot simpler than building a new one.
20-year purchase agreement covers half of an adult lifelong career.
I pity the fool that believes anything these corporations put out publicly.
Actions matter, words are wind
Google and Microsoft, or their current CEOs, today?
Amazon's CEO committed to their office employees having flexibility regarding their workplace, only about 2 years ago, yet here we are now, with said employees soon having the flexibility to be 5 days in the office, or quit the company.
CEO promises are not worth the screen time they're provided.
Have these companies signed contracts with major penalties if they back out? Those would basically be the only "close to" unbreakable bonds for them.
All but the biggest Google fanboys know that Google is incredibly indecisive and will cut plans at a moment’s notice.
Tomorrow, tomorrow, I’ll decarbonize tomorrow.
Instead of paying to buy wind and solar plants, which can go up today they are signing a meaningless agreement for the future.
A PPA isn’t worth the paper it’s written on if the seller can’t produce electricity at the agreed upon price by the date required.
Take Three Mile Island. It was closed in 2019 since it was uneconomical to run. Since then renewables have continued getting substantially cheaper, while the reactor has been in the process of decommissioning.
Instead of spending money on building wind and solar, Microsoft saw how well Vogtle went and decided that another first of it’s kind nuclear project is the best way to make it appear like they’re doing something.
I think now's fine, even if it takes time. these companies already buy a ton of power from renewable sources, and it's good to diversify - nuclear is a good backup to have.
It did not deliver. It is time to leave nuclear power to the past just like we have done with the steam engine.
It had its heyday but better cheaper technology replaced it.
American companies and utilities announced 30 reactors. Britain announced ~14.
We went ahead and started construction on 7 reactors in Vogtle, Virgil C. Summer, Flamanville, Olkiluoto and Hanhikivi to rekindle the industry. We didn't believe renewables would cut it.
The end result of what we broke ground on is 3 cancelled reactors, 3 reactors which entered commercial operation in the 2020s and 1 still under construction.
The rest are in different states of trouble with financing with only Hinkley Point C slowly moving forward.
In the meantime renewables went from barely existing to dominating new capacity (TWh) in the energy sector.
Today renewables make up 2/3rds of global investment in the energy sector.
The failure of nuclear power is that it is horrifically expensive and the timelines are insane compared to the competition.
Steam locomotives technically work, but are like nuclear power uncompetitive.
Lately nuclear power has caught the imagination of conservative politicians as a method to delay the renewable disruption of the fossil industry and have an answer to climate change.
When their plans, like in Australia, get presented they don’t care the slightest about nuclear power and it is only a method to prolong the life of the coal and gas assets.
[1]: https://en.wikipedia.org/wiki/Nuclear_renaissance_in_the_Uni...
Lots of projects get announced, they aren't meant to be promises.
> The end result of what we broke ground on is 3 cancelled reactors, 3 reactors which entered commercial operation in the 2020s and 1 still under construction.
So there are three operational reactors and another one almost ready. I'm surprised we got that after Fukushima.
> Today renewables make up 2/3rds of global investment in the energy sector.
So we should not invest in anything else?
> Steam locomotives technically work, but are like nuclear power uncompetitive.
This is a terrible analogy.
> Lately nuclear power has caught the imagination of conservative politicians as a method to delay the renewable disruption of the fossil industry and have an answer to climate change.
People who have been advocating for more nuclear power should stop because it is a conservative issue now?
We should of course continue with basic research. But, without some incredible breakthrough nuclear power will only serve climate change deniers agenda in delaying the renewable buildout.
This is what you sign up for when proposing investing in nuclear power in 2024:
> The opposition last week released modelling of its “coal-to-nuclear” plan that would slow the rollout of renewable energy and batteries and instead rely on more fossil fuel generation until a nuclear industry could be developed, mostly after 2040.
https://www.theguardian.com/australia-news/2024/dec/16/coali...
The research disagrees with you. Whenever new built nuclear power is included in the analysis the results becomes prohibitively expensive.
> Focusing on the case of Denmark, this article investigates a future fully sector-coupled energy system in a carbon-neutral society and compares the operation and costs of renewables and nuclear-based energy systems.
> The study finds that investments in flexibility in the electricity supply are needed in both systems due to the constant production pattern of nuclear and the variability of renewable energy sources.
> However, the scenario with high nuclear implementation is 1.2 billion EUR more expensive annually compared to a scenario only based on renewables, *with all systems completely balancing supply and demand across all energy sectors in every hour*.
> For nuclear power to be cost competitive with renewables an investment cost of 1.55 MEUR/MW must be achieved, which is substantially below any cost projection for nuclear power.
https://www.sciencedirect.com/science/article/pii/S030626192...
Or if you want a more southern latitude you have Australia here:
https://www.csiro.au/-/media/Energy/GenCost/GenCost2024-25Co...
Many grids around the world already spend loads of time with renewables filling 100% of the demand.
https://www.power-technology.com/news/california-achieves-10...
That is a down right hostile environment for nuclear power which relies on being able to output at 100% 24/7 all year around to only be horrifically expensive.
In the land of infinite resources and infinite time "all of the above" is a viable answer. In the real world we neither have infinite resources nor infinite time to fix climate change.
Lets focus our limited resources on what works and instead spend the big bucks on decarbonizing truly hard areas like aviation, construction, shipping and agriculture.
I’m advocating against wasting public money on nuclear power pretending it is a solution to climate change.
Have at it with your own money.
I already provided you with the scientists and engineers, but you seem to have completely disregarded them because they did not align with what you wanted.
I can do it again:
The research disagrees with you. Whenever new built nuclear power is included in the analysis the results becomes prohibitively expensive.
> Focusing on the case of Denmark, this article investigates a future fully sector-coupled energy system in a carbon-neutral society and compares the operation and costs of renewables and nuclear-based energy systems.
> The study finds that investments in flexibility in the electricity supply are needed in both systems due to the constant production pattern of nuclear and the variability of renewable energy sources.
> However, the scenario with high nuclear implementation is 1.2 billion EUR more expensive annually compared to a scenario only based on renewables, *with all systems completely balancing supply and demand across all energy sectors in every hour*.
> For nuclear power to be cost competitive with renewables an investment cost of 1.55 MEUR/MW must be achieved, which is substantially below any cost projection for nuclear power.
https://www.sciencedirect.com/science/article/pii/S030626192...
Or if you want a more southern latitude you have Australia here:
https://www.csiro.au/-/media/Energy/GenCost/GenCost2024-25Co...
You agree it costs more, is less flexible, takes longer to be operational than renewable energies.
You didn’t present any good argument for nuclear except “something something you don’t like my politics”
I agree with GP that nuclear is often used as a smokescreen to delay doing __anything__ practical and instead keep burning coal etc
Since the nuclear phase out began both coal and nuclear is down replaced by renewables. Fossil gas is stable.
https://ourworldindata.org/grapher/share-elec-by-source?time...
Germany brought a few coal plants out mothball to prevent the collapse of the French grid when half the French nuclear fleet was off line at the height of the energy crisis.
Which then were promptly mothballed again when the French got their nuclear power under control.
https://www.nytimes.com/2022/11/15/business/nuclear-power-fr...
But lets blame the French nuclear power not delivering on Germany. That makes total sense.
it sounds like they turned off coal to go back to nuclear after all...
This is not something you can answer clearly, no one can.
I personally would say since renewables (there are many different types of renewable energy sources btw) are so much cheaper and easier to build they are more consistent.
France for example has really shitty nuclear plants that have been falling apart since the 90s - they are not reliable and fixing them is not feasible
Storage delivering nuclear scale energy day in and day out in California:
https://blog.gridstatus.io/caiso-batteries-apr-2024/
Storage plummeting in cost 20% YoY, now at $66/kWh.
https://reneweconomy.com.au/mind-blowing-battery-cell-prices...
The US is already adding record amount of solar and wind power to replace coal and natural gas plants. What makes you believe Microsoft can just buy more renewable energies? Did you privy to the terms and conditions of the PPA?
The alternative to Three Miles Island restart would be to add natural gas plants, or to buy renewable energy at higher price. I’m sure they have plan B.
Have you considered googling and checking your assumptions? May help clear up the cynical misunderstandings you appear to have.
If you had, you would’ve read that both Microsoft and Google invest heavily into wind and solar, and that Google is the largest corporate purchaser of renewables in the world. I’m not advocating for these companies, just trying to show that tech is one of the few industries that does actually care and invest into clean energy.
Some sources:
- https://www.gstatic.com/gumdrop/sustainability/google-2024-e...
- https://www.latitudemedia.com/news/googles-largest-wind-inve...
- https://amp.theguardian.com/technology/2019/sep/20/google-sa...
- https://www.theverge.com/2024/5/2/24147153/microsoft-ai-data...
I don't have any such misunderstanding. Perhaps consider seeing my original comment which links to an article describing Google building out solar and wind farms for its data centres.
My cynicism, which I argue is well founded, is based around tech companies signing such agreements with nuclear companies, especially when it involves doings things that have never been done before (restarting reactors and building economical SMRs, see Nuscale...).
All these agreements are likely to amount to nothing more than positive PR, greenwashing, or predatory delay. Yes, they also build out solar and wind, but their nuclear PPAs are given equal standing with projects which actually are likely to be built; so instead of having to build more solar and wind today for more real money, they can promise to buy nuclear tomorrow for no cost today.
Anyways, it’s been a bore, cheers!
Argentina just announced they're building nuclear plants for AI.
In that scenario, you can go from 0 independent artificial intelligences to tens of millions of them, very quickly.
AI compute is measured in gigawatts, not gigaflops.
It's "how any gigawatts of compute can we get allocated?"
Not
"How much compute can we fit inside of a gigawatt?"
There's no such thing as "enough"
Example:
1. To decrease total gas consumption, more fuel efficient vehicles are invented.
2. Instead of using less gas, people drive more miles. They take longer road trips, commute farther for work, and more people can now afford to drive.
3. This increased driving leads to higher overall gasoline consumption, despite each car using gas more efficiently.
People will do whatever's more convenient, so if you make driving far more convenient than everything else ("cheaper"/"more available"), they will drive.
However convenience should not be the only factor for social decisions. To take this to extremes, it would be much more convenient for J. Doe to steal a car than to buy it, so we definitely do not want to make theft convenient.
It's a bit like queueing. The cost isn't monetary.
Is more value produced or are costs just shifted off the balance sheet onto the public commons? Driving instead of walking/public transit has certainly been profitable for some people/companies. But it has also been less than ideal from a public health standpoint. And the time spent commuting is unpaid, so while the business saves money on rent, the increase in travel time is still a cost borne by society as a whole. I would describe this as the opposite of 'efficient land use' personally.
If someone has a need or wants something real bad but can't afford to buy the desired quantity at the prevailing price then economists don't call it demand.
I always feel a bit silly referring to any "paradox" as such, when it's not a paradox anymore. When it now makes perfect sense.
If we run 7B now, why wouldn't we run 700b with memory optimizations?
I think there's the energy parallel: Software is becoming more energy-hungry faster than algorithms are becoming efficient.
So we'll still need the energy.
The grave implication of Jevons paradox is that the fundamental conflict between sustainability and economic progress is not resolved solely by using resources more efficiently. It's a theory of supply chain constraints essentially. Once a resource is used more efficiently, its use is increased until the next most economically constrained resource hits its economically useful limit.
I didn’t expect capable language models to be practical/possible to run loyally, much less on hardware I already have.
There’s soooo much more to optimize.
If you just want to play for a bit: llamafile
If you want granular control with ease of execution in exchange for having to figure out what the settings mean and figure out which weights to download: koboldcpp. (check out bartowski on huggingface for the weights)
These are all based on llamacpp as a backend, by the way.
Now there's a fun typo. Hopefully not too much fun.
Brains have gone through millions of iterations where being efficient was a huge driver of success. We should not be surprised if someone finds a new ML method that is both wildly more efficient and wildly more effective.
The two big take-aways for me are:
* It's possible to train a model to learn to summarize context from the attention matrix, based only on dot-product scores (k @ q.T * mask), regardless of how tokens are embedded.
* Once the model is trained, it will work with any attention matrix, even if it's the attention matrix of another model.
I've added this to my ever-growing list of things to try.
The model the authors use, in fact, maps attention scores to features in the frequency domain.