<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v1.3 20210610//EN" "JATS-journalpublishing1-3.dtd">
<article article-type="research-article" dtd-version="1.3" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="ru"><front><journal-meta><journal-id journal-id-type="publisher-id">ntv</journal-id><journal-title-group><journal-title xml:lang="ru">Научно-технический вестник информационных технологий, механики и оптики</journal-title><trans-title-group xml:lang="en"><trans-title>Scientific and Technical Journal of Information Technologies, Mechanics and Optics</trans-title></trans-title-group></journal-title-group><issn pub-type="ppub">2226-1494</issn><issn pub-type="epub">2500-0373</issn><publisher><publisher-name>Университет ИТМО</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.17586/2226-1494-2026-26-4-851-859</article-id><article-id custom-type="elpub" pub-id-type="custom">ntv-653</article-id><article-categories><subj-group subj-group-type="heading"><subject>Research Article</subject></subj-group><subj-group subj-group-type="section-heading" xml:lang="ru"><subject>КОМПЬЮТЕРНЫЕ СИСТЕМЫ И ИНФОРМАЦИОННЫЕ ТЕХНОЛОГИИ</subject></subj-group><subj-group subj-group-type="section-heading" xml:lang="en"><subject>COMPUTER SCIENCE</subject></subj-group></article-categories><title-group><article-title>Модерация NLP в реальном времени в XMPP с GPU-ускоренным инференсом и адаптивным батчингом</article-title><trans-title-group xml:lang="en"><trans-title>Real-time NLP moderation on XMPP with GPU-accelerated inference and adaptive batching</trans-title></trans-title-group></title-group><contrib-group><contrib contrib-type="author" corresp="yes"><contrib-id contrib-id-type="orcid">https://orcid.org/0000-0001-7249-5071</contrib-id><name-alternatives><name name-style="eastern" xml:lang="ru"><surname>Альдарф</surname><given-names>А.</given-names></name><name name-style="western" xml:lang="en"><surname>Aldarf</surname><given-names>A.</given-names></name></name-alternatives><bio xml:lang="ru"><p>Альдарф Алаа — аспирант</p><p>Санкт-Петербург, 197101</p></bio><bio xml:lang="en"><p>Alaa Aldarf — PhD Student</p><p>Saint Petersburg, 197101</p></bio><email xlink:type="simple">aaldarf@itmo.ru</email><xref ref-type="aff" rid="aff-1"/></contrib><contrib contrib-type="author" corresp="yes"><contrib-id contrib-id-type="orcid">https://orcid.org/0000-0003-2709-0766</contrib-id><name-alternatives><name name-style="eastern" xml:lang="ru"><surname>Шакер</surname><given-names>А.</given-names></name><name name-style="western" xml:lang="en"><surname>Shaker</surname><given-names>A.</given-names></name></name-alternatives><bio xml:lang="ru"><p>Шакер Алаа — кандидат технических наук, независимый исследователь</p><p>Санкт-Петербург</p></bio><bio xml:lang="en"><p>Alaa Shaker — PhD, Independent Researcher</p><p>Saint Petersburg</p></bio><email xlink:type="simple">alaashaker11071991@gmail.com</email></contrib><contrib contrib-type="author" corresp="yes"><contrib-id contrib-id-type="orcid">https://orcid.org/0000-0001-6711-6399</contrib-id><name-alternatives><name name-style="eastern" xml:lang="ru"><surname>Бессмертный</surname><given-names>И. А.</given-names></name><name name-style="western" xml:lang="en"><surname>Bessmertny</surname><given-names>I. A.</given-names></name></name-alternatives><bio xml:lang="ru"><p>Бессмертный Игорь Александрович — доктор технических наук, профессор</p><p>sc 36661767800</p><p>Санкт-Петербург, 197101</p></bio><bio xml:lang="en"><p>Igor A. Bessmertny — D.Sc., Full Professor</p><p>sc 36661767800</p><p>Saint Petersburg, 197101</p></bio><email xlink:type="simple">bessmertny@itmo.ru</email><xref ref-type="aff" rid="aff-1"/></contrib></contrib-group><aff-alternatives id="aff-1"><aff xml:lang="ru"><institution>Университет ИТМО</institution><country>Россия</country></aff><aff xml:lang="en"><institution>ITMO University</institution><country>Russian Federation</country></aff></aff-alternatives><pub-date pub-type="collection"><year>2026</year></pub-date><pub-date pub-type="epub"><day>27</day><month>08</month><year>2026</year></pub-date><volume>26</volume><issue>4</issue><fpage>851</fpage><lpage>859</lpage><permissions><copyright-statement>Copyright &amp;#x00A9; Альдарф А., Шакер А., Бессмертный И.А., 2026</copyright-statement><copyright-year>2026</copyright-year><copyright-holder xml:lang="ru">Альдарф А., Шакер А., Бессмертный И.А.</copyright-holder><copyright-holder xml:lang="en">Aldarf A., Shaker A., Bessmertny I.A.</copyright-holder><license xml:lang="ru" license-type="creative-commons-attribution" xlink:href="https://creativecommons.org/licenses/by/4.0/" xlink:type="simple"><license-p>Данная работа распространяется под лицензией Creative Commons Attribution 4.0.</license-p></license><license xml:lang="en" license-type="creative-commons-attribution" xlink:href="https://creativecommons.org/licenses/by/4.0/" xlink:type="simple"><license-p>This work is licensed under a Creative Commons Attribution 4.0 License.</license-p></license></permissions><self-uri xlink:href="https://ntv.elpub.ru/jour/article/view/653">https://ntv.elpub.ru/jour/article/view/653</self-uri><abstract><p>Введение. Современные системы мгновенного обмена сообщениями обрабатывают большие объемы коротких текстов, для которых критично время доставки. В таких условиях становится актуальной автоматическая модерация токсичного контента. Примитивные методы, основанные на ключевых словах и ручной проверке, плохо справляются со значительной нагрузкой, многоязычными сообщениями и сложностью контекста. Модели обработки естественного языка, основанные на трансформерах, позволяют более точно определять токсичность, однако их использование в децентрализованных системах обмена сообщениями, таких как протокол расширяемого обмена сообщениями и присутствия (Extensible Messaging and Presence Protocol, XMPP), затруднено высокой вычислительной стоимостью и асинхронным характером запросов. Метод. Предложена система модерации сообщений в XMPP-сетях, состоящая из плагина сервера OpenFire, внешнего сервиса инференса, поддерживающего выполнение на центральном процессоре (Central Processing Unit, CPU) и графическом процессоре (Graphics Processing Unit, GPU), и метода адаптивного батчинга (Adaptive CrossDomain Batching, ACDB). Плагин осуществляет перехват сообщений на уровне обработки пакетов и передает их во внешний сервис инференса для определения токсичности. Предложенный метод адаптивного батчинга динамически подстраивает размер батча в зависимости от текущей нагрузки, состояния очереди и фактического времени выполнения инференса на GPU. Основные результаты. Эксперименты проводились на CPU и GPU конфигурациях с текстами сообщений различной длины, соответствующими типичным чат-сообщениям. Полученные результаты показывают, что использование GPU позволяет значительно ускорить инференс — до 28 раз (по сравнению с CPU) и снизить общую задержку до 9 раз. Сравнительная оценка по отношению к базовым решениям со статическим батчингом в различных сценариях трафика показывает, что ACDB динамически адаптирует размеры батчей в диапазоне от 3 до 25 в зависимости от условий нагрузки, снижая задержку на 52–59 % по сравнению со статическими конфигурациями с крупными батчами при сохранении 85–94 % их пропускной способности. Обсуждение. Представленный подход ориентирован на реальные условия работы федеративных XMPP-сетей, в которых сообщения поступают асинхронно и неравномерно. В отличие от решений, рассчитанных на централизованные системы с предсказуемым трафиком, данная архитектура обеспечивает устойчивую и масштабируемую модерацию сообщений в реальном времени без увеличения задержек доставки.</p></abstract><trans-abstract xml:lang="en"><p>Real-time communication platforms generate continuous streams of short, latency-sensitive messages, creating a demanding environment for automated toxicity detection. Transformer-based language models offer strong contextual accuracy, but their inference cost makes them difficult to deploy efficiently in decentralized messaging systems such as the Extensible Messaging and Presence Protocol, where requests arrive asynchronously from multiple servers. Traditional batching strategies struggle in this setting because traffic patterns fluctuate, message lengths vary, and strict latency budgets prevent the accumulation of large batches. This work introduces a full-stack moderation system that combines an OpenFire server plugin, a Graphics Processing Unit (GPU) accelerated microservice for toxicity classification, and an adaptive batch processing method suitable for use in multi-server systems. The plugin intercepts messages at the packet-processing layer and forwards them to a lightweight external inference service that can run on either a Central Processing Unit or a GPU. We introduce Adaptive Cross-Domain Batching (ACDB) as a method to dynamically adjust batch sizes based on the state of the queues, characteristics of the messages being processed, and real-time feedback from GPU usage. Experiments demonstrate that GPU inference provides significant improvements in both throughput and latency, with compute accelerations of up to 28× and total end-to-end accelerations of up to 9×. Comparative evaluation against static batching baselines across multiple traffic scenarios shows that ACDB dynamically adapts batch sizes from 3 to 25 depending on load conditions, reducing latency by 52–59 % compared to large-batch static configurations while maintaining 85–94 % of their throughput. Overall, this system enables scalable, real-time toxic content moderation capabilities for federated chat systems using adaptive batching for Transformer-based inference on dynamic workloads, while preserving strict message delivery constraints under realistic operating conditions.</p></trans-abstract><kwd-group xml:lang="ru"><kwd>обнаружение токсичности</kwd><kwd>XMPP протокол</kwd><kwd>OpenFire</kwd><kwd>GPU ускорение</kwd><kwd>адаптивный батчинг</kwd><kwd>модерация NLP</kwd><kwd>распределенные системы</kwd><kwd>трансформерный инференс</kwd></kwd-group><kwd-group xml:lang="en"><kwd>toxicity detection</kwd><kwd>XMPP</kwd><kwd>OpenFire</kwd><kwd>GPU acceleration</kwd><kwd>adaptive batching</kwd><kwd>NLP moderation</kwd><kwd>distributed systems</kwd><kwd>transformer inference</kwd></kwd-group></article-meta></front><back><ref-list><title>References</title><ref id="cit1"><label>1</label><citation-alternatives><mixed-citation xml:lang="ru">Park Y., Budhathoki K., Chen L., Kübler J.M., Huang J., Kleindessner M., et al. Inference optimization of foundation models on AI accelerators // Proc. of the 30th ACM SIGKDD Conference on Knowledge Discovery and Data Mining (KDD ’24). 2024. P. 6605-6615. doi: 10.1145/3637528.3671465</mixed-citation><mixed-citation xml:lang="en">Park Y., Budhathoki K., Chen L., Kübler J.M., Huang J., Kleindessner M., et al. Inference optimization of foundation models on AI accelerators. Proc. of the 30th ACM SIGKDD Conference on Knowledge Discovery and Data Mining (KDD ’24), 2024, pp. 6605-6615. doi: 10.1145/3637528.3671465</mixed-citation></citation-alternatives></ref><ref id="cit2"><label>2</label><citation-alternatives><mixed-citation xml:lang="ru">Aminabadi R.Y., Rajbhandari S., Awan A.A., Li C., Li D., Zheng E., et al. DeepSpeed-inference: Enabling efficient inference of transformer models at unprecedented scale // Proc. of the SC22: International Conference for High Performance Computing, Networking, Storage and Analysis. 2022. P. 1–15. doi: 10.1109/SC41404.2022.00051</mixed-citation><mixed-citation xml:lang="en">Aminabadi R.Y., Rajbhandari S., Awan A.A., Li C., Li D., Zheng E., et al. DeepSpeed-inference: Enabling efficient inference of transformer models at unprecedented scale. Proc. of the SC22: International Conference for High Performance Computing, Networking, Storage and Analysis, 2022, pp. 1–15. doi: 10.1109/SC41404.2022.00051</mixed-citation></citation-alternatives></ref><ref id="cit3"><label>3</label><citation-alternatives><mixed-citation xml:lang="ru">Khan Z. Natural language processing techniques for automated content moderation // International Journal of Web of Multidisciplinary Studies. 2025. V. 2. N 2. P. 21–27.</mixed-citation><mixed-citation xml:lang="en">Khan Z. Natural language processing techniques for automated content moderation. International Journal of Web of Multidisciplinary Studies, 2025, vol. 2, no. 2, pp. 21–27.</mixed-citation></citation-alternatives></ref><ref id="cit4"><label>4</label><citation-alternatives><mixed-citation xml:lang="ru">Liaskovska S., Bacarra R., Martyn Y., Baidych V., Alsayaydeh J. Artificial intelligence for automatic moderation of textual content in online chats and social networks // International Journal of Electrical and Computer Engineering (IJECE). 2025. V. 15. N 3. P. 3396–3409. doi: 10.11591/ijece.v15i3.pp3396-3409</mixed-citation><mixed-citation xml:lang="en">Liaskovska S., Bacarra R., Martyn Y., Baidych V., Alsayaydeh J. Artificial intelligence for automatic moderation of textual content in online chats and social networks. International Journal of Electrical and Computer Engineering (IJECE), 2025, vol. 15, no. 3, pp. 3396-3409. doi: 10.11591/ijece.v15i3.pp3396-3409</mixed-citation></citation-alternatives></ref><ref id="cit5"><label>5</label><citation-alternatives><mixed-citation xml:lang="ru">Fillies J., Mitsikas T., Schäfermeier R., Paschke A. A hate speech moderated chat application: Use case for GDPR and DSA compliance // arXiv. 2024. arXiv:2410.07713. doi: 10.48550/arXiv.2410.07713</mixed-citation><mixed-citation xml:lang="en">Fillies J., Mitsikas T., Schäfermeier R., Paschke A. A hate speech moderated chat application: Use case for GDPR and DSA compliance. arXiv, 2024. arXiv:2410.07713. doi: 10.48550/arXiv.2410.07713</mixed-citation></citation-alternatives></ref><ref id="cit6"><label>6</label><citation-alternatives><mixed-citation xml:lang="ru">Mengade S., Chopade P., Tate P., Patil S. Facilitating anonymous communication on social networks via AI-driven content moderation // Journal of the ACS Advances in Computer Science. 2025. V. 16. N 1. P. 19–32. doi: 10.21608/asc.2025.351475.1033</mixed-citation><mixed-citation xml:lang="en">Mengade S., Chopade P., Tate P., Patil S. Facilitating anonymous communication on social networks via AI-driven content moderation. Journal of the ACS Advances in Computer Science, 2025, vol. 16, no. 1, pp. 19–32. doi: 10.21608/asc.2025.351475.1033</mixed-citation></citation-alternatives></ref><ref id="cit7"><label>7</label><citation-alternatives><mixed-citation xml:lang="ru">Wagner N., Kraus M., Tonn T., Minker W. Comparing moderation strategies in group chats with multi-user chatbots // Proc. of the 4th Conference on Conversational User Interfaces. 2022. P. 1–4. doi: 10.1145/3543829.3544527</mixed-citation><mixed-citation xml:lang="en">Wagner N., Kraus M., Tonn T., Minker W. Comparing moderation strategies in group chats with multi-user chatbots. Proc. of the 4th Conference on Conversational User Interfaces, 2022, pp. 1–4. doi: 10.1145/3543829.3544527</mixed-citation></citation-alternatives></ref><ref id="cit8"><label>8</label><citation-alternatives><mixed-citation xml:lang="ru">Zhang D., Luo Y., Wang Y., Kui X., Ren J. BatOpt: Optimizing GPUbased deep learning inference using dynamic batch processing // IEEE Transactions on Cloud Computing. 2024. V. 12. N 1. P. 174–185. doi: 10.1109/TCC.2024.3350561</mixed-citation><mixed-citation xml:lang="en">Zhang D., Luo Y., Wang Y., Kui X., Ren J. BatOpt: Optimizing GPUbased deep learning inference using dynamic batch processing. IEEE Transactions on Cloud Computing, 2024, vol. 12, no. 1, pp. 174–185. doi: 10.1109/TCC.2024.3350561</mixed-citation></citation-alternatives></ref><ref id="cit9"><label>9</label><citation-alternatives><mixed-citation xml:lang="ru">Cang Y., Chen M., Huang K. Joint batching and scheduling for highthroughput multiuser edge AI with asynchronous task arrivals // IEEE Transactions on Wireless Communications. 2024. V. 23. N 10. P. 13782–13795. doi: 10.1109/TWC.2024.3404811</mixed-citation><mixed-citation xml:lang="en">Cang Y., Chen M., Huang K. Joint batching and scheduling for highthroughput multiuser edge AI with asynchronous task arrivals. IEEE Transactions on Wireless Communications, 2024, vol. 23, no. 10, pp. 13782–13795. doi: 10.1109/TWC.2024.3404811</mixed-citation></citation-alternatives></ref><ref id="cit10"><label>10</label><citation-alternatives><mixed-citation xml:lang="ru">Fang J., Yu Y., Zhao C., Zhou J. TurboTransformers: An efficient GPU serving system for transformer models // Proc. of the 26th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP ’21). 2021. P. 389–402. doi: 10.1145/3437801.3441578</mixed-citation><mixed-citation xml:lang="en">Fang J., Yu Y., Zhao C., Zhou J. TurboTransformers: An efficient GPU serving system for transformer models. Proc. of the 26th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP ’21), 2021, pp. 389–402. doi: 10.1145/3437801.3441578</mixed-citation></citation-alternatives></ref><ref id="cit11"><label>11</label><citation-alternatives><mixed-citation xml:lang="ru">Kasoju A., Vishwakarma T.V.C. Optimizing transformer models for low-latency inference: Techniques, architectures, and code implementations // International Journal of Science and Research (IJSR). 2025. V. 14. N 4. P. 857–866. doi: 10.21275/sr25409073105</mixed-citation><mixed-citation xml:lang="en">Kasoju A., Vishwakarma T.V.C. Optimizing transformer models for low-latency inference: Techniques, architectures, and code implementations. International Journal of Science and Research (IJSR), 2025, vol. 14, no. 4, pp. 857–866. doi: 10.21275/sr25409073105</mixed-citation></citation-alternatives></ref><ref id="cit12"><label>12</label><citation-alternatives><mixed-citation xml:lang="ru">Cong P., Chen Q., Zhao H., Yang T. Baton: Enhancing batch-wise inference efficiency for large language models via dynamic rebatching // Proc. of the ACM on Web Conference. 2025. P. 2309-2318. doi: 10.1145/3696410.3714950</mixed-citation><mixed-citation xml:lang="en">Cong P., Chen Q., Zhao H., Yang T. Baton: Enhancing batch-wise inference efficiency for large language models via dynamic rebatching. Proc. of the ACM on Web Conference, 2025, pp. 2309–2318. doi: 10.1145/3696410.3714950</mixed-citation></citation-alternatives></ref><ref id="cit13"><label>13</label><citation-alternatives><mixed-citation xml:lang="ru">Lam M., Yedidia Z., Banbury C.R., Reddi V.J. Precision batching: Bitserial decomposition for efficient neural network inference on GPUs // Proc. of the 30th International Conference on Parallel Architectures and Compilation Techniques (PACT). 2021. P. 129–141. doi: 10.1109/PACT52795.2021.00017</mixed-citation><mixed-citation xml:lang="en">Lam M., Yedidia Z., Banbury C.R., Reddi V.J. Precision batching: Bitserial decomposition for efficient neural network inference on GPUs. Proc. of the 30th International Conference on Parallel Architectures and Compilation Techniques (PACT), 2021, pp. 129-141. doi: 10.1109/PACT52795.2021.00017</mixed-citation></citation-alternatives></ref><ref id="cit14"><label>14</label><citation-alternatives><mixed-citation xml:lang="ru">Speckhard D.T., Bechtel T., Kehl S., Godwin J., Draxl C. Training speedups via batching for geometric learning: An analysis of static and dynamic algorithms // arXiv. 2025. arXiv:2502.00944. doi: 10.48550/arXiv.2502.00944</mixed-citation><mixed-citation xml:lang="en">Speckhard D.T., Bechtel T., Kehl S., Godwin J., Draxl C. Training speedups via batching for geometric learning: An analysis of static and dynamic algorithms. arXiv, 2025. arXiv:2502.00944. doi: 10.48550/arXiv.2502.00944</mixed-citation></citation-alternatives></ref><ref id="cit15"><label>15</label><citation-alternatives><mixed-citation xml:lang="ru">Aldarf A., Shaker A., Bessmertny I., Sobeih M.Y. Accelerating hate speech classification with GPUs: A multi-layer approach with string matching and transformers // Lecture Notes in Networks and Systems. 2025. V. 5588. P. 535–548. doi: 10.1007/978-981-96-1918-4_38</mixed-citation><mixed-citation xml:lang="en">Aldarf A., Shaker A., Bessmertny I., Sobeih M.Y. Accelerating hate speech classification with GPUs: A multi-layer approach with string matching and transformers. Lecture Notes in Networks and Systems, 2025, vol. 5588, pp. 535–548. doi: 10.1007/978-981-96-1918-4_38</mixed-citation></citation-alternatives></ref><ref id="cit16"><label>16</label><citation-alternatives><mixed-citation xml:lang="ru">Yang Z., Grenon-Godbout N., Rabbany R. Towards detecting contextual real-time toxicity for in-game chat // Findings of the Association for Computational Linguistics: EMNLP. 2023. P. 9894-9906. doi: 10.18653/v1/2023.findings-emnlp.663</mixed-citation><mixed-citation xml:lang="en">Yang Z., Grenon-Godbout N., Rabbany R. Towards detecting contextual real-time toxicity for in-game chat. Findings of the Association for Computational Linguistics: EMNLP, 2023, pp. 9894-9906. doi: 10.18653/v1/2023.findings-emnlp.663</mixed-citation></citation-alternatives></ref></ref-list><fn-group><fn fn-type="conflict"><p>The authors declare that there are no conflicts of interest present.</p></fn></fn-group></back></article>
