{"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/keyword-transformer-a-self-attention-model","title":"Keyword Transformer: A Self-Attention Model for Keyword Spotting","arxiv_id":"2104.00769","date":"2021-04-01","proceeding":null,"authors":["Axel Berg","Mark O'Connor","Miguel Tairum Cruz"],"abstract":"The Transformer architecture has been successful across many domains, including natural language processing, computer vision and speech recognition. In keyword spotting, self-attention has primarily been used on top of convolutional or recurrent encoders. We investigate a range of ways to adapt the Transformer architecture to keyword spotting and introduce the Keyword Transformer (KWT), a fully self-attentional architecture that exceeds state-of-the-art performance across multiple tasks without any pre-training or additional data. Surprisingly, this simple architecture outperforms more complex models that mix convolutional, recurrent and attentive layers. KWT can be used as a drop-in replacement for these models, setting two new benchmark records on the Google Speech Commands dataset with 98.6% and 97.7% accuracy on the 12 and 35-command tasks respectively.","url_abs":"https://arxiv.org/abs/2104.00769v3","url_pdf":"https://arxiv.org/pdf/2104.00769v3.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":"keyword-transformer-a-self-attention-model","repo_url":"https://github.com/ARM-software/keyword-transformer","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"keyword-transformer-a-self-attention-model","repo_url":"https://github.com/Arizona-Voice/Arizona-spotting","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"keyword-transformer-a-self-attention-model","repo_url":"https://github.com/ID56/Torch-KWT","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"keyword-transformer-a-self-attention-model","repo_url":"https://github.com/aau-es-ml/ssl_noise-robust_kws","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"keyword-transformer-a-self-attention-model","repo_url":"https://github.com/holgerbovbjerg/data2vec-kws","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"keyword-transformer-a-self-attention-model","repo_url":"https://github.com/intelligentmachines/keyword_spotting_transformer","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"keyword-transformer-a-self-attention-model","repo_url":"https://github.com/mashrurmorshed/torch-kwt","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"keyword-transformer-a-self-attention-model","repo_url":"https://github.com/phanxuanphucnd/Arizona-spotting","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":null},{"paper_slug":"keyword-transformer-a-self-attention-model","repo_url":"https://github.com/EscVM/EscVM_YT/blob/master/Notebooks/1%20-%20TF2.X%20DeepAI-Quickie/tf_2_keyword_transformer.ipynb","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"tf","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"keyword-transformer-a-self-attention-model","repo_url":"https://github.com/KrishnaDN/Keyword-Transformer","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"none","reach":{"status":"ok"}}],"tasks":[{"task_slug":"keyword-spotting","task_name":"Keyword Spotting"},{"task_slug":"speech-recognition","task_name":"Speech Recognition"}],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/keyword-spotting-on-google-speech-commands","task":"Keyword Spotting","dataset":"Google Speech Commands","model":"KWT-3","rank_in_archive_order":5,"of":42,"metrics":{"Google Speech Commands V1 12":"97.49 ±0.15","Google Speech Commands V2 12":"98.56 ±0.07","Google Speech Commands V2 35":"97.69 ±0.09"},"uses_additional_data":false},{"leaderboard":"/sota/keyword-spotting-on-google-speech-commands","task":"Keyword Spotting","dataset":"Google Speech Commands","model":"KWT-2","rank_in_archive_order":8,"of":42,"metrics":{"Google Speech Commands V1 12":"97.27 ±0.08","Google Speech Commands V2 12":"98.43±0.08","Google Speech Commands V2 35":"97.74 ±0.03"},"uses_additional_data":false},{"leaderboard":"/sota/keyword-spotting-on-google-speech-commands","task":"Keyword Spotting","dataset":"Google Speech Commands","model":"KWT-1","rank_in_archive_order":9,"of":42,"metrics":{"Google Speech Commands V1 12":"97.26±0.18","Google Speech Commands V2 12":"98.08±0.10","Google Speech Commands V2 35":"96.95±0.14"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2104.00769","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2104.00769"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+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/aau-es-ml/ssl_noise-robust_kws","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/ID56/Torch-KWT","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/KrishnaDN/Keyword-Transformer","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/phanxuanphucnd/Arizona-spotting","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/holgerbovbjerg/data2vec-kws","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/intelligentmachines/keyword_spotting_transformer","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/Arizona-Voice/Arizona-spotting","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/mashrurmorshed/torch-kwt","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/EscVM/EscVM_YT/blob/master/Notebooks/1%20-%20TF2.X%20DeepAI-Quickie/tf_2_keyword_transformer.ipynb","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/ARM-software/keyword-transformer","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran_draft_wrong":1,"unverified":15},"by_repo_kind":{"listed":{"samples":16,"ran":1,"repositories":5}},"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":"189d634a5204c3ef","entry":"find_consecutive_values","repo":"phanxuanphucnd/Arizona-spotting","repo_kind":"listed","path":"demo/app_kws.py","file_url":"https://github.com/phanxuanphucnd/Arizona-spotting/blob/HEAD/demo/app_kws.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"189d634a5204c3ef"}},{"code_sha256_prefix":"12d715bdf737f38c","entry":"calc_step","repo":"ID56/Torch-KWT","repo_kind":"listed","path":"utils/misc.py","file_url":"https://github.com/ID56/Torch-KWT/blob/HEAD/utils/misc.py","link_basis":"harvester_set","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":"12d715bdf737f38c"}},{"code_sha256_prefix":"854b6b5cf6315fbc","entry":"count_params","repo":"ID56/Torch-KWT","repo_kind":"listed","path":"utils/misc.py","file_url":"https://github.com/ID56/Torch-KWT/blob/HEAD/utils/misc.py","link_basis":"harvester_set","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":"854b6b5cf6315fbc"}},{"code_sha256_prefix":"40175e67a61190d6","entry":"evaluate","repo":"ID56/Torch-KWT","repo_kind":"listed","path":"utils/trainer.py","file_url":"https://github.com/ID56/Torch-KWT/blob/HEAD/utils/trainer.py","link_basis":"harvester_set","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":"40175e67a61190d6"}},{"code_sha256_prefix":"d203ddadc113d9d6","entry":"get_config","repo":"ID56/Torch-KWT","repo_kind":"listed","path":"config_parser.py","file_url":"https://github.com/ID56/Torch-KWT/blob/HEAD/config_parser.py","link_basis":"harvester_set","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":"d203ddadc113d9d6"}},{"code_sha256_prefix":"90190d4490581c2d","entry":"get_from_registry","repo":"Arizona-Voice/Arizona-spotting","repo_kind":"listed","path":"arizona_spotting/utils/misc_utils.py","file_url":"https://github.com/Arizona-Voice/Arizona-spotting/blob/HEAD/arizona_spotting/utils/misc_utils.py","link_basis":"harvester_set","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":"90190d4490581c2d"}},{"code_sha256_prefix":"4a28eb83a542016f","entry":"get_label","repo":"intelligentmachines/keyword_spotting_transformer","repo_kind":"listed","path":"preprocessing.py","file_url":"https://github.com/intelligentmachines/keyword_spotting_transformer/blob/HEAD/preprocessing.py","link_basis":"harvester_set","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":"4a28eb83a542016f"}},{"code_sha256_prefix":"d65ca06fe0124125","entry":"get_optimizer","repo":"ID56/Torch-KWT","repo_kind":"listed","path":"utils/opt.py","file_url":"https://github.com/ID56/Torch-KWT/blob/HEAD/utils/opt.py","link_basis":"harvester_set","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":"d65ca06fe0124125"}},{"code_sha256_prefix":"43893718a859b6fe","entry":"get_preds","repo":"mashrurmorshed/torch-kwt","repo_kind":"listed","path":"inference.py","file_url":"https://github.com/mashrurmorshed/torch-kwt/blob/HEAD/inference.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":"43893718a859b6fe"}},{"code_sha256_prefix":"d836a387836b9a38","entry":"get_scheduler","repo":"ID56/Torch-KWT","repo_kind":"listed","path":"utils/scheduler.py","file_url":"https://github.com/ID56/Torch-KWT/blob/HEAD/utils/scheduler.py","link_basis":"harvester_set","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":"d836a387836b9a38"}},{"code_sha256_prefix":"207ecf57a690304c","entry":"get_train_val_test_split","repo":"ID56/Torch-KWT","repo_kind":"listed","path":"utils/dataset.py","file_url":"https://github.com/ID56/Torch-KWT/blob/HEAD/utils/dataset.py","link_basis":"harvester_set","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":"207ecf57a690304c"}},{"code_sha256_prefix":"ea6f42601b6cb44e","entry":"ifnone","repo":"Arizona-Voice/Arizona-spotting","repo_kind":"listed","path":"arizona_spotting/utils/misc_utils.py","file_url":"https://github.com/Arizona-Voice/Arizona-spotting/blob/HEAD/arizona_spotting/utils/misc_utils.py","link_basis":"harvester_set","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":"ea6f42601b6cb44e"}},{"code_sha256_prefix":"d1bdc96cc20606ef","entry":"kwt_from_name","repo":"ID56/Torch-KWT","repo_kind":"listed","path":"models/kwt.py","file_url":"https://github.com/ID56/Torch-KWT/blob/HEAD/models/kwt.py","link_basis":"harvester_set","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":"d1bdc96cc20606ef"}},{"code_sha256_prefix":"cce294fcacc4be3b","entry":"load_files","repo":"intelligentmachines/keyword_spotting_transformer","repo_kind":"listed","path":"preprocessing.py","file_url":"https://github.com/intelligentmachines/keyword_spotting_transformer/blob/HEAD/preprocessing.py","link_basis":"harvester_set","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":"cce294fcacc4be3b"}},{"code_sha256_prefix":"9e0b1e5fd4f77016","entry":"str2bool","repo":"Arizona-Voice/Arizona-spotting","repo_kind":"listed","path":"arizona_spotting/utils/misc_utils.py","file_url":"https://github.com/Arizona-Voice/Arizona-spotting/blob/HEAD/arizona_spotting/utils/misc_utils.py","link_basis":"harvester_set","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":"9e0b1e5fd4f77016"}},{"code_sha256_prefix":"1aa66761878693ca","entry":"train_single_batch","repo":"ID56/Torch-KWT","repo_kind":"listed","path":"utils/trainer.py","file_url":"https://github.com/ID56/Torch-KWT/blob/HEAD/utils/trainer.py","link_basis":"harvester_set","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":"1aa66761878693ca"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}