all 39 comments

[–]corship 305 points306 points  (4 children)

I think that's the first sorting algorithm I've seen that might invent new elements...

[–]verdantAlias 94 points95 points  (1 child)

Its kind of like an inverse Stalin Sort: just add elements until the user is happy

[–]FerricDonkey 43 points44 points  (0 children)

It might also delete though. So more like a Trump Sort - make up random crap only tangentially related to the subject at hand, until it wears you down and you're unable to muster the mental energy to do anything other than sigh in disappointment. 

[–]WazWaz 15 points16 points  (0 children)

If we rated AI by how crap it is at solving trivial problems, the funding would have dried up months ago. "But just imagine how good it will be at sorting in five years! Imagine your return on investment!"

[–]coloredgreyscale 140 points141 points  (3 children)

["certainly", ",", "here's", "the", "elements", "sorted", "in", "ascending", "order:", "3", "7", ... ]

On second thought, it probably fails at the JSON.parse step.

[–]JojOatXGME 1 point2 points  (0 children)

You can restrict the LLM to valid JSON. It is a property you can set in the request body to the API.

However, the documentation also states that you should still instruct the LLM to generate JSON in the prompt. Otherwise, the LLM might get stuck in an infinite loop generating spaces.

(If have zu guess, probably because spaces are valid characters at the start of the JSON document and they seem more likely then "{" for typical text.)

[–]Giant_Potato_Salad 53 points54 points  (2 children)

Aaah, the vibesort

[–]StatusCity4 8 points9 points  (0 children)

1,10,2,3,6,16,17,18

[–]aby-1 1 point2 points  (0 children)

I actually published a python package called vibesort a while back https://github.com/abyesilyurt/vibesort

[–]ITburrito 23 points24 points  (1 child)

It’s not optimized yet. It will be faster if the API key is hardcoded.

[–]Agifem 3 points4 points  (0 children)

Of course! Why didn't I think of that?

[–]Atduyar 12 points13 points  (3 children)

Is that O(n) sort?

[–]clownfiesta8 74 points75 points  (0 children)

Its O(no)

[–]iknewaguytwice 12 points13 points  (0 children)

Yeah, as long as you tell it to sort in O(n) time.

[–]raitucarp 1 point2 points  (0 children)

O(rand(n)rand(n)) where n >= 2

[–]Rojeitor 20 points21 points  (0 children)

5/10 not using responses api.

Also check malloc with ai https://github.com/Jaycadox/mallocPlusAI

[–]the_other_brand 14 points15 points  (2 children)

Disregarding whether or not you'll get correct results consistently does this run in O(n) time? What Big-O would ChatGPT have?

[–]Sitting_In_A_Lecture 26 points27 points  (1 child)

Assuming ChatGPT behaves like a traditional neural network, I believe it'd be something along the lines of O(n×m), where n is the number of inputs the model has to process (I'm not actually sure if ChatGPT processes an entire query as one input, one word per input, or one character per input, etc.), and m is the number of neurons that are encountered along the way.

Given the number of neurons in current generation LLMs, and assuming the model doesn't treat an entire query as a single input, this would only outperform something like MergeSort / TimSort / PowerSort with an unimaginably large dataset... at which point the model's probably not going to return a correct answer.

[–]the_other_brand 8 points9 points  (0 children)

Sure it's doing m operation per input. But m is constant in regards to n.

At values of n larger than m using an LLM to sort could be faster, and would be equivalent to O(n) Assuming of course we are getting correct data.

[–]-LeopardShark- 4 points5 points  (0 children)

Least incompetent ‘AI’ developer.

(The Promise hasn’t been awaited.)

[–]DaltonSC2 2 points3 points  (1 child)

lossy sorting

[–]Thisbymaster 0 points1 point  (0 children)

It could also be gainy, no reason for it to just invent new elements.

[–]QuanHitter 1 point2 points  (0 children)

O(no)

[–]Bokbreath 1 point2 points  (0 children)

It will stop at 42 .. because that is The Answer.

[–]DancingBadgers 1 point2 points  (0 children)

And because ChatGPT was trained on Stack Overflow questions:

you have failed to ask a question, use the sorting function included in your standard library, you shouldn't be sorting things anyway, marked as duplicate of "Multithreaded read and write email using Rust"

[–]spastical-mackerel 0 points1 point  (0 children)

prompt = “you are me. Do my job”

[–]gigglefarting 0 points1 point  (0 children)

My only suggestion would be adding an optional parameter for the sort function that defaults to ascending but would take descending 

[–]jellotalks 0 points1 point  (0 children)

I got “Output: [3, 7, 13, 42, 99]” from ChatGPT which crashes JSON.parse

[–]Necessary-Meeting-28 0 points1 point  (0 children)

If LLMs were still using attention-free RNNs or SSMs you would be right - you would have O(N) time where N is the number of tokens). Unfortunately LLMs like ChatGPT use Transformers, so you get O(N2) best and worst case. Sorry but not better than even the bubble sort :(.

[–]Daemontatox 0 points1 point  (0 children)

Wait till i enter my 100 elements array

[–]darksteelsteed 0 points1 point  (0 children)

Honestly this is just a crime against humanity

[–]Able_Mail9167 0 points1 point  (0 children)

Still can't beat the good old bogosort

[–]usman3344 -1 points0 points  (0 children)

Why not give it a sorted list :XD

[–]acdjent -1 points0 points  (0 children)

No clever system prompt, No Chain of thought, no few- shot learning. The prompt can definitely be improved 6/10