Since there is no answer yet. It could be quite likely that this is just not possible. In linear cases, the interface can store the internal representation of the linear/quadratic terms. For nonlinear terms, the interface would need to be able to store an arbitrary Julia function. Which is of course much harder.
I think the question then becomes: If you have a very long and complicated function, is it maybe easier to put it into a Julia file and store this script (and include it later again) rather than some serialization which might not work in the future?
If your nonlinear function is a symbolic expression, you could use Symbolics to store it: Symbolic Calculations and Building Callable Functions ยท Symbolics.jl They also use the approach to store a Julia file with the plain definition. (See this recent post: Using Serialization to store then load a lambdified function? - #4 by SteffenPL but there are more posts of course on this topic.)