Gradient Algorithm
The gradient algorithm is the core mechanism for calculating a claim's truth value based on weighted community votes. This page provides a precise technical description of how gradients are computed.
Overview
Each claim has a gradient value between 0 and 1, representing the collective assessment of its truth. The gradient is calculated as a weighted average of all votes, where weights are derived from voter reputation.
Key Insight
The Formula
The gradient is computed using the weighted arithmetic mean:
Where:
- — The gradient (final truth value)
- — Individual vote value (0.0 to 1.0)
- — Weight derived from voter's reputation
- — Total number of votes
Weight Calculation
Vote weights are calculated from reputation scores using a logarithmic function:
Where is the voter's reputation score. The logarithm provides diminishing returns:
Why logarithmic weighting?
Worked Example
Consider a claim with three voters:
| Voter | Reputation | Weight (log(1+r)) | Vote | Weighted Vote |
|---|---|---|---|---|
| Alice | 800 | 6.69 | 0.9 | 6.02 |
| Bob | 200 | 5.30 | 0.8 | 4.24 |
| Carol | 50 | 3.93 | 0.3 | 1.18 |
| Total | — | 15.92 | — | 11.44 |
The claim has a gradient of 0.719, indicating moderate consensus toward TRUE. Note how the logarithmic weighting means Alice's high-reputation vote has more influence than Carol's, but not overwhelmingly so — this prevents any single user from dominating.
Consensus Thresholds
Claims are considered to have reached consensus when their gradient moves outside the uncertain zone:
| Gradient Range | Status | Meaning |
|---|---|---|
| 0.0 - 0.2 | Consensus FALSE | Community strongly believes claim is false |
| 0.2 - 0.8 | Uncertain / Contested | No clear consensus yet, more evidence needed |
| 0.8 - 1.0 | Consensus TRUE | Community strongly believes claim is true |
Update Triggers
The gradient is recalculated when:
- A new vote is cast
- An existing vote is changed
- A vote is removed
- A voter's reputation changes significantly (batch updates)
Implementation
1import math2 3def calculate_gradient(votes: List[Vote]) -> float:4 """Calculate weighted gradient from votes."""5 if not votes:6 return 0.5 # Neutral starting point7 8 weighted_sum = 0.09 weight_total = 0.010 11 for vote in votes:12 # Logarithmic weighting with minimum of 0.113 weight = math.log(1 + max(0, vote.agent.reputation_score))14 if weight < 0.1:15 weight = 0.116 weighted_sum += vote.value * weight17 weight_total += weight18 19 return weighted_sum / weight_totalEdge Cases
No votes
Claims start with a gradient of 0.5 (neutral)
Single vote
Gradient equals the vote value
Zero reputation
Still receives minimum weight of 0.1