bridge.models.qwen.modeling_qwen4_exp.gated_residual_math#

Preserve Qwen4-Exp activation rounding at gated residual operation boundaries.

Module Contents#

Functions#

_activate_reference

_mix_reference

activate_residual_gate

Keep the low-precision division store before SiLU, including under compile.

mix_residual_streams

Keep sigmoid and multiplication stores before the stream mean.

Data#

API#

bridge.models.qwen.modeling_qwen4_exp.gated_residual_math._activate_reference(down: torch.Tensor, streams: int) → torch.Tensor#
bridge.models.qwen.modeling_qwen4_exp.gated_residual_math._mix_reference(
up: torch.Tensor,
normalized: torch.Tensor,
streams: int,
) → torch.Tensor#
bridge.models.qwen.modeling_qwen4_exp.gated_residual_math._activate_eager#

‘disable(…)’

bridge.models.qwen.modeling_qwen4_exp.gated_residual_math._mix_eager#

‘disable(…)’

bridge.models.qwen.modeling_qwen4_exp.gated_residual_math.activate_residual_gate(
down: torch.Tensor,
streams: int,
) → torch.Tensor#

Keep the low-precision division store before SiLU, including under compile.

bridge.models.qwen.modeling_qwen4_exp.gated_residual_math.mix_residual_streams(
up: torch.Tensor,
normalized: torch.Tensor,
streams: int,
) → torch.Tensor#

Keep sigmoid and multiplication stores before the stream mean.