News for hackers. Stuff that matters.
Re:CodeAlpaca – Instruction following code generation model by tarruda on Saturday March 25, 2023 @01:33PM (#35304943)
Didn't explore much, but it seems alpaca-lora has better results for coding tasks. One example I've used was: "Implement quicksort in python.". This is the result with Code alpaca:

    def quicksort(arr):
        if len(arr) < 2:
            return arr
        else:
            pivot = arr[len(arr) / 2]
            left_index = 0
            right_index = len(arr) - 1
            while left_index <= right_index:
                while arr[left_index] < pivot:
                    left_index += 1
                while arr[right_index] > pivot:
                    right_index -= 1
                if left_index <= right_index:
                    temp = arr[left_index]
                    arr[left_index] = arr[right_index]
                    arr[right_index] = temp
                    left_index += 1
                    right_index -= 1
            return quicksort(arr[:left_index]) + [arr[left_index]] + quicksort(arr[right_index + 1:])

Alpaca lora result:

    def quicksort(arr):
        if len(arr) <= 1:
            return arr
        pivot = arr[0]
        left = [arr[i] for i in range(1, len(arr)) if arr[i] < pivot]
        right = [arr[i] for i in range(1, len(arr)) if arr[i] > pivot]
        return quicksort(left) + [pivot] + quicksort(right)

Shorter and much cleaner, not to mention it works (code alpaca version is broken). Also it matches what ChatGPT generates for me.
Re:CodeAlpaca – Instruction following code generation model by sahil_chaudhary on Saturday March 25, 2023 @02:43PM (#35305699)
Interesting, in my experiments alpaca-lora performed worse but definitely possible that isn't the case generally.
Re:CodeAlpaca – Instruction following code generation model by grph123dot on Saturday March 25, 2023 @04:39PM (#35307079)
The Alpaca lora result is incorrect since, for example, if all elements in array are the same the result in just an array with one element.
Re:CodeAlpaca – Instruction following code generation model by xiphias2 on Sunday March 26, 2023 @12:09AM (#35310819)
You are correct also it's not quicksort as it's not in place array, but needs a lot of memory management