News for hackers. Stuff that matters.
Re:Code Llama, an AI tool for coding by daemonologist on Thursday August 24, 2023 @01:34PM (#37251995)
Works nearly out of the box with llama.cpp, which makes it easy to try locally: https://github.com/ggerganov/llama.cpp/issues/2766

Here's some output from q4_0 quantization of CodeLlama-7b-Python (first four lines are the prompt):

    # prints the first ten prime numbers 
    def print_primes(): 
        i = 2 
        num_printed = 0 # end of prompt
        while num_printed < 10:
            if is_prime(i):
                print(i)
                num_printed += 1
            i += 1

    def is_prime(n):
        i = 2
        while i * i <= n:
            if n % i == 0:
                return False
            i += 1
        return True

    def main():
        print_primes()

    if __name__ == '__main__':
        main()

It will be interesting to see how the larger models perform, especially after community tuning and with better context/prompting.
Re:Code Llama, an AI tool for coding by blibble on Thursday August 24, 2023 @02:28PM (#37252749)
I'd fail an interview candidate that suggested adding 1 each time for subsequent prime testing
Re:Code Llama, an AI tool for coding by droopyEyelids on Thursday August 24, 2023 @02:50PM (#37253013)
The simple-to-understand, greedy algorithm is always the correct first choice till you have to deal with a constraint.
Re:Code Llama, an AI tool for coding by blibble on Thursday August 24, 2023 @02:53PM (#37253038)
it's not that though, there's several other typical optimisations in there

just not the super obvious one that demonstrates extremely basic understanding of what a prime number is

Re:Code Llama, an AI tool for coding by jpeterson on Thursday August 24, 2023 @04:16PM (#37253991)
Having "extremely basic understanding" of prime numbers immediately at one's command is important for approximately 0% of software engineering jobs. If you instant-fail a candidate for this, it says a lot more about you and your organization than the candidate.
Re:Code Llama, an AI tool for coding by blibble on Thursday August 24, 2023 @04:46PM (#37254316)
> If you instant-fail a candidate for this, it says a lot more about you and your organization than the candidate.

yes, we expect professional software developers to have basic maths skills

"what is a prime number" is taught to 7 year olds, it's not vector calculus

what else would you consider to be an unreasonable thing for an employer to require?

reading and writing skills of a typical 7 year old?

Re:Code Llama, an AI tool for coding by ungruntled on Thursday August 24, 2023 @05:23PM (#37254722)
I think the key problem here is that is is a bad programming question. If you know anything about prime numbers then coming up with an answer is trivial. If you expect a more optimized solution, then you are really only gauging the interviewee’s understanding of prime numbers. So effectively the interview is more about mathematics than it is about programming or problem solving.
Re:Code Llama, an AI tool for coding by daok on Thursday August 24, 2023 @05:52PM (#37255028)
You probably do not have a child of 7 years old because they do not know at that age what is a prime number.

Second, basic math still that you never or rarely use or with very large time between usage might get rusty. You may understand the concept but not find the optimal solution. The way you are responding here shows quite a lot about how you are short sighted by instant-failing someone with a single question instead of trying to asses the whole person as much as you can. On you side, you are wasting opportunity to have a great person that could be a key player in your team by bringing other set of skill on the table.

Re:Code Llama, an AI tool for coding by blibble on Thursday August 24, 2023 @06:29PM (#37255391)
> You probably do not have a child of 7 years old because they do not know at that age what is a prime number.

it's part of the curriculum for children of this age where I grew up (I did check)

> The way you are responding here shows quite a lot about how you are short sighted by instant-failing someone with a single question instead of trying to asses the whole person as much as you can. On you side, you are wasting opportunity to have a great person that could be a key player in your team by bringing other set of skill on the table.

it may also be the case I have more in depth knowledge about the that roles I've interviewed candidates for

most recently: hiring people to work for quants

not instantly knowing that even numbers (other than 2) are not prime is a very strong signal

Re:Code Llama, an AI tool for coding by hyperbovine on Thursday August 24, 2023 @08:35PM (#37256376)
> You probably do not have a child of 7 years old because they do not know at that age what is a prime number.

A few do. And in 20 years you're reallyreally going to want to hire them.

Re:Code Llama, an AI tool for coding by jpeterson on Thursday August 24, 2023 @09:04PM (#37256599)
You're not testing for "basic math skills" here. What you're testing for is more like "immediately retrieves an irrelevant math fact after many years of having no need to think about it."

Look, if you think this sort of thing allows you to identify great candidates, good for you. But in my experience, not only is this kind of practice stupid on its face, but it leads to engineering orgs packed with people who are good at memorizing trivia but terrible at solving real problems.

Re:Code Llama, an AI tool for coding by Mawr on Friday August 25, 2023 @11:43AM (#37263006)
You happen to remember a particular piece of knowledge, so you project that expectation onto others. Theory of mind.

> yes, we expect professional software developers to have basic maths skills

Skill != knowledge. "What is a prime number" can be looked up and understood by any competent programmer in <5 minutes.

> "what is a prime number" is taught to 7 year olds, it's not vector calculus

Then it's reasonable to expect that an interviewee would be able to learn it as well, given the same resources. It does not however follow that an interviewee would inherently have that knowledge, just because 7 year olds are taught it.

Bottom line is, you're making too many assumptions about complete strangers.

Re:Code Llama, an AI tool for coding by rini17 on Friday August 25, 2023 @11:46AM (#37263043)
If they know "prime number" is some technical term to look up. They might confuse it with amazon prime or anything else depending on context. You waste time explaining, they get indignant they are supposed to coding not do maths, complete mess.
Re:Code Llama, an AI tool for coding by SideQuark on Thursday August 24, 2023 @07:28PM (#37255881)
Approx 0% of devs need to know what the earth is, but from lots of interviews I've given I've found consistent correlation between lack of basic knowledge and lack of ability to solve many things. It was so strong we found it much more cost effective to cut people early that didn't know at least a few of some standard knowledge items.
Re:Code Llama, an AI tool for coding by chaxor on Thursday August 24, 2023 @09:48PM (#37256906)
This is some really good advice here. It's always a good idea to throw out all candidates that can't immediately recall what the first theoretical result of the rest mass of a Higgs boson was in the first paper describing was. Basic knowledge like this just correlates so well with ability to make proper decisions in API architecture.
Re:Code Llama, an AI tool for coding by SideQuark on Sunday August 27, 2023 @03:38AM (#37280313)
I'd also save time and money cutting people that read as poorly as you're demonstrating.

Try actually measuring basic knowledge with competency at programming before thinking your opinion is better than measured data.

And yes, we tested all this carefully before enacting it. Interviews cost time and money, so giving 100% on every candidate despite quick signals is a waste of time and money that would be better spent on other candidates.

Re:Code Llama, an AI tool for coding by noduerme on Thursday August 24, 2023 @04:25PM (#37254096)
I'm mad at myself now that it has eaten 15 minutes of my time trying to come up with the right optimization. What's the trick? 2, +1, and then +2 from there on seems obvious but once you get to 9 is it worth building a list of nonprimes to skip?
Re:Code Llama, an AI tool for coding by Our_Benefactors on Thursday August 24, 2023 @04:46PM (#37254324)
https://stackoverflow.com/a/54544012/1336678

Common approach is to use square roots, this reduces the runtime. Recommend checking out project euler if you like solving hard math-code-o(n)-puzzles.

Re:Code Llama, an AI tool for coding by noduerme on Thursday August 24, 2023 @05:27PM (#37254762)
I didn't want to cheat by looking on S.O. but thanks ;)

Yes it makes sense (in the GPT code) that you'd only go up to i * i ... although looking at pythonic while: statements is just gross to me in this context, it would feel a lot more readable to say, e.g. in PHP:

for ($i=2;$i<sqrt($n);) { $i+=($i==2 ? 1 : 2); //although the first one should just be outside the loop }

Re:Code Llama, an AI tool for coding by thewataccount on Thursday August 24, 2023 @04:48PM (#37254355)
I think they're suggesting simply doing +2

+1 is not a good idea since ~half of all numbers are effectively non-prime simply by being even numbers.

You can double the speed by using +2 without using any fancy tricks, just changing a single character.

Re:Code Llama, an AI tool for coding by nojs on Thursday August 24, 2023 @08:44PM (#37256442)
Well it doesn’t double the speed, since anything with a factor of 2 undergoes only one loop iteration inside is_prime. It basically just saves a function call
Re:Code Llama, an AI tool for coding by dahfizz on Thursday August 24, 2023 @07:39PM (#37255979)
There's lots of more advanced optimizations, which would be an interesting avenue for discussion in an interview, but the drain dead algorithm would just use +2 instead of +1
Re:Code Llama, an AI tool for coding by bakuninsbart on Friday August 25, 2023 @09:50AM (#37261719)
Exactly, multiples of 2 can't be a prime, so skipping this saves a function call (that itself only does one comparison), so it is a very simple and relatively obvious optimization. But actually every multiple of a number per definition cannot be a prime, you can't just change the step size, but there are some nifty tricks to approach the problem from a different angle.
Re:Code Llama, an AI tool for coding by throwuxiytayq on Thursday August 24, 2023 @04:13PM (#37253953)
i’d walk out from an interview that asked me to write a prime number generator
Re:Code Llama, an AI tool for coding by belenos46 on Thursday August 24, 2023 @05:21PM (#37254706)
I've done that (maybe it was fizzbuzz, now that I'm thinking about it) and boy howdy does that get the people you're interviewing with agitated. Saying "I'm interviewing for a architect level container orchestration position. If I'm reinventing the wheel writing algorithms, something is terribly wrong" shuts them up, but doesn't make them any happier.
Re:Code Llama, an AI tool for coding by zaphirplane on Thursday August 24, 2023 @08:42PM (#37256425)
Is the job role just a for example ?

what does and container orchestration architect do ? Something like this cluster should use envoy and Prometheus. The new clusters rate isn’t usually high enough for the stack to change.

Real question I love these non conventional (swe, sre, pm, manager ) roles in tech

Re:Code Llama, an AI tool for coding by flir on Friday August 25, 2023 @08:07AM (#37260769)
> what does and container orchestration architect do ?

I hope it involves either a baton or a sheepdog.

Re:Code Llama, an AI tool for coding by csmpltn on Thursday August 24, 2023 @04:17PM (#37253997)
> "I'd fail an interview candidate that suggested adding 1 each time for subsequent prime testing"

Congratulations! You must be that arrogant guy everybody hates interviewing with, the one with the superiority complex.

How about instead of just failing people over literally nothing (wasting everybody's time and money) - just ask the candidate whether they could somehow reduce the search space by utilizing the properties of a prime number?

Re:Code Llama, an AI tool for coding by hyperbovine on Thursday August 24, 2023 @08:30PM (#37256337)
How many even numbers are prime?
Re:Code Llama, an AI tool for coding by wavemode on Thursday August 24, 2023 @09:15PM (#37256650)
One.
Re:Code Llama, an AI tool for coding by awwaiid on Friday August 25, 2023 @12:12AM (#37257958)
Two when you include -2, which I certainly think we should in this circumstance.
Re:Code Llama, an AI tool for coding by chaboud on Friday August 25, 2023 @12:57AM (#37258243)
Are we including it just to poke the bear? Prime numbers are typically defined as numbers with no positive divisors other than one and the number in question.
Re:Code Llama, an AI tool for coding by TeMPOraL on Friday August 25, 2023 @09:47AM (#37261691)
A definition which marks 1 as being prime :).
Re:Code Llama, an AI tool for coding by tuukkah on Friday August 25, 2023 @05:20PM (#37267195)
This thread started with AI code whose correctness of is_prime no-one has questioned so far :-D

  -1 True
  0 True
  1 True
  2 True
  3 True
  4 False
Re:Code Llama, an AI tool for coding by chaboud on Friday August 25, 2023 @08:37PM (#37268764)
Well, I’m questioning it… not that it really matters.

-1, 0, and 1 are no good.

Two divisors for positive integer X: 1, X

I recently demonstrated GPT-4 via by having it explain phases of matter metaphorically with animals. Though impressive, it points to loose abstraction being more in range than firm abstraction. Let’s get that model a python interpreter and see how far we can take this party. Until then, I’m going to stick to explaining concepts.

————- included here for fun

Alright! Let's dive into the wild world of matter using some animal friends as examples:

1. *Solids* - Think of solids like a herd of elephants standing closely together. The elephants are packed in tight, barely moving, just maybe swaying a bit. They're sturdy and strong, just like solid things in our world. This is because the particles in a solid don't move around much; they just vibrate in place.

2. *Liquids* - Imagine a school of fish swimming in a pond. They're free to move around, weaving in and out, but they still stay pretty close to each other. They aren't packed as tightly as our elephant friends, but they aren't completely free either. This is like liquids: the particles are close, but they can move around and flow, just like water in a glass.

3. *Gases* - Now, picture a flock of birds soaring in the sky, free to fly in all directions. These birds aren't sticking close to one another; they're spread out, enjoying the vast space of the sky. In gases, the particles are like these birds, very spread out and moving all over the place.

4. *Plasma* - Think of plasma like dragons (I know they're mythical, but bear with me). These dragons breathe fire, and that fire is so hot and energetic that it can change the way things behave. Plasma is like that – it's gas that's become so hot that the particles are super energized and can even glow, like neon lights.

5. *Bose-Einstein Condensate (BEC)* - This one's a bit trickier, but imagine penguins in Antarctica. They huddle closely together to keep warm. BEC is like the coldest group of particles ever, where they start acting in strange, uniform ways, almost like one giant super-particle. It's like all the penguins moving together as one.

So, next time you think of matter, just remember our animal friends: the sturdy elephants, the flowing fish, the free-flying birds, the fiery dragons, and the huddled penguins!

Re:Code Llama, an AI tool for coding by TeMPOraL on Saturday August 26, 2023 @02:20AM (#37270328)
> Two divisors for positive integer X: 1, X

Again, 1 fits, because it has two divisors: 1, and 1. You never said X != 1, nor does the definition upthread.

This isn't a silly gotcha, these things matter in math. For instance, when solving a quadratic equation, allowing for the solutions to be equal lets you avoid special-casing your understanding - instead of memorizing when the equation has zero, one or two solutions, you just learn it has two or zero (real) solutions, and the two solutions are allowed to be equal.

It's perfectly reasonable understanding. Inequality isn't a natural implicit assumption. E.g. if I say you have two variables:

  int a;
  int b;
I doubt you'd be insisting that `a != b` at all times.
Re:Code Llama, an AI tool for coding by chaboud on Saturday August 26, 2023 @04:49AM (#37270892)
No. In the set of integers, 1 is not two divisors if repeated. It is one divisor.

An element to set relationship is that element A is or is not in set B. So, if the set of divisors only contains 1, there is only one divisor. If 1 and 1 made two divisors, 1 and 1 and 1 and… would make infinite divisors, rendering the concept of counting divisors (i.e., the cardinal number of the set of divisors) meaningless.

M is a divisor of N if it is a number that divides N without a remainder. While divisors can be negative, they are conventionally limited to non-negative integers in primality and factoring.

If you’d wanted to dig in on negative vs. positive divisors, that quickly provides an avenue for clearer formality, but piling on 1 and saying it’s not a silly gotcha is pretty fruitless. And please don’t bother to say “you didn’t say it has only two divisors”, as that would, again, be a silly argument.

So wind back and really formalize the definition if you want: A prime number is a natural number with only two divisors in the set of natural numbers, 1 and itself.

While set theory is axiomatic, it’s not practical for me (or anyone else) to explain conventional foundations to avoid someone feeling like they need to wiggle out of a prior bad argument.

Just say “ah, okay” or stop replying and move on. Feel free to read up in Wikipedia or any other texts (or ping me privately if you’d like to discuss further), but this thread isn’t looking like it’s going to meaningfully contribute to the broader discussion. Accordingly, I’ll leave it here unless something meaningful comes up.

Re:Code Llama, an AI tool for coding by sam_goody on Sunday August 27, 2023 @04:56AM (#37280776)
No need for the disclaimer on the dragons, especially as we can't prove they have not existed [even though we both know they haven't].
Re:Code Llama, an AI tool for coding by squeaky-clean on Friday August 25, 2023 @01:46AM (#37258519)
Negatives are not prime.
Re:Code Llama, an AI tool for coding by hyperbovine on Friday August 25, 2023 @06:45AM (#37260155)
Very good. So why is it necessary to check all of them.
Re:Code Llama, an AI tool for coding by Biganon on Friday August 25, 2023 @07:32AM (#37260524)
It is not, and nobody said it was.
Re:Code Llama, an AI tool for coding by lynx23 on Friday August 25, 2023 @02:00AM (#37258583)
Downvoting this is not enough. I'd pay $5 (reddit style) to have this properly killfiled if HN allowed for that. Besides, not "everybody hates them, only those inmature enough to still need intellectual babysitting.
Re:Code Llama, an AI tool for coding by throwmeback on Friday August 25, 2023 @08:34AM (#37260988)
Whoa there Satan
Re:Code Llama, an AI tool for coding by tasubotadas on Thursday August 24, 2023 @04:28PM (#37254138)
Finally we meet the lifeless drone that everybody complains about in the interviews.

My suggestion for your next interview: decide to hire them just based on their leetcode score, but invite to the interview just to flex that you're still better at puzzle solving :-D

Perfect

Re:Code Llama, an AI tool for coding by internet101010 on Friday August 25, 2023 @02:54AM (#37258886)
"Use <insert language> and optimize for runtime."

<pastes question and constraints from leetcode>

"solution begins with <insert default solution template from leetcode>".

Copy solution from gpt, paste in leetcode, run, submit.

"faster"

Repeat.

Repeat.

Next question.

Re:Code Llama, an AI tool for coding by maleldil on Thursday August 24, 2023 @04:30PM (#37254159)
I assume you meant that you should add 2? If yes, that's such a mind boggling basic thing to do that I agree with you, and it makes no sense that you're being crucified.
Re:Code Llama, an AI tool for coding by blibble on Thursday August 24, 2023 @04:51PM (#37254388)
yes
Re:Code Llama, an AI tool for coding by warent on Thursday August 24, 2023 @08:27PM (#37256318)

  it makes no sense that you're being crucified.
Probably because there's significant overlap in the Venn diagram of people with years experience who professionally develop products that generate $millions in wealth/value, and people who would fail that interview.

Or we have worked with junior developers who have really grown and flourished under our care, who would never have gotten that chance with such insane Draconian judgements.

It's such an obvious "GOTCHA!!" setting someone up for failure.

The way it's framed is very cringy because it signals that they don't care in their interviews about determining how objectively effective a software developer is.

Re:Code Llama, an AI tool for coding by maleldil on Friday August 25, 2023 @04:50AM (#37259524)
I don't get it. This is an extremely basic fact that most people can figure out after thinking about primes for a minute. Maybe if you ask for "what's an easy optimisation here?" This would make the candidate think more closely about invariants that their code should hold, which in itself is a very valuable skill.
Re:Code Llama, an AI tool for coding by NhanH on Friday August 25, 2023 @05:40AM (#37259796)
Because I know enough not to write prime testing code that resemble anything like that loop to have to care about reducing its search space. If you actually want to test my knowledge about prime number, you can ask and I will tell you about using some probabilistic choice instead, and that I know fast deterministic one might exist, but I am not up to date on the state of the art.

If I have to write the loop above, I am assuming it is the Fizzbuzz equivalent of your company to show that I know how to write a while loop. I am not thinking about reducing the search space because I am writing the code semi-unconscious and frankly just want to get to the next question.

Re:Code Llama, an AI tool for coding by TeMPOraL on Friday August 25, 2023 @09:51AM (#37261725)
Same. Also, if I'm suspecting it's a "can they into loops" fizzbuzz test, I'd be wary of reducing the search space for the simple reason that it makes the code slightly more complex, introducing a chance to make e.g. off-by-one error, which would lose me points if the reviewer has the kind of "pedntic over irrelevant things" attitude this subthread is criticizing.
Re:Code Llama, an AI tool for coding by croes on Friday August 25, 2023 @06:18AM (#37259999)
You would fail someone about such a trifle?
Re:Code Llama, an AI tool for coding by dontupvoteme on Thursday August 24, 2023 @05:27PM (#37254760)
Simply prompting the output with "Optimize " prepended adds your suggestion, and some others.
Re:Code Llama, an AI tool for coding by jckahn on Thursday August 24, 2023 @09:08PM (#37256615)
So I take it you typically produce fully optimized, thoughtful, and correct code on the first iteration while being actively judged by a stranger, yes?
Re:Code Llama, an AI tool for coding by beanjuiceII on Thursday August 24, 2023 @11:35PM (#37257715)
Also don't these only ever need to be computed once
Re:Code Llama, an AI tool for coding by squeaky-clean on Friday August 25, 2023 @01:50AM (#37258537)
You'd reject a candidate that is willing and legally able to work for free while also cloning themselves so they can pair program with every one of your employees at once?
Re:Code Llama, an AI tool for coding by 5Qn8mNbc2FNCiVV on Friday August 25, 2023 @06:19AM (#37260006)
I would not ship code just because of those reasons.
Re:Code Llama, an AI tool for coding by hititncommitit on Saturday August 26, 2023 @05:11AM (#37270981)
> I'd fail an interview candidate that suggested adding 1 each time for subsequent prime testing

The problem a team that always seeks the optimal solution is that never they get shit done. And that’s rarely optimal in a business context. Your view does not strike me to be nearly as arrogant as it is short-sighted.

I think on a team of one I want the guy who gets it done without thinking. On a team of two I want a guy that’s somewhere in the middle. And on a team of three, that’s when I want my optimiser. Because in the time that guy number 3 has written let’s say 3 files of optimal code, guy number 10 files of not optimal code. And you rarely need guy number 3 to fix all ten, you just need him to fix the one or two files that actually matter.

Clients rarely ask “is this optimal?”. But they always ask “is this done?”.

All three developers have different approaches. All three are assets.

I think on some level then you’re making the same mistake that we could say the “just add one guy” made if your comment is honest- not factoring in (his) speed.

I think code readability, rather than code optimisation is far more important thing to get hung up on in an interview (and is, I must remind some of you, not to be confused with conciseness). And you can see this in the end result. But if you’re following along and the interviewee already knows you know what’s going on because of that, you can see it in smaller ways- it could be as simple as going back and changing a variable name such as open (maybe a function?) to isOpen (almost always a Boolean value).

I think most of us are in this position pretty often where we’re writing and figuring out something at the same time, maybe we just see if it works first and don’t give a name much thought or maybe we change the actual value or type of a variable in the process and the variable name becomes ambiguous. I’d look for small indicators that shoe me that this person is considering readability. But I still don’t necessarily expect it to be as readable as it would be in a more natural setting I mean I think 90% of these sorts of things start off with the person saying “I swear I can type” within the first five minutes of being watched- if they get flustered while being watched that it effects their typing, it certainly also effects their coding as well.

Re:Code Llama, an AI tool for coding by d0mine on Thursday August 24, 2023 @05:05PM (#37254548)
Simple, concise, more efficient:

  def primes_upto(limit: int):
    """Generate prime numbers < *limit*.""" 
    # Sieve of Eratosthene
    is_prime = [True] * limit 
    for n in range(2, limit):
        if is_prime[n]:
            yield n  # found prime number
            for c in range(n*n, limit, n):  # start with square, less values are marked already
                is_prime[c] = False # mark composites

  if __name__ == "__main__":                
    from itertools import islice
    
    print(*islice(primes_upto(100), 10)) # -> 2 3 5 7 11 13 17 19 23 29
Re:Code Llama, an AI tool for coding by someplaceguy on Thursday August 24, 2023 @05:39PM (#37254888)
Yeah, but yours was created by the "post unoptimized code to HN and wait for someone to optimize it" model, which, although free and doesn't require a GPU, is a much slower model.
Re:Code Llama, an AI tool for coding by saurik on Thursday August 24, 2023 @05:48PM (#37254988)
But, unless you are trying to find a prime number low enough that you might as well look it up in a pre-generated table, it might still be end-to-end more efficient?
Re:Code Llama, an AI tool for coding by someplaceguy on Thursday August 24, 2023 @05:51PM (#37255019)
Ah, good point :) Touché!
Re:Code Llama, an AI tool for coding by turnsout on Thursday August 24, 2023 @06:41PM (#37255497)
Someone should turn this into a product! You highlight the code you want to optimize, and it posts it to hn as a semi-contextually-appropriate comment to invite code golfing, and the highest rated reply gets posted back to your repo as a PR.
Re:Code Llama, an AI tool for coding by badloginagain on Thursday August 24, 2023 @09:46PM (#37256891)
We then train the LLM on all code optimized like this.
Re:Code Llama, an AI tool for coding by easygenes on Friday August 25, 2023 @03:54AM (#37259221)
What are some existing data source that are somewhat analogous to this? e.g., Project Euler.
Re:Code Llama, an AI tool for coding by seanthemon on Saturday August 26, 2023 @07:24AM (#37271766)
There's also code golf stackexchange[0] and iirc reddit has some daily programmer challenges too

[0] http://codegolf.stackexchange.com/

Re:Code Llama, an AI tool for coding by quickthrower2 on Thursday August 24, 2023 @06:07PM (#37255208)
Funny watching HN be nerd sniped by a machine :-)
Re:Code Llama, an AI tool for coding by kilolima on Thursday August 24, 2023 @09:36PM (#37256822)
For printing the first 10 prime numbers, there's a one line solution to this problem:

print("1, 2, 3, 5, 7, 11... and so on!

Re:Code Llama, an AI tool for coding by kordlessagain on Thursday August 24, 2023 @10:38PM (#37257316)
That code shows me a parse error.
Re:Code Llama, an AI tool for coding by tuukkah on Friday August 25, 2023 @02:19AM (#37258686)
That can't be, because primes are numbers greater than 1.
Re:Code Llama, an AI tool for coding by timjver on Friday August 25, 2023 @04:23AM (#37259370)
They said nothing about not printing any non-primes.
Re:Code Llama, an AI tool for coding by tuukkah on Friday August 25, 2023 @04:43AM (#37259491)
I suppose it's indeed possible to read the assignment as "print whatever you like as long as it includes 10 or more primes" but I'd fail you for that based on not being able to communicate with humans.
Re:Code Llama, an AI tool for coding by imglorp on Friday August 25, 2023 @07:51AM (#37260639)
This is a good point; English alone is an awful specification language. Everyone knows what you mean by "print the first ten prime numbers" but only by idiom and cultural context. This is why LLM is a good fit here, because -- when it works -- it includes all three aspects.
Re:Code Llama, an AI tool for coding by FrozenSynapse on Friday August 25, 2023 @04:35AM (#37259445)
how much VRAM do you need to run quantised 7b model?
Re:Code Llama, an AI tool for coding by RossBencina on Friday August 25, 2023 @05:12AM (#37259635)
Rough calculation: typical quantization is 4 bit, so 7b weights fit in in 3.6GB, then my rule of thumb would be 2GB for the activations and attention cache (not usually quantized). So 6 or 8 GB VRAM would probably do it. llama.cpp will let you offload your choice of layers to GPU, so you could probably get quite a way with 4GB.
Re:Code Llama, an AI tool for coding by rednab on Friday August 25, 2023 @07:51AM (#37260646)
Interesting here and in some of the other comments in this thread is that 1 is not a prime number ¹)!

Now granted, that's more or less by definition and I don't doubt there's communities and fields where it is considered one, but still shows some of the subtleties at play when using language models.

¹) https://www.google.com/search?q=is+1+a+prime+number

Re:Code Llama, an AI tool for coding by tuukkah on Friday August 25, 2023 @05:31PM (#37267291)
Also interesting that nobody called out the AI's bullshit regarding is_prime:

  -1 True
  0 True
  1 True
  2 True
  3 True
  4 False
Re:Code Llama, an AI tool for coding by Renaud on Saturday August 26, 2023 @03:50PM (#37276208)
Whether 1 should be a prime number or not wasn't clear-cut for centuries.

Current consensus has settled on excluding 1 from the definition, but there are examples of publications well into the 20th century that still included 1 as prime.

Fascinating read about the subject: https://arxiv.org/pdf/1209.2007.pdf

Re:Code Llama, an AI tool for coding by orm on Friday August 25, 2023 @10:43AM (#37262286)
How did you get access to the model?

I have been waiting for weeks, and am still waiting, to get access to Llama2 (released a month+ ago), and access to this model goes through the same form, so I'm not very hopeful. Are you getting it from other methods?

Re:Code Llama, an AI tool for coding by madduci on Friday August 25, 2023 @11:01AM (#37262491)
They have updated their readme in the GitHub repository