{"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/algebraic-positional-encodings","title":"Algebraic Positional Encodings","arxiv_id":"2312.16045","date":"2023-12-26","proceeding":null,"authors":["Konstantinos Kogkalidis","Jean-Philippe Bernardy","Vikas Garg"],"abstract":"We introduce a novel positional encoding strategy for Transformer-style models, addressing the shortcomings of existing, often ad hoc, approaches. Our framework provides a flexible mapping from the algebraic specification of a domain to an interpretation as orthogonal operators. This design preserves the algebraic characteristics of the source domain, ensuring that the model upholds its desired structural properties. Our scheme can accommodate various structures, ncluding sequences, grids and trees, as well as their compositions. We conduct a series of experiments to demonstrate the practical applicability of our approach. Results suggest performance on par with or surpassing the current state-of-the-art, without hyper-parameter optimizations or \"task search\" of any kind. Code is available at https://github.com/konstantinosKokos/ape.","url_abs":"https://arxiv.org/abs/2312.16045v3","url_pdf":"https://arxiv.org/pdf/2312.16045v3.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":"algebraic-positional-encodings","repo_url":"https://github.com/konstantinoskokos/ape","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"algebraic-positional-encodings","repo_url":"https://github.com/konstantinoskokos/unitarype","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"CC-BY-SA-4.0"}}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2312.16045","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2312.16045"}},"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/konstantinoskokos/unitarype","reach":{"status":"ok","spdx":"CC-BY-SA-4.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/konstantinoskokos/ape","reach":null}],"summary":{"ran":9,"ran_draft_wrong":3,"ran_fixture":1,"ran_honours":1},"by_repo_kind":{"official":{"samples":14,"ran":14,"repositories":2}},"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":14,"samples":[{"code_sha256_prefix":"82f46cf27f6b050d","entry":"Branching","repo":"konstantinoskokos/ape","repo_kind":"official","path":"ape/nn/position/algebraic.py","file_url":"https://github.com/konstantinoskokos/ape/blob/HEAD/ape/nn/position/algebraic.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"CC-BY-SA-4.0","inline_ok":false,"mcp_get_code":{"code_sha256":"82f46cf27f6b050d"}},{"code_sha256_prefix":"b26ded5e4759c67f","entry":"applicative","repo":"konstantinoskokos/ape","repo_kind":"official","path":"ape/nn/position/algebraic.py","file_url":"https://github.com/konstantinoskokos/ape/blob/HEAD/ape/nn/position/algebraic.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"CC-BY-SA-4.0","inline_ok":false,"mcp_get_code":{"code_sha256":"b26ded5e4759c67f"}},{"code_sha256_prefix":"84f611811acc8623","entry":"beam_active","repo":"konstantinoskokos/unitarype","repo_kind":"official","path":"eval/models/nmt/base.py","file_url":"https://github.com/konstantinoskokos/unitarype/blob/HEAD/eval/models/nmt/base.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"CC-BY-SA-4.0","inline_ok":false,"mcp_get_code":{"code_sha256":"84f611811acc8623"}},{"code_sha256_prefix":"1b5b1a8a40b47b92","entry":"beam_search","repo":"konstantinoskokos/unitarype","repo_kind":"official","path":"eval/models/nmt/base.py","file_url":"https://github.com/konstantinoskokos/unitarype/blob/HEAD/eval/models/nmt/base.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"CC-BY-SA-4.0","inline_ok":false,"mcp_get_code":{"code_sha256":"1b5b1a8a40b47b92"}},{"code_sha256_prefix":"651e7c9e76c6ea73","entry":"create_paths","repo":"konstantinoskokos/ape","repo_kind":"official","path":"ape/nn/position/algebraic.py","file_url":"https://github.com/konstantinoskokos/ape/blob/HEAD/ape/nn/position/algebraic.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"CC-BY-SA-4.0","inline_ok":false,"mcp_get_code":{"code_sha256":"651e7c9e76c6ea73"}},{"code_sha256_prefix":"8836ba7e4a50d0ba","entry":"create_steps","repo":"konstantinoskokos/ape","repo_kind":"official","path":"ape/nn/position/algebraic.py","file_url":"https://github.com/konstantinoskokos/ape/blob/HEAD/ape/nn/position/algebraic.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":"CC-BY-SA-4.0","inline_ok":false,"mcp_get_code":{"code_sha256":"8836ba7e4a50d0ba"}},{"code_sha256_prefix":"e61c32bb0f3aa28d","entry":"drop_path","repo":"konstantinoskokos/unitarype","repo_kind":"official","path":"ape/nn/drop_path.py","file_url":"https://github.com/konstantinoskokos/unitarype/blob/HEAD/ape/nn/drop_path.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"CC-BY-SA-4.0","inline_ok":false,"mcp_get_code":{"code_sha256":"e61c32bb0f3aa28d"}},{"code_sha256_prefix":"dbd6097f38fb1a58","entry":"make_cosine_schedule","repo":"konstantinoskokos/unitarype","repo_kind":"official","path":"ape/nn/schedule.py","file_url":"https://github.com/konstantinoskokos/unitarype/blob/HEAD/ape/nn/schedule.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"CC-BY-SA-4.0","inline_ok":false,"mcp_get_code":{"code_sha256":"dbd6097f38fb1a58"}},{"code_sha256_prefix":"1c37865da38b7a15","entry":"make_decoder_mask","repo":"konstantinoskokos/unitarype","repo_kind":"official","path":"eval/models/nmt/base.py","file_url":"https://github.com/konstantinoskokos/unitarype/blob/HEAD/eval/models/nmt/base.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"CC-BY-SA-4.0","inline_ok":false,"mcp_get_code":{"code_sha256":"1c37865da38b7a15"}},{"code_sha256_prefix":"c07063a31085fbe6","entry":"make_linear_schedule","repo":"konstantinoskokos/unitarype","repo_kind":"official","path":"ape/nn/schedule.py","file_url":"https://github.com/konstantinoskokos/unitarype/blob/HEAD/ape/nn/schedule.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"CC-BY-SA-4.0","inline_ok":false,"mcp_get_code":{"code_sha256":"c07063a31085fbe6"}},{"code_sha256_prefix":"5bf842eb35f51278","entry":"make_mediator","repo":"konstantinoskokos/unitarype","repo_kind":"official","path":"eval/models/nmt/algebraic.py","file_url":"https://github.com/konstantinoskokos/unitarype/blob/HEAD/eval/models/nmt/algebraic.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"CC-BY-SA-4.0","inline_ok":false,"mcp_get_code":{"code_sha256":"5bf842eb35f51278"}},{"code_sha256_prefix":"73f5517c35fddfa8","entry":"make_schedule","repo":"konstantinoskokos/unitarype","repo_kind":"official","path":"ape/nn/schedule.py","file_url":"https://github.com/konstantinoskokos/unitarype/blob/HEAD/ape/nn/schedule.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"CC-BY-SA-4.0","inline_ok":false,"mcp_get_code":{"code_sha256":"73f5517c35fddfa8"}},{"code_sha256_prefix":"35bf3adaa9416633","entry":"multihead_atn_fn","repo":"konstantinoskokos/ape","repo_kind":"official","path":"ape/nn/position/algebraic.py","file_url":"https://github.com/konstantinoskokos/ape/blob/HEAD/ape/nn/position/algebraic.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"CC-BY-SA-4.0","inline_ok":false,"mcp_get_code":{"code_sha256":"35bf3adaa9416633"}},{"code_sha256_prefix":"bd29c10489d04283","entry":"rope_like_init","repo":"konstantinoskokos/ape","repo_kind":"official","path":"ape/nn/position/algebraic.py","file_url":"https://github.com/konstantinoskokos/ape/blob/HEAD/ape/nn/position/algebraic.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"CC-BY-SA-4.0","inline_ok":false,"mcp_get_code":{"code_sha256":"bd29c10489d04283"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}