When to use an algorithm vs. AI

Sometimes AI is overkill

I have been participating in this discussion several times. Is AI now capable of just solving any problem, and can be applied to every possible use case with the certainty of getting the best results? Or there are problems in which AI should not even be involved, perhaps because it would output disappointing results?

Terminator Genisys: An AI expert's view - BBC Culture
Terminator machine

I side more with the second scenario, mostly because knowing how AI works from top to bottom I know that when applied to simplified use cases, compared with a simple algorithm, AI underperforms.

When an algorithm is boss

What does it mean for a problem to be simple enough? To get more technical, it is not a matter of simplicity. For example, there is a problem which is called the eight queen problem, a mathematical problem that requires a technique called backtracking to be solved: we could say that compared to many other engineering problems, it is quite tough to solve.

However, I would never use AI to solve it. I would create an algorithm that brute-forces the solution instead, but why?

AI is not supposed to give a right/precise answer

AI has been created to make inferences and approximate solutions. Algorithms, instead, lack flexibility, unless we program them to be that way (AI itself is an algorithm, and it is quite flexible). They are specialized in brute-forcing any solution we give them. This becomes very handy when we have sufficient processing power to solve a problem. We can think of the Rubik’s cube or sudoku, even chess, as an example.

Data requires to be fit into the AI

One of the main issues related to programming AI, purely from the side of the ML engineers who have to endure the task, is to format the data in the only way the algorithm can actually process it. Because, most of the time, we need to create a simple algorithm on our own, we immediately start working on the data, and we can create its structure according to what we have at our disposal; this is much more comfortable than having to perform an endless stream of data manipulation steps.

AI, on the other hand, comes with algorithms with a pre-defined structure: nobody designs a neural network from scratch, it uses libraries that have already been written for that unique purpose.

Is computationally intensive

Even if we could use an AI on simpler problems, to set up the AI, including the right number of networks and the right approach for the task, requires several libraries and, in addition, a huge amount of processing power.

When should we use AI, then?

Instead, there are problems that are too complex to be brute-forced, because the range of possibilities that describe the solution is unmanageable with our current computational power. As a solution, we need to inference or estimate the solution. The best way of doing this is by using an AI.

Natural Language Processing

Human Language, for example, it is something that requires too many rules for a manually written algorithm to be created. There is no one on the planet that could ever undertake this quest. As a solution, we use the data at our disposal (text) to make AI learn how text sequences work. By feeding the models Gigabytes of data, they learn to estimate how some words are used in a particular context by using language models, for example, GPT-3. This allows them to attempt to predict the next word in a sequence, for example, performing text generation.

Computer Vision

Another outstanding application of AI is computer vision. Because results are too complex to be brute-forced, like NLP, applying an AI to solve them is just perfect, as we only require an approximate solution to a problem, not a perfect one. For example, when we perform object detection on an image, a square around the object of 500 pixels or 501 pixels does not make any difference to us.

Join our free programming community on discord, learn how to code, and meet other experts

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: