Skip to main content

Squillify development is paused indefinitely. Read why, and discover what this experiment achieved. Read the story

MicroSkills Reference

Reciprocal Rank Fusion

knowledge.reciprocal_rank_fusion

ProductionBounded custom (Class B)Deterministicstrictfastv1.0.0
No network

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

Note
Fuses named ranked document-id lists with reciprocal-rank fusion and published tie-breaks.

Non-goals

  • Does not retrieve documents
  • Does not learn weights
  • Does not compare document text

Properties

IdempotentRetry safeStreaming supportedFile input supportedRequires external service

Capabilities

analysissearch

Cost & billing

Flat rate per invocation

MetercallsBillable onsuccessCost per call1 credit

File handling

Accepts file_refProduces file_refMax input2 MB

How we handle your data

Sensitive processing
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.

Read the Microskill Data Handling Policy

Input schema

FieldTypeRequiredDescription
rankingsarrayYesFrom 1 through 101 closed rankings {id, documents}; runtime accepts at most 100 and 100000 ids in aggregate.
weightsarrayNoOptional weights aligned with rankings; omit it for weight 1 on every ranking.
kintegerNoRRF constant from 1 through 10001; omit it for 60.
limitintegerNoFused-list length from 1 through 10001; omit it for 1000.

Output schema

FieldTypeRequiredDescription
fusedarrayYesFused documents best first, each a closed {rank, id, score, bestRank, contributions} object.
kintegerYesRRF constant k that was actually applied to every ranking.
limitintegerYesFused-list length that was actually applied after clamping to the ranked set.
rankingCountintegerYesHow many rankings were fused.
documentCountintegerYesHow many distinct document ids scored.
truncatedbooleanYesTrue when limit cut the fused ranking short.
formulaVersionstringYesPinned reciprocal-rank-fusion formula identifier.

API contract

POST /v1/execute
curl
curl -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"]}]}}'
Integrations
TypeScript SDK
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

CodeHTTPRetryableDescription
VALIDATION_ERROR400NoThe request payload failed schema validation.
UNAUTHORIZED401NoMissing or invalid API key.
SKILL_NOT_ACCESSIBLE403NoThe API key is not granted access to this skill.
SKILL_NOT_AVAILABLE_FOR_PLAN403NoThis skill is not included in your current plan.
PLAN_ELIGIBILITY_UNAVAILABLE503YesPlan eligibility could not be decided. Retry after backoff.
SKILL_NOT_FOUND404NoThe requested skill or version does not exist.
TENANT_RATE_LIMITED429YesRequest rate limit exceeded. Retry after backoff.
QUOTA_EXCEEDED429YesPlan quota exhausted. Retryable once the quota period resets.
EXECUTION_TIMEOUT504YesExecution exceeded the allowed time budget.
RRF_RANKINGS_INVALID400NoThe request payload failed this skill's input validation.
RRF_DOCUMENT_ID_DUPLICATE400NoThe request payload failed this skill's input validation.
RRF_PARAMETER_INVALID400NoThe request payload failed this skill's input validation.
RRF_LIMIT_EXCEEDED429NoA size, quota, rate, or time limit was exceeded.

Other limits

LimitValue
Recommended inline bytes32 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)

Request bodyjson
{
  "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

Inputjson
{
  "rankings": [
    {
      "id": "lexical",
      "documents": [
        "D1",
        "D2"
      ]
    },
    {
      "id": "vector",
      "documents": [
        "D2",
        "D3"
      ]
    }
  ]
}
Expected outputjson
{
  "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"
}
Tip
D2 has the highest fused score because both rankings list it.

Equal fused scores break on best rank then lexical id

Inputjson
{
  "rankings": [
    {
      "id": "a",
      "documents": [
        "alpha",
        "beta"
      ]
    },
    {
      "id": "b",
      "documents": [
        "beta",
        "alpha"
      ]
    }
  ]
}
Expected outputjson
{
  "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"
}
Tip
alpha and beta share a score; alpha sorts first by id.
  • 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

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.

Tags

retrievaltextrankingsearch