{"record":{"id":"5c6bd6d092fce83a","repo":"xai-org/x-algorithm","slug":"invalid-backward-pass-implementation-backward-pa-5c6bd6","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/ranker_attention_v2.py","lineNumber":1091,"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=num_stages),\n        )(q, k, v, temp, segment_ids, k_block_bwd_dkv_state_metadata, 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":1073,"sourceCodeEnd":1096,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/phoenix/xrex/pallas/ranker_attention_v2.py#L1073-L1096","documentation":"The backward pass of the fused MHA kernel dispatches on backward_pass_impl, selecting a specialized Pallas kernel per implementation (e.g. the 'kv' fused-dkv kernel). If the string does not match any known implementation, this ValueError is raised. It is a top-level API argument validation failure for _mha_backward.","triggerScenarios":"Calling the ranker attention v2 public API with backward_pass_impl set to a value other than the supported ones (e.g. 'kv' / supported impl names), such as 'flash', 'vanilla', a typo, or an option removed/renamed between versions.","commonSituations":"Upgrading the library and passing a backward_pass_impl name that no longer exists; copying example configs from incompatible versions; experiment sweeps enumerating unsupported values.","solutions":["Inspect the function signature/default of _mha_backward in ranker_attention_v2.py to list valid backward_pass_impl values and use one of them.","Omit backward_pass_impl to use the default implementation.","Pin or align the library version with the config you copied the value from."],"exampleFix":"# before\nout = mha(q, k, v, backward_pass_impl='flash')\n# after\nout = mha(q, k, v)  # or backward_pass_impl='kv' if explicitly needed","handlingStrategy":"validation","validationCode":"import inspect\nsig = inspect.signature(_mha_backward)  # or the public wrapper\n# omit backward_pass_impl to use the default, or verify against\n# the branches in phoenix/xrex/pallas/ranker_attention_v2.py","typeGuard":null,"tryCatchPattern":"try:\n    out = mha(q, k, v, backward_pass_impl=impl)\nexcept ValueError as e:\n    if 'Invalid backward pass implementation' in str(e):\n        out = mha(q, k, v)  # fall back to default\n    else:\n        raise","preventionTips":["Prefer omitting backward_pass_impl to use the default.","After library upgrades, re-check supported values in the source signature."],"tags":["pallas","jax","tpu","attention","backward-pass","api-misuse"],"backgroundTag":"unsupported-option-value","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}