{"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/spikebert-a-language-spikformer-trained-with","title":"SpikeBERT: A Language Spikformer Learned from BERT with Knowledge Distillation","arxiv_id":"2308.15122","date":"2023-08-29","proceeding":null,"authors":["Changze Lv","Tianlong Li","Jianhan Xu","Chenxi Gu","Zixuan Ling","Cenyuan Zhang","Xiaoqing Zheng","Xuanjing Huang"],"abstract":"Spiking neural networks (SNNs) offer a promising avenue to implement deep neural networks in a more energy-efficient way. However, the network architectures of existing SNNs for language tasks are still simplistic and relatively shallow, and deep architectures have not been fully explored, resulting in a significant performance gap compared to mainstream transformer-based networks such as BERT. To this end, we improve a recently-proposed spiking Transformer (i.e., Spikformer) to make it possible to process language tasks and propose a two-stage knowledge distillation method for training it, which combines pre-training by distilling knowledge from BERT with a large collection of unlabelled texts and fine-tuning with task-specific instances via knowledge distillation again from the BERT fine-tuned on the same training examples. Through extensive experimentation, we show that the models trained with our method, named SpikeBERT, outperform state-of-the-art SNNs and even achieve comparable results to BERTs on text classification tasks for both English and Chinese with much less energy consumption. Our code is available at https://github.com/Lvchangze/SpikeBERT.","url_abs":"https://arxiv.org/abs/2308.15122v4","url_pdf":"https://arxiv.org/pdf/2308.15122v4.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":"spikebert-a-language-spikformer-trained-with","repo_url":"https://github.com/Lvchangze/SpikeBERT","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"knowledge-distillation","task_name":"Knowledge Distillation"},{"task_slug":"text-classification","task_name":"Text Classification"},{"task_slug":"text-classification-1","task_name":"text-classification"}],"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":"attention-dropout","method_name":"Attention Dropout"},{"method_slug":"bert","method_name":"BERT"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"knowledge-distillation","method_name":"Knowledge Distillation"},{"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":"linear-warmup-with-linear-decay","method_name":"Linear Warmup With Linear Decay"},{"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"},{"method_slug":"weight-decay","method_name":"Weight Decay"},{"method_slug":"wordpiece","method_name":"WordPiece"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2308.15122","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2308.15122"}},"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/Lvchangze/SpikeBERT","reach":{"status":"ok"}}],"summary":{"ran":8,"unverified":1},"by_repo_kind":{"official":{"samples":9,"ran":8,"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":9,"samples":[{"code_sha256_prefix":"fc24dee092843e40","entry":"animator","repo":"Lvchangze/SpikeBERT","repo_kind":"official","path":"snntorch/spikeplot.py","file_url":"https://github.com/Lvchangze/SpikeBERT/blob/HEAD/snntorch/spikeplot.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"fc24dee092843e40"}},{"code_sha256_prefix":"87c318da3d9efb70","entry":"atan","repo":"Lvchangze/SpikeBERT","repo_kind":"official","path":"snntorch/surrogate.py","file_url":"https://github.com/Lvchangze/SpikeBERT/blob/HEAD/snntorch/surrogate.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"87c318da3d9efb70"}},{"code_sha256_prefix":"21eb026ebffc0795","entry":"delta","repo":"Lvchangze/SpikeBERT","repo_kind":"official","path":"snntorch/spikegen.py","file_url":"https://github.com/Lvchangze/SpikeBERT/blob/HEAD/snntorch/spikegen.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"21eb026ebffc0795"}},{"code_sha256_prefix":"f5b193bde4622c87","entry":"fast_sigmoid","repo":"Lvchangze/SpikeBERT","repo_kind":"official","path":"snntorch/surrogate.py","file_url":"https://github.com/Lvchangze/SpikeBERT/blob/HEAD/snntorch/surrogate.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f5b193bde4622c87"}},{"code_sha256_prefix":"9c8800935fc3f50e","entry":"latency","repo":"Lvchangze/SpikeBERT","repo_kind":"official","path":"snntorch/spikegen.py","file_url":"https://github.com/Lvchangze/SpikeBERT/blob/HEAD/snntorch/spikegen.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9c8800935fc3f50e"}},{"code_sha256_prefix":"9062106e0d1564e3","entry":"raster","repo":"Lvchangze/SpikeBERT","repo_kind":"official","path":"snntorch/spikeplot.py","file_url":"https://github.com/Lvchangze/SpikeBERT/blob/HEAD/snntorch/spikeplot.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9062106e0d1564e3"}},{"code_sha256_prefix":"9b13a20d3da4c19b","entry":"rate","repo":"Lvchangze/SpikeBERT","repo_kind":"official","path":"snntorch/spikegen.py","file_url":"https://github.com/Lvchangze/SpikeBERT/blob/HEAD/snntorch/spikegen.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9b13a20d3da4c19b"}},{"code_sha256_prefix":"20a427d41b37eb17","entry":"sigmoid","repo":"Lvchangze/SpikeBERT","repo_kind":"official","path":"snntorch/surrogate.py","file_url":"https://github.com/Lvchangze/SpikeBERT/blob/HEAD/snntorch/surrogate.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"20a427d41b37eb17"}},{"code_sha256_prefix":"ee372b8b463f17d6","entry":"spike_count","repo":"Lvchangze/SpikeBERT","repo_kind":"official","path":"snntorch/spikeplot.py","file_url":"https://github.com/Lvchangze/SpikeBERT/blob/HEAD/snntorch/spikeplot.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ee372b8b463f17d6"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}