Software package MaRDI Open Interfaces for improved interoperability in numerical optimization
Source: arXiv:2606.20490 · Published 2026-06-18 · By Dmitry I. Kabanov, Stephan Rave, Mario Ohlberger
TL;DR
This paper tackles key challenges in computational science related to interoperability across numerical optimization solvers implemented in different programming languages. Writing language bindings for solvers or adapting experiment code to accommodate varying solver interfaces wastes time and effort for researchers, detracting from scientific goals. The authors present recent extensions to the MaRDI Open Interfaces software package designed to simplify these tasks by offering unified, language-agnostic interfaces for nonlinear optimization problems. This enables seamless switching and benchmarking of solvers across C, Julia, and Python ecosystems without rewriting problem code. The work demonstrates the interface's utility through computational experiments training physics-informed neural networks (PINNs) to approximate solutions of the viscous Burgers' equation, comparing several BFGS implementations from SciPy and Optim.jl across languages. Results show consistent solution quality and no significant performance overhead despite crossing language boundaries, validating the design.
Key findings
- MaRDI Open Interfaces support automated data marshalling across C, Julia, and Python with minimal overhead by passing arrays by reference and using callback function wrappers.
- The optimization interface currently supports unconstrained nonlinear problems with object-oriented function calls for setting guess, user data, objective and gradient callbacks, methods, and optimization execution.
- Adapters are available for SciPy's optimize and Julia's Optim.jl packages, allowing users to benchmark and switch solvers with minimal code changes.
- Physics-informed neural network training for the viscous Burgers’ equation using BFGS showed that tighter gradient norm tolerances (gtol = 10^-5) yield accurate PDE solutions satisfying boundary conditions, independent of implementation or initial guess (Fig 1).
- Comparing BFGS implementations, SciPy and Optim.jl-StrongWolfe use the same line-search algorithm but differ by 17% in function evaluation counts at gtol=10^-5, illustrating that identical algorithms can have varying real-world performance.
- Optim.jl-BackTracking implementation outperformed SciPy in elapsed runtime despite crossing language boundaries, indicating that the interoperability approach incurs negligible performance penalty (Table 1).
- Mean statistics are averaged over 42 independent trials differing by random initial seeds, providing robust quantitative comparison across solver implementations.
Methodology — deep read
The MaRDI Open Interfaces package addresses computational interoperability challenges stemming from different solver programming languages and varying solver interfaces. It splits the software architecture into loosely coupled user-facing and implementation-facing parts communicating through language-agnostic APIs. Data types supported include standard primitive types plus arrays passed strictly by reference to avoid costly copies. Callbacks for objective and gradient functions are wrapped with native and C function pointers to reduce inter-language call overhead. The current nonlinear optimization interface handles unconstrained problems of the form minimize f(x; α) over x ∈ ℝ^n where f: ℝ^n × A → ℝ. Instead of monolithic solver calls, an object-oriented style sets initial guess, user context, objective and gradient callbacks with validated signatures before running minimize which outputs solution x and status.
Adapters are implemented for SciPy's optimize package and Julia's Optim.jl package. The former includes gradient-based and derivative-free methods; the latter leverages Julia-native and wrapper solvers with different line searches like HagerZhang, StrongWolfe, and BackTracking.
The example problem trains a multilayer perceptron physics-informed neural network (PINN) approximating solutions of the viscous Burgers' PDE with periodic boundary conditions. The PINN loss combines PDE residual, initial condition, and boundary condition enforcement sampled on a uniform spatiotemporal grid. Automatic differentiation with JAX computes gradients on CPU.
Training optimizes the PINN parameters θ using BFGS from SciPy or Optim.jl with varying stopping tolerances (|gradient|_∞ ≤ gtol for gtol ∈ {10^-3, 10^-4, 10^-5}). For each gtol and implementation, 42 independent experiments use different random seeds but identical initial parameter guesses (Xavier init). Statistics reported include number of iterations, function/gradient evaluations, final loss, gradient norm, and elapsed run time measured independently.
The evaluation compares solver performance metrics and solution accuracy by plotting PINN predictions against exact solutions (via Cole–Hopf transform) at final time t=2. Differences in performance between line-search variants and language implementations are analyzed. The interface overhead is assessed in terms of elapsed run time and iteration count consistency.
Reproducibility is partially facilitated by leveraging public packages (SciPy, Optim.jl, JAX) and designing transparent modular APIs. MaRDI Open Interfaces code is referenced in prior work [21], though explicit public release details for this extension are not clearly stated. Exact runtime and statistical uncertainties are reported.
An end-to-end example: To solve the constrained PDE optimization problem, a user writes code to set initial θ guess, defines a JAX function computing PINN loss and gradient, sets these as callbacks on the MaRDI interface, chooses BFGS method and parameters, then calls minimize(). The solver iterates, querying the callbacks for function/gradient values until the stopping criterion based on gtol is met. Results give optimized θ which yields a PINN approximating the PDE solution.
Technical innovations
- Design of a generalized, language-agnostic nonlinear optimization interface unifying solver APIs across C, Julia, and Python to reduce binding and adaptation overhead.
- Efficient inter-language data marshalling by passing arrays strictly by reference combined with callback function pointer wrappers minimizing cross-language call overhead.
- An object-oriented interface for nonlinear optimization allowing separate setting and validation of initial guess, user data, objective, and gradient functions versus monolithic solver calls.
- Integration and benchmarking support for multiple BFGS algorithm implementations with different line-search strategies across language boundaries without significant performance loss.
Baselines vs proposed
- SciPy BFGS with strong Wolfe line search: final loss ≈ 5.9e-6 at gtol=1e-5 vs Optim.jl-StrongWolfe BFGS: final loss ≈ 6.3e-6
- SciPy function evaluations at gtol=1e-5: ~691 vs Optim.jl-StrongWolfe: ~814 (17% more evaluations)
- Optim.jl-BackTracking runtime at gtol=1e-5: 112.3s vs SciPy runtime: 129.0s (Optim.jl faster despite cross-language calls)
- Number of iterations SciPy and Optim.jl-StrongWolfe close (~672 vs ~678 at gtol=1e-5)
- Optim.jl-HagerZhang requires more function evaluations (~754) than SciPy (~691) at gtol=1e-5
Limitations
- Current interface supports only unconstrained nonlinear optimization problems; constraints not yet integrated.
- Experiment only on a single PDE problem and PINN training; generalizability to different problem types or solvers untested.
- No reported adversarial or robustness testing against faulty or malicious solver implementations.
- Performance analysis limited to CPU-based JAX computations; GPU or other hardware impacts not explored.
- Reproducibility is impeded by no explicit public code or dataset release for the new interface and experiments.
- Discrepancies in runtime measurement methods (authors' Python timing vs solver reported) may affect exact performance comparisons.
Open questions / follow-ons
- How can the MaRDI Open Interfaces be extended to support constrained nonlinear and mixed-integer optimization problems?
- What is the overhead and applicability of this interoperability approach for large-scale and high-performance computing scenarios including GPU computations?
- How stable and fault-tolerant is the interface when dealing with potentially buggy or malicious solver callbacks from different languages?
- Can MaRDI be integrated with more advanced optimization frameworks or domain-specific languages beyond SciPy and Optim.jl?
Why it matters for bot defense
The paper is relevant to bot-defense and CAPTCHA engineers primarily in the context of interoperability and benchmarking of numerical optimization components used in training or tuning models, such as physics-informed neural networks that may be part of advanced defense mechanisms. The MaRDI Open Interfaces approach shows how to unify and accelerate experimentation with different solver implementations across language boundaries. This reduces engineering overhead when integrating or comparing optimization techniques embedded in CAPTCHA or bot-detection pipelines, potentially enabling more rapid iteration on model training losses and constraints without costly rewrites. The evaluation also highlights subtle but real performance differences between nominally identical optimization algorithms implemented in various ecosystems, an insight valuable when embedding efficient optimizers under latency constraints. However, direct security or adversarial considerations are outside the scope and would require complementary analysis. Overall, MaRDI Open Interfaces presents a practical approach to streamline and benchmark optimizer usage in complex, multi-language scientific computing environments relevant to CAPTCHA-related research.
Cite
@article{arxiv2606_20490,
title={ Software package MaRDI Open Interfaces for improved interoperability in numerical optimization },
author={ Dmitry I. Kabanov and Stephan Rave and Mario Ohlberger },
journal={arXiv preprint arXiv:2606.20490},
year={ 2026 },
url={https://arxiv.org/abs/2606.20490}
}