Key takeaways
- The knowledge base holds what is known; the inference engine decides how conclusions are drawn.
- Forward chaining runs from facts to conclusions and suits monitoring and alerts.
- Backward chaining runs from a goal back to the facts and suits answering one specific question.
- Keeping rules apart from the engine lets people change the rules without rewriting the program.
- Inference in the machine learning sense, running a trained model, is a different idea with the same word.
How an inference engine works
An inference engine works in a loop: it finds the rules whose conditions match the current facts, picks one to apply, adds its conclusion to the facts and starts again. It stops when no rule adds anything new or when it has answered the question it was asked.
Because each new fact comes from a named rule fired on named facts, the engine can keep a trace of its steps. That trace is what lets expert systems explain how they reached an answer.
Forward chaining, with a worked example
Forward chaining starts from the facts you have and applies every rule they satisfy, adding conclusions until nothing new follows. It suits watching for events worth acting on. An illustrative sales example:
- Facts: the company has announced a funding round, and it is hiring for sales roles.
- Rule 1: if a company raised a round and is hiring sales roles, flag it as a buying signal.
- Rule 2: if a company shows a buying signal and fits the ideal customer profile, add it to this week's priority list.
- The engine fires rule 1, adds the buying signal, then fires rule 2 because the company also fits the profile.
Backward chaining, with a worked example
Backward chaining starts from a goal and works back to the facts that would prove it, asking only for what it needs. It suits answering one question, such as whether a lead is ready for sales. An illustrative example:
- Goal: is this lead sales-qualified?
- Rule: a lead is sales-qualified if budget, authority, need and timing are all confirmed.
- The engine checks each condition in turn and finds budget and need confirmed in the notes.
- Authority is unknown, so it looks for a rule that settles it: is the contact a decision-maker or reporting to one?
- If any condition cannot be shown, the answer is not yet, along with the missing fact.
Inference engine vs knowledge base
The knowledge base is what a system knows and the inference engine is how it reasons with it. Keeping them separate was a central idea of expert systems: domain experts could change rules and facts without touching the program, and one engine could serve several knowledge bases.
The same split appears in modern rules engines in business software, where operations teams edit the rules in a screen and the engine that runs them never changes.
Not the same as inference in machine learning
Inference in machine learning means running a trained model on new input to get a prediction or generated text, which is a different idea from an inference engine. When people talk about inference costs or inference hardware for AI models, they mean that second sense.
Both draw conclusions from what is known, but an inference engine does it by applying explicit rules a person can read, while a model does it through learned patterns in its weights.
Where Pebbles Ai fits
Common questions
Which is better, forward or backward chaining?
Neither in general. Forward chaining suits watching a stream of new facts for anything worth acting on; backward chaining suits answering one question without working out everything else.
Does an inference engine learn?
A classic one does not: it applies the rules it is given, the same way every time. Changing its behaviour means changing the rules or the facts.
Can an inference engine explain its conclusions?
Yes, and this is one of its main strengths. Asked how it reached a conclusion, it can replay the rules it fired and the facts each one used, in order.
About this page. Written by the Pebbles Ai team for people who run sales, marketing and growth. Last updated .