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.
Glossary
Factor Graph Optimization

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.
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.
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.
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.
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.
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.
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.
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.
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.
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
Factor graph optimization is deeply connected to several core estimation and probabilistic reasoning frameworks. Understanding these related terms provides the essential context for applying factor graphs to complex sensor fusion problems.
Maximum A Posteriori (MAP) Estimation
The core inference objective solved by factor graph optimization. MAP estimation finds the most probable set of state variables given observed measurements and prior knowledge. In a factor graph, this is achieved by finding the variable configuration that maximizes the product of all factor potentials, which is equivalent to minimizing the sum of their negative log-likelihoods. This transforms a complex probabilistic inference into a sparse nonlinear least squares problem solvable with iterative methods like Gauss-Newton or Levenberg-Marquardt.
Nonlinear Least Squares
The mathematical optimization engine underlying factor graph solvers like GTSAM and g2o. Since sensor measurement functions are rarely linear, the MAP objective becomes a nonlinear least squares problem. Solvers iteratively linearize the factors around the current estimate, solve a linear system for an update step, and repeat until convergence. Key properties exploited for efficiency include the sparsity of the Hessian matrix and the use of robust loss functions like Huber or Cauchy to handle outlier measurements.
Simultaneous Localization and Mapping (SLAM)
The canonical application domain for factor graph optimization. In pose-graph SLAM, robot poses are variables and constraints between them—derived from odometry or loop closures—are factors. Factor graphs elegantly handle the back-end optimization of SLAM by naturally representing the sparse, graph-structured nature of the problem. Modern systems like iSAM2 perform incremental smoothing and mapping, efficiently updating the full solution in real-time as new measurements arrive without recomputing from scratch.
Bundle Adjustment
A specific factor graph formulation from photogrammetry and computer vision. Bundle adjustment jointly optimizes 3D landmark positions and camera poses by minimizing the reprojection error of observed image points. In the factor graph, each observed 2D image feature generates a projection factor connecting a camera pose variable and a landmark variable. The sparsity patterns of the resulting Schur complement are heavily exploited to solve large-scale structure-from-motion problems efficiently.
Bayesian Networks
The directed probabilistic graphical model from which factor graphs generalize. A Bayesian network represents a joint probability distribution as a directed acyclic graph where edges indicate conditional dependencies. Factor graphs convert this into a bipartite representation that is more flexible for inference. Unlike Bayesian networks, factor graphs can represent undirected or cyclic dependencies and make the factorization of the joint probability explicit, which is essential for formulating general sensor fusion problems.
Smoothing and Mapping (SAM)
A paradigm that treats the full robot trajectory and map as a single optimization problem, in contrast to filtering approaches. Smoothing considers all past states when estimating the current one, producing more accurate results than recursive filters by relinearizing past measurements. Factor graphs are the natural representation for SAM, where the entire history of poses and landmarks is a graph. Incremental smoothing techniques like iSAM2 exploit the graphical structure to provide real-time performance despite the full-history formulation.

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