The Differences Between Forward Chaining and Backward Chaining in Artificial Intelligence

The Differences Between Forward Chaining and Backward Chaining in Artificial Intelligence

Forward chaining and backward chaining are methods of reasoning used to apply logical rules to the knowledge base in an expert system.

Forward Chaining and backward chaining are strategies used by an inference engine to apply logical rules to the knowledge base in an expert system. These strategies determine the type of expert system that will be built for an AI system.

An Introduction to Expert Systems

According to JavaTPoint,

Expert systems are software applications designed to solve complex problems and to provide decision-making abilities in a particular domain like a human expert.

An expert system has a database of knowledge that has been added by a human expert. This database contains expert knowledge that is used by the expert system to make decisions and solve problems.

Expert systems contain an inference engine that is used to determine the knowledge required to solve an end user's problem.

Inference engines use two strategies to make a decision or solve a problem based on the knowledge in the database. These strategies are forward chaining and backward chaining.

What is Forward Chaining?

Forward Chaining (also known as forward deduction or forward reasoning) is a reasoning technique where the inference engine uses knowledge in the database to make a logical prediction

Forward chaining is a form of reasoning that starts with simple facts in the knowledge base and applies inference rules in the forward direction to extract more data until a goal is reached.

Properties of Forward Chaining

  • It uses a down-up approach (bottom to top)

  • It is a process of making conclusions from known facts

  • It is data-driven

  • It is commonly used in expert systems for businesses, for example, business and production-rule systems

An Example of Forward Chaining

Using a real-world example, I will explain how forward chaining works.

A Tea Recipe

  1. Add milk to a pot

  2. Once the milk has boiled (fact), add an equal amount of water (rule).

  3. Once the mixture of milk and water has boiled (fact), add tea leaves (rule).

  4. Once the mixture has boiled (fact), the tea is ready (goal).

In this example, the chef makes decisions that lead to the attainment of the goal. Once a fact is fulfilled, a corresponding decision is made and the sequence continues till the goal is attained.

Here's the flowchart

An example of an expert system that uses forward chaining is DENDRAL. It is an expert system that is used to predict the molecular structure of substances.

Advantages of Forward Chaining

  • Forward chaining can be used to derive multiple conclusions

  • Forward chaining is great at deriving conclusions

  • Forward chaining is more flexible than backward chaining because there is no data limitation

Disadvantages of Forward Chaining

  • Forward chaining can be time-consuming. The process involves going through all the data in the database and synchronizing it.

  • The explanation of facts and observations is unclear unlike in backward chaining

What is Backward Chaining?

Backward chaining (also known as backward deduction or backward reasoning) is a reasoning technique that starts with the goal and works backward, chaining through inference rules to find known facts that support the goal.

Backward chaining helps us to understand why something happened or how we can solve a problem based on known facts.

Properties of Backward Chaining

  • It is an up-down approach

  • It is goal-driven

  • The goal is sub-divided into smaller goals to prove the truth of the facts

  • It uses the modus ponens inference rule. This rule suggests that if A implies B and A is true then B is also true.

  • It is commonly used in expert systems for healthcare, game theories and complex database systems.

An Example of Backward Chaining

I will use a real-world example to explain how backward chaining works.

A Medical Diagnosis

A doctor would like to prove that the patient has the flu.

They would use the following rules or known facts to determine whether the patient has the flu:

  • The patient has a fever

  • The patient is experiencing body aches

  • The patient is fatigued

This is the backward chaining process:

Goal -> flu

Checking the rules

If the patient is fatigued, move to the next rule.

If the patient is experiencing body aches, move to the first rule.

If the patient has a fever, then the goal is satisfied.

Conclusion - The patient has the flu

In this example, we start with the goal and work backward using the known facts to determine whether the patient has the flu.

An example of an expert system that uses backward chaining is MYCIN. It is an expert system that is used to identify microorganisms causing severe diseases such as meningitis and propose antibiotics based on the patient's weight.

Advantages of Backward Chaining

  • Backward chaining is a simple easy process because the goal is already defined

  • Backward chaining is fast because the end-point is available

  • Solutions can be derived effectively if the pre-determined rules are met by the inference engine

Disadvantages of Backward Chaining

  • Backward chaining is limited to the data in the knowledge base

  • The reasoning process can only start when the goal is clearly defined

  • It only deduces necessary data which makes it inflexible

  • It can only deduce one solution or answer

What are the Differences Between Forward Chaining and Backward Chaining?

Forward ChainingBackward Chaining
Starts with the known factsStarts with the goal or conclusion
Ends with goal or conclusionEnds with the facts that prove the goal
Data-drivenGoal-driven
Down-up approachUp-down approach
Facts and observations are unclearFacts and observations are clearly explained
Can be time-consumingA fast process
Uses breadth-first search strategiesUses depth-first search strategies
Can deduce multiple solutions or goalsCan only deduce one solution or goal

Conclusion

Forward chaining and backward chaining are used in inference engines to interact with the expert knowledge in the database. These reasoning techniques determine the type of expert systems developed for an AI system.

Forward chaining is a reasoning method that utilizes known facts and applies inference rules in a forward direction to extract more data until a goal is reached.

Backward chaining is a reasoning method that starts with the goal and works backward to find facts that satisfy the goal.

The reasoning techniques are essential and they differ in approach, speed, technique, search strategy, and operational direction.

References

  1. Expert Systems in Artificial Intelligence by JavaTPoint

  2. Forward Chaining and Backward Chaining in AI by JavaTPoint

  3. Forward and Backward Chaining in AI on Section.io by Onesmus Mbaabu