TuringLang / TuringLang/DynamicPPL.jl
Rename `OnlyAccsVarInfo` to `VarInfo`
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 286
- Forks
- 41
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 34
Description
There is no longer any need for VarInfo. Note that VarInfo carries with it
- vectorised values (
vi.values) - a transform strategy (
vi.transform_strategy) - accumulators (
vi.accs)
Now, vi.values is exactly the same as VectorValueAccumulator. This is rarely needed, and using VarInfo causes unnecessary performance losses in most scenarios. Many of the performance improvements have really resulted from the choice to stop using VarInfo See e.g.
- Removal of VarInfo from LogDensityFunction: https://github.com/TuringLang/DynamicPPL.jl/pull/1132
- Removal of VarInfo from MCMCChainsExt: https://github.com/TuringLang/DynamicPPL.jl/pull/1130
- Removal of VarInfo from MH: https://github.com/TuringLang/Turing.jl/pull/2733
- Removal of VarInfo from Gibbs & ESS: https://github.com/TuringLang/Turing.jl/pull/2803
And even in the cases where vi.values is needed, it can be simply added as a new accumulator in vi.accs.
vi.transform_strategy only exists to keep track of the status of vi.values and improve performance. However, if one uses init!! instead of evaluate!! this is not needed, because init!! takes a transform strategy as an argument.
Essentially, all use cases of evaluate!!(model, varinfo::VarInfo) should be replaced with init!!(model, oavi::OnlyAccsVarInfo, InitFromParams(varinfo.values), varinfo.transform_strategy).
With this in mind, I would argue that VarInfo should just be removed completely. There's no reason to keep maintaining an interface that's less flexible and less performant.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the VarInfo and OnlyAccsVarInfo interfaces, especially evaluate!! and init!!, and review the linked removals from LogDensityFunction, MCMCChainsExt, MH, Gibbs, and ESS. Clarify whether the intended result is renaming OnlyAccsVarInfo or removing VarInfo entirely; done means the chosen interface is consistently applied without the obsolete VarInfo use cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100