{"record":{"id":"76cac93ebc8f4e86","repo":"xai-org/x-algorithm","slug":"invalid-backward-pass-implementation-backward-pa","errorCode":null,"errorMessage":"Invalid backward pass implementation: {backward_pass_impl}","messagePattern":"Invalid backward pass implementation: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"phoenix/xrex/pallas/attention.py","lineNumber":702,"sourceCode":"                ),\n            ],\n            out_specs=[\n                pl.BlockSpec(\n                    index_map=lambda j, k, _: (j, 0, k, 0),\n                    block_shape=(None, seq_len, None, head_dim),\n                ),\n                pl.BlockSpec(\n                    index_map=lambda j, k, _: (j, 0, k, 0),\n                    block_shape=(None, seq_len, None, head_dim),\n                ),\n            ],\n            name=\"mha_backward_kv\",\n            debug=debug,\n            interpret=interpret,\n            compiler_params=CompilerParams(num_warps=num_warps, num_stages=2),\n        )(q, k, v, temp, segment_ids, out, do_scaled, l, m, delta)\n    else:\n        raise ValueError(f\"Invalid backward pass implementation: {backward_pass_impl}\")\n    return dq.astype(q.dtype), dk, dv, dtemp, dsegment\n\n\nmha.defvjp(_mha_forward, _mha_backward)\n","sourceCodeStart":684,"sourceCodeEnd":707,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/phoenix/xrex/pallas/attention.py#L684-L707","documentation":"The MHA backward pass dispatcher received a backward_pass_impl string it does not recognize. The implementation supports only specific named backward variants (the 'kv' variant shown above); anything else falls through to this ValueError.","triggerScenarios":"Calling mha (or its vjp) with backward_pass_impl set to a value other than the supported implementation names (e.g. a typo like 'kv_cache' or a removed variant like 'dq').","commonSituations":"Upgrading versions where a backward variant was renamed/removed, typos in the attention config string, or copying example code from a different release.","solutions":["Check the function signature/docstring of _mha_backward for the accepted backward_pass_impl values and use one of them (e.g. 'kv')","Fix typos in the config string","If you relied on a removed variant, pin the previous library version or migrate to the supported one"],"exampleFix":"# before\nout = mha(q, k, v, ..., backward_pass_impl=\"kv_recompute\")\n\n# after\nout = mha(q, k, v, ..., backward_pass_impl=\"kv\")","handlingStrategy":"validation","validationCode":"VALID = {\"kv\"}\nassert backward_pass_impl in VALID, f\"backward_pass_impl must be one of {VALID}\"","typeGuard":"def is_valid_backward_impl(s: str) -> bool:\n    return s in {\"kv\"}","tryCatchPattern":null,"preventionTips":["Centralize the backward_pass_impl constant instead of string literals","Re-check supported values after library upgrades"],"tags":["attention","pallas","mha","backward-pass","invalid-argument"],"backgroundTag":"invalid-enum-value","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}