AI  

Part 2: Knowledge Representation and Reasoning in AI

image_2026-07-16_001724285

Part 2 explores how early AI represented problems, facts, relationships, and reasoning before modern machine learning became dominant.

Introduction

In Part 1, we discussed the shift from rule-based software to data-driven learning systems. Before we move into machine learning models, it is important to understand the foundations that came before modern AI.

For decades, AI was not mainly about neural networks or large language models. It was about search, structured knowledge, logic, rules, and reasoning. These ideas are still important today.

Many modern AI applications combine classical AI techniques with machine learning. A good software engineer should know when to use a model, when to use a graph, when to use rules, and when a simple search algorithm is the best tool.

Search Algorithms: How Machines Find Solutions

A search algorithm is used when a problem has a clear starting point, a goal, and a set of possible moves. The system explores possible paths and tries to find a solution.

A simple maze is a good example. The robot knows:

  • Where it starts

  • Where it wants to go

  • Which moves are allowed

  • Which paths are blocked

image_2026-07-16_001806613

Search algorithms explore possible paths from a start state to a goal state.

This idea appears in many real systems. A GPS application represents roads as a network of intersections and routes. Each route has a cost, such as distance or travel time. The algorithm searches for the path with the lowest total cost.

Chess engines also use search. They explore possible moves, opponent responses, and future board states. Deep Blue, the chess system that defeated Garry Kasparov, relied heavily on searching through a massive space of possible moves.

The lesson for developers is simple: if the problem has clear rules, clear states, and a clear goal, you may not need machine learning. A search algorithm may be faster, more reliable, and easier to explain.

Knowledge Graphs: Structuring Facts and Relationships

Search helps machines find paths. Knowledge graphs help machines understand relationships.

To a human, the sentence 'Paris is the capital of France' is meaningful. We know Paris is a city, France is a country, and capital-of is a relationship. To a computer, unless we provide structure, these are just strings.

A knowledge graph represents entities as nodes and relationships as edges. Facts can be stored as triplets:

(Subject, Predicate, Object)

(Paris, IS_CAPITAL_OF, France)

(Eiffel Tower, IS_LOCATED_IN, Paris)

image_2026-07-16_001835609

Knowledge graphs connect entities through meaningful relationships.

This is how systems can connect facts instead of treating text as isolated words. Search engines, recommendation systems, enterprise knowledge bases, and AI assistants can all benefit from graph-based knowledge representation.

Ontologies: The Rulebook for Knowledge

A knowledge graph stores facts. An ontology defines the rules and structure behind those facts.

For example, an ontology may define that a city can be located in a country, a person can have a birth date, and a painting can be created by an artist.

Ontologies make reasoning possible. If the ontology says all mammals have lungs, and the graph says a cat is a mammal, the system can infer that a cat has lungs even if that exact fact was not directly stored.

This kind of logical reasoning is one of the classical strengths of AI.

RAG: Why Knowledge Graphs Still Matter with LLMs

Large language models are powerful, but they can hallucinate. They generate text based on learned patterns, not guaranteed truth.

This is where structured knowledge becomes valuable again. In Retrieval-Augmented Generation, or RAG, the system first retrieves trusted facts from documents, databases, or knowledge graphs. Then the language model uses those facts to generate a human-friendly answer.

image_2026-07-16_001859582

RAG grounds language model answers in trusted documents, databases, or knowledge graphs.

RAG is one of the most practical patterns in enterprise AI because it combines the fluency of an LLM with the reliability of trusted data.

Logic and Rule-Based Systems

Before machine learning became dominant, many AI systems were built using explicit rules. These systems are often called expert systems or symbolic AI.

A medical expert system might follow rules like:

If the patient has a fever, check the temperature.

If fever is over 102 degrees and rash is present, consider a possible diagnosis.

If the rule does not match, move to the next rule.

image_2026-07-16_001923390

Rule-based systems are explainable, but they can become brittle when real-world cases do not match the rulebook.

The benefit of rule-based systems is explainability. If a system denies a loan or flags a transaction, we can often trace the exact rule that caused the decision.

The weakness is brittleness. Real-world situations often contain exceptions, ambiguity, incomplete information, and edge cases. Writing rules for everything becomes expensive and sometimes impossible.

Even today, rule-based systems are not dead. They are often used as safety rails around machine learning systems. A model may understand messy input, while rules enforce business policies, legal constraints, or safety requirements.

Why Explicit Programming Falls Short

Classical AI reached a major limitation: many things humans know are difficult to explain as rules. This is known as Polanyi's paradox: we can know more than we can tell.

You can recognize a familiar face in a crowd, but it is very hard to write exact rules for how you do it. You can ride a bicycle, but you probably do not consciously calculate all the physics involved.

image_2026-07-16_002017798

Some knowledge is easy to express as rules. Other knowledge is tacit and difficult to program explicitly.

This is why explicit programming struggles with perception, language, speech, and many real-world tasks. The rules exist in some sense, but humans cannot always write them down clearly.

Machine learning became powerful because it changed the approach. Instead of asking humans to write every rule, we provide data and allow the system to learn patterns from examples.

When Should Developers Use Classical AI Techniques?

Modern AI does not replace classical AI. In many systems, classical techniques are still the better choice.

  • Use search algorithms when the problem has clear states, moves, and goals.

  • Use knowledge graphs when relationships and facts need to be structured.

  • Use ontologies when the system needs consistent rules about entities and relationships.

  • Use rule-based logic when decisions must be transparent, auditable, and deterministic.

  • Use machine learning when rules are too complex, incomplete, or impossible to write manually.

A mature AI engineer does not force every problem into a neural network. The right solution may be search, rules, graphs, machine learning, or a combination of all of them.

Conclusion

Knowledge representation and reasoning are foundational parts of AI. Search algorithms help machines find solutions. Knowledge graphs structure facts and relationships. Ontologies provide rules for meaning. Rule-based systems make decisions explainable.

These ideas came before modern machine learning, but they are still highly relevant. In fact, many strong AI systems today combine classical reasoning with modern models.

In the next part of this series, we will move into machine learning models. We will understand what a model really is, how features become vectors, and why training and inference are two different stages of the AI lifecycle.