Skip to main content

Inferred-Structure and In-Context Learning: A Unified Bayesian Framework for Adaptive Robotic Intelligence

K. Ghamati & A. Zaraki • University of Hertfordshire

Under Review

About the Paper

Khashayar Ghamati & Abolfazl Zaraki
University of Hertfordshire, UK

Modern adaptive robotic systems must rapidly adjust their behaviour when encountering new tasks or environments. Two paradigms have emerged for this challenge: Inferred-Structure Learning (IS), which explicitly infers latent task structure via gradient-based meta-learning (e.g., MAML), and In-Context Learning (ICL), which adapts implicitly through a pre-trained transformer's context window without parameter updates. This paper presents a unified Bayesian framework that formally characterises both approaches and derives precise conditions under which each strategy is optimal.

We validate our theoretical predictions on a Niryo Ned3 Pro 6-axis collaborative robot, collecting 2,400 proprioceptive observations across 200 episodes. The results confirm that IS significantly outperforms ICL under structural task shifts (Cohen's d = 0.587, p = 1.42 × 10−6), while ICL shows a directional advantage under contextual task shifts -- validating the complementarity predicted by the framework.

Key Insight

IS and ICL are not competing methods -- they are complementary. Our Bayesian framework shows exactly when each excels, enabling principled strategy selection for adaptive robots.

Unified Bayesian Framework

How IS and ICL Complement Each Other

Inferred-Structure (IS)
Uses MAML to explicitly infer latent task structure through gradient-based meta-learning. Excels when the underlying task dynamics change fundamentally -- structural shifts require re-estimating the generative model.
In-Context Learning (ICL)
Employs a pre-trained transformer that adapts implicitly through its context window, without updating parameters. Best suited for contextual shifts where the task structure remains stable but surface features change.
Bayesian Unification
Both paradigms are formalised as posterior inference over latent task variables. The framework derives decision boundaries for optimal strategy selection based on shift type and magnitude.
Real-Robot Validation
Validated on a Niryo Ned3 Pro with 21-dimensional proprioceptive data (6 joint angles, 3 end-effector positions, 12 relative object positions) across 200 episodes with 4 reach targets each.

Innovation

This is the first framework to formally unify IS and ICL under a single Bayesian lens, providing mathematically grounded criteria for when to use gradient-based adaptation vs. in-context adaptation on real robotic hardware.

Paper Overview

Watch a video walkthrough explaining the IS vs ICL Bayesian framework, the core hypotheses, the experimental design on the Niryo Ned3 Pro, and the key findings on structural vs contextual task shifts.

Video: Paper overview — IS vs ICL: A Unified Bayesian Framework for Adaptive Robotic Intelligence.

Data Collection Demo

Watch the data collection session using a Niryo Ned3 Pro 6-axis collaborative robot. The robot collects 2,400 proprioceptive observations (21-dimensional: 6 joint angles, 3 end-effector positions, 12 relative object positions) across 200 episodes, each involving 4 reach targets in the workspace. These observations are used to evaluate whether IS (via MAML) and ICL (via a pre-trained transformer) exhibit complementary adaptation under structural and contextual task shifts on real sensor data.

Video: Niryo Ned3 Pro data collection for the IS vs ICL adaptive robotics study.

Key Results

Empirical Validation on Real Robot Hardware

  • Experimental Setup: A Niryo Ned3 Pro robot performed reach tasks across 200 episodes (4 targets each), generating 2,400 proprioceptive observations with 21 dimensions per sample.
  • Structural Shifts: IS (MAML) significantly outperforms ICL under structural task shifts, with a large effect size (Cohen's d = 0.587) and high statistical significance (p = 1.42 × 10−6).
  • Contextual Shifts: ICL shows a directional advantage under contextual shifts, where the task structure is preserved but surface-level features change -- confirming the theoretical predictions.
  • Complementarity: The results validate the Bayesian framework's prediction that IS and ICL are complementary strategies, each optimal for different types of distribution shifts.
0.587
Cohen's d (IS advantage)
2,400
Proprioceptive Observations
21-D
Observation Dimensions

Why It Matters

As robots are deployed in increasingly complex real-world settings, they must adapt quickly to unforeseen changes. Understanding when to use gradient-based meta-learning vs. in-context adaptation is critical for building reliable adaptive systems. This work advances the field by:

  • Providing the first unified Bayesian framework that formally connects IS and ICL as complementary strategies
  • Deriving mathematically grounded decision boundaries for choosing the optimal adaptation strategy
  • Validating predictions on real robotic hardware (Niryo Ned3 Pro) with proprioceptive data
  • Demonstrating that structural vs. contextual shift classification enables principled, efficient adaptation

Impact

This framework enables robot designers to select the right adaptation strategy based on the type of environmental change, leading to more robust and efficient adaptive robotic systems across manufacturing, assistive robotics, and collaborative applications.

Open Science & Collaboration

We are committed to open, reproducible research. If you are interested in collaborating, extending the framework, or accessing the experimental data, please reach out.

Full Paper & Code

Download Full Paper View Code

Preprint available on SSRN. Code and datasets will be made available upon publication.