Suboptimal demonstrations are imperfect examples of task execution that may contain mistakes, inefficiencies, or noisy actions. In imitation learning, these demonstrations pose a significant challenge because algorithms like behavioral cloning are designed to mimic the provided data directly. Learning from flawed data can cause the agent to inherit and even amplify the demonstrator's errors, leading to poor performance and unsafe policies.
Glossary
Suboptimal Demonstrations

What are Suboptimal Demonstrations?
In imitation learning, suboptimal demonstrations are imperfect examples of task execution used to train an agent.
To overcome this, advanced techniques like inverse reinforcement learning (IRL) and adversarial imitation learning are employed. Instead of copying actions directly, these methods aim to infer the underlying intent or reward function that the demonstrator was trying to optimize. This allows the learning agent to recover a robust, often superior, policy that fulfills the task's goal rather than replicating its suboptimal execution path.
Key Characteristics of Suboptimal Demonstrations
Suboptimal demonstrations are imperfect examples of task execution used for training. These flawed datasets present unique challenges for algorithms designed to recover a robust and efficient policy.
Noisy or Inconsistent Actions
Demonstrations contain stochastic or erroneous actions that deviate from the intended optimal path. This noise can stem from human error, sensor inaccuracy, or imprecise teleoperation.
- Example: A human operator slightly overshooting a target position during kinesthetic teaching.
- Impact: Algorithms like Behavioral Cloning may learn to replicate these errors, leading to jittery or unreliable policies. Techniques like filtering or robust regression are often required to mitigate this.
Inefficient or Non-Optimal Paths
The demonstrated trajectories solve the task but are not maximally efficient regarding time, energy, or smoothness. They represent one of many possible solutions, often a suboptimal one.
- Example: A warehouse pick-and-place demonstration that takes a longer route to avoid a temporary obstacle that no longer exists.
- Impact: Simple imitation will inherit these inefficiencies. Algorithms like Inverse Reinforcement Learning (IRL) are designed to infer the underlying reward function that explains the demonstrations, potentially recovering a more optimal policy than the one demonstrated.
Partial Task Completions or Failures
The dataset includes demonstrations where the task was not successfully completed. These may be aborted attempts, failures due to external disturbances, or demonstrations of what not to do.
- Example: A robot dropping an object during a grasping demonstration, with the recovery sequence also recorded.
- Impact: Requires the learning algorithm to distinguish between successful and unsuccessful segments. Preference-based learning or success-classifier weighting can be used to filter or de-emphasize failed trajectories.
Demonstrator Heterogeneity
Data is collected from multiple demonstrators with varying skill levels, styles, or strategies. This creates a multi-modal distribution of solutions, some of which may conflict.
- Example: Data from both expert technicians and novice operators for the same assembly task.
- Impact: The policy must reconcile different strategies. Algorithms must avoid averaging incompatible actions, which can lead to ineffective "middle-ground" behavior. Clustering demonstrations or using multi-modal policy architectures can address this.
Covariate Shift in States
The distribution of states visited by the learner's policy diverges from the states in the demonstration dataset. This is a fundamental challenge, especially with suboptimal data where the demonstrator may have avoided certain difficult states.
- Example: A suboptimal demonstration that narrowly avoids a slippery patch on a table. The learner, replicating small errors, later encounters that patch and fails because it was never trained on such states.
- Impact: Leads to compounding errors. Algorithms like Dataset Aggregation (DAgger) are explicitly designed to query an expert (or oracle) on the learner's visited states to correct this shift.
Sparse or Ambiguous Reward Signals
Suboptimal demonstrations provide a weak or confusing signal about the true objectives of the task. Since the actions are not optimal, inferring the underlying goal becomes an ill-posed problem with multiple explanations (reward ambiguity).
- Example: A demonstration that successfully opens a drawer but uses excessive force. Is the goal to open the drawer, or to open it with minimal force?
- Impact: Makes Inverse Optimal Control (IOC) and Inverse Reinforcement Learning more challenging. Maximum Entropy IRL is a common approach to resolve ambiguity by preferring the reward function that makes the demonstrations appear least surprising.
Impact on Imitation Learning Algorithms
Suboptimal demonstrations—imperfect examples containing mistakes, noise, or inefficiencies—fundamentally alter the design and robustness requirements of imitation learning algorithms.
Suboptimal demonstrations force algorithms to move beyond naive behavioral cloning, which would simply replicate the demonstrator's errors. Instead, they must infer the underlying intent or a more robust policy. This shifts the problem from pure supervised learning to one involving preference learning, inverse reinforcement learning (IRL), or adversarial filtering to separate useful signal from noise. The core challenge is credit assignment: determining which parts of a demonstration are optimal versus suboptimal.
Algorithms must incorporate mechanisms for robustness, such as reward modeling that explains high-level goals, or distribution matching that focuses on successful state transitions. Techniques like Dataset Aggregation (DAgger) can mitigate issues by querying for corrections, while Generative Adversarial Imitation Learning (GAIL) variants may weight demonstrations. Ultimately, handling suboptimal data is critical for scaling imitation learning to real-world, imperfect human or scripted data sources.
Techniques for Handling Suboptimal Data
Suboptimal demonstrations are imperfect examples of task execution that may contain mistakes, inefficiencies, or noisy actions. This section details the core algorithmic techniques designed to robustly learn from such imperfect data in imitation learning.
Robust Behavioral Cloning
Standard Behavioral Cloning treats all demonstration data as optimal, leading to poor performance when data is suboptimal. Robust variants address this by:
- Weighting Demonstrations: Assigning lower weight or filtering out trajectories with high loss or inferred poor performance.
- Noise-Aware Models: Explicitly modeling the noise process in the expert's actions (e.g., assuming a wider variance in the action distribution).
- Loss Trimming: Using robust loss functions like the Huber loss that are less sensitive to outlier actions compared to mean squared error. The goal is to learn the central tendency of good behavior while being resilient to occasional mistakes in the dataset.
Inverse Reinforcement Learning (IRL)
Inverse Reinforcement Learning is a principled solution to suboptimality. Instead of copying actions, it infers the reward function the demonstrator was trying to optimize.
- Maximum Entropy IRL: Models demonstrations as exponentially more likely if they achieve higher reward, but allows for variation and suboptimality. It finds the reward function that makes the expert's (potentially noisy) trajectories look as good as possible on average.
- Bayesian IRL: Treats the reward function as a random variable with a prior, updating beliefs based on observed trajectories. It can naturally handle uncertainty and quantify confidence in the inferred reward. By recovering the intent, the agent can learn a policy that outperforms the suboptimal demonstrations.
Adversarial Imitation Learning (e.g., GAIL)
Generative Adversarial Imitation Learning (GAIL) and related methods frame imitation as distribution matching. A discriminator is trained to distinguish between state-action pairs from the learner and the demonstrator.
- Handling Suboptimality: The discriminator learns the distribution of demonstrator data, which can include both good and bad examples. The learner (generator) tries to match this overall distribution.
- Implicit Reward: The discriminator's output provides a reward signal. The learner is incentivized to produce behaviors that are statistically similar to the demonstration dataset, not to perfectly replicate any single, potentially flawed, trajectory. This makes the approach more robust to occasional mistakes, as it learns the manifold of demonstrated behavior.
Preference-Based & Ranking Learning
This technique sidesteps the need for optimal trajectories by learning from relative comparisons.
- Preference-Based Reward Learning: An algorithm presents a human with two trajectory segments (A and B) and asks, "Which is better?" From these pairwise preferences, it learns a reward function that explains the human's judgments.
- Learning from Rankings: Demonstrations are ranked from best to worst. The algorithm learns to maximize the probability that higher-ranked trajectories receive higher reward under the learned function. This is powerful for suboptimal data because it explicitly identifies which parts of the demonstrations are more desirable, filtering out the worst mistakes.
Data Filtering & Trajectory Selection
A pragmatic, pre-processing approach that involves algorithmically cleaning the demonstration dataset before training.
- Success Detection: Using heuristics or learned classifiers to label which demonstration trajectories successfully completed the task. Only successful trajectories are used for training.
- Outlier Removal: Employing statistical methods (e.g., based on dynamic time warping distance or action sequence likelihood) to identify and remove anomalous demonstrations that deviate significantly from the norm.
- Segment Labeling: Manually or automatically labeling parts of trajectories as good or bad, enabling selective learning from only the high-quality segments. This reduces the noise injected into the learning process at the data level.
Interactive Correction & DAgger
Dataset Aggregation (DAgger) is an online, iterative algorithm designed to combat covariate shift. It directly addresses the compounding errors that arise when a learner policy visits states not seen in the (potentially suboptimal) demonstrations.
- Train an initial policy on the available demonstrations.
- Roll out the current policy in the environment (or simulation).
- Have an expert (or automated system) provide the correct action for the states visited by the policy.
- Aggregate these new corrective state-action pairs into the dataset.
- Retrain the policy on the aggregated dataset. Even if initial demonstrations are suboptimal, DAgger iteratively queries for optimal actions on the learner's own state distribution, converging to a robust policy.
Frequently Asked Questions
Suboptimal demonstrations are imperfect examples of task execution used in imitation learning. This FAQ addresses the core challenges and solutions for learning from noisy, inefficient, or erroneous human demonstrations.
Suboptimal demonstrations are imperfect examples of task execution provided to a learning agent, which may contain mistakes, inefficiencies, noisy actions, or incomplete sequences. Unlike optimal demonstrations, which are assumed to be near-perfect examples of a task, suboptimal data reflects the natural variability and error inherent in human performance or data collection. In imitation learning, algorithms must filter this noise to recover a robust and often superior policy, rather than blindly copying all demonstrated behaviors. This is a critical challenge because naively applying behavioral cloning to such data can lead to the agent learning and compounding the demonstrator's mistakes.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Understanding suboptimal demonstrations requires familiarity with adjacent concepts in imitation learning, which address challenges like distribution shift, reward inference, and efficient learning from limited data.
Behavioral Cloning
Behavioral cloning is a supervised learning method where a policy is trained to directly map observed states to actions by minimizing prediction error against an expert dataset. It is highly susceptible to compounding errors when the learner encounters states not covered by the demonstrations, a problem exacerbated by suboptimal demonstrations that may lead the policy to learn and replicate mistakes.
- Primary Challenge: Suffers from covariate shift as the agent's state distribution drifts from the expert's.
- Relation to Suboptimal Data: Naively cloning from imperfect demonstrations will yield a policy that replicates the demonstrator's errors and inefficiencies.
Inverse Reinforcement Learning (IRL)
Inverse Reinforcement Learning is the paradigm of inferring a latent reward function from observed expert behavior, under the assumption the demonstrations are optimal with respect to that function. It directly confronts the problem of reward ambiguity, where many rewards can explain the same data. When demonstrations are suboptimal, standard IRL assumptions break down, necessitating algorithms that can robustly infer intent despite noise or mistakes.
- Core Assumption: Demonstrations are (near) optimal.
- Challenge with Suboptimality: Must differentiate between intentional behavior and demonstrator error to recover the true objective.
Dataset Aggregation (DAgger)
Dataset Aggregation is an iterative, interactive algorithm designed to correct covariate shift in behavioral cloning. It collects new demonstration data on states visited by the learner's current policy, which are then aggregated into the training set. This is particularly relevant for learning from suboptimal demonstrations, as it allows an expert to provide corrective actions for states where the initial suboptimal policy fails, iteratively refining the policy beyond the limitations of the original dataset.
- Key Mechanism: Iterative querying of an expert for corrections.
- Addresses Suboptimality: Enables improvement beyond a static, potentially flawed, demonstration set.
Adversarial Imitation Learning
Adversarial Imitation Learning frames imitation as a distribution matching problem, where a learner policy (generator) aims to produce state-action distributions indistinguishable from the expert's, as judged by a discriminator network. Generative Adversarial Imitation Learning (GAIL) is a prominent example. This framework can be more robust to suboptimal demonstrations than behavioral cloning, as it matches the overall distribution of behavior rather than cloning individual, potentially erroneous, actions. However, it may still match and perpetuate systematic biases present in the suboptimal data.
- Core Objective: Match the expert's state-action occupancy measure.
- Robustness: Can average out occasional mistakes in demonstrations but may learn systematic flaws.
Preference-Based Reward Learning
Preference-Based Reward Learning circumvents the need for optimal (or any) demonstrations by learning a reward function from human preferences between trajectory segments. This approach is highly relevant when only suboptimal demonstrations are available, as it does not assume the provided demonstrations are optimal. Instead, it infers the underlying reward by asking which of two behaviors is better, allowing the system to learn the true objective despite noisy or imperfect example trajectories.
- Data Source: Relative preferences between behaviors, not absolute demonstrations.
- Advantage for Suboptimal Data: Does not require the demonstrator to be expert; focuses on comparative quality.
Offline Imitation Learning
Offline Imitation Learning is the problem of learning a policy solely from a fixed dataset of demonstrations without any further online interaction with the environment. This setting is inherently challenged by distributional shift and the off-policy evaluation problem. When the dataset contains suboptimal demonstrations, offline algorithms must carefully weight or filter data to avoid converging to the demonstrator's average performance, often employing techniques like conservative regularization or distribution matching (e.g., ValueDICE) to extract the best possible policy from the static, imperfect dataset.
- Core Constraint: No online rollouts or exploration.
- Challenge with Suboptimality: Must perform inverse optimization or distribution correction from a static, flawed dataset.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us