Thoughts on ChatGPT

software_sirppi

Sirppi

Posted on January 8, 2024

Thoughts on ChatGPT

I have to admit I've been using ChatGPT since it came out in late 2022. Pretty much all my assignments are written by it. BUT, I've always been skeptical to use it to write programs. It felt like I'm diligently copying code snippets from the entire world. On the other hand I'm getting told by people around me "if you don't use AI tools, you will be replaced with someone that's using AI". YouTube keeps showing me this irritating Ad. I don't wanna name names. You know what I'm talking about. It goes something like ...10x. It's hard enough to find soulful, unique content and people. To make it even harder, companies allegedly churn out GPT articles to drive SEO and engagement. Unique and quality websites and content are getting harder to find through search engines. I can't make sense of the mess that's web right now.

People around me prompt Mr.GPT to write python machine learning programs with libraries like sklearn, tensorflow and pytorch. Are they working smart? or digging themselves into a hole? It's evident they don't know what the hell is going on inside the algorithm. But they claim they built a deep learning neural network.

Depending on an external tool to write algorithms is shameful, honestly.

Ethical issues aside. I see a fundamental problem with this approach.

Let's ask Mr.GPT to write the infamous quicksort

Prompt: Write me quick sort in python

def quick_sort(arr):
    if len(arr) <= 1:
        return arr
    else:
        pivot = arr[0]
        lesser = [x for x in arr[1:] if x <= pivot]
        greater = [x for x in arr[1:] if x > pivot]
        return quick_sort(lesser) + [pivot] + quick_sort(greater)
Enter fullscreen mode Exit fullscreen mode

Prompt: Write me quick sort in C

#include <stdio.h>

void swap(int* a, int* b) {
    int temp = *a;
    *a = *b;
    *b = temp;
}

int partition(int arr[], int low, int high) {
    int pivot = arr[high];
    int i = (low - 1);

    for (int j = low; j <= high - 1; j++) {
        if (arr[j] < pivot) {
            i++;
            swap(&arr[i], &arr[j]);
        }
    }
    swap(&arr[i + 1], &arr[high]);
    return (i + 1);
}

void quick_sort(int arr[], int low, int high) {
    if (low < high) {
        int pi = partition(arr, low, high);

        quick_sort(arr, low, pi - 1);
        quick_sort(arr, pi + 1, high);
    }
}
Enter fullscreen mode Exit fullscreen mode

Do you see the friggin' problem here?

Quicksort it wrote with python, allocates new lists for every single function call (lesser and greater). Although I like the naming, I don't like the fact that it's subpar. It could have been inplace. It wrote it inplace for C. Maybe out of respect for the C programming language?

Retrospective

I've implemented quick sort a dozen times to realize the cracks in Mr.GPT's program. We can make it write the inplace algorithm by asking explicitly in the prompt.

What if I ask it to implement something which I myself can't implement or don't understand? At that point, I wouldn't even be able to see through the bullshit. Moreover, you can't extend/maintain the algorithm since you don't understand it.

Sneaky unknown unknowns are venomous than known unknowns. Quote me on that!

Conclusion

I'm not against Artificial Intelligence and LLMs. It's fine to use Mr.GPT to write boilerplate code or something that you can but bored to implement. I refrain from using it to make it write something beyond my capabilities. Its a skill issue. The right move is to lift the bar up and improve my capabilities.

Here's my take on that. Lets see if it changes.

💖 💪 🙅 🚩
software_sirppi
Sirppi

Posted on January 8, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related