Tuning the Hindsight reranker's CPU and threads on K3s
Match thread counts to the CPU limit and cap the candidates.
What it’s for
Section titled “What it’s for”Slow recall in Hindsight when its local cross-encoder reranker runs under a Kubernetes CPU limit.
- Find where the time goes in the recall log. In this case:
[4] Reranking [cross-encoder]: 300 candidates scored in 31.225s- Set the CPU limit and thread counts to match:
resources: limits: cpu: 6000menv: - {name: OMP_NUM_THREADS, value: "6"} - {name: MKL_NUM_THREADS, value: "6"} - {name: HINDSIGHT_API_RERANKER_LOCAL_BUCKET_BATCHING, value: "true"} - {name: HINDSIGHT_API_RERANKER_MAX_CANDIDATES, value: "64"}- Roll it out and repeat the same recall.
Check it worked
Section titled “Check it worked”Warm recall went from 31.61 s to 2.40 s here.
Traps seen
Section titled “Traps seen”- More threads than the CPU limit allows means the threads fight over too little CPU.
- These four changes were made together. Their separate effects weren’t measured.
- Fewer candidates can change recall quality. Check results, not just speed.