# Lowest Possible Memory For Neural ODE

**URL:** <https://discourse.julialang.org/t/lowest-possible-memory-for-neural-ode/102526>\
**Category:** Machine Learning\
**Tags:** diffeq, differentialequation\
**Created:** [August 5, 2023, 11:39pm UTC](https://discourse.julialang.org/t/lowest-possible-memory-for-neural-ode/102526 "2023-08-05T23:39:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![prbzrg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/prbzrg/32/23866_2.png) [@prbzrg](https://discourse.julialang.org/u/prbzrg)\
**Post date:** [August 5, 2023, 11:39pm UTC](https://discourse.julialang.org/t/lowest-possible-memory-for-neural-ode/102526/1 "2023-08-05T23:39:35Z")

</div>

For a neural ode, what are the best `kwargs` to pass to the `solve` function that make it use the lowest possible memory in both direct and AD usage?  
I use:

```julia
kwargs = Dict(
    :alg_hints => [:nonstiff, :memorybound],
    :dense => false,
    :save_everystep => false,
    :save_on => false,
    :calck => false,
    :alias_u0 => true,
    :verbose => false,
    :merge_callbacks => true,
    :wrap => Val(true),
    :alg => BS3(),
    :sensealg => BacksolveAdjoint(;
        autodiff = true,
        autojacvec = ZygoteVJP(),
        checkpointing = true,
    ),
    :reltol => 1.0f-2 + eps(1.0f-2),
)

```

Can it be any better?

---

<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:** [August 6, 2023, 12:22am UTC](https://discourse.julialang.org/t/lowest-possible-memory-for-neural-ode/102526/2 "2023-08-06T00:22:42Z")

</div>

For the alg you can use a low memory RK method.
