NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Active Alignments of Lens Systems with Reinforcement Learning

Matthias Burkhardt, Tobias Schmähling, Pascal Stegmann, Michael Layh, Tobias Windisch · DOI

Abstract

Aligning a lens system relative to an imager is a critical challenge in camera manufacturing. While optimal alignment can be mathematically computed under ideal conditions, real-world deviations caused by manufacturing tolerances often render this approach impractical. Measuring these tolerances can be costly or even infeasible, and neglecting them may result in suboptimal alignments. We propose a reinforcement learning (RL) approach that learns exclusively in the pixel space of the sensor output, eliminating the need to develop expert-designed alignment concepts. We conduct an extensive benchmark study and show that our approach surpasses other methods in speed, precision, and robustness. We further introduce relign, a realistic, freely explorable, open-source simulation utilizing physically based rendering that models optical systems with non-deterministic manufacturing tolerances and noise in robotic alignment movement. It provides an interface to popular machine learning frameworks, enabling seamless experimentation and development. Our work highlights the potential of RL in a manufacturing environment to enhance efficiency of optical alignments while minimizing the need for manual intervention.

Introduction

In modern camera manufacturing, "active alignment" is the essential process of positioning a lens system relative to an image sensor to maximize optical performance. While theoretically straightforward, this task is complicated by three primary real-world factors:

  1. Manufacturing Tolerances: Individual lenses possess microscopic, unpredictable variations in tilt and position.
  2. Robotic Noise: The mechanical actuators used for alignment are not perfectly precise.
  3. High-Dimensional Complexity: Lens systems typically involve six degrees of freedom (x, y, z, and three rotations), where adjustments in one dimension non-linearly affect multiple performance metrics.

Traditional alignment methods often rely on exhaustive scans or hand-crafted features like sharpness scores. These are not only slow but frequently fail when manufacturing defects create asymmetrical or noisy optical outputs. Supervised learning is similarly limited by the lack of ground-truth datasets that can account for the infinite variety of manufacturing variances.

Methodology: The relign Framework

To address these challenges, we frame the alignment task as a Partially Observable Markov Decision Process (POMDP). Because the internal manufacturing defects of a specific lens set are unknown, the agent must infer the optimal state based solely on high-dimensional image observations from the sensor.

Overview of the active alignment process as a POMDP, where the agent moves the lens system based on sensor observations.

Reinforcement Learning Agent

We utilized Proximal Policy Optimization (PPO), a robust on-policy RL algorithm. The policy network employs a Convolutional Neural Network (CNN) to process $200 \times 200$ pixel sensor observations into 256 latent features, which then inform the next robotic movement.

Simulation and Reward Structure

Training was conducted using relign, an open-source simulation framework built on the Mitsuba3 physically based rendering engine. This allows for realistic light ray tracing through lenses, incorporating distortions and noise to bridge the "sim-to-real" gap. To navigate the complex reward landscape, we implemented a hybrid reward function:

  • Coarse Alignment: When far from the target, the reward is based on the Euclidean distance to the ideal position.
  • Fine Alignment: Near the target, the reward switches to an image-pattern similarity score, comparing the current view to a reference "Siemens star" pattern.

Results and Performance

Our RL-PPO agent demonstrated significant advantages over traditional Bayesian Optimization (BO) methods across several metrics.

Visualization of the complex, non-linear reward landscapes across different degrees of freedom (x, y, z, Rx, Ry), illustrating the difficulty of the optimization task.
  • Efficiency: The RL agent consistently achieved optimal alignment in fewer than 10 steps.
  • Latency: At runtime, the agent requires only 25ms to decide a move, outperforming BO-RF (95ms) and BO-GP, which becomes increasingly slow as the step count grows.
  • Precision and Robustness: RL outperformed both Bayesian Optimization and random search across all noise levels ($N=0$ to $N=0.5$). While Bayesian methods struggled with the "noisy" search space created by lens defects, the RL policy learned a generalized strategy that remained stable.

Conclusion

This work demonstrates that reinforcement learning can effectively automate high-precision optical alignment by learning directly from pixel data. By bypassing the need for hand-crafted features, the RL agent discovers internal representations of optical aberrations that are more robust to manufacturing defects than traditional methods. Future research will focus on improving sample efficiency to reduce training time (currently ~28 hours) and deploying pre-trained models onto physical robotic alignment stations.

Summary updated

BibTeX
@misc{burkhardt2025active,
  author = {Matthias Burkhardt and Tobias Schmähling and Pascal Stegmann and Michael Layh and Tobias Windisch},
  title = {{Active Alignments of Lens Systems with Reinforcement Learning}},
  year = {2025},
  eprint = {2503.02075},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2503.02075},
}
Figure