probcomp / Venturecxx

Primary implementation of the Venture probabilistic programming system
http://probcomp.csail.mit.edu/venture/
GNU General Public License v3.0
29 stars 6 forks source link

Surprising non-determinism example #571

Open axch opened 8 years ago

axch commented 8 years ago

@pgmoren gives us the enclosed test program, which is not deterministic (but should be). Specifically, the values reported by global_log_joint and global_log_likelihood after the infer command vary (in both backends!). The ones before are stable. test_seed.py.txt

Update: Lite is deterministic as of June 6 (PR #579)

axch commented 8 years ago

On further investigation:

axch commented 8 years ago

One candidate explanation (at least for Lite): All the node collections used in scaffold construction are sets. Not only that, but keyed by the object identities of the nodes, which are of course unstable from run to run.

How does this leak to sampling different values after inference? Not completely clear, but

Why does Puma also exhibit instability? Not sure, but probably has a similar bug (perhaps in a less severe fashion, if the structures indexed by node identities are, e.g., binary search trees rather than hash tables).

axch commented 8 years ago

Candidate solutions:

riastradh-probcomp commented 8 years ago

Indexing the scaffold structures by insertion order can be done by dropping in collections.OrderedDict where we use dict.

axch commented 8 years ago

For the record: the uploaded program hardcodes a backend (Puma, I believe), but is a valid test program for either backend by editing that hardcode point.

axch commented 7 years ago

For the record, confirmed (again?) that this issue does not affect Lite anymore.