{"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/tamer-tree-aware-transformer-for-handwritten","title":"TAMER: Tree-Aware Transformer for Handwritten Mathematical Expression Recognition","arxiv_id":"2408.08578","date":"2024-08-16","proceeding":null,"authors":["Jianhua Zhu","Wenqi Zhao","Yu Li","Xingjian Hu","Liangcai Gao"],"abstract":"Handwritten Mathematical Expression Recognition (HMER) has extensive applications in automated grading and office automation. However, existing sequence-based decoding methods, which directly predict $\\LaTeX$ sequences, struggle to understand and model the inherent tree structure of $\\LaTeX$ and often fail to ensure syntactic correctness in the decoded results. To address these challenges, we propose a novel model named TAMER (Tree-Aware Transformer) for handwritten mathematical expression recognition. TAMER introduces an innovative Tree-aware Module while maintaining the flexibility and efficient training of Transformer. TAMER combines the advantages of both sequence decoding and tree decoding models by jointly optimizing sequence prediction and tree structure prediction tasks, which enhances the model's understanding and generalization of complex mathematical expression structures. During inference, TAMER employs a Tree Structure Prediction Scoring Mechanism to improve the structural validity of the generated $\\LaTeX$ sequences. Experimental results on CROHME datasets demonstrate that TAMER outperforms traditional sequence decoding and tree decoding models, especially in handling complex mathematical structures, achieving state-of-the-art (SOTA) performance.","url_abs":"https://arxiv.org/abs/2408.08578v2","url_pdf":"https://arxiv.org/pdf/2408.08578v2.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":"tamer-tree-aware-transformer-for-handwritten","repo_url":"https://github.com/qingzhenduyu/tamer","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"handwritten-mathmatical-expression","task_name":"Handwritten Mathmatical Expression Recognition"},{"task_slug":"prediction","task_name":"Prediction"}],"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":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"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":"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"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/handwritten-mathmatical-expression","task":"Handwritten Mathmatical Expression Recognition","dataset":"CROHME 2014","model":"TAMER","rank_in_archive_order":3,"of":17,"metrics":{"ExpRate":"61.23"},"uses_additional_data":false},{"leaderboard":"/sota/handwritten-mathmatical-expression-1","task":"Handwritten Mathmatical Expression Recognition","dataset":"CROHME 2016","model":"TAMER","rank_in_archive_order":3,"of":16,"metrics":{"ExpRate":"60.26"},"uses_additional_data":false},{"leaderboard":"/sota/handwritten-mathmatical-expression-2","task":"Handwritten Mathmatical Expression Recognition","dataset":"CROHME 2019","model":"TAMER","rank_in_archive_order":3,"of":14,"metrics":{"ExpRate":"61.97"},"uses_additional_data":false},{"leaderboard":"/sota/handwritten-mathmatical-expression-3","task":"Handwritten Mathmatical Expression Recognition","dataset":"HME100K","model":"TAMER","rank_in_archive_order":3,"of":12,"metrics":{"ExpRate":"68.52"},"uses_additional_data":false}],"syntology":{"syntology_url":"https://syntology.ai/paper/2408.08578","atlas_url":"https://app.syntology.ai/?focus=2408.08578","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2408.08578"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/qingzhenduyu/tamer","reach":{"status":"ok"}}],"summary":{"ran":5,"unverified":2},"by_repo_kind":{"official":{"samples":7,"ran":5,"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":"51c4f1ba8cbc8fef","entry":"data_iterator","repo":"qingzhenduyu/tamer","repo_kind":"official","path":"tamer/datamodule/datamodule.py","file_url":"https://github.com/qingzhenduyu/tamer/blob/HEAD/tamer/datamodule/datamodule.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":"51c4f1ba8cbc8fef"}},{"code_sha256_prefix":"6ef73ec3051b3eb0","entry":"extract_data","repo":"qingzhenduyu/tamer","repo_kind":"official","path":"tamer/datamodule/datamodule.py","file_url":"https://github.com/qingzhenduyu/tamer/blob/HEAD/tamer/datamodule/datamodule.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":"6ef73ec3051b3eb0"}},{"code_sha256_prefix":"a7b95b6cf187938e","entry":"findendmatrix","repo":"qingzhenduyu/tamer","repo_kind":"official","path":"tamer/datamodule/latex2gtd.py","file_url":"https://github.com/qingzhenduyu/tamer/blob/HEAD/tamer/datamodule/latex2gtd.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":"a7b95b6cf187938e"}},{"code_sha256_prefix":"70ca7d9a779e6f15","entry":"findnextbracket","repo":"qingzhenduyu/tamer","repo_kind":"official","path":"tamer/datamodule/latex2gtd.py","file_url":"https://github.com/qingzhenduyu/tamer/blob/HEAD/tamer/datamodule/latex2gtd.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":"70ca7d9a779e6f15"}},{"code_sha256_prefix":"e06d2f5f2824ecc6","entry":"rotate_every_two","repo":"qingzhenduyu/tamer","repo_kind":"official","path":"tamer/model/pos_enc.py","file_url":"https://github.com/qingzhenduyu/tamer/blob/HEAD/tamer/model/pos_enc.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":"e06d2f5f2824ecc6"}},{"code_sha256_prefix":"9f2e3298b5be99e0","entry":"collate_fn","repo":"qingzhenduyu/tamer","repo_kind":"official","path":"tamer/datamodule/datamodule.py","file_url":"https://github.com/qingzhenduyu/tamer/blob/HEAD/tamer/datamodule/datamodule.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":"9f2e3298b5be99e0"}},{"code_sha256_prefix":"bffcd3c331e624f2","entry":"latex2Tree","repo":"qingzhenduyu/tamer","repo_kind":"official","path":"tamer/datamodule/latex2gtd.py","file_url":"https://github.com/qingzhenduyu/tamer/blob/HEAD/tamer/datamodule/latex2gtd.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":"bffcd3c331e624f2"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}