{"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/sequoia-scalable-robust-and-hardware-aware","title":"Sequoia: Scalable, Robust, and Hardware-aware Speculative Decoding","arxiv_id":"2402.12374","date":"2024-02-19","proceeding":null,"authors":["Zhuoming Chen","Avner May","Ruslan Svirschevski","Yuhsun Huang","Max Ryabinin","Zhihao Jia","Beidi Chen"],"abstract":"As the usage of large language models (LLMs) grows, performing efficient inference with these models becomes increasingly important. While speculative decoding has recently emerged as a promising direction for speeding up inference, existing methods are limited in their ability to scale to larger speculation budgets, and adapt to different hyperparameters and hardware. This paper introduces Sequoia, a scalable, robust, and hardware-aware algorithm for speculative decoding. To attain better scalability, Sequoia introduces a dynamic programming algorithm to find the optimal tree structure for the speculated tokens. To achieve robust speculative performance, Sequoia uses a novel sampling and verification method that outperforms prior work across different decoding temperatures. Finally, Sequoia introduces a hardware-aware tree optimizer that maximizes speculative performance by automatically selecting the token tree size and depth for a given hardware platform. Evaluation shows that Sequoia improves the decoding speed of Llama2-7B, Llama2-13B, and Vicuna-33B on an A100 by up to $4.04\\times$, $3.73\\times$, and $2.27\\times$. For offloading setting on L40, Sequoia achieves as low as 0.56 s/token for exact Llama2-70B inference latency, which is $9.96\\times$ on our optimized offloading system (5.6 s/token), $9.7\\times$ than DeepSpeed-Zero-Inference, $19.5\\times$ than Huggingface Accelerate.","url_abs":"https://arxiv.org/abs/2402.12374v2","url_pdf":"https://arxiv.org/pdf/2402.12374v2.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":"sequoia-scalable-robust-and-hardware-aware","repo_url":"https://github.com/infini-ai-lab/sequoia","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[],"methods":[{"method_slug":"speed","method_name":"SPEED"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2402.12374","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2402.12374"}},"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/infini-ai-lab/sequoia","reach":{"status":"ok"}}],"summary":{"ran_fixture":2,"ran":3,"ran_draft_wrong":1,"unverified":4},"by_repo_kind":{"official":{"samples":10,"ran":6,"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":10,"samples":[{"code_sha256_prefix":"3c76e52815c5401d","entry":"repeat_kv","repo":"infini-ai-lab/sequoia","repo_kind":"official","path":"Engine/offload_engine.py","file_url":"https://github.com/infini-ai-lab/sequoia/blob/HEAD/Engine/offload_engine.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":2,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"3c76e52815c5401d"}},{"code_sha256_prefix":"0fe82a947dc39b42","entry":"apply_rotary_pos_emb","repo":"infini-ai-lab/sequoia","repo_kind":"official","path":"Engine/offload_engine.py","file_url":"https://github.com/infini-ai-lab/sequoia/blob/HEAD/Engine/offload_engine.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"0fe82a947dc39b42"}},{"code_sha256_prefix":"12333d41382964d1","entry":"get_residual","repo":"infini-ai-lab/sequoia","repo_kind":"official","path":"utils.py","file_url":"https://github.com/infini-ai-lab/sequoia/blob/HEAD/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":"12333d41382964d1"}},{"code_sha256_prefix":"e03d53ba9d4f9ae5","entry":"rotate_half","repo":"infini-ai-lab/sequoia","repo_kind":"official","path":"Engine/offload_engine.py","file_url":"https://github.com/infini-ai-lab/sequoia/blob/HEAD/Engine/offload_engine.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e03d53ba9d4f9ae5"}},{"code_sha256_prefix":"8ae68c62acab5ae3","entry":"sampling_with_replacement","repo":"infini-ai-lab/sequoia","repo_kind":"official","path":"utils.py","file_url":"https://github.com/infini-ai-lab/sequoia/blob/HEAD/utils.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":"8ae68c62acab5ae3"}},{"code_sha256_prefix":"b732b28665793b45","entry":"sampling_without_replacement","repo":"infini-ai-lab/sequoia","repo_kind":"official","path":"utils.py","file_url":"https://github.com/infini-ai-lab/sequoia/blob/HEAD/utils.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":"b732b28665793b45"}},{"code_sha256_prefix":"9070da5c998a7e68","entry":"capture_graph","repo":"infini-ai-lab/sequoia","repo_kind":"official","path":"Engine/Engine.py","file_url":"https://github.com/infini-ai-lab/sequoia/blob/HEAD/Engine/Engine.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":"9070da5c998a7e68"}},{"code_sha256_prefix":"d8e2c7d6baf5f7f0","entry":"convert_cnn_dataset","repo":"infini-ai-lab/sequoia","repo_kind":"official","path":"data_converter.py","file_url":"https://github.com/infini-ai-lab/sequoia/blob/HEAD/data_converter.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":"d8e2c7d6baf5f7f0"}},{"code_sha256_prefix":"5b1b8a82c36d132f","entry":"convert_wiki_dataset","repo":"infini-ai-lab/sequoia","repo_kind":"official","path":"data_converter.py","file_url":"https://github.com/infini-ai-lab/sequoia/blob/HEAD/data_converter.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":"5b1b8a82c36d132f"}},{"code_sha256_prefix":"35394e2d63e1c44b","entry":"convert_wikimqa_dataset","repo":"infini-ai-lab/sequoia","repo_kind":"official","path":"data_converter.py","file_url":"https://github.com/infini-ai-lab/sequoia/blob/HEAD/data_converter.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":"35394e2d63e1c44b"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}