Konnect: A Distributed Microservices Architecture for Real-Time Chat with Multi-Task NLP and Context-Aware Toxicity Dampening
Ankit Sinha1, Shantanu Chhetri2, Raipuriya Sakshi3, Manan Gulati4, Daniel Odametey5
[1,5] Department of Computer Applications, Lovely Professional University, Phagwara, Punjab 144411, India.
[1] ankits0057@gmail.com
[2] shantanuchhetri7@gmail.com
[3] sakshiraipuriya21@gmail.com
[4] manangulati40@gmail.com
[5] kojoalpha68@gmail.com
Abstract — Automated content moderation within group messaging platforms poses a compound engineering challenge: the system must classify harmful text with reasonable precision while operating under sub-second latency constraints imposed by conversational user experience expectations. Existing approaches that rely exclusively on transformer-based classifiers produce frequent false positives on colloquial negative expressions such as "I hate Mondays" or "this exam is killing me," which carry no intent to harm yet trigger high toxicity scores. This paper presents Konnect, a cloud-native group messaging platform built on six containerized microservices interconnected through Apache Kafka publish-subscribe pipelines. The natural language processing subsystem pairs a RoBERTa-based sentiment classifier with a BERT-based toxicity detector to analyze every message asynchronously. We introduce a post-classification dampening layer that performs pronoun-target resolution and emotional-venting pattern recognition to suppress false positives before scores enter a Redis-backed sliding-window aggregation engine. The aggregation engine computes composite group-level moderation scores and drives a four-tier graduated escalation framework. The benchmark results on a dataset containing 2,400 annotated chat messages indicate that the dampening layer cuts down false positives by 38% while maintaining 97.2% of true positives. The end-to-end latency of the pipeline, from ingesting the message at the Kafka broker to delivering the scores to WebSocket clients, takes an average of 312 milliseconds on a standard CPU.
Index Terms — microservices, publish/subscribe, toxicity detection, sentiment analysis, score dampening, sliding window aggregation, real-time content moderation, transformer inference, Kafka, WebSocket