A knowledge base (KB) is a structured collection of facts, rules and axioms expressed in a formal language, so that an inference engine can derive conclusions that were never stored explicitly. In knowledge representation, the central discipline of symbolic AI & reasoning within artificial intelligence, the knowledge base is the component that holds what a system believes about its domain.
The defining property is machine-usable semantics: every statement has a precise meaning that supports logical entailment. A system built around such a store is often called a knowledge-based system, and the classic expert system is its best-known form. This sense differs from a help-desk article collection, which is written for human readers rather than for automated reasoning.
How a knowledge base supports reasoning
A knowledge base works by separating knowledge from control. Declarative statements live in the KB, while a separate reasoner decides which statements to combine and in what order. This separation lets engineers add or correct knowledge without rewriting the program, which was the original promise of knowledge-based systems in the 1970s and 1980s.
Most knowledge bases have two layers. The TBox, or terminological box, defines concepts and their relations, such as the statement that every surgeon is a physician. The ABox, or assertional box, records facts about individuals, such as the fact that a named person is a surgeon. Together they allow a reasoner to entail facts by deduction, for example that this person is also a physician.
The table below summarizes the main components found in a typical knowledge-based system.
| Component | Role | Typical form |
|---|---|---|
| Terminological layer | Defines classes and relations | Ontology axioms, frames |
| Assertional layer | Stores facts about individuals | Ground atoms, triples |
| Rule base | Encodes conditional knowledge | Production rules, Horn clauses |
| Inference engine | Derives new statements | Chaining, resolution, tableau |
| Explanation facility | Justifies conclusions | Proof traces, rule firing logs |
Representation languages and their trade-offs
The choice of representation language fixes what can be said and how hard it is to reason. This is the classic expressiveness versus tractability trade-off: richer languages capture more of the domain but make inference slower or even undecidable.
First-order logic is highly expressive but only semi-decidable. Description logics, which underpin the Web Ontology Language, restrict expressiveness to keep consistency checking decidable. Horn clause languages such as Datalog sacrifice disjunction and negation in exchange for polynomial-time query answering over large fact sets.
| Formalism | Expressiveness | Reasoning complexity |
|---|---|---|
| Propositional logic | No variables or quantifiers | NP-complete satisfiability |
| Datalog | Function-free Horn rules | Polynomial in data size |
| Description logic | Concepts, roles, restrictions | Decidable, often EXPTIME or higher |
| First-order logic | Full quantification | Semi-decidable |
| Production rules | Condition-action pairs | Depends on the conflict strategy |
| Frames and semantic networks | Objects with slots and links | Fast inheritance, weak semantics |
Inference strategies and world assumptions
An inference engine queries a knowledge base through forward chaining, backward chaining or refutation by resolution. Forward chaining fires rules whenever their conditions hold and is efficient for monitoring, often with the Rete algorithm to avoid re-matching. Backward chaining starts from a goal and searches for supporting facts, which suits diagnosis and question answering.
Equally important is the world assumption. Under the closed-world assumption, anything not provable is treated as false, as in databases and logic programming. Under the open-world assumption, missing information is simply unknown, as in ontologies. Mixing the two without care produces wrong negative answers.
| Choice | Behavior | Suits |
|---|---|---|
| Forward chaining | Data-driven rule firing | Alerting, configuration, monitoring |
| Backward chaining | Goal-driven proof search | Diagnosis, advisory dialogs |
| Closed-world assumption | Unprovable means false | Complete operational data |
| Open-world assumption | Unprovable means unknown | Incomplete, shared ontologies |
| Non-monotonic reasoning | Defaults that can be retracted | Exceptions and common sense |
Building and maintaining a knowledge base
Construction is the hardest part. The knowledge acquisition bottleneck describes how slow and costly it is to elicit rules from domain experts and encode them correctly. Large efforts such as Cyc have spent decades encoding common-sense knowledge, which illustrates the scale involved.
- Consistency checking detects contradictions that would let a classical reasoner entail anything.
- Truth maintenance systems record dependencies so that retracting one fact updates its consequences.
- Versioning and provenance show who added each rule and why.
- Competency questions define what the KB must answer and serve as regression tests.
Modern practice increasingly uses machine learning to populate the assertional layer, for example by extracting facts from text, while keeping the terminological layer under expert control. Neuro-symbolic systems also query a KB to ground language model outputs in verifiable statements.
Limitations and common misconceptions
A knowledge base is only as good as its axioms. It is brittle at the edges of its domain, cannot handle uncertainty without probabilistic extensions, and reasons poorly about situations its designers did not anticipate. A common misconception equates a KB with a database: a database stores and retrieves facts, while a KB also entails facts that were never stored.
Another frequent error is confusing a KB with a knowledge graph. A knowledge graph is usually a large assertional store of triples, sometimes with little formal semantics, whereas a knowledge base in the strict sense pairs facts with axioms that license inference.
Finally, a knowledge base does not guarantee correct answers merely because its reasoning is sound. Soundness preserves truth only relative to the axioms, so a single wrong rule propagates into every conclusion that depends on it. Regular expert review, test queries with known answers and explicit scope statements that tell users which questions the system was designed to answer remain essential safeguards in any deployment that informs real decisions.
Put simply
A knowledge base is like a rulebook plus a notebook of facts that a computer can reason with. The rulebook says things like every bird has feathers. The notebook says a robin is a bird. The computer then works out that a robin has feathers, even though nobody wrote that down.
The value lies in this step. The system does not just look things up. It draws new conclusions from what it already knows.
In practice
A hospital pharmacy runs a drug interaction checker built on a knowledge base. The terminological layer classifies several thousand medicines into classes such as anticoagulants or strong enzyme inhibitors. The rule base holds a few hundred interaction rules, each stated at the class level rather than for every drug pair.
When a physician prescribes a new medicine, a forward-chaining engine combines the patient’s current prescriptions with these rules and flags conflicts within a second. Because rules apply to classes, adding a newly approved drug requires only one classification statement, and every relevant warning follows automatically. The explanation facility shows which rule fired, so pharmacists can verify each alert before contacting the prescriber.