Reciprocal Rank Fusion
knowledge.reciprocal_rank_fusion
Overview
You send two or more named rankings, each a list of unique document ids in rank order. Optional weights (strictly positive, one per ranking) default to 1. k defaults to 60 and limit defaults to 1000. The fused score of a document is the sum of weight / (k + rank) over rankings that contain it. Ties break by best individual rank, then lexical id. This does not retrieve documents or learn weights.
Two rankers that both saw a document should lift it without a learned fusion model.
Reliability
Scores round to nine decimals. Ties break by best individual rank, then lexical id. RRF_RANKINGS_INVALID — trigger: empty rankings, missing ranking id, or empty documents; retryable: no; next: send named non-empty lists. RRF_DOCUMENT_ID_DUPLICATE — trigger: a ranking repeats an id; retryable: no; next: deduplicate that ranking. RRF_PARAMETER_INVALID — trigger: weights length mismatch or a non-positive weight; retryable: no; next: send one positive weight per ranking. RRF_LIMIT_EXCEEDED — trigger: more than 100 rankings, k/limit above 10000, or more than 100000 ids; retryable: no; next: split the request.
Context footprint
Ids, ranks and scores only; document text is never returned. A successful call costs 1 execution credit.
When to use it
When two or more already-ranked id lists must be fused with a published RRF formula.
When documents still need retrieving, or when fusion weights must be learned from labels.
Powered by Squillify's own reciprocal-rank-fusion arithmetic. No search engine and no model is involved.
Scope
Non-goals
- Does not retrieve documents
- Does not learn weights
- Does not compare document text
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
How we handle your data
What this means
This skill is designed to detect, mask, redact, validate, or otherwise process sensitive data.
Squillify guarantees
- Runs inside Squillify
- This skill runs inside Squillify.
- Payloads are not sent to an external service by this skill.
- Squillify does not permanently store submitted payloads.
- Telemetry records metadata only, not submitted content.
- Submitted payloads are not used for training.
- Submitted payloads are not reviewed by humans.
- Targets sensitive data
- The response does not contain submitted content.
Your responsibility
Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| rankings | array | Yes | From 1 through 101 closed rankings {id, documents}; runtime accepts at most 100 and 100000 ids in aggregate. |
| weights | array | No | Optional weights aligned with rankings; omit it for weight 1 on every ranking. |
| k | integer | No | RRF constant from 1 through 10001; omit it for 60. |
| limit | integer | No | Fused-list length from 1 through 10001; omit it for 1000. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| fused | array | Yes | Fused documents best first, each a closed {rank, id, score, bestRank, contributions} object. |
| k | integer | Yes | RRF constant k that was actually applied to every ranking. |
| limit | integer | Yes | Fused-list length that was actually applied after clamping to the ranked set. |
| rankingCount | integer | Yes | How many rankings were fused. |
| documentCount | integer | Yes | How many distinct document ids scored. |
| truncated | boolean | Yes | True when limit cut the fused ranking short. |
| formulaVersion | string | Yes | Pinned reciprocal-rank-fusion formula identifier. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"knowledge.reciprocal_rank_fusion","input":{"rankings":[{"id":"lexical","documents":["D1","D2"]},{"id":"vector","documents":["D2","D3"]}]}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("knowledge.reciprocal_rank_fusion", {"rankings":[{"id":"lexical","documents":["D1","D2"]},{"id":"vector","documents":["D2","D3"]}]});Errors
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
| RRF_RANKINGS_INVALID | 400 | No | The request payload failed this skill's input validation. |
| RRF_DOCUMENT_ID_DUPLICATE | 400 | No | The request payload failed this skill's input validation. |
| RRF_PARAMETER_INVALID | 400 | No | The request payload failed this skill's input validation. |
| RRF_LIMIT_EXCEEDED | 429 | No | A size, quota, rate, or time limit was exceeded. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- Does not retrieve documents
- Does not learn weights
- Does not compare document text
- Searching a corpus you have not ranked
- Learning fusion weights from labels
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "knowledge.reciprocal_rank_fusion",
"input": {
"rankings": [
{
"id": "lexical",
"documents": [
"D1",
"D2"
]
},
{
"id": "vector",
"documents": [
"D2",
"D3"
]
}
]
}
}Examples
D2 outranks D1 when it appears in both lists
{
"rankings": [
{
"id": "lexical",
"documents": [
"D1",
"D2"
]
},
{
"id": "vector",
"documents": [
"D2",
"D3"
]
}
]
}{
"fused": [
{
"rank": 1,
"id": "D2",
"score": 0.032522475,
"bestRank": 1,
"contributions": [
{
"rankingId": "lexical",
"rank": 2,
"contribution": 0.016129032
},
{
"rankingId": "vector",
"rank": 1,
"contribution": 0.016393443
}
]
},
{
"rank": 2,
"id": "D1",
"score": 0.016393443,
"bestRank": 1,
"contributions": [
{
"rankingId": "lexical",
"rank": 1,
"contribution": 0.016393443
}
]
},
{
"rank": 3,
"id": "D3",
"score": 0.016129032,
"bestRank": 2,
"contributions": [
{
"rankingId": "vector",
"rank": 2,
"contribution": 0.016129032
}
]
}
],
"k": 60,
"documentCount": 3,
"rankingCount": 2,
"truncated": false,
"limit": 1000,
"formulaVersion": "knowledge.reciprocal_rank_fusion.v1"
}Equal fused scores break on best rank then lexical id
{
"rankings": [
{
"id": "a",
"documents": [
"alpha",
"beta"
]
},
{
"id": "b",
"documents": [
"beta",
"alpha"
]
}
]
}{
"fused": [
{
"rank": 1,
"id": "alpha",
"score": 0.032522475,
"bestRank": 1,
"contributions": [
{
"rankingId": "a",
"rank": 1,
"contribution": 0.016393443
},
{
"rankingId": "b",
"rank": 2,
"contribution": 0.016129032
}
]
},
{
"rank": 2,
"id": "beta",
"score": 0.032522475,
"bestRank": 1,
"contributions": [
{
"rankingId": "a",
"rank": 2,
"contribution": 0.016129032
},
{
"rankingId": "b",
"rank": 1,
"contribution": 0.016393443
}
]
}
],
"k": 60,
"documentCount": 2,
"rankingCount": 2,
"truncated": false,
"limit": 1000,
"formulaVersion": "knowledge.reciprocal_rank_fusion.v1"
}Recommended use cases
- Fuse a lexical list with a vector list
- Break a fused-score tie by best rank then id
Avoid for
- Searching a corpus you have not ranked
- Learning fusion weights from labels
Related skills
Composable with
Safety & privacy
- Runs without calling any external service.
- Your payloads are never stored permanently.
- Telemetry captures metadata only — never your payload contents.
- We never train models on your payloads.
- No human reviews your payloads.