As noted in https://github.com/TuringLang/DynamicPPL.jl/pull/793/files#r1936255984 and the comment that it's on, unflatten, replace_value, one of the constructors for VarInfo, and set_values!! seem very similar, especially once indexing by samplers has been removed. Some or all of them should be unified into a single function.