Forward Chaining & Backward Chaining in AI

Anshul Jain

22 Apr 2020

Nowadays, the need for expert systems is increasing rapidly, with more and more individuals demanding systems that deliver quick and accurate solutions. Artificial Intelligence (AI) is conveniently achieving this feat, with the help of a variety of technologies that assist artificial intelligence applications to perform numerous tasks like planning, classification, reasoning, etc.
Forward and Backward Chaining in Artificial Intelligence are two of these important reasoning techniques used by expert systems, to imitate human-like intelligence. The importance of the Forward Chaining and Backward Chaining is immense in expert systems, which makes it crucial for us to understand their basics.

Hence, we are here unraveling the concepts of these two techniques by answering questions like What is Forward Chaining? What is backward chaining in Artificial Intelligence? What is the difference between Forward Chaining and Backward Chaining?

Inference Engine:

The first step to unraveling the basics of the Forward Chaining and Backward Chaining is to understand the Inference Engine, which uses these two techniques for reasoning.

Inference Engine, in Artificial Intelligence, is one of the three essential components (knowledge base, inference engine, & user interface) of Expert Systems designed to deduce information by implementing logical rules to the knowledge base. It contacts the knowledge stored in the knowledge base, in the form of rules and applies it to the known facts to further infer new facts or reach the solution. Inference Engine performs these tasks with the help of two reasoning techniques: Forward and Backward Chaining techniques.

What is Forward Chaining in Expert System?

One of the two main reasoning techniques used by Inference Engine, Forward Chaining or Forward Reasoning, is a popular implementation strategy used for improving and developing expert systems and modeling the human brain in Artificial Intelligence.

This is a bottom-up computational model that starts with a set of known facts and applies inference rules (modus ponens) in a forward direction to generate new facts whose premises match the known facts. It follows this process until the predetermined goal state is achieved.

Forward Chaining Example:

XCON, the rule-based system, is an example of a Forward Chaining expert system that is used to configure large computer systems. It was among the first clear commercial success of expert systems, which is implemented in the general-purpose language OPS5.

Properties of Forward Chaining:

Other important properties that define forward chaining are:

  • It is also known as the Forward Deduction.
  • This a bottom-up approach that moves from the bottom to the top.
  • Used to make conclusions based on known facts or data, moving from the initial state to the goal state.
  • It is a data-driven approach that uses available data to reach the goal state.
  • Uses a breadth-first search strategy.
  • Uses prolog language, the logic programming language, to deal with inference rules.

Forward Chaining Algorithm:

The forward-chaining algorithm, which is also known as the forward chaining inference process, uses the following step by step process to complete a task and reach the logical or accurate conclusion:

  • The user provides the system with information about the problem.
  • This information is then sealed in the working memory.
  • The inference engine scans the rules in a predefined sequence looking for the one that matches contents in the working memory.
  • The system evaluates the rules again to identify new matches.
  • Once the new cycle is initiated, rules that were previously fired are ignored.
  • This process is continued until no further matches are found.

This process is most evidently used when Forward Chaining is implemented in rule-based systems.

Benefits of Forward Chaining:

From assessing the known facts to obtaining logical conclusions, there are numerous benefits offered by the forward chaining reasoning technique, a few of which are mentioned below:

  • It is useful when there are a few or initial states.
  • Best choice for expert systems that need interruption, control, monitoring, and planning.
  • It provides excessive data from the available few initial data or facts.
  • Runs great when a problem naturally begins by collecting data and searching for information that can be collected.
  • It helps find possible conclusions supported by the given facts.
  • Here, the reception of new data triggers new inferences, which makes the engine more suitable for dynamic situations.

Drawbacks of Forward Chaining:

Since forward chaining is among the first few AI reasoning techniques developed to help AI machines perform reasoning, there are certain drawbacks associated with it, like:

  • It generates new information without understanding what is important and relevant to the problem solution.
  • It requires excessive user inputs, much of which remains irrelevant to the final conclusion.
  • The hypothesis performed by the forward chaining is at times not clear.
  • Might give different conclusions, which may result in the high cost of the chaining process.

Now that we understand what Forward Chaining is, let us move on to discussing Backward Chaining.

What is Backward Chaining in Expert System?

Backward Chaining or backward reasoning is the inference engine reasoning technique, where chaining starts from a hypothetical goal. It uses backtracking to find the most optimal way for conflict resolution or to reach the goal state, wherein the search starts from the conclusion and goes back to understand the conditions from which it resulted.

This reasoning technique of inference engine is used by systems to find conditions and rules by which a logical result or conclusion was achieved.

Backward Chaining Example:

MYCIN is an example of Backward Chaining expert systems that used AI to identify severe infections caused by bacteria. Developed in the early years of the 1970s at Stanford University, MYCIN operated using a simple inference engine and knowledge base.

Properties of Backward Chaining:

The major characteristics that set backward chaining apart from the forward chaining are:

  • It is a goal-driven, top-down approach.
  • Helps dismantle complex problems into easy, small, fixed sections.
  • Systems that use this reasoning techniques are known as Goal-Driven Systems.
  • It is used in game theory, inference engine, proof assistants, theorem proving tools, etc.
  • It mostly uses a depth-first search strategy for proof.

WBackward Chaining Algorithm:

Backward Chaining algorithm follows a process similar to that of hypothesis testing in human problem-solving. However, compared to the latter, it is focused on the required rules. In short, this process of backward chaining involves:

  • First, the system examines the knowledge base to validate whether the goal has been specified or not.
  • If not, it searches for the rules in the knowledge base until it reaches the one that contains the goal in its THEN part in the form of premises.
  • Once the premises are listed is identified, the system ensures it is present in the knowledge base, which if missing acts as the new goal. This new goal is termed as sub-goal to be proved.
  • The system continues the above steps until it finds the premise that is not provided by any rule. This premise is termed as primitive.
  • Finally, when the primitive is found by the system, it asks the user for more information, which is used to prove the sub-goal as well as the original goal.

Benefits of Backward Chaining:

Like Forward Chaining, Backward Chaining too offers a range of benefits, a few of which are stated below:

  • Works well the problem naturally starts by forming a hypothesis and then checking it can be proved or not.
  • As it is focused on a given goal, it only uses parts of the knowledge base that are relevant to the hypothesis.
  • It is suitable for problems where an expert system is required for diagnostics, prescription, and debugging.
  • As it evaluates and checks only the required rules, the process of backward chaining is faster.

Drawbacks of Backward Chaining:

Backward Chaining is an extremely beneficial reasoning technique that performs task analysis quickly and helps the system reach the goal state effectively. However, there are a few drawbacks of this technique, like:

  • It may follow a particular path of reasoning and search even though it eventually proves to be impractical.
  • At times, it can be challenging to implement backward chaining.

Between Forward Vs. Backward Chaining?

Backward Chaining and Forward Chaining are two reasoning techniques, which though use a similar reasoning technique, deductive reasoning, are vastly different from one another. Therefore, to signify this contrast, listed here are some major differences between Forward and Backward Chaining.

Forward Chaining

  • Used by Expert System to answer “What can happen next?”.
  • It starts with facts.
  • Applies rules to find all possible conclusions.
  • It is a data-driven approach.
  • Uses the bottom-up process for reasoning.
  • Applies a breadth-first search strategy.
  • Forward Chaining helps find any conclusion by testing all available rules.
  • Operates in a forward direction.

Backward Chaining

  • Used by Expert Systems to answer “Why this happens?”.
  • It starts with the desired conclusions
  • Work backward to find supporting rules or facts.
  • It is a goal-driven approach.
  • Uses the top-down process for reasoning.
  • Applies a depth-first search strategy.
  • Backward Chaining helps tests only required data or rules to find the conclusion.
  • Operates in a backward direction.


One of the building blocks of Expert Systems, Forward Chaining and Backward Chaining, help create systems that solve both simple and complicated problems by imitating human-like thinking. Moreover, these are now further enhanced to create a hybrid chaining inference technique that delivers the advantages of both forward and backward chaining. In short, these techniques are working at the core of various modern machines, making them capable of performing tasks that were earlier termed unachievable.