What is an algorithm? What are the characteristics of algorithms in AI?

陽一 和也
陽一 和也

Okay, let's talk about algorithms, especially how they differ in the field of AI.


What is an Algorithm? Let's Start with Cooking a Dish

You can think of an algorithm as a recipe.

For example, if you want to make "Scrambled Eggs with Tomatoes," the recipe will tell you:

  1. Ingredients (Input): 2 tomatoes, 3 eggs, salt, oil.
  2. Specific Steps (Processing):
    • Wash and cut the tomatoes into pieces.
    • Beat the eggs.
    • Heat the pan, add oil, scramble the eggs, and set aside.
    • Add more oil, stir-fry the tomatoes, and add salt.
    • Finally, add the eggs back and stir-fry a few times.
  3. Completion (Output): A delicious plate of Scrambled Eggs with Tomatoes is ready.

You see, this recipe is very clear. As long as you follow the steps one by one, no matter who you are, the result will be pretty much the same.

So, an algorithm is precisely this: a clear, step-by-step set of instructions used to solve a specific problem or complete a particular task.

Almost all programs on our computers and phones are made up of countless "recipes" (algorithms) like these. For example, when you calculate 1+1 on a calculator, it executes an addition algorithm; when you use map navigation, it executes a pathfinding algorithm (like finding the shortest route). These are all classic, clearly instructed algorithms.

How are Algorithms in AI Different?

Alright, now let's talk about algorithms in AI. If traditional algorithms are like "hand-holding instruction," then AI algorithms are more like "letting it learn on its own."

Let's use the cooking analogy again.

A traditional algorithm gives you a fixed recipe. An AI algorithm, however, is more like training a little chef. You wouldn't give this chef a recipe precise down to the gram; instead, you would:

  1. Massive Training (Feeding Data): You let him taste thousands upon thousands of "Scrambled Eggs with Tomatoes" dishes made by top chefs, and you tell him which ones are delicious and which are not.
  2. Self-Discovery (Learning & Adjustment): This little chef is very smart. He'll figure out on his own: "Oh, for delicious scrambled eggs with tomatoes, the tomatoes should be soft, the eggs shouldn't be overcooked, and the salt needs to be just right..." He gradually forms his own complex "cooking wisdom" in his mind.
  3. Applying Knowledge (Prediction & Generalization): Next time, you give him a bunch of new ingredients, and he can make a great plate of Scrambled Eggs with Tomatoes based on the "wisdom" he's learned. Even if you give him a type of tomato he's never seen before, he can handle it well because he's learned the "essence," not just rigid steps.

So, AI algorithms (especially machine learning algorithms) have several cool characteristics:

  • Data-Driven They are not driven by rigid rules written by humans, but rather "fed" by large amounts of data. The more and better the data, the more skilled this "little chef" becomes. Without data, even the most powerful AI algorithm is just an empty shell.

  • Self-Learning & Optimization The core of AI algorithms is "learning." They continuously make mistakes during training, and then, based on those errors (e.g., the dish doesn't taste good), they adjust their internal parameters ("cooking wisdom") to strive for better results next time. This process is like human learning: a continuous cycle of trial, error, and improvement.

  • Handling Ambiguity & Complexity Traditional algorithms are most afraid of "unexpected situations." For example, if a recipe says "medium heat," how hot is "medium heat"? A traditional algorithm would be stumped. But AI algorithms are very good at handling such ambiguous information. It's like how we recognize faces: everyone's face has subtle differences, and lighting and angles vary. It's almost impossible to write a "rule" to recognize all faces. However, AI algorithms can "understand" what a "face" is by looking at countless face photos, achieving very high recognition rates.

  • Sometimes Like a "Black Box" Because AI algorithms learn on their own, their internal decision-making logic can be extremely complex. Sometimes, even the engineers who created them find it difficult to fully explain why they make a particular decision. It's like asking the little chef why he added that much salt; he might say "it felt right," an intuition born from thousands of experiences. This is also a significant area of research in AI today: how to make AI's decision-making process more transparent and explainable.

To Summarize

  • Traditional Algorithms: Like a rigid recipe, they strictly follow instructions, and the results are stable and predictable. They are suitable for problems with clear rules.
  • AI Algorithms: Like a self-learning chef, they acquire skills through extensive experience (data) and are adept at handling complex, ambiguous problems without fixed formulas.

I hope this analogy gives you a more intuitive understanding of algorithms, especially those in AI!