{"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/retvec-resilient-and-efficient-text","title":"RETVec: Resilient and Efficient Text Vectorizer","arxiv_id":"2302.09207","date":"2023-02-18","proceeding":"NeurIPS 2023 11","authors":["Elie Bursztein","Marina Zhang","Owen Vallis","Xinyu Jia","Alexey Kurakin"],"abstract":"This paper describes RETVec, an efficient, resilient, and multilingual text vectorizer designed for neural-based text processing. RETVec combines a novel character encoding with an optional small embedding model to embed words into a 256-dimensional vector space. The RETVec embedding model is pre-trained using pair-wise metric learning to be robust against typos and character-level adversarial attacks. In this paper, we evaluate and compare RETVec to state-of-the-art vectorizers and word embeddings on popular model architectures and datasets. These comparisons demonstrate that RETVec leads to competitive, multilingual models that are significantly more resilient to typos and adversarial text attacks. RETVec is available under the Apache 2 license at https://github.com/google-research/retvec.","url_abs":"https://arxiv.org/abs/2302.09207v3","url_pdf":"https://arxiv.org/pdf/2302.09207v3.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":"retvec-resilient-and-efficient-text","repo_url":"https://github.com/google-research/retvec","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"tf","reach":null}],"tasks":[{"task_slug":"adversarial-text","task_name":"Adversarial Text"},{"task_slug":"metric-learning","task_name":"Metric Learning"},{"task_slug":"word-embeddings","task_name":"Word Embeddings"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2302.09207","atlas_url":"https://app.syntology.ai/?focus=2302.09207","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2302.09207"}},"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":"deterministic:regex_extraction","url":"https://github.com/google-research/retvec","reach":null}],"summary":{"ran":2,"ran_fixture":1,"unverified":4},"by_repo_kind":{"official":{"samples":7,"ran":3,"repositories":1}},"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":"1953f86b2e83d02f","entry":"RETVecIntToBinary","repo":"google-research/retvec","repo_kind":"official","path":"retvec/tf/layers/tokenizer.py","file_url":"https://github.com/google-research/retvec/blob/HEAD/retvec/tf/layers/tokenizer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"1953f86b2e83d02f"}},{"code_sha256_prefix":"776e1afaf9b7c7da","entry":"RETVecIntegerizer","repo":"google-research/retvec","repo_kind":"official","path":"retvec/tf/layers/tokenizer.py","file_url":"https://github.com/google-research/retvec/blob/HEAD/retvec/tf/layers/tokenizer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"776e1afaf9b7c7da"}},{"code_sha256_prefix":"8bb9169209b09470","entry":"_reshape_embeddings","repo":"google-research/retvec","repo_kind":"official","path":"retvec/tf/layers/tokenizer.py","file_url":"https://github.com/google-research/retvec/blob/HEAD/retvec/tf/layers/tokenizer.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"8bb9169209b09470"}},{"code_sha256_prefix":"bde2b45305369264","entry":"RETVecBinarizer","repo":"google-research/retvec","repo_kind":"official","path":"retvec/tf/layers/tokenizer.py","file_url":"https://github.com/google-research/retvec/blob/HEAD/retvec/tf/layers/tokenizer.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"bde2b45305369264"}},{"code_sha256_prefix":"97997be5edd715b5","entry":"RETVecEmbedding","repo":"google-research/retvec","repo_kind":"official","path":"retvec/tf/layers/tokenizer.py","file_url":"https://github.com/google-research/retvec/blob/HEAD/retvec/tf/layers/tokenizer.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"97997be5edd715b5"}},{"code_sha256_prefix":"27a5474470da210f","entry":"RETVecTokenizer","repo":"google-research/retvec","repo_kind":"official","path":"retvec/tf/layers/tokenizer.py","file_url":"https://github.com/google-research/retvec/blob/HEAD/retvec/tf/layers/tokenizer.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"27a5474470da210f"}},{"code_sha256_prefix":"0fa9283e2d6d503d","entry":"download_retvec_saved_model","repo":"google-research/retvec","repo_kind":"official","path":"retvec/tf/layers/tokenizer.py","file_url":"https://github.com/google-research/retvec/blob/HEAD/retvec/tf/layers/tokenizer.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"0fa9283e2d6d503d"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}