Inferensys

Glossary

Factor Graph Optimization

A graphical model framework for state estimation that represents a complex inference problem as a bipartite graph of variables and probabilistic constraints, solved via nonlinear least squares to find the maximum a posteriori estimate.
Governance lead reviewing model governance framework on laptop, policy documents visible, executive office setup.
PROBABILISTIC GRAPHICAL INFERENCE

What is Factor Graph Optimization?

Factor graph optimization is a framework for state estimation that represents complex inference problems as bipartite graphs of variables and probabilistic constraints, solved via nonlinear least squares to find the maximum a posteriori estimate.

Factor graph optimization is a graphical model framework that decomposes a complex probabilistic state estimation problem into a bipartite graph of variable nodes and factor nodes. Each factor encodes a probabilistic constraint—derived from a sensor measurement or a motion model—that connects one or more variables, representing the residual error between a predicted and observed value.

The optimal state estimate is found by solving a nonlinear least squares problem that minimizes the sum of squared residuals across all factors, equivalent to computing the maximum a posteriori (MAP) estimate. Unlike recursive filters such as Kalman variants, factor graphs perform batch optimization over the entire trajectory, enabling iterative relinearization and robust outlier rejection through techniques like the Huber loss.

PROBABILISTIC INFERENCE

Key Characteristics of Factor Graph Optimization

Factor graph optimization (FGO) reframes complex state estimation as a sparse nonlinear least-squares problem on a bipartite graph, enabling efficient, globally consistent solutions for sensor fusion and SLAM.

01

Bipartite Graph Structure

The factor graph is a bipartite graph with two distinct node types: variable nodes representing unknown states (e.g., robot poses, landmark positions) and factor nodes representing probabilistic constraints. An edge exists only between a factor and the variables it constrains. This explicit structure makes the underlying inference problem transparent and allows for the natural encoding of heterogeneous sensor measurements—such as GPS priors, visual odometry, and loop closures—as distinct factor types within a single unified framework.

02

Nonlinear Least-Squares Formulation

Inference in a factor graph is formulated as finding the maximum a posteriori (MAP) estimate by minimizing the sum of squared error functions across all factors. Each factor encodes a cost proportional to the negative log-likelihood of a measurement. The optimization iteratively linearizes these nonlinear factors around the current estimate and solves a sparse linear system—typically via Gauss-Newton or Levenberg-Marquardt algorithms—to update the variable assignments until convergence to a global minimum.

03

Sparsity and Incremental Solving

Factor graphs inherently exploit the sparsity of the SLAM problem, where each measurement constrains only a small subset of variables. This leads to an information matrix with a characteristic arrowhead or block-tridiagonal pattern. Advanced solvers like iSAM2 (Incremental Smoothing and Mapping 2) use the Bayes tree data structure to perform incremental updates, re-linearizing and re-solving only the affected portion of the graph when new factors are added, enabling real-time performance on long-duration trajectories.

04

Robust Error Functions

To handle data association errors and sensor outliers, factor graphs employ M-estimator robust loss functions that reduce the influence of high-error measurements during optimization. Common kernels include:

  • Huber: Quadratic for small errors, linear for large errors.
  • Cauchy: Suppresses outliers more aggressively with a logarithmic penalty.
  • Geman-McClure: A redescending kernel that fully rejects extreme outliers. These are applied directly to the residual of each factor, preventing a single false loop closure from corrupting the entire state estimate.
05

Smoothing vs. Filtering Paradigm

Factor graph optimization is a smoothing approach, meaning it re-estimates the entire history of states given all available measurements, rather than only the current state as in Kalman filtering. This full batch or sliding-window optimization allows information from future measurements to refine past estimates, which is critical for correcting accumulated drift when a loop closure is detected. The result is a globally consistent trajectory that a causal filter alone cannot achieve.

FACTOR GRAPH OPTIMIZATION

Frequently Asked Questions

Clear, technically precise answers to the most common questions about factor graph optimization for state estimation in sensor fusion and robotics.

Factor graph optimization is a probabilistic framework for state estimation that represents the problem as a bipartite graph of variables (unknown states) and factors (probabilistic constraints). The algorithm finds the maximum a posteriori (MAP) estimate by solving a nonlinear least squares problem—iteratively adjusting variable values to minimize the error across all factors. Each factor encodes a residual function measuring how well a predicted measurement matches the actual sensor observation, weighted by an information matrix that captures measurement uncertainty. The graph structure naturally handles asynchronous, heterogeneous sensor data by adding new variable nodes for each time step and connecting them with factors representing motion models and sensor observations. Optimization is typically performed using incremental solvers like iSAM2 or GTSAM, which exploit the sparsity of the underlying matrix structure to achieve real-time performance even for large-scale problems.

Prasad Kumkar

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.