{"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/optimal-sketching-for-trace-estimation","title":"Optimal Sketching for Trace Estimation","arxiv_id":"2111.00664","date":"2021-11-01","proceeding":null,"authors":["Shuli Jiang","Hai Pham","David P. Woodruff","Qiuyi","Zhang"],"abstract":"Matrix trace estimation is ubiquitous in machine learning applications and has traditionally relied on Hutchinson's method, which requires $O(\\log(1/\\delta)/\\epsilon^2)$ matrix-vector product queries to achieve a $(1 \\pm \\epsilon)$-multiplicative approximation to $\\text{tr}(A)$ with failure probability $\\delta$ on positive-semidefinite input matrices $A$. Recently, the Hutch++ algorithm was proposed, which reduces the number of matrix-vector queries from $O(1/\\epsilon^2)$ to the optimal $O(1/\\epsilon)$, and the algorithm succeeds with constant probability. However, in the high probability setting, the non-adaptive Hutch++ algorithm suffers an extra $O(\\sqrt{\\log(1/\\delta)})$ multiplicative factor in its query complexity. Non-adaptive methods are important, as they correspond to sketching algorithms, which are mergeable, highly parallelizable, and provide low-memory streaming algorithms as well as low-communication distributed protocols. In this work, we close the gap between non-adaptive and adaptive algorithms, showing that even non-adaptive algorithms can achieve $O(\\sqrt{\\log(1/\\delta)}/\\epsilon + \\log(1/\\delta))$ matrix-vector products. In addition, we prove matching lower bounds demonstrating that, up to a $\\log \\log(1/\\delta)$ factor, no further improvement in the dependence on $\\delta$ or $\\epsilon$ is possible by any non-adaptive algorithm. Finally, our experiments demonstrate the superior performance of our sketch over the adaptive Hutch++ algorithm, which is less parallelizable, as well as over the non-adaptive Hutchinson's method.","url_abs":"https://arxiv.org/abs/2111.00664v1","url_pdf":"https://arxiv.org/pdf/2111.00664v1.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":"links_only","authors_date_abstract":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license), from the Kaggle arXiv metadata snapshot of 2026-09-12"},"code_links":[{"paper_slug":"optimal-sketching-for-trace-estimation","repo_url":"https://github.com/11hifish/OptSketchTraceEst","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"none","reach":null}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2111.00664","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2111.00664"}},"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/11hifish/OptSketchTraceEst","reach":null}],"summary":{"ran_violates":1,"ran_draft_wrong":3,"ran_honours":2,"ran_fixture":1},"by_repo_kind":{"official":{"samples":7,"ran":7,"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":7,"samples":[{"code_sha256_prefix":"289cfb973a090b4e","entry":"hutchinson","repo":"11hifish/OptSketchTraceEst","repo_kind":"official","path":"algorithms/algos.py","file_url":"https://github.com/11hifish/OptSketchTraceEst/blob/HEAD/algorithms/algos.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"289cfb973a090b4e"}},{"code_sha256_prefix":"c66263446ec6c756","entry":"hutchinson_moment_est","repo":"11hifish/OptSketchTraceEst","repo_kind":"official","path":"logdet/maxent_logdet_seq.py","file_url":"https://github.com/11hifish/OptSketchTraceEst/blob/HEAD/logdet/maxent_logdet_seq.py","link_basis":"first_harvest_node","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":"c66263446ec6c756"}},{"code_sha256_prefix":"bca264e688998c17","entry":"hutchpp","repo":"11hifish/OptSketchTraceEst","repo_kind":"official","path":"algorithms/algos.py","file_url":"https://github.com/11hifish/OptSketchTraceEst/blob/HEAD/algorithms/algos.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"bca264e688998c17"}},{"code_sha256_prefix":"37901787cda24ee3","entry":"hutchpp_moment_est","repo":"11hifish/OptSketchTraceEst","repo_kind":"official","path":"logdet/maxent_logdet_seq.py","file_url":"https://github.com/11hifish/OptSketchTraceEst/blob/HEAD/logdet/maxent_logdet_seq.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"37901787cda24ee3"}},{"code_sha256_prefix":"3e685776fe8432bb","entry":"matvec_fn","repo":"11hifish/OptSketchTraceEst","repo_kind":"official","path":"exp_synthetic.py","file_url":"https://github.com/11hifish/OptSketchTraceEst/blob/HEAD/exp_synthetic.py","link_basis":"first_harvest_node","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":"3e685776fe8432bb"}},{"code_sha256_prefix":"f809391a2a9c2c09","entry":"na_hutchpp","repo":"11hifish/OptSketchTraceEst","repo_kind":"official","path":"algorithms/algos.py","file_url":"https://github.com/11hifish/OptSketchTraceEst/blob/HEAD/algorithms/algos.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f809391a2a9c2c09"}},{"code_sha256_prefix":"cdeac8b6cb20e6ba","entry":"na_hutchpp_moment_est","repo":"11hifish/OptSketchTraceEst","repo_kind":"official","path":"logdet/maxent_logdet_seq.py","file_url":"https://github.com/11hifish/OptSketchTraceEst/blob/HEAD/logdet/maxent_logdet_seq.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"cdeac8b6cb20e6ba"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}