Skip to content

Two reproducibility issues due to lack of tie-breaking #20

@sscdotopen

Description

@sscdotopen

I found two bugs in Serenade, which lead to reproducibility issue, where the recommender system returns different results when executed with the same inputs. Both are caused by a lack of tie breaking during sorting or top-k aggregation.

The first issue is in https://github.com/bolcom/serenade/blob/main/src/io.rs#L48 which loads test sessions from a CSV file. Here the session entries are sorted by timestamp. The code does not handle cases where several entries have the same timestamp and puts such entries in random order across different executions. A fix is for example to sort by item id in addition for equal timestamps.

The second issue is in https://github.com/bolcom/serenade/blob/main/src/vmisknn/vmis_index.rs#L395 . This code iterates over the session similarities which are stored in a hash map and extracts the top-k entries via a heap. The iteration order over a hashmap is not defined and changes in a non-deterministic way during repeated executions for the same data. If several sessions with the same score are present, there can be case where the selection which of them to put into the top-k entries of the heap changes non-deterministically as well (as it depends on the iteration order). A fix here is to for example sort the keys before iterating.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions