[해외 DS] 오픈소스 LLM, 접근성과 비용 사이의 갈림길

메타 라마 2, 비용 효율성의 함정
작업 규모에 맞는 LLM 사용 중요
비용 절감 위한 최적화 방안 모색

[해외DS]는 해외 유수의 데이터 사이언스 전문지들에서 전하는 업계 전문가들의 의견을 담았습니다. 저희 데이터 사이언스 경영 연구소 (GIAI R&D Korea)에서 영어 원문 공개 조건으로 콘텐츠 제휴가 진행 중입니다.


사진=AI Business

메타의 오픈소스 언어모델을 이용하는 스타트업이 접근성과 운영 비용 사이의 균형을 맞추는 데 어려움을 겪고 있는 것으로 조사됐다. 라마(Llama) 2는 Meta가 개발한 대규모언어모델로(LLM), 접근성 측면에서 지금까지 개발자와 연구자들로부터 높은 평가를 받아왔었다.

그러나 더 인포메이션(The Information)에 따르면 몇몇 스타트업은 GPT-4가 훨씬 더 비싼 건 사실이지만, OpenAI의 GPT-3.5 터보에 비해 Meta의 라마 2에 약 50%에서 100%의 운영 비용을 더 지출하고 있다고 분석됐다. 때로는 이러한 비용이 기하급수적으로 증가하기도 한다. 예를 들어 챗봇 스타트업 Cypher의 창업자들은 8월에 라마 2를 이용하여 테스트를 진행했는데, 이에 든 비용은 1,200달러였다. 이와 같은 테스트를 GPT-3.5 터보에서 실행하면 비용은 5달러에 불과했다.

출처=The Information

한편 OpenAI가 최근 발표한 새로운 모델은 더 저렴한 비용으로 놀라운 성능을 자랑했다. 데브데이 행사에서 GPT-4 터보를 선보였는데, 이 모델은 GPT-4(8K 모델)보다 3배 더 저렴하며, 입력 토큰 100개당 1센트로 실행 가능하다고 밝혔다. 개발자들에게 모델을 체험해 볼 기회를 주기 위해 OpenAI는 콘퍼런스 참석자 모두에게 500달러의 무료 API 크레딧을 제공했다. 라마 2는 OpenAI의 폐쇄적인 시스템과 달리 사용자가 무료로 액세스하고 수정할 수 있는 오픈소스 모델이다. 이러한 장점에도 불구하고 엄청난 비용 차이로 인해 기업들의 선택 폭이 좁아지고 있는 실정이다.

작업의 복잡성에 따른 모델 선택이 중요해

OpenAI는 고객으로부터 받는 수백만 건의 요청을 한 번에 하나씩 처리하지 않고 일괄적으로 칩에 전송하여 병렬로 처리하는 반면, 오픈소스 모델을 사용하는 스타트업인 Cypher와 같은 소규모 기업은 요청 쿼리를 충분히 얻지 못하는 상황에서 쿼리를 처리해야 하는 일이 빈번하게 발생한다. 이에 따라 작은 기업에서는 OpenAI만큼 서버 칩의 기능을 충분히 활용하지 못해서 오픈소스 모델을 사용하는 효율이 떨어진다.

하지만 스타트업에서 OpenAI의 최고사양 모델(GPT-4 기준)을 사용하면 더 큰 비용이 발생하기도 한다. 최근 Permutable.ai가 진행한 비용 분석에 따르면, OpenAI 모델을 이용하면 연간 약 100만 달러의 비용이 발생할 것으로 예상하는데, 이는 Permutable.ai가 자체 모델을 개발해서 사용하는 것보다 약 20배나 더 큰 비용이다. OpenAI의 고가 모델은 더 어려운 작업에 적합하다는 의미를 내포하고 있는 분석이었다. 윌슨 찬(Wilson Chan, Permutable.ai CEO)은 소규모 기업에서 ChatGPT를 사용하는 것은 “소 잡는 칼로 닭을 잡는 격”이라며, 효과는 좋지만 필요 이상으로 큰 노력이 든다고 설명했다. LLM에 필요한 컴퓨팅 및 재정 자원이 실제 수요와 일치하지 않을 수 있어 비효율적인 전력 및 예산 할당이 발생할 수 있다고도 덧붙였다.

출처=Permutable.ai

오픈소스 LLM을 사용하는 비용은 작업의 복잡성, 요청 처리량, 제품에 대한 커스터마이징 수준에 따라 크게 달라질 수 있다. 위의 극명한 대비는 작업의 규모와 특성을 고려하여 적절한 AI 모델을 선택해야 하는 중요성을 강조하는 바다. 한편 모델의 투명성과 보안 및 개인정보 보호와 같은 문제가 오픈소스의 높은 비용을 감내해야 하는 요소로 작용하기도 한다. 특히 최근의 AI 규제 방향을 고려할 때, 기능과 효율 자체보다 훨씬 더 중요한 문제로 대두되고 있는 요소들이다.

비용 및 최적화에 대한 고민해야

대규모 언어 모델을 실행하는 데 드는 비용은 주로 규모에 따라 달라진다. 라마 2는 다양한 크기로 제공되며, 그중 가장 큰 크기는 700억 개의 매개변수를 보유하고 있다. 모델의 규모가 커질수록 학습 및 실행에 필요한 컴퓨팅 자원이 증가하지만, 더 나은 성능을 얻을 수 있다. Iris.ai의 CTO이자 공동 창립자인 빅터 보테프는 모델 가중치의 정밀도를 수정하는 양자화, 혹은 하드웨어 간 데이터 전송으로 인한 병목 현상을 줄이는 데 사용되는 어텐션 알고리즘인 플래시 어텐션(Flash Attention) 같은 방법을 사용하여 매개 변수를 줄일 수 있다고 말했다. 비용을 크게 줄일 수도 있지만, 응답 품질이 저하될 위험이 있으므로 용도에 따라 신중히 선택해야 한다.

온프레미스 파라미터가 1,000억 개 미만인 모델에는 최소 하나의 DGX 박스(엔비디아 소프트웨어 및 하드웨어 플랫폼)가 필요하다. 현재 시장 가격 기준으로 각 DGX 박스의 가격은 약 20만 달러이며 3년 보증이 제공된다. Iris.ai에서 조사한 바에 따르면 온프레미스에서 라마 2를 실행할 경우 하드웨어 비용만 연간 약 65,000달러가 들 것이라고 계산했다. 하지만 클라우드에서 모델을 실행할 때는 모델 규모에 따라 비용이 크게 달라진다. 매개변수가 150억 개 미만인 모델의 경우 클라우드 운영 비용은 월 1,000달러, 연간 12,000달러 정도며, 약 700억 개의 매개 변수가 있는 모델의 경우 비용은 월 약 1,500달러, 연간 18,000달러로 증가한다.

출처=AI Business(ChatGPT로 생성)

안타깝게도 기본으로 제공되는 모델은 기업이 원하는 품질을 맞출 수 있는 경우가 드물기 때문에 사용자 대면 애플리케이션에 다양한 튜닝 기술을 적용해야 한다. 즉석 튜닝은 인코딩된 정보에 영향을 주지 않기 때문에 가장 저렴하며 비용은 10달러에서 1,000달러까지 다양하다. 명령어 튜닝은 모델이 특정 명령어를 이해해야 하지만 기존 학습 지식을 사용하여 응답할 수 있는 도메인에 가장 유용하다. 해당 도메인 조정에는 100달러에서 1,000달러 사이의 비용이 든다. 마지막으로, 미세 조정은 비용이 가장 많이 드는 프로세스 중 하나다. 학습된 지식, 추론 능력 등 모델의 근본적인 측면을 변경하기 때문에 이러한 비용은 모델의 규모에 따라 다르지만, 일반적으로 매개변수가 10억 개에서 50억 개 사이의 소규모 모델의 경우 약 10만 달러, 대규모 모델의 경우 수백만 달러의 비용이 든다.

인공지능 컴퓨팅 자원 수급 영향도 있어

컴퓨팅 액세스와 운영 비용에 영향을 주는 또 다른 중요한 쟁점은 하드웨어 접근성에 있다. 현재 인공지능은 뜨거운 관심사이며, 기업들은 어떠한 방식으로든 AI를 도입하고 활용하려 하지만, 이를 위해서는 컴퓨팅 자원에 대한 안정적인 액세스가 필수다. 그러나 현재는 공급이 수요를 따라가지 못하는 상황이다. 엔비디아는 최근 2분기 동안 약 900톤의 주요 GPU를 공급하는 등 H100 및 A100 GPU에 대한 수요가 많이 증가하고 있다. 또한 AMD와 인텔과 같은 경쟁 업체들도 새로운 AI 칩을 통해 경쟁을 준비하고 있는 가운데, H100의 성능을 뛰어넘는 H200 버전이 공개되면서 시장 경쟁을 가열시키고 있다.

안정적인 컴퓨팅 자원 액세스가 없으면 기업은 추가 비용을 지불해야 하는 상황을 피하기 어렵다. Hugging Face, NexGen Cloud 그리고 최근 AWS의 ‘임대 GPU’ 공간과 같은 다양한 해결책들이 시장에 등장하고 있지만, 라마 2와 같은 모델의 연산을 실행하려면 하드웨어 요구 사항을 충족하기 위해 강력한 칩이 구비되어야 한다.

모델 자체를 호스팅하지 않고 모델 가중치를 적용하거나, 중간 계층 설루션을 개발하여 모델 관리에 더 창의적인 전략을 적용하는 사례가 늘고 있다. 이러한 조치는 유사하고 반복적인 쿼리에 대한 불필요한 리소스 소비를 줄이는 데 도움이 되고 있다. 또한 특정 사용 사례에 적합하면서도 비용 효율적인 모델을 사용하는 것도 증가하는 추세다. 현재 70억 개와 130억 개의 파라미터로 구성된 라마 2의 라이트 버전들이 이미 출시되었다. 마이크로소프트의 Phi 1.5는 이제 13억 개의 작은 매개 변수로 멀티모달 기능도 제공하고, EleutherAI의 Pythia-1b와 데이터브릭스가 소유한 MosaicML의 MPT-1b도 최근 인기를 끌고 있다.


Open Source vs. Closed Models: The True Cost of Running AI

Is open source really cheaper? Here’s a cost breakdown.

At a Glance
Meta’s open source language models have startups questioning whether accessibility is worth potentially higher running costs.
Meta’s open source release of its powerful large language model Llama 2 earned plaudits from developers and researchers for its accessibility. It went on to form the basis for AI models such as Vicuna and Alpaca – as well as Meta’s own Llama 2 Long.

Costs to operate the model, however, can be more expensive than proprietary models. The Information reports that several startups are spending around 50% to 100% more on running costs for Meta’s Llama 2 compared with rival OpenAI’s GPT-3.5 Turbo, although top-of-the-line GPT-4 remains far more expensive. Both LLMs underlie ChatGPT.

Sometimes the cost is exponentially even higher. The founders of chatbot startup Cypher ran tests using Llama 2 in August at a cost of $1,200. They repeated the same tests on GPT-3.5 Turbo and it only cost $5.

AI Business has contacted Meta for comment.

This week, OpenAI unveiled a new, more powerful model that costs even cheaper to run. At its DevDay event, OpenAI said the new GPT-4 Turbo is three times cheaper than GPT-4 (8K model) – costing one cent per 100 input tokens. To get developers to give it a try, OpenAI gave each of its conference attendees $500 in free API credits.

While Llama 2 is free for users to access and tinker with compared to OpenAI’s closed systems, the sheer difference in running costs could turn companies away.

Why open-source can be more expensive
One reason comes from how companies use the specialized servers that power the models. OpenAI can bundle the millions of requests it gets from customers and send the batch to chips to process in parallel rather than one at a time, according to The Information.

In contrast, startups like Cypher that use open-source models while renting specialized servers from cloud providers may not get enough customer queries to bundle them. As such, they do not benefit fully from the server chips’ capabilities the way OpenAI can, a Databricks executive told the news outlet.

To be sure, the cost of using open source LLMs can vary widely depending on the task, the number of requests it serves and how much needs to be customized for a certain product. For simple summarization, the cost can be relatively low while complex tasks might need more expensive models.

Another possibility is “we don’t know how much operating cost OpenAI is simply ‘eating’ right now,” Bradley Shimmin, chief analyst for AI and data analytics at sister research firm Omdia said. “We have no visibility into the cost of running any of OpenAI’s models. I’m sure they’re benefiting from economies of scale that would far outgun those available to mom and pop enterprises seeking to host a seven-billion parameter model on AWS or Azure.”

“However, from what we do know of model resource requirements and what we’re learning about model resource optimization, it is unlikely that these moves will overturn the current trend toward smaller model adoption in the enterprise, especially where issues like transparency, openness and security/privacy may far outweigh ease of use and even capability itself.”

Using a sledgehammer to crack a nut
This week, Permutable.ai published a detailed analysis of its actual costs to use OpenAI’s tech: approximately $1 million annually or 20 times more than using in-house models.

That means OpenAI’s pricier models are best reserved for tougher tasks. CEO Wilson Chan told AI Business that using ChatGPT for smaller tasks is like using a sledgehammer to crack a nut — effective but exerting far more force than needed. The computational and financial resources required for heavyweight models may not align with practical demands, resulting in inefficient power and budget allocations.

“The costs associated with deploying such powerful AI models for minor assignments can be significantly higher than employing tailored, more nuanced solutions. In essence, it’s akin to utilizing a cutting-edge sports car for a stroll around the block,” he said. “This stark juxtaposition underscores the importance of evaluating the scale and nature of the task at hand when choosing the appropriate AI model, ensuring a harmonious balance between capability and cost-effectiveness.”

Costs comparison
The costs of running large language models largely depend on size. Llama 2 comes in various sizes, the biggest of which is 70 billion parameters. The larger the model, the more compute is needed to train and run. However, users might get a better performance.

In emailed comments, Victor Botev, CTO and co-founder at Iris.ai, said parameters can be reduced using methods like quantization, whereby you modify the precision of a model’s weight and flash attention, an attention algorithm used to reduce bottlenecks stemming from transferring data between hardware.

“You can also reduce the costs − sometimes significantly so. However, this risks degrading the quality of response, so the choice depends on your use.”

Botev said that models with fewer than 100 billion parameters on-premises require at least one DGX box (Nvidia software and hardware platform). Each of these DGX boxes is priced around $200,000 at current market prices and comes with a three-year guarantee. He calculates that for running something like Llama 2 on-premises, the annual cost for hardware alone would be about $65,000.

However, when it comes to running models in the cloud, the costs differ significantly based on the model’s size. For models below 15 billion parameters, he said, the cloud operation cost is around $1,000 monthly, or $12,000 annually. As for models with around 70 billion parameters, the cost escalates to approximately $1,500 per month, or $18,000 annually.

“Unfortunately, models out of the box rarely provide the quality that companies are looking for, which means that we need to apply different tuning techniques to user-facing applications. Prompt tuning is the cheapest because it doesn’t affect any encoded knowledge, with costs varying from $10 to $1000,” Botev said. “Instruction tuning is most useful for domains where the model needs to understand specific instructions but can still use its existing training knowledge to respond. This domain adaptation costs between $100 to $10,000.”

“Finally, fine-tuning is the most expensive process. It changes some fundamental aspects of a model: its learned knowledge, its expressive reasoning capabilities, and so on. These costs can be unpredictable and depend on the size of the model, but usually cost around $100,000 for smaller models between one to five billion parameters, and millions of dollars for larger models.”

Here come the small models
Enter the idea of using smaller but more-cost effective models for specific use cases. There are already smaller variations of Llama 2, coming in at seven billion and 13 billion parameters. But new systems are emerging at pace. There’s Phi 1.5 from Microsoft, which now has multimodal capabilities, offering a miniscule 1.3 billion parameters. Other popular smaller models include Pythia-1b from EleutherAI and MPT-1b from the Databricks-owned MosaicML.

All these systems are open source, but as Omdia chief analyst Lian Jye Su puts it, “Open source is never cheap to begin with, especially when forking is introduced to the vanilla model for enhancement or domain-specific capability.”

Moreover, “all OpenAI models are inherently proprietary. The idea of sharing their profit with OpenAI via licensing fee or royalty may not sit well with some businesses that are launching gen AI products and prefer not to. In that case, the model cost probably is less of a priority,” the analyst added.

Anurag Gurtu, CPO at StrikeReady, said that startups should balance model costs with the potential return on investment.

“AI models can drive innovation, create personalized user experiences, and optimize operations. By strategically integrating AI, startups can gain a competitive edge, which might justify the initial investment,” he said. “As the AI field advances, we’re seeing more efficient models and cost-effective solutions emerge, which will likely make AI more accessible to startups and developers in the future.”

Access to compute
Another major issue affecting running costs is access to hardware. AI is hot right now and companies are looking to adopt or deploy AI in some way, and that requires access to compute.

But demand is outweighing supply. Market leader Nvidia has seen a huge increase in demand for its H100 and A100 GPUs, delivering some 900 tons of its flagship GPUs in Q2 alone. It also just unveiled a higher-memory, faster version of H100, appropriately called H200, as rivals AMD and Intel get ready to compete with their own new AI chips.

Without steady access to compute, companies will have to pay more to meet their needs. Options in the market include the ‘GPUs for rent’ space from Hugging Face, NexGen Cloud and most recently AWS. But hardware-intensive demands for running computations on a model like Llama 2 requires powerful chips.

In emailed comments, Tara Waters, chief digital officer and partner at Ashurst, said that consumption-based pricing for public models has forced some startups to curb use by potential customers looking to trial and pilot before they buy.

“It can also make customer pricing a more difficult conversation, if it’s not possible to offer price certainty. The availability of open source models could be seen as a panacea to this problem, although the new challenge of needing to have the necessary infrastructure to host a model arises,” she said.

“We have seen a rise in more creative strategies being employed to help manage them — for example looking to apply model weightings without hosting the model itself, as well development of mid-layer solutions, to reduce unnecessary consumption for similar and repeat queries.”