# Keeper Weighing

The usual approaches for weighting employs simple algebraic functions, commonly linear or square root. Though simple and rather efficient to compute (e.g., for square root the seven-iteration Newton-Raphson method is common in Solidity mathematical libraries under the sobriquet of the Babylonian method), they have two flaws in that they are unbounded from above and that their derivatives either do not diminish or diminish slowly. This skews the distribution very disproportionately towards the whales, and employment of square-root weighting only dilates the scale at which this occurs. Weighing keepers by this method will yield the probability of keepers with the largest stakes to be chosen almost always, and those with the lesser stake - almost never. We think that it would be highly desirable to find a function that is algebraic, not much more expensive that a square root, possesses a saturation property at a parametrically controlled point, and is Lipschitz. Studying functions that behave sigmoidally (like a hyperbolic tangent), we constructed by demanding a number of properties from the derivative of the weighting rule an algebraic sigmoid function, reading

<figure><img src="/files/vTmQ1OEWlVIAVLsQudf2" alt=""><figcaption></figcaption></figure>

where the parameters are the scaling factor `a`, the order `n` and the shift `s`. If one restricts `n` to equal 2, one immediately sees that the cost of computing such a function is not much higher than for the square root (indeed, the naive overhead over the square root consists in five multiplications, a division, and three summations, and can be improved to three multiplications, one summation, and one division). One also finds that this function is Lipschitz, nondecreasing, and saturating at a finite value (it tends to a finite limit at infinity). Moreover, one can easily adjust the parameters to make the function saturate at a demanded value. Though the ability to do so is somewhat impaired at great intervals, such inconveniences can be ameliorated by rescaling the weights relative to the sample maxima.

*Other weighing functions are in development, incuding those optimized for extreme gas efficiency.*


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.powerpool.finance/powerpool-and-poweragent-network/research/automation-networks-research/keeper-weighing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
