Use LLMs to rank anything
Use LLMs for document ranking.
Got a bunch of data? Want to throw it at an LLM to find the most "interesting" stuff? If you simply YOLO your data into a ChatGPT session, you'll run into problems:
siftrank is an implementation of the SiftRank document ranking algorithm that uses LLMs to efficiently find the items in any dataset that are most relevant to a given prompt:
Use LLMs to rank anything. No fine-tuning. No domain-specific models. Just an off-the-shelf model and your ranking prompt. Typically runs in seconds and costs pennies.
go install github.com/noperator/siftrank/cmd/siftrank@latestEither set an OPENAI_API_KEY environment variable, or create a named configuration profile in ~/.config/siftrank/config.yaml or ./config.yaml containing the API key. The default profile auto-loads when -P is not specified, and CLI flags always take precedence over profile values. Use *_cmd to retrieve secrets from a password manager or other command rather than storing them in plaintext. See config-example.yaml for all available options.
default: nano
profiles:
nano:
api_key_cmd: op read op://myvault/openai-api-key/credential
model: gpt-5-nano-2025-08-07
effort: minimal…Compares 100 sentences in 7 seconds.
…Advanced usage
If the input file is a JSON document, it will be read as an array of objects and each object will be used for ranking.
For instance, two objects would be loaded and ranked from this document:
[
{
"path": "/foo",
"code": "bar"
},
{
"path": "/baz",
"code": "nope"
}
]It is possible to include each element from the input file in a template using the Go template syntax via the --template "template string" (or --template @file.tpl) argument.
For text input files, each line can be referenced in the template with the Data variable:
Anything you want with {{ .Data }}For JSON input files, each object in the array can be referenced directly. For instance, elements of the previous JSON example can be referenced in the template code like so:
# {{ .path }}
{{ .code }}Note in the following example that the resulting value key contains the actual value being presented for ranking (as described by the template), while the object key contains the entire original object from the input file for easy reference.
…I released the prototype of this tool, Raink, while at Bishop Fox. See the original presentation, blog post and CLI tool.
Completed
This project is licensed under the MIT License.
No open issues yet, or sync has not completed.