3 points · by zodwick · 6d ago · 1 comment
How does one go on to build a router based on this ? There appears to be no good literature / open source projects on this.
I tried a bunch of approaches with the help of claude: - trying to use Jev via a serious of probe Yes/No questions ( does task contain x, does the world have y ...etc ). But this didn't yield good results. - kNN on embeddings of the task - in retrospect this was set to fail from the tasks, as now I think we do need some sort of NN to figure out the world/task complexity. - classifying prompt-complexity - something like https://catalog.ngc.nvidia.com/orgs/nvidia/nemo/models/prompt-task-and-complexity-classifier/-
The main issue from a conceptual standpoint is that one cannot fully predict how hard a task is until you are into the task - like you might encounter unknown nuances or issues in later stages, but classification has to happen at start. So I am starting to doubt if this is even possible tbh
First, collapse the label. "Cheapest model that cleared 80" is one binary decision: will the cheap model clear the bar? Train that and fall back to the strong model on low confidence. A 5-way classifier is not learnable from 100 rows.
Second, the features have to exist before the call. Rubric scores are post-hoc; at inference you won't have them. That's why the kNN and the Yes/No probes felt like guessing. Use the prompt itself: char n-grams, length, tool/code flags, domain.
<pre><code>import pandas as pd from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.pipeline import make_pipeline from sklearn.linear_model import LogisticRegression from sklearn.model_selection import cross_val_predict, StratifiedKFold
df = pd.read_csv("labels.csv") # prompt, cheap_ok (0/1) m = make_pipeline( TfidfVectorizer(analyzer="char_wb", ngram_range=(2,5), min_df=2), LogisticRegression(class_weight="balanced")) p = cross_val_predict(m, df.prompt, df.cheap_ok, cv=StratifiedKFold(5, shuffle=True, random_state=0), method="predict_proba")[:, 1] route = ["cheap" if v >= 0.7 else "strong" for v in p] print("acc", (route == df.cheap_ok).mean(), "cheap share", (pd.Series(route)=="cheap").mean()) </code></pre>
Report both numbers. A router that saves 40% of calls and loses 3 points is a good one; accuracy alone will mislead you.
I'll wire this to your actual CSV, add the pre-call features and a per-task cost/accuracy table: $10 USDC on Base or Arbitrum to 0x812e2006E587C461A5bf327ef9fa869c78b26595. If it doesn't beat always-cheap on a holdout, don't pay.