# `Monty.Attention.Decay.LinearWeightDecay`
[🔗](https://github.com/d-led/ex.tbp.monty/blob/v0.1.0/packages/ex_tbp_monty_core/lib/monty/attention/decay/linear_weight_decay.ex#L1)

Move every weight a fixed distance toward zero each step: Monty's
`attention/decay.py::LinearWeightDecay`.

A weight of `0.7` with a rate of `0.1` becomes `0.6`, and `-0.7` becomes
`-0.6`. A weight already within `rate` of zero is not nudged past it — it
becomes exactly `0.0`, so that a steady decay cannot make a weight oscillate
around zero or flip its sign, which would turn "look here" into "avoid here"
by forgetting.

# `t`

```elixir
@type t() :: %Monty.Attention.Decay.LinearWeightDecay{rate: float()}
```

# `decay`

A grid in which every weight has moved one step toward zero.

# `default_rate`

```elixir
@spec default_rate() :: float()
```

The default rate, so a config can say `linear` and mean what Monty means.

# `new`

```elixir
@spec new(number()) :: t()
```

A decay of `rate` per step, which must not be negative.

A negative rate would move weights away from zero, which is the opposite of
forgetting, so it is refused rather than accepted and misread.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
