# How to optimize neural network parameters with non-gradient algorithms?

**URL:** <https://discourse.julialang.org/t/how-to-optimize-neural-network-parameters-with-non-gradient-algorithms/124186>\
**Category:** Specific Domains\
**Tags:** optimization, neural-network\
**Created:** [December 26, 2024, 3:52pm UTC](https://discourse.julialang.org/t/how-to-optimize-neural-network-parameters-with-non-gradient-algorithms/124186 "2024-12-26T15:52:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![greatpet](https://avatars.discourse-cdn.com/v4/letter/g/e495f1/32.png) [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Post date:** [December 26, 2024, 3:52pm UTC](https://discourse.julialang.org/t/how-to-optimize-neural-network-parameters-with-non-gradient-algorithms/124186/1 "2024-12-26T15:52:32Z")

</div>

Is there any simple example code for optimizing neural network (e.g. from Flux.jl) parameters using non-gradient algorithms such as simulated annealing and genetic algorithms?

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [December 26, 2024, 5:12pm UTC](https://discourse.julialang.org/t/how-to-optimize-neural-network-parameters-with-non-gradient-algorithms/124186/2 "2024-12-26T17:12:37Z")

</div>

Here’s an unconventional one

> **[Adaptive Neural-Network training · LowLevelParticleFilters Documentation](https://baggepinnen.github.io/LowLevelParticleFilters.jl/stable/neural_network/)**
>
> Documentation for LowLevelParticleFilters Documentation.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [December 26, 2024, 7:41pm UTC](https://discourse.julialang.org/t/how-to-optimize-neural-network-parameters-with-non-gradient-algorithms/124186/3 "2024-12-26T19:41:58Z")

</div>

If you use Lux with Optimization.jl

> **[Training Lux Models using Optimization.jl | Lux.jl Docs](https://lux.csail.mit.edu/stable/tutorials/beginner/5_OptimizationIntegration)**
>
> Documentation for LuxDL Repositories

then just change to a gradient-free algorithm, like the ones in

> **[PRIMA.jl · Optimization.jl](https://docs.sciml.ai/Optimization/stable/optimization_packages/prima/)**
>
> Documentation for Optimization.jl.
