← Work

Slack question classifier

GCB8WorkbounceModel2024

Python · scikit-learn · OpenAI embeddings

At Workbounce we monitored customers' Slack channels to automatically answer questions using company knowledge. The problem is that almost everything in Slack is just chatter, and even most messages with a question mark ("who's around on Friday?") aren't things a bot should answer. Running a large LLM over hundreds of thousands of Slack messages would have been way too slow and expensive, so we built a small classifier to sit in front of it and filter out the noise.

I don't have the code anymore so the details are from memory, but the setup was pretty simple. We ran each message through an OpenAI embedding model (~1,500 dimensions) and trained a small neural net on top using scikit-learn's MLPClassifier: one hidden layer of a few hundred units with L2 regularization, outputting a single probability. Anything above our threshold went to the LLM to answer.

For training data we hand-labeled about 5,000 messages from enterprise Slack channels as 1 or 0. A real question with an answer somewhere in the company got a 1; everything else, including casual questions, got a 0. We kept the classes roughly balanced and held out validation and test sets. With only 5,000 examples we kept the network small (a few hundred thousand weights) so it wouldn't overfit. The OpenAI embeddings already gave it most of the signal it needed. I think the saved file was around 35 MB, mostly from cached training embeddings pickled alongside it rather than the weights themselves.

Because it was so small it ran fine on CPU in production, cheap enough to score every message in every channel we monitored.

If I were building this today I wouldn't train a classifier at all. I'd just use an off-the-shelf decision model like Jev. Those didn't exist in 2024, so we had to roll our own.