Logic-Guided Vector Fields (LGVF)
- LGVF is a neuro-symbolic framework that embeds differentiable logic constraints into continuous-time generative models for constraint-aware sampling.
- It combines training-time penalty terms with inference-time gradient corrections to steer sample trajectories away from constraint violations.
- Empirical evaluations in linear, nonlinear, and obstacle-avoidance settings show significant reductions in violation rates and improved distribution fidelity.
Logic-Guided Vector Fields (LGVF) are a neuro-symbolic framework for constrained generative modeling that incorporate symbolic, logic-based knowledge into continuous-time generative models, specifically flow matching architectures. LGVF injects differentiable relaxations of logical constraints into sample generation, coupling a training-time penalty for constraint violations with an inference-time corrective mechanism based on the gradients of those constraints. The method achieves substantial reductions in constraint-violation rates and can yield improved fidelity to the target distribution. LGVF establishes a scalable approach to constraint-aware sampling, evidenced by performance gains in linear, nonlinear, and obstacle-avoidance domains (Baheri, 2 Feb 2026).
1. Continuous-Time Generative Modeling and Constraints
Generative modeling by continuous-time flows frames sample generation as the solution to an ordinary differential equation (ODE) transporting points from a tractable base distribution to a complex target distribution . In the flow-matching paradigm, the dynamics are parameterized by a vector field , and the ODE
transports samples from towards . Standard flow matching optimizes via the conditional flow matching loss: where .
Generative models of this class lack mechanisms for enforcing declarative (symbolic) constraints on during generation. LGVF addresses this by integrating logic-aware constraints directly into both training and inference phases.
2. Differentiable Relaxation of Logical Constraints
LGVF expresses symbolic constraints 0 through differentiable surrogates 1, where 2 iff 3. The general form is: 4 with 5 extracting features relevant to the constraint (e.g., 6 for a half-space), and 7 being a hinge-style relaxation such as 8.
A penalty term is added to the training objective, resulting in the total LGVF loss: 9 where the logic loss is a time-weighted trajectory integral: 0 and the schedule 1 increases toward 2, where adherence to constraints becomes critical.
This approach shapes 3 to transport mass in a way that inherently avoids constraint violation, especially near the target distribution.
3. Inference-Time Logic Adjustment
Even with robust training-time penalties, inference-time violations can occur due to the complexity of the constraint surface and model limitations. LGVF employs an inference-time "steering" correction during numerical ODE integration: 4 where 5 is a schedule that becomes active at later times (e.g., 6 for 7, then increasing quadratically to 8). The negative gradient 9 points in the direction of maximal reduction in violation, nudging samples back into feasible regions without explicit path planning.
This two-stage design—combining training-time logic shaping and local inference-time steering—enables robust satisfaction of symbolic constraints across a variety of geometry classes.
4. Empirical Evaluation on Constrained Generation
LGVF was evaluated in three 2D settings: a linear half-plane, a nonlinear ring, and a multi-obstacle "forbidden disk" region. In all experiments, 0 was implemented as a 3-layer MLP with 128 hidden units and ReLU activations, trained using Adam for 8,000 steps (learning rate 1, batch size 256), with 100 Euler steps for ODE integration at inference.
Summary of results for 2,000 samples per geometric setting:
| Scenario | Violations (FM) | Violations (LGVF) | Violations (LGVF+Adj.) | MMD (FM) | MMD (LGVF) | MMD (LGVF+Adj.) |
|---|---|---|---|---|---|---|
| Linear half-plane (2) | 2.20% | 2.00% (9%) | 0.40% (82%) | 3 | 4 | 5 |
| Nonlinear ring (6) | 5.65% | 3.45% (39%) | 1.20% (79%) | 7 | 8 | 9 |
| Multi-obstacle avoidance | 1.70% | 2.50% (–47%) | 0.70% (59%) | 0 | 1 | 2 |
Percentages in parentheses denote improvement relative to baseline flow matching (FM). LGVF with inference-time adjustment ("LGVF+Adj.") consistently reduced violation rates by 59–82% across tasks. In the linear and ring settings, distributional fidelity—measured by Maximum Mean Discrepancy (MMD)—was also improved by eliminating infeasible samples. For the multi-region, obstacle scenario, improved feasibility came at the cost of a minimally higher MMD, illustrating a satisfaction–fidelity trade-off.
Empirically, LGVF induced "emergent obstacle-avoidance behavior," automatically routing generative trajectories around forbidden regions without explicit planning.
5. Implementation and Ablation Insights
Key implementation parameters included the network architecture (3-layer, 128-unit MLP), time concatenation, training setup (Adam, learning rate 3, 8,000 steps, batch size 256), logic weight schedule 4 with 5, and inference schedules 6 for 7 and quadratic ramp-up to 8.
Ablation studies in the linear constraint setting showed that:
- Increasing 9 steadily reduces violation rates, reaching zero for 0.
- Larger 1 values in the inference correction reduce violations for both FM+Adjusted and LGVF+Adjusted, but LGVF+Adjusted achieves zero errors with smaller 2, indicating complementarity between mechanisms.
- The timing of inference adjustment (3 between 0.1 and 0.5) has minimal effect, suggesting robustness of the correction mechanism.
6. Advantages, Limitations, and Future Prospects
LGVF brings hard constraint satisfaction to continuous-time flow generative models by merging training-time vector-field shaping with an inference-time gradient-based steering mechanism. Documented advantages include:
- Consistent constraint-violation reduction (59–82%).
- Emergent obstacle-avoidance without explicit path planning.
- Improved or preserved distributional fidelity (MMD), especially in convex constraint settings.
- Scalability demonstrated by near-zero violation rates up to 100 dimensions for half-space constraints.
Limitations and potential directions for further research include:
- Training-time logic shaping may be less effective on highly nonconvex or multi-region constraints; adaptive weighting or curriculum learning could mitigate this.
- Application to structured, high-dimensional data (e.g., images, molecules) invites research into learning or differentiating more complex violation measures.
- Joint learning of 4 from data or symbolic programs is a promising generalization.
- Further coupling with optimal-transport techniques or more expressive vector-field architectures may yield improvements in sample quality under constraints.
LGVF exemplifies the unification of neuro-symbolic constraint satisfaction with the flexibility of continuous generative dynamics, offering a lightweight and extensible strategy for generating samples that meet complex, declarative requirements (Baheri, 2 Feb 2026).