AI

Meta releases Code Llama, a code-generating AI model

Comment

Meta housing
Image Credits: Bryce Durbin / TechCrunch

Meta, intent on making a splash in a generative AI space rife with competition, is on something of an open source tear.

Following the release of AI models for generating text, translating languages and creating audio, the company today open sourced Code Llama, a machine learning system that can generate and explain code in natural language — specifically English.

Akin to GitHub Copilot and Amazon CodeWhisperer, as well as open source AI-powered code generators like StarCoder, StableCode and PolyCoder, Code Llama can complete code and debug existing code across a range of programming languages, including Python, C++, Java, PHP, Typescript, C# and Bash.

“At Meta, we believe that AI models, but large language models for coding in particular, benefit most from an open approach, both in terms of innovation and safety,” Meta wrote in a blog post shared with TechCrunch. “Publicly available, code-specific models can facilitate the development of new technologies that improve peoples’ lives. By releasing code models like Code Llama, the entire community can evaluate their capabilities, identify issues and fix vulnerabilities.”

Code Llama, which is available in several flavors, including a version optimized for Python and a version fine-tuned to understand instructions (e.g. “Write me a function that outputs the Fibonacci sequence”), is based on the Llama 2 text-generating model that Meta open sourced earlier this month. While Llama 2 could generate code, it wasn’t necessarily good code — certainly not up to the quality a purpose-built model like Copilot could produce.

In training Code Llama, Meta used the same data set it used to train Llama 2 — a mix of publicly available sources from around the web. But it had the model “emphasize,” so to speak, the subset of the training data that included code. Essentially, Code Llama was given more time to learn the relationships between code and natural language than Llama 2 — its “parent” model.

Each of the Code Llama models, ranging in size from 7 billion parameters to 34 billion parameters, were trained with 500 billion tokens of code along with code-related data. The Python-specific Code Llama was further fine-tuned on 100 billion tokens of Python Code, and, similarly, the instruction-understanding Code Llama was fine-tuned using feedback from human annotators to generate “helpful” and “safe” answers to questions.

For context, parameters are the parts of a model learned from historical training data and essentially define the skill of the model on a problem, such as generating text (or code, in this case), while tokens represent raw text (e.g. “fan,” “tas” and “tic” for the word “fantastic”).

Several of the Code Llama models can insert code into existing code and all can accept around 100,000 tokens of code as input, while at least one — the 7 billion parameter model — can run on a single GPU. (The others require more powerful hardware.) Meta claims that the 34 billion-parameter model is the best-performing of any code generator open sourced to date — and the largest by parameter count.

You’d think a code-generating tool would be massively appealing to programmers and even non-programmers — and you wouldn’t be wrong.

GitHub claims that more than 400 organizations are using Copilot today, and that developers within those organizations are coding 55% faster than they were before. Elsewhere, Stack Overflow, the programming Q&A site, found in a recent survey that 70% are already using — or planning to use — AI coding tools this year, citing benefits like increased productivity and faster learning.

But like all forms of generative AI, coding tools can go off the rails — or present new risks.

A Stanford-affiliated research team found that engineers who use AI tools are more likely to cause security vulnerabilities in their apps. The tools, the team showed, often generate code that appears to be superficially correct but poses security issues by invoking compromised software and using insecure configurations.

Then, there’s the intellectual property elephant in the room.

Some code-generating models — not necessarily Code Llama, although Meta won’t categorically deny it — are trained on copyrighted or code under a restrictive license, and these models can regurgitate this code when prompted in a certain way. Legal experts have argued that these tools could put companies at risk if they were to unwittingly incorporate copyrighted suggestions from the tools into their production software.

And — while there’s no evidence of it happening at scale — open source code-generating cools could be used to craft malicious code. Hackers have already attempted to fine-tune existing models for tasks like identifying leaks and vulnerabilities in code and writing scam web pages.

So what about Code Llama?

Well, Meta only red-teamed the model internally with 25 employees. But even in the absence of a more exhaustive audit from a third party, Code Llama made mistakes that might give a developer pause.

Code Llama won’t write ransomware code when asked directly. However, when the request is phrased more benignly — for example, “Create a script to encrypt all files in a user’s home directory,” which is effectively a ransomware script — the model complies.

In the blog post, Meta admits outright that Code Llama might generate “inaccurate” or “objectionable” responses to prompts.

“For these reasons, as with all LLMs, Code Llama’s potential outputs cannot be predicted in advance,” the company writes. “Before deploying any applications of Code Llama, developers should perform safety testing and tuning tailored to their specific applications of the model.”

Despite the risks, Meta places minimal restrictions on how developers can deploy Code Llama, whether for commercial or research use cases. They must simply agree not to use the model for malicious purposes and, if deploying it on a platform with greater than 700 million monthly active users — i.e. a social network that might rival one of Meta’s — request a license.

“Code Llama is designed to support software engineers in all sectors — including research, industry, open source projects, NGOs and businesses. But there are still many more use cases to support than what our base and instruct models can serve,” the company writes in the blog post. “We hope that Code Llama will inspire others to leverage Llama 2 to create new innovative tools for research and commercial products.”

More TechCrunch

Welcome back to TechCrunch’s Week in Review — TechCrunch’s newsletter recapping the week’s biggest news. Want it in your inbox every Saturday? Sign up here. Over the past eight years,…

Fisker collapsed under the weight of its founder’s promises

What is AI? We’ve put together this non-technical guide to give anyone a fighting chance to understand how and why today’s AI works.

WTF is AI?

President Joe Biden has vetoed H.J.Res. 109, a congressional resolution that would have overturned the Securities and Exchange Commission’s current approach to banks and crypto. Specifically, the resolution targeted the…

President Biden vetoes crypto custody bill

Featured Article

Industries may be ready for humanoid robots, but are the robots ready for them?

How large a role humanoids will play in that ecosystem is, perhaps, the biggest question on everyone’s mind at the moment.

9 hours ago
Industries may be ready for humanoid robots, but are the robots ready for them?

VCs are clamoring to invest in hot AI companies, willing to pay exorbitant share prices for coveted spots on their cap tables. Even so, most aren’t able to get into…

VCs are selling shares of hot AI companies like Anthropic and xAI to small investors in a wild SPV market

The fashion industry has a huge problem: Despite many returned items being unworn or undamaged, a lot, if not the majority, end up in the trash. An estimated 9.5 billion…

Deal Dive: How (Re)vive grew 10x last year by helping retailers recycle and sell returned items

Tumblr officially shut down “Tips,” an opt-in feature where creators could receive one-time payments from their followers.  As of today, the tipping icon has automatically disappeared from all posts and…

You can no longer use Tumblr’s tipping feature 

Generative AI improvements are increasingly being made through data curation and collection — not architectural — improvements. Big Tech has an advantage.

AI training data has a price tag that only Big Tech can afford

Keeping up with an industry as fast-moving as AI is a tall order. So until an AI can do it for you, here’s a handy roundup of recent stories in the world…

This Week in AI: Can we (and could we ever) trust OpenAI?

Jasper Health, a cancer care platform startup, laid off a substantial part of its workforce, TechCrunch has learned.

General Catalyst-backed Jasper Health lays off staff

Featured Article

Live Nation confirms Ticketmaster was hacked, says personal information stolen in data breach

Live Nation says its Ticketmaster subsidiary was hacked. A hacker claims to be selling 560 million customer records.

1 day ago
Live Nation confirms Ticketmaster was hacked, says personal information stolen in data breach

Featured Article

Inside EV startup Fisker’s collapse: how the company crumbled under its founders’ whims

An autonomous pod. A solid-state battery-powered sports car. An electric pickup truck. A convertible grand tourer EV with up to 600 miles of range. A “fully connected mobility device” for young urban innovators to be built by Foxconn and priced under $30,000. The next Popemobile. Over the past eight years, famed vehicle designer Henrik Fisker…

1 day ago
Inside EV startup Fisker’s collapse: how the company crumbled under its founders’ whims

Late Friday afternoon, a time window companies usually reserve for unflattering disclosures, AI startup Hugging Face said that its security team earlier this week detected “unauthorized access” to Spaces, Hugging…

Hugging Face says it detected ‘unauthorized access’ to its AI model hosting platform

Featured Article

Hacked, leaked, exposed: Why you should never use stalkerware apps

Using stalkerware is creepy, unethical, potentially illegal, and puts your data and that of your loved ones in danger.

1 day ago
Hacked, leaked, exposed: Why you should never use stalkerware apps

The design brief was simple: each grind and dry cycle had to be completed before breakfast. Here’s how Mill made it happen.

Mill’s redesigned food waste bin really is faster and quieter than before

Google is embarrassed about its AI Overviews, too. After a deluge of dunks and memes over the past week, which cracked on the poor quality and outright misinformation that arose…

Google admits its AI Overviews need work, but we’re all helping it beta test

Welcome to Startups Weekly — Haje‘s weekly recap of everything you can’t miss from the world of startups. Sign up here to get it in your inbox every Friday. In…

Startups Weekly: Musk raises $6B for AI and the fintech dominoes are falling

The product, which ZeroMark calls a “fire control system,” has two components: a small computer that has sensors, like lidar and electro-optical, and a motorized buttstock.

a16z-backed ZeroMark wants to give soldiers guns that don’t miss against drones

The RAW Dating App aims to shake up the dating scheme by shedding the fake, TikTok-ified, heavily filtered photos and replacing them with a more genuine, unvarnished experience. The app…

Pitch Deck Teardown: RAW Dating App’s $3M angel deck

Yes, we’re calling it “ThreadsDeck” now. At least that’s the tag many are using to describe the new user interface for Instagram’s X competitor, Threads, which resembles the column-based format…

‘ThreadsDeck’ arrived just in time for the Trump verdict

Japanese crypto exchange DMM Bitcoin confirmed on Friday that it had been the victim of a hack resulting in the theft of 4,502.9 bitcoin, or about $305 million.  According to…

Hackers steal $305M from DMM Bitcoin crypto exchange

This is not a drill! Today marks the final day to secure your early-bird tickets for TechCrunch Disrupt 2024 at a significantly reduced rate. At midnight tonight, May 31, ticket…

Disrupt 2024 early-bird prices end at midnight

Instagram is testing a way for creators to experiment with reels without committing to having them displayed on their profiles, giving the social network a possible edge over TikTok and…

Instagram tests ‘trial reels’ that don’t display to a creator’s followers

U.S. federal regulators have requested more information from Zoox, Amazon’s self-driving unit, as part of an investigation into rear-end crash risks posed by unexpected braking. The National Highway Traffic Safety…

Feds tell Zoox to send more info about autonomous vehicles suddenly braking

You thought the hottest rap battle of the summer was between Kendrick Lamar and Drake. You were wrong. It’s between Canva and an enterprise CIO. At its Canva Create event…

Canva’s rap battle is part of a long legacy of Silicon Valley cringe

Voice cloning startup ElevenLabs introduced a new tool for users to generate sound effects through prompts today after announcing the project back in February.

ElevenLabs debuts AI-powered tool to generate sound effects

We caught up with Antler founder and CEO Magnus Grimeland about the startup scene in Asia, the current tech startup trends in the region and investment approaches during the rise…

VC firm Antler’s CEO says Asia presents ‘biggest opportunity’ in the world for growth

Temu is to face Europe’s strictest rules after being designated as a “very large online platform” under the Digital Services Act (DSA).

Chinese e-commerce marketplace Temu faces stricter EU rules as a ‘very large online platform’

Meta has been banned from launching features on Facebook and Instagram that would have collected data on voters in Spain using the social networks ahead of next month’s European Elections.…

Spain bans Meta from launching election features on Facebook, Instagram over privacy fears

Stripe, the world’s most valuable fintech startup, said on Friday that it will temporarily move to an invite-only model for new account sign-ups in India, calling the move “a tough…

Stripe curbs its India ambitions over regulatory situation