[ANN] PolyStep.jl: Gradient-free optimization with batched evaluations - v0.3.0

Hi everyone!

I’d like to share PolyStep.jl, a gradient-free optimizer for general black-box objectives in Julia.

It works directly with function evaluations, so you can use it with smooth, nonsmooth, or piecewise-constant objectives without providing gradients. This can be useful when your objective involves a simulation, an argmax, or a combinatorial solver, or when computing gradients is inconvenient.

The package is registered and MIT-licensed, and integrates with Optimization.jl through PolyStepOptimizer.

To install:

using Pkg
Pkg.add(["Optimization", "PolyStep"])

Here’s a simple example minimizing a smooth objective:

using Optimization, PolyStep, Random

f(u, p) = sum(abs2, u)
prob = OptimizationProblem(f, fill(5.5, 10))

sol = solve(
    prob,
    PolyStepOptimizer(epsilon = 0.1, step_radius = 1.0);
    maxiters = 100,
    batched = X -> vec(sum(abs2, X; dims = 1)),
    rng = Xoshiro(0),
)

(sol.objective, sol.retcode)

The optional batched keyword lets you evaluate all candidates in a round with a single call. If you have a vectorized implementation of your objective, you can pass it in here.

The integration also supports bounds, maximization through MaxSense, maxiters, maxtime, and callbacks.

I’d love to hear what people try it on, whether that’s parameter tuning, simulation-based optimization, or objectives with discrete decisions inside them. If you give it a go, I’d love feedback on what works, what’s tricky, and what could be easier to use.

I think a link to your package will be helpful here. And what’s the underlying algorithm of PolyStep.jl?

Ah thanks for pointing that out! I should have included the GitHub
https://github.com/anindex/PolyStep.jl

The underlying algorithm is PolyStep, a randomized gradient-free method. The idea is to explore around the current point using a rotated polytope, then combine the candidate directions according to their objective values.

For the https://anindex.github.io/PolyStep.jl/stable/guide/, each iteration:

  1. Generates a randomly rotated orthoplex around the current point, giving 2d candidates in d dimensions.
  2. Evaluates the objective at those candidates, optionally in a single batched call.
  3. Computes softmax weights from the scaled costs, giving lower-cost candidates more weight.
  4. Updates the point to the weighted average of those candidates.

epsilon controls how concentrated the weights are. Smaller values put more emphasis on the best candidates, while larger values spread the weight more evenly.

The softmax rule comes from a one-sided entropic optimal transport formulation and has a closed-form solution. There is also a Sinkhorn option that couples the weights across multiple particles. The derivation and analysis are in https://arxiv.org/abs/2605.01928, published in TMLR.

The update only needs function values, so it also applies to smooth objectives. For piecewise-constant objectives, the probe radius needs to be large enough to find variation beyond a flat region.

There’s also an https://vietngth.github.io/polystep-visualization/ that shows how the probes, weights, and updates work.

Let me know any feedback, I really appreciate it!

Nice animations! They might get more impressive with the classic Rosenbrock (banana) function.

Thanks for the suggestion! I will add the gallery to the PolyStep repos soon.

Also, please check out my old repos on scaling up particle batch optimization using the same polytope mechanism here https://github.com/anindex/ssax