{"id":16885575,"url":"https://github.com/maciejkula/binge","last_synced_at":"2025-07-14T15:33:59.970Z","repository":{"id":80032922,"uuid":"90901108","full_name":"maciejkula/binge","owner":"maciejkula","description":"Recommendation models that use binary rather than floating point operations at prediction time.","archived":false,"fork":false,"pushed_at":"2017-09-18T21:43:49.000Z","size":166,"stargazers_count":21,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-05T21:33:56.963Z","etag":null,"topics":["deep-learning","learning-to-rank","machine-learning","matrix-factorization","recommender"],"latest_commit_sha":null,"homepage":"","language":"TeX","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maciejkula.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-10T19:31:33.000Z","updated_at":"2024-01-04T16:13:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"6eeed675-9a22-4c4f-8af1-c0735c8b38d3","html_url":"https://github.com/maciejkula/binge","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/maciejkula/binge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maciejkula%2Fbinge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maciejkula%2Fbinge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maciejkula%2Fbinge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maciejkula%2Fbinge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maciejkula","download_url":"https://codeload.github.com/maciejkula/binge/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maciejkula%2Fbinge/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265312165,"owners_count":23745179,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","learning-to-rank","machine-learning","matrix-factorization","recommender"],"created_at":"2024-10-13T16:35:57.474Z","updated_at":"2025-07-14T15:33:59.933Z","avatar_url":"https://github.com/maciejkula.png","language":"TeX","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Binary Representations in Recommendations\n\nThis repository contains an implementation of recommendation models that use binary rather than floating point operations at prediction time. This makes them much faster (and less memory intensive), but also less accurate.\n\nThe details are in the [paper](https://arxiv.org/abs/1706.07479) and in the [slides](https://speakerdeck.com/maciejkula/binary-embeddings-for-efficient-ranking).\n\n## Implementation\n\nThe [model](binge/models.py#L134) is implemented in PyTorch for fitting, and [C](binge/predict.c#L118) for prediction (using AVX2 SIMD operations).\n\n## Results\n```\nDimension   MRR Binary MRR MRR ratio   PPMS Binary PPMS PPMS ratio Memory use ratio\n      32 0.077      0.059     0.768 87,758     264,146      3.010            0.091\n      64 0.075      0.066     0.878 45,992     220,833      4.802            0.062\n     128 0.076      0.071     0.935 23,870     166,252      6.965            0.047\n     256 0.078      0.071     0.908 12,284     190,131     15.477            0.039\n     512 0.080      0.073     0.912   6074     122,637     20.190            0.035\n    1024 0.080      0.075     0.936   3056      61,301     20.056            0.033\n\n```\n\nThe table above summarises the results of comparing floating point and binary models on the Movielens 1M dataset. MRR (mean reciprocal rank) ratio denotes the fraction of the real-valued MRR the binary model achieves for that dimensionality; PPMS (predictions per millisecond) ratio denotes how many more predictions the binary model can compute per millisecond.\n\nIt appears that  continous models retain good accuracy as latent dimensionality decreases, binary models' representational power sharply deteriorates. Moving from the 1024 to 32 dimensions in the continuous model implies a 29 times increase in prediction speed at the expense of a modest 4% decrease in accuracy. This compares favourably to switching to binary representations: moving to a 1024-binary dimensional representation implies a sharper accuracy drop at 6% in exchange for a smaller 20 times increase in prediction speed. Moving to 32 dimensions yields a further speed gains at 86 times, but at the cost of a considerable loss of accuracy at 26%.\n\nThe results suggest that latent recommender models have good representational power even at low latent dimensionalities. This advantage is lost when using binary embeddings, which need to be high-dimensional to achieve comparable accuracy. At the same time, binary representations' speed advantage is only evident at high dimensions. The attractiveness of binary representations is tightly coupled with high-dimensional models where a single prediction requires many floating point operations, such as convolutional neural networks. Relatively compact latent factor models do not fall into this category.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaciejkula%2Fbinge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaciejkula%2Fbinge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaciejkula%2Fbinge/lists"}