Third-Pass Feed Ranker β ONNX + INT8
ONNX and dynamically-quantized INT8 builds of the third-pass feed ranker for fast CPU inference. Same model, two files:
| file | precision | size | notes |
|---|---|---|---|
model.onnx |
fp32 | ~471 MB | scores are identical to the PyTorch model |
model_quantized.onnx |
int8 (dynamic) | ~118 MB | 4Γ smaller; scores within ~0.05 of fp32 (ranking order preserved) |
CPU throughput (job_title Γ post scoring)
Measured on a desktop CPU (AVX2/AVX-VNNI, no AVX-512), 8 threads:
| build | items/sec |
|---|---|
| onnx fp32 | ~910 |
| onnx int8 |
On server CPUs with AVX-512 VNNI (e.g. Intel Xeon Scalable), the INT8 speedup is typically 2β4Γ β this desktop under-shows it. Absolute rates depend on post length.
Usage
from optimum.onnxruntime import ORTModelForSequenceClassification
from transformers import AutoTokenizer
import torch
name = "you/third-pass-feed-ranker-onnx"
tok = AutoTokenizer.from_pretrained(name)
model = ORTModelForSequenceClassification.from_pretrained(name, file_name="model_quantized.onnx") # or model.onnx
title, posts = "Registered Nurse", ["Updated sepsis screening pathway is now live.", "Q3 revenue beat expectations!"]
enc = tok([title]*len(posts), posts, truncation=True, max_length=160, padding=True, return_tensors="pt")
scores = model(**enc).logits.squeeze(-1).tolist() # higher = more relevant
The promotion/gate logic (which item to move to slot 1, and when) is not in the model β see the base model card for the decision-logic snippet. This repo only provides the CPU-optimized scorer. Trained on synthetic data; validate on your own before production. See the base model card for full evaluation, limitations, and license/attribution.
- Downloads last month
- -