{"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/enhancing-transformer-rnns-with-multiple","title":"Enhancing Transformer RNNs with Multiple Temporal Perspectives","arxiv_id":"2402.02625","date":"2024-02-04","proceeding":null,"authors":["Razvan-Gabriel Dumitru","Darius Peteleaza","Mihai Surdeanu"],"abstract":"We introduce the concept of multiple temporal perspectives, a novel approach applicable to Recurrent Neural Network (RNN) architectures for enhancing their understanding of sequential data. This method involves maintaining diverse temporal views of previously encountered text, significantly enriching the language models' capacity to interpret context. To show the efficacy of this approach, we incorporate it into the Receptance Weighted Key Value (RWKV) architecture, addressing its inherent challenge of retaining all historical information within a single hidden state. Notably, this improvement is achieved with a minimal increase in the number of parameters --even as little as $0.04\\%$ of the original number of parameters. Further, the additional parameters necessary for the multiple temporal perspectives are fine-tuned with minimal computational overhead, avoiding the need for a full pre-training. The resulting model maintains linear computational complexity during prompt inference, ensuring consistent efficiency across various sequence lengths. The empirical results and ablation studies included in our research validate the effectiveness of our approach, showcasing improved performance across multiple benchmarks. The code, model weights and datasets are open-sourced at: https://github.com/RazvanDu/TemporalRNNs.","url_abs":"https://arxiv.org/abs/2402.02625v2","url_pdf":"https://arxiv.org/pdf/2402.02625v2.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":"enhancing-transformer-rnns-with-multiple","repo_url":"https://github.com/razvandu/temporalrnns","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2402.02625","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2402.02625"}},"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":"deterministic:regex_extraction","url":"https://github.com/RazvanDu/TemporalRNNs","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/razvandu/temporalrnns","reach":{"status":"ok"}}],"summary":{"ran":3,"unverified":3},"by_repo_kind":{"official":{"samples":6,"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":6,"samples":[{"code_sha256_prefix":"78743ba0d202ec36","entry":"code","repo":"RazvanDu/TemporalRNNs","repo_kind":"official","path":"MultiplePerspectives/src/binidx.py","file_url":"https://github.com/RazvanDu/TemporalRNNs/blob/HEAD/MultiplePerspectives/src/binidx.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":"78743ba0d202ec36"}},{"code_sha256_prefix":"c698017abb36d19c","entry":"cosine_similarity","repo":"RazvanDu/TemporalRNNs","repo_kind":"official","path":"MultiplePerspectives/src/model_run_ours.py","file_url":"https://github.com/RazvanDu/TemporalRNNs/blob/HEAD/MultiplePerspectives/src/model_run_ours.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":"c698017abb36d19c"}},{"code_sha256_prefix":"c1934c6bad591733","entry":"to_float","repo":"RazvanDu/TemporalRNNs","repo_kind":"official","path":"MultiplePerspectives/src/utils.py","file_url":"https://github.com/RazvanDu/TemporalRNNs/blob/HEAD/MultiplePerspectives/src/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"c1934c6bad591733"}},{"code_sha256_prefix":"e7f22ce43cbbcab9","entry":"RWKV_RNN","repo":"razvandu/temporalrnns","repo_kind":"official","path":"MultiplePerspectives/src/model_run_ours.py","file_url":"https://github.com/razvandu/temporalrnns/blob/HEAD/MultiplePerspectives/src/model_run_ours.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":"e7f22ce43cbbcab9"}},{"code_sha256_prefix":"bdf28f9492a770dc","entry":"data_file_path","repo":"RazvanDu/TemporalRNNs","repo_kind":"official","path":"MultiplePerspectives/src/binidx.py","file_url":"https://github.com/RazvanDu/TemporalRNNs/blob/HEAD/MultiplePerspectives/src/binidx.py","link_basis":"harvester_set","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":"bdf28f9492a770dc"}},{"code_sha256_prefix":"8b1a74a6db32c163","entry":"index_file_path","repo":"RazvanDu/TemporalRNNs","repo_kind":"official","path":"MultiplePerspectives/src/binidx.py","file_url":"https://github.com/RazvanDu/TemporalRNNs/blob/HEAD/MultiplePerspectives/src/binidx.py","link_basis":"harvester_set","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":"8b1a74a6db32c163"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}