{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/whitening-sentence-representations-for-better","title":"Whitening Sentence Representations for Better Semantics and Faster Retrieval","arxiv_id":"2103.15316","date":"2021-03-29","proceeding":null,"authors":["Jianlin Su","Jiarun Cao","Weijie Liu","Yangyiwen Ou"],"abstract":"Pre-training models such as BERT have achieved great success in many natural language processing tasks. However, how to obtain better sentence representation through these pre-training models is still worthy to exploit. Previous work has shown that the anisotropy problem is an critical bottleneck for BERT-based sentence representation which hinders the model to fully utilize the underlying semantic features. Therefore, some attempts of boosting the isotropy of sentence distribution, such as flow-based model, have been applied to sentence representations and achieved some improvement. In this paper, we find that the whitening operation in traditional machine learning can similarly enhance the isotropy of sentence representations and achieve competitive results. Furthermore, the whitening technique is also capable of reducing the dimensionality of the sentence representation. Our experimental results show that it can not only achieve promising performance but also significantly reduce the storage cost and accelerate the model retrieval speed.","url_abs":"https://arxiv.org/abs/2103.15316v1","url_pdf":"https://arxiv.org/pdf/2103.15316v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"whitening-sentence-representations-for-better","repo_url":"https://github.com/bojone/BERT-whitening","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok"}},{"paper_slug":"whitening-sentence-representations-for-better","repo_url":"https://github.com/autoliuweijie/bert-whitening-pytorch","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"whitening-sentence-representations-for-better","repo_url":"https://github.com/sleepthroughdifficulties/kernelwhitening","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"retrieval","task_name":"Retrieval"},{"task_slug":"sentence","task_name":"Sentence"}],"methods":[{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"attention-dropout","method_name":"Attention Dropout"},{"method_slug":"bert","method_name":"BERT"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"linear-warmup-with-linear-decay","method_name":"Linear Warmup With Linear Decay"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"weight-decay","method_name":"Weight Decay"},{"method_slug":"wordpiece","method_name":"WordPiece"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2103.15316","atlas_url":"https://app.syntology.ai/?focus=2103.15316","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2103.15316"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/bojone/BERT-whitening","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/sleepthroughdifficulties/kernelwhitening","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/autoliuweijie/bert-whitening-pytorch","reach":null}],"summary":{"ran_violates":1,"ran_honours":1,"unverified":3},"by_repo_kind":{"listed":{"samples":5,"ran":2,"repositories":2}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"d259d4952723bb10","entry":"check_data","repo":"sleepthroughdifficulties/kernelwhitening","repo_kind":"listed","path":"EMNLP22/utilis/datasets.py","file_url":"https://github.com/sleepthroughdifficulties/kernelwhitening/blob/HEAD/EMNLP22/utilis/datasets.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d259d4952723bb10"}},{"code_sha256_prefix":"ea5e089cab451f0a","entry":"processSentences","repo":"sleepthroughdifficulties/kernelwhitening","repo_kind":"listed","path":"EMNLP22/utilis/datasets.py","file_url":"https://github.com/sleepthroughdifficulties/kernelwhitening/blob/HEAD/EMNLP22/utilis/datasets.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"ea5e089cab451f0a"}},{"code_sha256_prefix":"85db364c67187a22","entry":"batcher","repo":"autoliuweijie/bert-whitening-pytorch","repo_kind":"listed","path":"eval_with_whitening(nli).py","file_url":"https://github.com/autoliuweijie/bert-whitening-pytorch/blob/HEAD/eval_with_whitening%28nli%29.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"85db364c67187a22"}},{"code_sha256_prefix":"9ca27cd7321dc94d","entry":"prepare","repo":"autoliuweijie/bert-whitening-pytorch","repo_kind":"listed","path":"eval_with_whitening(nli).py","file_url":"https://github.com/autoliuweijie/bert-whitening-pytorch/blob/HEAD/eval_with_whitening%28nli%29.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9ca27cd7321dc94d"}},{"code_sha256_prefix":"41a1326c23b14192","entry":"prepare","repo":"autoliuweijie/bert-whitening-pytorch","repo_kind":"listed","path":"eval_with_whitening(target).py","file_url":"https://github.com/autoliuweijie/bert-whitening-pytorch/blob/HEAD/eval_with_whitening%28target%29.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"41a1326c23b14192"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}