DESCRIPTION: Removing the veil of Maya to see things as they really are

What to do when you have discovered that something is wrong with the world? Nothing, this happens all the time.

Everything is wrong with C++, but everyone uses it, everything is wrong with packaged food, especially the toxic crap Nestle produced, and everyone is buying it. Nothing can be done.

Here is what is wrong with your “AI” and “LLMs”.

Despite the very convincing (and carefully crafted, just like these Nestle packaging) illusion that LLMs “think” or even “reason”, they don’t. They just select nexttokens of highest probabilities for a given sequence.

If you do not know this, you will be convinced (just like most people like packaged junk food).

LLMs sell you a packaged slop.

This is how:

I was going through an old rare classic book, where they explain to you homomorphisms on lists:

Yes, yes, our old friends fold_right and fold_left

let rec list_it f xs z =
  match xs with
  | [] -> z
  | (x::xs) -> f x (list_it f xs z)

let rec it_list f z xs =
  match xs with
  | [] -> z
  | (x::xs) -> it_list f (f z x) xs

There are a few subtleties about these functions, which are fundamental but rarely explicitly stated on internet pages which were used to train the model.

The first one is not /tail-recursive, which means that it will eventually blow up your stack – it builds up a chain of nested pending function calls until the base case is reached, the actual computation is done when the recursion unwinds, and the “value accumulated so far” is implicitly returned from each call.

The second one is tail-recursive, uses the accumulator pattern (by explicitly passing the accumulator – “the value so far” – as a parameter).

Now what ChatGPT (state of he art suggested):

let append xs ys = list_it (fun x z -> x::z) xs ys

let rev xs = list_it (fun x z -> z @ [x]) xs []

Every computer science major knows what is deeply wrong with these functions, but these fundamental notions is not in the current /context, so the GPT generates the most often seen “naive” implementations – a packaged slop.

  • append in the rev makes the whole thing quadratic,
  • append itself is stated in terms of fold_right with an unnecessary wrapping (it should be expressed directly as an explicit recursion on xs)

The fundamental and very serious problem (yes, an alarmist wording) is that most of the people would just hit [Enter] and move along, without any interference of understanding. Look, ma, what a productivity! Who needs an understanding when it type-checks, compiles and even passes some tests (until it crashes)?

Here is how a well-educated person (who understands the underlying principles) would write these:

let flip f = fun x y -> f y x
let cons x xs = (x :: xs)

let rev = it_list (flip cons) []

(* a let is a lambda with an in-place application -- an implicit nesting *)
let (&) f g x =
  let y = g x in
  f y

yes, Haskell has so much better, carefully chosen and well-designed syntactic forms, including sections.

and then

let partition' f xs =
  let switch (l1,l2) x =
    if f x then (l1, x::l2) else (x::l1, l2)
  in it_list switch ([], []) xs

let filter' p = rev & snd & (partition' p)

let rec quicksort compare = function
  | []  -> []
  | [x]  -> [x]
  | (x::xs) -> let xs1, xs2 = partition' (compare x) xs
    in (quicksort compare xs1) @ (x::(quicksort compare xs2))

No GPT “understands” or “sees” the subtle optimizations used here, while any (I hope) undergraduate would.

If you understand the meaning of every sentence in this article you will see through the illusion.

I will not show other bizarre suggestions it made for partition and for quicksort – they all were a packaged slop.