So. I was working with this code:

public function front(?string $sortBy,
        ?string $time,
        ?string $type,
        ?string $filter,
        string $federation,
        Request $request): Response
    {
        $user = $this->getUser();

        if (!$user)
        {
            $filter = 'all';
        }

        $criteria = new EntryPageView($this->getPageNb($request));
        $criteria->showSortOption($criteria->resolveSort($sortBy))    

… and so on; the function continues. VSCode told me there was a syntax error on the close brace on the if statement. I stared at it for a while, then pasted the code into GPT (not Copilot). Here’s the conversation we had about it:


Me

What’s the syntax error here?

(and I pasted the code)

GPT

The syntax error in your PHP function public function front seems to be due to the incorrect placement of the closing curly brace for the if statement. It appears that the if statement is not properly closed before the $criteria initialization begins. The corrected code should look like this:

public function front(?string $sortBy, ?string $time, ?string $type, ?string $filter, string $federation, Request $request): Response
{
    $user = $this->getUser();

    if (!$user) {
        $filter = 'all';
    } // Closing brace for the if statement

    $criteria = new EntryPageView($this->getPageNb($request));
    $criteria->showSortOption($criteria->resolveSort($sortBy));
    // ... rest of your function code ...
}

Ensure that each statement and block is properly closed and followed correctly by the next statement. This corrected structure should resolve the syntax error you are encountering.

Me

I don’t get it. I put a closing curly brace right after the statement in mine… what am I missing?

GPT

I apologize for the confusion. Upon re-examining your code, it seems the placement of the curly brace is correct. If you’re still encountering a syntax error, it may not be related to the if statement structure.

Let’s look at other possible issues:


… and so on. Pasting GPT’s recommended if-statement block, including the curly brace that was already there, fixed the error. I have since re-pasted the same thing I initially gave to GPT to VSCode, and it all works now, and asking the exact same question of GPT again now leads to random guesses which have nothing to do with the cursed curly brace that was previously causing problems for both VSCode and GPT.

I have given up and moved on at this point, content to say vaguely that maybe the unusual brace style, or pasting the incomplete function without semicolon or final close brace, managed to coincidentally confuse GPT on exactly the same line where VSCode had gotten confused for unexplained reasons. But the whole thing still has this Twilight-Zone oddness to me.

  • @[email protected]
    link
    fedilink
    75 months ago

    the AI is only responding in a way to complete the conversation. It has no ability to comprehend the code

    Ask it to explain the code, and get surprised.

    GPT has stopped being a markov chain completion engine like 10 years ago.

    • @MagicShel
      link
      85 months ago

      I have. I’ve used GPT for about 5 years. It has gotten more sophisticated and yet it’s still just a completion engine even if it has more moving parts. There is no comprehension or reasoning behind it.

      • @[email protected]
        link
        fedilink
        4
        edit-2
        5 months ago

        At this point some of those moving parts are capable of reacting to syntax errors, sentiments, and a ton of other “comprehension” elements. By looping over its responses, it can also do reasoning, as in comprehend its own comprehension.

        It doesn’t do that by default, though. You have to explicitly ask it to loop in order to see any reasoning, otherwise it’s happy with doing the least amount of work possible.

        A way to force it to do a reasoning iteration, is to prompt it with “Explain your reasoning step by step”. For more iterations, you may need to repeat that over and over, or run Auto-GPT.

        • TehPers
          link
          fedilink
          English
          35 months ago

          GPT, at least from my limited understanding, is a tool designed to continue the input. You feed it a sequence of tokens, it returns a tokens which it “believes” come next. While your impression is valid, it’s still a “completion engine”. ChatGPT and other products use GPT but have built a product around it. They are not simply frontends for GPT - they do a lot more processing than that.

          Also, not trying to understate your impression. It’s pretty impressive how good it is, despite the compute needed for it. I would caution against overestimating its responses though. It does not “reason”, “think”, etc. Its purpose is to continue a sequence of tokens following a (super complex) pattern it has been trained on (super basically). When it claims to reason something, it’s because the people it trained off of did reason it.

          • @[email protected]
            link
            fedilink
            4
            edit-2
            5 months ago

            Yes and no.

            GPT started as a model for a completion engine… then it got enhanced with a self-reflection circuit, got trained on a vast amount of data, and added a “temperature” parameter so it can make tiny “mistakes” as compared to a simple continuation model, which allows it to do (limited, and random) free association of concepts.

            It doesn’t “think”, but it does what can be seen as a single iteration of “reasoning” at a time. If you run it multiple times without resetting the context, you can make it actually “reason”, step by step. Thanks to the degree of free association of concepts, this reasoning is not always the same as what it found in the training set, but actually what can be seen as “real” reasoning: associating concepts towards a goal. These are the “zero shot” responses that make LLMs so interesting:

            https://en.m.wikipedia.org/wiki/Zero-shot_learning

            TL;DR: I agree that it shouldn’t be overestimated, but I don’t think it should be underestimated either; it does “reason”, a bit.

            • Mad_Punda.de
              link
              fedilink
              15 months ago

              This was really interesting to read. Do you have some links where I can read more about what ChatGPT likely is and isn’t capable of?

          • mozzOP
            link
            fedilink
            15 months ago

            GPT runs on computer hardware which is just a tool to decide, “yes” and “no” equals “no” because they’re not both true, remember “one,” okay tell me back what the value was, okay “one.” It’s all just bits and mind-bogglingly simple transformations on bits. The simplicity of the computations that underlie it, doesn’t translate into the complexity of what it can do at scale.

            I fully agree with you that GPT can’t actually reason, no matter how convincing the illusion is, but purely-token-shuffling tasks like translating between human languages, or analyzing code for purely-syntactical errors, is as much in its wheelhouse as arithmetic is to CPUs. Or it should be, anyway. Sometimes weird stuff happens.

          • @[email protected]
            link
            fedilink
            1
            edit-2
            5 months ago

            Can LLMs Really Reason and Plan?

            do LLMs generate their output through a logical process?

            Shifting goalposts. I’ve claimed a single reasoning iteration for an LLM, per prompt; both “planning” and a “logical process” require multiple iterations. Check Auto-GPT for that.

            PS: to be more precise, an LLM has a capacity of self-reflection defined by the number of attention heads, which can easily surpass the single-iteration reasoning capacity of a human, but still require multiple iterations to form a plan or follow a reasoning path.

      • @[email protected]
        link
        fedilink
        25 months ago

        Fucking thank you. Everyone seems to think GPT is some kind of reasoning engine.

        It is just a storyteller with fucktastically huge pile of material to pull from.

        • mozzOP
          link
          fedilink
          3
          edit-2
          5 months ago

          Agree. It’s a matching and reshuffling engine. If you ask it a question the components of which are contained somewhere out in the universe of text it has to draw from, it’s able to find the answer in its data and reshuffle tokens around so that it can present that other person’s reasoned-out answers back to you in a way that they look like it reasoned them out itself.

          It’s incredibly impressive. That already is, as its successes are demonstrating, sufficient to execute a lot of “intelligence” tasks that previously computers just weren’t able to do. It’s still really easy to make it fall down by asking it questions that it can’t “reason” about by shuffling tokens around.

          Easy example:

          Me: How many asterisks in **4**3*****2**1**?

          GPT: The expression **4**3\*****2**1** contains a total of 10 asterisks.

          The random backslash was inserted by GPT. I’m presenting the question as typed, and the exact raw text GPT gave me back instead of the way it’s formatted by the web interface, escaping asterisks and backslashes both so that they appear in markdown exactly as they were in the raw input and output.