Small rant : Basically, the title. Instead of answering every question, if it instead said it doesn't know the answer, it would have been trustworthy.

you are viewing a single comment's thread
view the rest of the comments
[–] 21 points 2 years ago* (2 children)

What's absolutely crazy about that is:

Prompt: write code that checks how many r's are in the word strawberry

Response:

using System;

class Program
{
    static void Main()
    {
        string word = "strawberry";
        char targetChar = 'r';
        int count = 0;

        foreach (char c in word)
        {
            if (c == targetChar)
                count++;
        }

        Console.WriteLine($"The letter '{targetChar}' appears {count} times in the word \"{word}\".");
    }
}
  • source
  • parent
  • hideshow 4 child comments
  • [–] 8 points 2 years ago (1 child)

    My first thought is that you could write a program that does something like this:

    • Receive prompt "how many times does R appear in the word 'strawberry'"
    • Run the prompt through LLM saying "reword the following into a command to generate code that will answer the question" or something like that
    • Run the results through LLM
    • Compile and run the results
    • Provide the output to the user

    Of course, the biggest problem with this system is that a person could fool it into generating malicious code.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 2 years ago

    The code does look like code that counts Rs. The training data probably included tons of code that “counts character X in string Y”, so ChatGPT “knows” what code that counts characters in a string looks like. It similarly “knows” what a string looks like in the language, and what an application entry point looks like, etc. I’m not so familiar with C# that I’d know if it compiles or not. ChatGPT doesn’t either, but it has the advantage of having seen a whole freaking lot of C# code before.

  • source
  • parent