Skip to content

Judge posts in groups: one classifier request per group - #8

Merged
tshmieldev merged 1 commit into
mainfrom
tshmieldev/classifier-batching
Sep 21, 2026
Merged

tshmieldev merged 1 commit into
mainfrom
tshmieldev/classifier-batching

Conversation

@tshmieldev

Copy link
Copy Markdown
Owner

The classifier answers every question in a request in parallel, so posts now go to it in groups.

Measured

OpenRouter, 16 posts, filter "no crypto shilling":

one post per request 16 posts in one request
time per request ~380 ms ~440 ms
tokens for the 16 posts 6,710 3,175

Clear cases scored within 1–2 points either way. Borderline posts moved by up to ~30 points, and in this sample toward the better call ("Bitcoin ETF flows, explained" 79% alone, ~50% in a group). Repeat runs differ by 1–3 points, so the shift is the batching, not noise. One filter and 16 posts: a good sign, not proof.

What changes

  • One request per group, keyed p1..pN; each question names its own post. A lone post keeps the single-post request.
  • Images per group: one request scores the text, a second carries only the posts in the image range, plus any with no text.
  • X › Advanced › Speed: "Posts per request" (the batch size the chat model already used, default 12) and "Requests at once". Set the first to 1 to judge every post alone again.
  • A skipped post fails alone; a failed request takes only its own group.
  • Debug traces say how many posts shared a request.
  • Prompt version bumped: cached verdicts are decided again once.

Not run against Vercel or TypeSafe keys; same request shape. Not tried in a browser on x.com; the extension's own classify was run live against OpenRouter.

125 tests pass; bun run check is clean.

The classifier answers every question in a request in parallel, so a group
of posts costs about one round trip and half the tokens of asking one by
one. Measured on OpenRouter with 16 posts: ~440 ms for one request of 16
against ~380 ms for a single post, and 3,175 tokens against 6,710.

- A group goes in one request, keyed p1..pN, each question naming its own
  post so the others are context and never the subject. A lone post keeps
  the single-post request it always had.
- Images work per group: one request scores the text, a second carries only
  the posts whose score fell in the reader's image range, plus any with no
  text. A failed text request is no reason to pay for images.
- "Posts per request" is the batch size the chat model already used; the
  classifier's other slider now counts requests at once, which is what the
  worker-wide gate limits. One post per request is still a setting away.
- A post the classifier skips fails alone and is retried; a request that
  fails takes only its own group with it.
- The debug trace says how many posts shared a request.

Clear cases score the same either way. Borderline posts move, since they
are judged side by side, so the prompt version is bumped and cached
verdicts are decided again once.
Copilot AI lite review requested due to automatic review settings September 21, 2026 08:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 205915eb-212c-4561-bcf1-d86bdef226e7

📥 Commits

Reviewing files that changed from the base of the PR and between 230b8ca and f180dca.

📒 Files selected for processing (4)
  • src/background/classifier.ts
  • src/common/settings.ts
  • src/popup/XPanel.tsx
  • tests/classifier.test.ts
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@tshmieldev
tshmieldev merged commit de49198 into main Sep 21, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants