xrag-temporal
Time-aware uncertainty for RAG — temporal decay of evidence confidence using Subjective Logic.
Your RAG system treats every retrieved document as equally valid — whether it was written yesterday or three years ago. xrag-temporal fixes this by applying subjective logic temporal decay: as evidence ages, belief migrates into uncertainty.
Install
pip install xrag-temporal
Quick Start
from xrag_temporal import opinion, decay, decay_series, should_abstain
# Create an opinion from evidence
ev = opinion(belief=0.8, disbelief=0.1) # strong evidence
# Decay it: 30 days old, 7-day half-life
stale = decay(ev, elapsed_days=30, half_life_days=7)
print(stale)
# → Opinion(b=0.0442, d=0.0055, u=0.9503) — almost all uncertainty!
# Should the system abstain?
print(should_abstain(stale)) # True — uncertainty > 0.7
The Problem
Standard RAG pipelines retrieve documents and feed them to an LLM without considering when the evidence was created. A 3-year-old article about "the CEO of Twitter" will confidently produce the wrong answer.
The Solution
xrag-temporal decays belief and disbelief into uncertainty as evidence ages:
- Fresh evidence (age ≈ 0): original confidence preserved
- Aging evidence: belief/disbelief shrink, uncertainty grows
- Stale evidence: nearly all mass is uncertainty → system knows it doesn't know
Three decay functions:
- Exponential (default): smooth, never fully zero —
λ = 2^(-t/τ) - Linear: reaches zero at 2× half-life —
λ = max(0, 1 - t/2τ) - Step: binary fresh/stale —
λ = 1 if t < τ else 0
License
MIT
Metadata
Release files for xrag-temporal 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| xrag_temporal-0.1.0.tar.gz | 4.9 kB | Without provenance | Details for xrag_temporal-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xrag_temporal-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for xrag_temporal-0.1.0-py3-none-any.whl |
Total release size: 10.8 kB
Release files / xrag_temporal-0.1.0.tar.gz
| Download URL | xrag_temporal-0.1.0.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
017a4a8d5aa073fc788d2e3a3b5c3fed612ac12ac9bf656e31bf4bd5fce4a557
|
|
BLAKE2b-256 checksum How to use checksums |
9a7371c59162454ec1bcddacb47d68eef770b165e90e9a6dd91e69f0b50c2e2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.2
|
Release files / xrag_temporal-0.1.0-py3-none-any.whl
| Download URL | xrag_temporal-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
849889a6b07b6d08929c625e5b6a2c457d40bdc577b0002dfa3aa380dbad321b
|
|
BLAKE2b-256 checksum How to use checksums |
62ff9622030cec1329fd9ae53490eccdeae67137d3722be215ca1863bc0ab71f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.2
|
Security for xrag-temporal 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.