How do AI "programs" work?

How do they work? … I understand its not a program as such, with “linear istructions” (if-then-else) working from beginning to end… but watching a video of Musk driving in FSD-mode, he mentions a lot of its not been programmed to to that, it learnd by observing/analyzing driver data - and they might change the weigth of certain (undesireble or desireble) behaviours.

So, how should a layman visualize (conceptually) a system like that?

I reckon that there are at least 3 components:

1.) the learning engine
2.) the data set
3.) the “educated” AI system

(or is that a wrong premise?)

Are they all part of the “program”? … or could you at a given time disconnect 1 and 2 from the system?

I have a hard time wrapping my brain around all that…

If you are talking about eg neural networks, then you do actually train them first via desired inputs and outputs as well as a loss function and other parameters. But after it is “trained” you could in principle forget about your training data set and give it new input; if you did things correctly you will probably get the right answer. It is true that does not involve “linear instructions”, as you put it, more like computing the value of some function.

Not sure this can be answered (see the articles below):

hmmm … if we really don’t know how they work (I assume that means “how they exactly work”) - doesn’t that mean the only way to improve it is by more and better data?

also, I assume the definition of “Better data” is a huge problem (what constitutes better data? e.g. in the context of teslas FSD? … every km of driving without incident? … that could lead to a lot of false-positives )

fascinating times and opportunities we live in

from the MIT article above (old, from 2017)

In 2015, a research group at Mount Sinai Hospital in New York was inspired to apply deep learning to the hospital’s vast database of patient records. This data set features hundreds of variables on patients, drawn from their test results, doctor visits, and so on. The resulting program, which the researchers named Deep Patient, was trained using data from about 700,000 individuals, and when tested on new records, it proved incredibly good at predicting disease. Without any expert instruction, Deep Patient had discovered patterns hidden in the hospital data that seemed to indicate when people were on the way to a wide range of ailments, including cancer of the liver. There are a lot of methods that are “pretty good” at predicting disease from a patient’s records, says Joel Dudley, who leads the Mount Sinai team. But, he adds, “this was just way better.”

At the same time, Deep Patient is a bit puzzling. It appears to anticipate the onset of psychiatric disorders like schizophrenia surprisingly well. But since schizophrenia is notoriously difficult for physicians to predict, Dudley wondered how this was possible. He still doesn’t know. The new tool offers no clue as to how it does this. If something like Deep Patient is actually going to help doctors, it will ideally give them the rationale for its prediction, to reassure them that it is accurate and to justify, say, a change in the drugs someone is being prescribed. “We can build these models,” Dudley says ruefully, “but we don’t know how they work.”

would “connecting” a 2023 LLM with Deep Patient allow them to communicate? … and ask the LLM why D.P. thinks that Al128 will possibly suffer from schizophrenia in a couple of years?

could they become mouthpieces that allow us to ask for the reasoning and rationale behind this?

Too late already to require AI systems to “show your working”, I suppose.

We know how they are programmed and made to seek out information.

I think the mystery is how they arrive at an answer.

If an AI says you will develop schizophrenia we would like to know how it came to that conclusion before we lock you up in in a psych ward in a hospital.

But we don’t know how the AI came to that diagnosis. Yet, the AI seems very good at predicting that (or other things). Not knowing how it comes to those answers is what worries many people.

AI (or Machine Learning) is a lot like the hundred monkeys at typewriters trying to create the works of Shakespeare. It is primarily created through shear brute force.

When I was a kid I worked as a cashier at a hamburger place. It gets boring after a while so I would start to guess the customer’s order before they gave it – going so far as to start filling out the order sheet. We didn’t have a big menu, but there were some unique decisions: 1/3 or 1/2 pound burger, cooking temperature, cheese, fires, drink, etc. It was surprising how often I was right. I’m sure if I measured my overall accuracy I wasn’t as good as I thought I was.

I was basing my guess off a bunch of factors like age, gender, was it lunch or dinner, were they dressed for work, etc. I might have been able to make better guesses if I started tracking a bunch more factors, writing them all down, and updating them. Things like weather outside, day of the week, color of shoes, etc. And if I did this for 1000 years, I might get pretty good at it – to the extent that it is a predictable problem.

This is an example of one common type of AI done manually by a human. If you had a huge spreadsheet where each row represents a single customer and their order (all of their factors and what they ordered), you could build an AI to guess orders. You could make your AI better by having more rows of examples.

You could also try to make it better by having more factors in the columns. Maybe you record their hair length, belt buckle size, number of rings, how busy the restaurant was when they ordered. Crazy factors that might not have any association with their order. Some of the ‘magic’ of AI is that it will tease out the factors that seem unrelated and find a correlation in them. Maybe people will tend to order fries more when the restaurant is busy because they don’t want to wait in line again if they are still hungry.

Exactly, data is everything in AI. Garbage in, garbage out.

For the hamburger example above, this means that the factors and the order have to be labelled correctly. If 5% of the data is mislabeled it’s going to be hard to get better than 95% accuracy. It also means that the data has to represent the entire problem you are trying to solve. If you want to guess people’s orders 7 days a week, but you don’t collect data on weekends then it might not guess well on weekends. Similarly if you collect data from a single store and it has some outliers the guesses will suffer – perhaps at this location every day a country squire sends his butler dressed in coat-and-tails in to order 25 salads. It’s unlikely this happens in general so the guesses might suffer at other stores.

In the context of self-driving it might be: Do you have enough examples of different road conditions, under different lighting conditions, times of day, with different configurations of pedestrians, cars, strollers, scooters, trash, graffiti, etc. Are these examples labelled correct? Are all of the strollers identified as pedestrians or were some of them labelled as cars? Were different areas over-sampled or under-sampled so that the AI is better at some areas and worse than others?

Self-driving is actually an entire orchestra of AIs working together. Obviously what constitutes good or bad data depends on the type of problem. An AI that is guessing where the other cars are going to be in 10 milliseconds is going to have different needs than an AI that is guessing where the boundaries of the lane are.

There are a bunch of “universal approximation theorems”

so it’s not quite accurate to say that there is no theoretical understanding of “how it works”. On the contrary, had they really no idea there would not have been so much progress in the field. However, as the OP put it, there is not a simple linear flowchart to explain how a neural network distinguishes a picture of a dog from a picture of a cat; it’s a different paradigm.

Here is one training method.

And we’re pretty sure (but, of course, not completely certain) that the way that most of these modern AI systems is qualitatively similar to how we work. But of course, that doesn’t help much, because we understand even less of how we work. Humans, also, are very good at doing many things that we can’t explain how we do them. For instance, I can recognize many people at a glance, but if you ask me to describe them, I’ll only give a very vague description that could apply to a great many people, who look almost nothing like them.

Yes and no.

In your example, the data set may have age, gender, which meal it is, how they’re dressed, what the weather was, etc…

The AI learns on that, and is corrected based on how well it did. This means that if it sees an example of a 19 year old woman coming in for breakfast wearing workout clothes in good weather, and it suggests a bacon double cheeseburger, when in fact the actual woman ordered a salad, there’s some kind of feedback mechanism to tell the AI that it got that one wrong.

After enough data, it builds its own way to predict what a customer’s order is. Problem is, we don’t know if it’s 70% what meal in the day, 10% how they’re dressed, and 20% gender, or anything like that. Absolutely no idea how that works. And for more abstract data - like having it visually identify what type of cloud it is (an AI training example we did in a training class), it gets even less clear how it’s telling a cumulus cloud from a cirrus cloud. Same thing with say… identifying who is at high risk for cancer and who’s not.

Of course, it would be great to be able to know that stuff for preventative purposes- maybe the AI has twigged to some combination of things humans haven’t seen, because no doctor can actually see and remember 1,000,000 cancer cases and all the various demographic and diagnostic data points about them. But that’s not the way they’re currently written, so it’s sort of like someone making gut feeling decisions- there are reasons, but they’re not clear to anyone, including the decision makers.

I’d go even further in your example … Doctors most likely use “magnifying glasses” when treating cancer pacients (detailed analytical micro data, like found in blood samples, etc…) … whereas I think the HUGE advantage of AI in that kind of scenario is they use a “telescope” when looking at patients (so they come from a macro scenario and not a micro scenario) … hence the high chance to find correlations, relationships, probabilities of “people with this kind of background have 47% higher chance of prostate cancer then the general populace”, etc…

IOW, doctors see anecdotes, AI sees statistics - and that job has not been done by anybody so far, hence the chance for “interesting findings” is high.

It is perhaps useful to contrast this with the traditional way of ‘programming’ computers where a programmer takes an algorithm (a set of operations organized into a logical flow) and implements them in a explicit ‘program’ written in a ‘computer language’ like C or Python or JavaScript which is then compiled down to machine code (direct instructions to the computer hardware and firmware) or bytecode (condensed, non-human-readable code that is interpreted by a ‘virtual machine’ which then sends direct instructions to the computer hardware and firmware). Large computer programs can produce very complicated results and it generally isn’t possible to produce every permutation of every input to test the code exhaustively, but you can expect that (absent errors with pseudo-number generation, defects in the hardware, and ‘bugs’ introduced by the programmer) that the program will produce a consistent result for every input, and that you can trace the effects of a particular input through the code to see how it got to a resulting output, which is what is done (‘debugging’) when the output is unexpected.

A neural network algorithm, on the other hand, doesn’t have any explicit logic other than the basic logical operations that occur at the nodes; the ‘programming’ is done implicitly by the network as it is exposed to training data (sometimes modified by a supervisor or by feedbacks that ‘penalize’ it for coming to an undesired solution). Its algorithms are implicit in the weighting of processes that occur at each node, and for any sophisticated system these are often complicated enough that you will get different results for even slight variations of perturbations of inputs. In fact, one of the major problems in getting such a network to do anything useful is just making them stable and reliable, which was a reason than many experts in machine cognition have previously dismissed them or considered them to be ancillary to a practicable artificial intelligence system.

It isn’t so much as that an AI system can’t “show your work” per se; we could certainly look at the individual weighting parameters at each node, and we understand the way the logic at that level are applied, so for a trivial network of a few nodes we could work out the rules for how it processes inputs and come up with an explicit algorithm, but anything approximating a useful artificial intelligence will have so many individual nodes that the resulting behavior becomes an emergent property of the system that cannot be estimated without a model approximately as complicated as the system it is representing. When a neural network has billions of nodes and processes each one millions of times a second, and with feed-forward and feed-back mechanisms to try to constrain the network, the resulting complexity of behavior is beyond anything we can understand by looking at the “code”.

This also means that any constraints we try to ‘program’ into the system are also subject to this uncertainty; you can’t just insert explicit directives with the assumption that it won’t do anything that violates them, which is why there is such a vigorous debate over what can even be done to monitor or assure the safety of “AI systems” that are used in ways that can influence public discourse or are placed in broad control over safety critical systems. There is no way you can ever hope to exhaustively test such a system to assure reliability or perform regression testing in response to corrections of undesirable outputs they way you would do with critical software like avionics code or the control system for a nuclear reactor. Of course, you can say the same thing about human beings and their inherent capriciousness, but humans are rarely granted such vast and unsupervised control of a system that could threaten the lives of millions of people, whereas control of SCADA-type systems are the essential use case for a highly capable AI, notwithstanding their use in processing and disseminating information in media.

Note that despite the use of the term “neural”, computer neural networks are not really anything like an animal brain in terms of complexity or control, and “neural networks” are just an extremely simplified conceptual model of how a brain functions without any of the detail or biochemical nuance. In a brain, there are many individual ‘circuits’ comprised of many millions of individual neurons that are evolved and develop during gestation for specialized functions, and within them each neuron performs a lot of internal processing of signals that go well beyond a voltage flip. They aren’t just interchangeable logic units like transistors, and their internal operations are so complex that biophysicists and neuroscientists still don’t have a comprehensive model of the behavior of even a single neuron, much less their behavior in the context of a developed brain. Human cognition (and that of even far more simple animals) is almost certainly an emergent phenomenon, but one that comes from a much more complex set of rules at the neuronal level, which is why human brains can do many things that complex computer ‘neural networks’ cannot even though they run many orders of magnitude slower in terms of an equivalent clock rate.

What computer neural networks do, while very impressive in many ways, is not regarded as meeting any real threshold of cognition by the majority of cognitive neuroscientists, and is as @CaveMike describes it, essentially a brute force method of producing some analogue of human heuristic learning. While they can do things no human can do, such as process more data in seconds than a human could in a lifetime of dedicated study and with reinforcement produce highly accurate and reliability pattern recognition, they badly fail when it comes to putting data into an abstract context, hence the “hallucinations” and other obvious defects in reasoning and logic that require human oversight to catch and correct. This will almost certainly improve with advances in neural network theory and direct and implicit reinforcement methods but ‘neural networks’ of this simplistic basis will always be doing some kind of simulacrum of human cognition, which also means they are inherently deception machines; systems intended to act and respond in human-like ways even though they do not perform human-like cognitive processes under the hood.

This does not preclude such a system from developing into an artificial general intelligence (AGI, or sometimes, GAI) but it won’t function the same way as a human (or have instilled human affect or ethics) and may not even be readily evident to us that such a threshold has been achieved. This is of obvious concern as we hand off more and more control over critical infrastructure and even our own cognitive autonomy to such systems. The danger is less genocidal kill-bots (although that does exist on some level as AI is inevitably implemented into warfighting systems) than that we simply allow our own cognitive and critical thinking facilities to atrophy in favor of the easy of letting our appliances do our hard learning and thinking for us.

Stranger

I would say that most of what people are calling AI is the machine learning subset of AI, which has become the current cool thing, but is not all of AI.

OTOH, a lot of what might have been considered traditional AI has become sufficiently mainstream that it gets forgotten whence it came.

A lot of AI has been about how to create traction inside problems of overwhelming complexity. That much is arguably common. Machine learning is an area that greatly benefits.

Crafting a ML system that actually works still requires a lot of domain knowledge. You can’t just throw arbitrary streams of data at a naive system. Choice of domain and representation is a key issue. In, say, image recognition, a much better image format may be a 2D FFT of images. No AI will a-priori invent such a transformation, but if fed images pre-transformed can have near miraculous efficacy compared to a simplistic approach.

Agreed. This is generally a feature and not a bug. It was what I was getting at with “Some of the ‘magic’ of AI is that it will tease out the factors that seem unrelated and find a correlation in them.” We want the AI to learn patterns that we did not think of or cannot even perceive otherwise we may as well hand-coded the algorithm.

This is a good explanation of the scope of the problem. Training a deep neural network is clearly a violation of Kernighan’s law:

Bolding mine. AIs have already ‘invented’ FFTs, among other complex circuits:

https://x.com/NeelNanda5/status/1616590926746619904?s=20

Paper:

It’s not going to be anything like that. If it’s just individual inputs considered in isolation, well, we already have (ordinary, old-fashioned, deterministic) programs that can go through a big database and tell us exactly how correlated each input is with each output. That part is easy. And we can then assume that they’re all independent, and combine them, and get a total probability breakdown based on all of the assumed-independent factors. That’s easy, too. The hard part, which is what some neural nets can sometimes do without explaining it, is that those inputs aren’t all independent. Maybe women are more likely, overall, to order the salad rather than the baconator, and maybe people in workout clothes are also more likely, overall, to order the salad rather than the baconator, but women wearing workout clothes are less likely to order the salad than the baconator. Or any other combination of factors. For combinations of factors, once you look at any specific combination, it’s easy to run the deterministic programs to make a prediction based on that combination, but there are just so many possible combinations that it’s not possible to check all of them that way.

And this is where advances are made in medicine. Maybe on average, a diet low in saturated fat reduces cholesterol, and low cholesterol, on average, results in fewer heart attacks, but reducing saturated fat has little or no effect on heart attack rates. Or maybe it does, but only for people with a specific gene. Or maybe how effective lowering saturated fat is also depends on how much fiber you’re getting in your diet. There are a lot of details we don’t know.

Yeah. But not in the context I was describing. You won’t see an AI doing image matching invent a FFT.

Giving an AI a leg up by providing it with a good part of the base problem and appropriate training data is a different matter.

And “explanation”.

That’s what I fear: not so much Orwell’s “boot stamping on a human face— forever” but a bevy of bored jobsworths reciting “Computer says no”, with little or no means of challenging, let alone overriding it.