Knowledge Representation in AI - Types, Issues, & Techniques
What is Knowledge Representation?
Knowledge Representation (KR) is the field of AI concerned with how information about the world is encoded so that a computer system can use it to solve complex tasks.
Types of Knowledge
- Declarative knowledge: Facts about the world.
- Procedural knowledge: How to perform tasks.
- Heuristic knowledge: Rules of thumb based on experience.
- Structural knowledge: Relationships between concepts.
Common Techniques
- Semantic Networks: Graph-based representation of concepts and relationships.
- Frames: Structured records representing stereotypical situations.
- Logic-based representation: Using propositional or predicate logic.
- Production Rules: If-then rules used in expert systems.
- Ontologies: Formal representation of knowledge as a set of concepts and relationships.
Issues in Knowledge Representation
- Handling incomplete or uncertain knowledge.
- Scalability as knowledge bases grow large.
- Balancing expressiveness with reasoning efficiency.
One Fact, Four Representations
The easiest way to compare techniques is to encode the same knowledge in each of them. Take this tiny piece of world knowledge: Tweety is a bird. Birds can usually fly. Penguins are birds that cannot fly. Pingu is a penguin.
Predicate logic
Bird(Tweety)
Penguin(Pingu)
∀x Penguin(x) → Bird(x)
∀x Bird(x) ∧ ¬Penguin(x) → CanFly(x)
Semantic network
Tweety --is-a--> Bird --can--> Fly
Pingu --is-a--> Penguin --is-a--> Bird
Penguin --can--> NOT Fly (overrides the inherited link)
Frame
Frame: Penguin
is-a : Bird
can_fly : false (default from Bird was true)
habitat : cold coasts
Production rule
IF bird(X) AND NOT penguin(X) THEN can_fly(X)
Notice how each style handles the penguin exception. Pure logic forces you to write the exception into every rule, which gets messy fast. Semantic networks and frames handle it naturally through inheritance with overrides. Production rules sit in between: easy to read, but you must order and test them carefully.
How a Rule-Based System Reasons Step by Step
Storing knowledge is only half of the job. An inference engine has to use it to reach new conclusions. The two classic strategies are:
- Forward chaining starts from known facts and keeps firing rules until nothing new can be derived. It suits monitoring and alerting, where data arrives first.
- Backward chaining starts from a goal, such as "can Pingu fly?", and works back to see which facts would prove it. It suits diagnosis and question answering.
A short forward-chaining loop in Python shows the idea:
facts = {"bird(tweety)", "penguin(pingu)"}
rules = [
({"penguin(pingu)"}, "bird(pingu)"),
({"bird(tweety)"}, "can_fly(tweety)"),
]
changed = True
while changed:
changed = False
for conditions, conclusion in rules:
if conditions <= facts and conclusion not in facts:
facts.add(conclusion)
changed = True
print(sorted(facts))
Each pass checks every rule against the current facts and adds any new conclusion. The loop stops once a full pass adds nothing, which is called reaching a fixed point.
Choosing a Technique for Your Problem
| Technique | Strength | Weakness | Typical use |
|---|---|---|---|
| Predicate logic | Precise, provable conclusions | Struggles with exceptions and uncertainty | Formal verification, theorem proving |
| Semantic network | Visual and intuitive | Link meanings can be vague | Concept maps, early knowledge graphs |
| Frames | Defaults and inheritance | Weak at complex reasoning | Object-like domain models |
| Production rules | Easy for experts to write | Rule conflicts grow with size | Expert systems, business rule engines |
| Ontologies | Shared, machine-readable vocabulary | Effort to design and maintain | Healthcare, search, data integration |
A good representation is usually judged on four qualities: representational adequacy (can it express what you need?), inferential adequacy (can it derive new knowledge?), inferential efficiency (can it do so quickly?) and acquisitional efficiency (how easily can new knowledge be added?).
Modern systems often blend approaches. A knowledge graph may store facts as subject-predicate-object triples, while a machine learning model supplies learned patterns, and the graph keeps answers grounded in checked facts.
Design mistakes to avoid
- Mixing up "is-a" (a class relationship) with "instance-of" (a specific individual).
- Writing rules without a plan for conflicts when two of them fire together.
- Treating missing knowledge as false when the domain really needs "unknown".
Ready to master Artificial Intelligence?
Build real-world AI skills with hands-on projects and mentor-guided training.