Machine Learning Is as Easy as an API, Says Hugging Face

AI right now seems like the domain of elite experts, but startup Hugging Face plans to “democratize good machine learning” by making it as easy as deploying a REST API.
This isn’t theoretical — it’s possible now, with use cases in frontend and web applications, explained Jeff Boudier, head of product and growth at the startup. Hugging Face offers opens source machine learning (ML) models for free on its community site, while charging a fee for infrastructure and service support.
“One, we make it really easy to use and so if you have a use case for machine learning within your app, then it’s super easy to come to Hugging Face, find a model, deploy an API and just build,” Boudier told The New Stack. “The second thing is [that] we want to make machine learning very accessible.”
Examples of AI Uses on Frontend and Mobile
Boudier shared how healthcare company Phamily used Hugging Face. The company helps medical groups manage in-house chronic care management service lines for between patient visits. It needed to leverage machine learning models to classify and triage the messages automatically.
The problem, of course, was building out the models, a proposition that can be very expensive, as Phamily soon learned. It came to a point where it needed to build out its infrastructure team or go home.
Instead, Phamily leveraged Hugging Face’s Inference Endpoints, which allows developers to deploy machine learning models on a fully managed infrastructure. After an hour of reading the documentation, the Phamily team was able to deploy a transformer model with a Rest-ful API, which previously took a week’s worth of developer time, according to Bryce Harlan, software engineer at Phamily.
Boudier estimated customers have deployed about 20,000 projects using AI technologies on their platform.
“Frontend, backend, mobile — it all works because we abstract away all of the machine learning and the infrastructure around the machine learning, so at the end of the day, it’s a REST API that you can send requests to — whether it’s from your frontend JavaScript or it’s your backend, or from a mobile client,” Boudier said. “We have a ton of developers and AI startups that are using our models and the inference endpoints … to power user-facing experiences.”
Examples of frontend and mobile AI uses include MusixMatch, which matches song lyrics to Spotify songs; Pinecone, which uses machine learning to conduct a semantic search; and a mobile app that ensures that patients follow prescriptions from doctors, Boudier said.
A Brief AI Lexicon: Defining New Models
In addition to its products, Hugging Face supports a robust open source community, acting as a free repository for all types of AI models — more than 120,000 — as well a sandbox to explore what the models do and information about potential bias.
Although Hugging Face started with natural language processing, developers will find two newer types of machine learning models on the site — transformers and diffusers.
Transformer models were pioneered by Google with the BART model. Transformer models — which Stanford labeled foundation models — are broadly trained on large data sets; for example, internet data or research data, or whatever large datasets the developers wants to use, Boudier said. These models can require millions of dollars in compute power to train, he added. For example, ChatGPT is based on the foundation model GPT3, which is trained with internet data, and NASA is collaborating with IBM to use NASA’s massive datasets to build open source foundation models for other scientists to leverage.
Once created, these models provide a foundation that can be fine-tuned — for instance, an existing foundation model could be further refined using an individual’s own email archive, to better classify it for the person’s unique needs.
“The most important concepts about transformers is transfer learning, which is the idea that you can create a big model with huge amounts of data using massive amounts of compute, and it creates what we call a pre-trained model that has accumulated a lot of knowledge,” he said. “Then you can apply transfer learning on that, to easily adapt it to a more specific domain, a more specific problem, to a different task, et cetera. So it’s a much more versatile technology that makes it easy and important to reuse.”
Diffusers are another relatively new type of model growing in popularity, thanks to Stable Diffusion and DALL-E 2.
“In terms of process, … imagine a picture that starts from a noisy image of dots, and then through iterations, the model improves upon that noise to make sense from the input,” Boudier explained.
So, for example, you might start with a text input of an astronaut riding a horse on the moon, and the model will start with an undefined random image, then iterate until a picture comes into focus that resembles what you requested, he said. It’s used in Photoshop to do painting; on Tuesday, Google revealed a new model that creates music from text using diffusion, he added.
Competition
Boudier was unaware of any companies that compete with open source models, and sees Hugging Face’s competition as proprietary companies, such as Google, AWS and OpenAI.
“In all these cases, you don’t have access to the model, so you can’t really bring your own model, you cannot improve the model, you cannot run the model in your own environment,” he said.
Hugging Face has drawn comparisons to GitHub, in that it federates the machine learning community in the same way that GitHub federated the software engineer community. But machine learning model files tend to be large — they’re called checkpoint files and can be in the range of 100 gigabytes — so GitHub isn’t the “right tool for the job,” he said.
“Typically, what happens is that when a research lab publishes a new model, they will publish the paper on arXiv, they will publish the code on GitHub and they will publish the model and the data sets and the demo on on Hugging Face,” Boudier said.
The community is heavily used by AI specialists and data scientists, and increasingly, software developers, he said. To help developers learn more about models and how to use them, Hugging Face offers a free online course.
“Don’t be intimidated,” Boudier advised developers.