{"about":{"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.","site":"https://codewithpapers.app","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","syntology":{"site":"https://syntology.ai","developers":"https://syntology.ai/developers","mcp":{"server":"https://syntology.ai/mcp","transport":"streamable-http","server_card":"https://syntology.ai/.well-known/mcp/server-card.json","auth":{"type":"trial token, no account","trial_token":"https://syntology.ai/api/oauth/trial/token","method":"POST","docs":"https://syntology.ai/developers"}},"have":"https://syntology.ai/api/graph/have?x=<method, arXiv id or title> (free, answers coverage only)","paper_base":"https://syntology.ai/paper/","atlas_base":"https://app.syntology.ai/?focus="},"machine_readable":[{"url":"https://codewithpapers.app/llms.txt","what":"the machine catalog: every machine-readable file, counted"},{"url":"https://codewithpapers.app/index/manifest.json","what":"paper-to-code index by arXiv id, with Syntology's counts"},{"url":"https://codewithpapers.app/search/manifest.json","what":"site search index (titles, authors) and its files"},{"url":"https://codewithpapers.app/download","what":"bulk files: Syntology's layer, described there"},{"url":"https://codewithpapers.app/build_manifest.json","what":"the build record: inputs, counts, exclusions, probes"}]},"url":"/method/sru-1","slug":"sru-1","name":"SRU++","full_name":"SRU++","full_name_withheld":false,"description_markdown":"**SRU++** is a self-attentive recurrent unit that combines fast recurrence and attention for sequence modeling, extending the [SRU](https://www.paperswithcode.com/method/sru) unit. The key modification of SRU++ is to incorporate more expressive non-linear operations into the recurrent network. Specifically, given the input sequence represented as a matrix $\\mathbf{X} \\in \\mathbb{R}^{L \\times d}$, the attention component computes the query, key and value representations using the following multiplications,\r\n\r\n$$\r\n\\mathbf{Q} =\\mathbf{W}^{q} \\mathbf{X}^{\\top} \r\n$$\r\n\r\n$$\r\n\\mathbf{K} =\\mathbf{W}^{k} \\mathbf{Q} \\\\\r\n$$\r\n\r\n$$\r\n\\mathbf{V} =\\mathbf{W}^{v} \\mathbf{Q}\r\n$$\r\n\r\nwhere $\\mathbf{W}^{q} \\in \\mathbb{R}^{d^{\\prime} \\times d}, \\mathbf{W}^{k}, \\mathbf{W}^{v} \\in \\mathbb{R}^{d^{\\prime} \\times d^{\\prime}}$ are model parameters. $d^{\\prime}$ is the attention dimension that is typically much smaller than $d$. Note that the keys $\\mathbf{K}$ and values $\\mathbf{V}$ are computed using $\\mathbf{Q}$ instead of $\\mathbf{X}$ such that the weight matrices $\\mathbf{W}^{k}$ and $\\mathbf{W}^{v}$ are significantly smaller. \r\n\r\nNext, we compute a weighted average output $\\mathbf{A} \\in \\mathbb{R}^{d^{\\prime} \\times L}$ using [scaled dot-product attention](https://paperswithcode.com/method/scaled):\r\n\r\n$$\r\n\\mathbf{A}^{\\top}=\\operatorname{softmax}\\left(\\frac{\\mathbf{Q}^{\\top} \\mathbf{K}}{\\sqrt{d^{\\prime}}}\\right) \\mathbf{V}^{\\top}\r\n$$\r\n\r\nThe final output $U$ required by the elementwise recurrence is obtained by another linear projection,\r\n\r\n$$\r\n\\mathbf{U}^{\\top}=\\mathbf{W}^{o}(\\mathbf{Q}+\\alpha \\cdot \\mathbf{A})\r\n$$\r\n\r\nwhere $\\alpha \\in \\mathbb{R}$ is a learned scalar and $\\mathbf{W}\\_{o} \\in \\mathbb{R}^{3 d \\times d^{\\prime}}$ is a parameter matrix. $\\mathbf{Q}+\\alpha \\cdot \\mathbf{A}$ is a [residual connection](https://paperswithcode.com/method/residual-connection) which improves gradient propagation and stabilizes training. We initialize $\\alpha$ to zero and as a result,\r\n\r\n$$\r\n\\mathbf{U}^{\\top}=\\mathbf{W}^{o} \\mathbf{Q}=\\left(\\mathbf{W}^{o} \\mathbf{W}^{q}\\right) \\mathbf{X}^{\\top}\r\n$$\r\n\r\ninitially falls back to a linear transformation of the input $X$ skipping the attention transformation. Intuitively, skipping attention encourages leveraging recurrence to capture sequential patterns during early stage of training. As $|\\alpha|$ grows, the attention mechanism can learn long-range dependencies for the model. In addition, $\\mathbf{W}^{o} \\mathbf{W}^{q}$ can be interpreted as applying a matrix factorization trick with a small inner dimension $d^{\\prime}<d$, reducing the total number of parameters. The Figure compares the differences of SRU, SRU with this factorization trick (but without attention), and SRU++.\r\n\r\nThe last modification is adding [layer normalization](https://paperswithcode.com/method/layer-normalization) to each SRU++ layer. We apply normalization after the attention operation and before the matrix multiplication with $\\mathbf{W}^{o}$\r\n\r\n$$\r\n\\mathbf{U}^{\\top}=\\mathbf{W}^{o} \\operatorname{layernorm}(\\mathbf{Q}+\\alpha \\cdot \\mathbf{A})\r\n$$\r\n\r\nThis implementation is post-layer normalization in which the normalization is added after the residual connection.","description_state":"present","introduced_year":null,"introduced_by":{"title":"When Attention Meets Fast Recurrence: Training Language Models with Reduced Compute","paper":"/paper/when-attention-meets-fast-recurrence-training","first_author":"Tao Lei","n_authors":1,"url_abs":null,"archive_paper_url":"https://paperswithcode.com/paper/when-attention-meets-fast-recurrence-training"},"source":{"url":"https://arxiv.org/abs/2102.12459v3","title":"When Attention Meets Fast Recurrence: Training Language Models with Reduced Compute","url_on_a_paper_host":true},"code_snippet_url":null,"code_snippet_url_on_a_code_host":false,"categories":[{"area":"Sequential","area_id":"sequential","collection":"Recurrent Neural Networks","url":"/methods/category/recurrent-neural-networks","pwc_aliases":[]}],"n_papers_tagged":2,"archive_num_papers":2,"papers_newest_first":[{"paper":null,"slug":"sru-pioneering-fast-recurrence-with-attention","title":"SRU++: Pioneering Fast Recurrence with Attention for Speech Recognition","date":"2021-10-11","arxiv_id":"2110.05571","n_code_links":0,"syntology":null},{"paper":"/paper/when-attention-meets-fast-recurrence-training","slug":"when-attention-meets-fast-recurrence-training","title":"When Attention Meets Fast Recurrence: Training Language Models with Reduced Compute","date":"2021-02-24","arxiv_id":"2102.12459","n_code_links":1,"syntology":null}],"papers_shown":2,"papers_order":"date (newest first), then slug","paper_counts":{"archive_papers_tagged":2,"with_a_code_link":1,"where_syntology_ran_a_sample":0,"not_listed_spam_title":0,"listed":2,"listed_where_code_ran":0,"where_syntology_ran_a_sample_split":{"with_a_run_with_no_instrument_failure":0,"every_run_a_failure_of_syntologys_instrument":0,"listed_with_a_run_with_no_instrument_failure":0,"listed_every_run_a_failure_of_syntologys_instrument":0,"filter":{"states":["a run with no instrument failure","any run, instrument failures included"],"default":"a run with no instrument failure","note":"on the 'only where code ran' pages the default hides, in the browser, the rows where every run was a failure of Syntology's instrument; the second state shows them again. Rows are hidden, never re-ordered; these twins list every row"}},"definition":"distinct papers the archive tags; 'where Syntology ran a sample' counts papers with at least one harvested sample that ran, which is not a correctness claim"},"papers_where_code_ran":0,"papers_where_code_ran_first_page":null,"papers_where_code_ran_caption":"We ran code from the paper's repository; we did not isolate this method inside it.","pages":[],"tasks":[{"task":"/task/language-modeling","name":"Language Modeling","papers":2},{"task":"/task/language-modelling","name":"Language Modelling","papers":2},{"task":"/task/machine-translation","name":"Machine Translation","papers":2},{"task":"/task/automatic-speech-recognition-2","name":"Automatic Speech Recognition","papers":1},{"task":"/task/automatic-speech-recognition","name":"Automatic Speech Recognition (ASR)","papers":1},{"task":null,"name":"GPU","papers":1},{"task":"/task/speech-recognition","name":"Speech Recognition","papers":1},{"task":"/task/translation","name":"Translation","papers":1},{"task":"/task/speech-recognition-1","name":"speech-recognition","papers":1}],"tasks_shown":9,"n_tasks":9,"usage_by_year":[{"year":"2021","papers":2}],"row_source":"methods_table","archive":{"source":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","archive_url":"https://paperswithcode.com/method/sru-1"},"syntology_read_at":"2026-10-05T00:36:11+00:00","syntology":{"source":"Syntology's have check for this name (the free coverage lookup), read from Syntology's graph","have_url":"https://syntology.ai/api/graph/have?x=SRU%2B%2B","read_at":"2026-10-05T01:02:31+00:00","query":"SRU++","kind":"method","have":"declared_code","tier":"repo_known","verified_implementation":false,"level":null,"level_meaning":"the served verification level, per answer; never summed across methods","resolved_to":{"method":"SRU++","origin_arxiv_id":"2102.12459"},"resolution":"exact","resolved_name_differs":false,"absence_asserted":false,"absence_unchecked":null,"no_code_is_about_this_method":false,"subject":"same_paper","archive_paper_arxiv_id":"2102.12459","repositories":{"listed":1,"in_graph":1,"list_truncated":false,"strongest_link":"official"},"retrieve_with":null,"name_competition":{"verdict":"contested","may_be_wrong_sense":false,"bearers_found":2,"served":{"arxiv_id":"2102.12459","citations":55},"leading_other_bearer":{"arxiv_id":"2110.05571","title":"SRU++: Pioneering Fast Recurrence with Attention for Speech Recognition","citations":13,"named_by":["title_prefix"],"bearer_name":"SRU++: Pioneering Fast Recurrence with Attention for Speech Recognition","ask_with":"have('2110.05571')"},"n_other_bearers_listed":1,"note":"1 other thing(s) here are also called 'SRU++', and none of them is cited more than the paper this answer is about. They are listed in `also_named` -- check `served.arxiv_id` is the paper you meant."},"name_competition_text":null,"near_matches":null,"code_nearby":[],"code_nearby_caption":null,"origin_paper":{"arxiv_id":"2102.12459","page":"/paper/when-attention-meets-fast-recurrence-training","syntology_url":"https://syntology.ai/paper/2102.12459","in_graph_layer":false,"samples":0},"line":"repository known, no verified implementation (declared_code; repositories: 1 listed of 1 in the graph, strongest link: official). This answer is about arXiv:2102.12459, the paper the archive credits with this method.","level_legend":null},"syntology_have_state":"loaded","record_sha256":"761ab67486d514a000df1a5ddd188101b56dc525f4c2dace1c69565d710ff9b9","record_changed_at":"2026-10-05","record_changed_at_basis":"changed"}