Posts Tagged ‘MarkNeedham’
[DevoxxUK2024] Game, Set, Match: Transforming Live Sports with AI-Driven Commentary by Mark Needham & Dunith Danushka
Mark Needham, from ClickHouse’s product team, and Dunith Danushka, a Senior Developer Advocate at Redpanda, presented an innovative experiment at DevoxxUK2024, showcasing an AI-driven co-pilot for live sports commentary. Inspired by the BBC’s live text commentary for sports like tennis and football, their solution automates repetitive summarization tasks, freeing human commentators to focus on nuanced insights. By integrating Redpanda for streaming, ClickHouse for analytics, and a large language model (LLM) for text generation, they demonstrate a scalable architecture for real-time commentary. Their talk details the technical blueprint, practical implementation, and broader applications, offering a compelling pattern for generative AI in streaming data contexts.
Real-Time Data Streaming with Redpanda
Dunith introduces Redpanda, a Kafka-compatible streaming platform written in C++ to maximize modern hardware efficiency. Unlike Kafka, Redpanda consolidates components like the broker, schema registry, and HTTP proxy into a single binary, simplifying deployment and management. Its web-based console and CLI (rpk) facilitate debugging and administration, such as creating topics and inspecting payloads. In their demo, Mark and Dunith simulate a tennis match by feeding JSON-formatted events into a Redpanda topic named “points.” These events, capturing match details like scores and players, are published at 20x speed using a Python script with the Twisted library. Redpanda’s ability to handle high-throughput streams—hundreds of thousands of messages per second—ensures robust real-time data ingestion, setting the stage for downstream processing.
Analytics with ClickHouse
Mark explains ClickHouse’s role as a column-oriented analytics database optimized for aggregation queries. Unlike row-oriented databases like PostgreSQL, ClickHouse stores columns contiguously, enabling rapid processing of operations like counts or averages. Its vectorized query execution processes column chunks in parallel, enhancing performance for analytics tasks. In the demo, events from Redpanda are ingested into ClickHouse via a Kafka engine table, which mirrors the “points” topic. A materialized view transforms incoming JSON data into a structured table, converting timestamps and storing match metadata. Mark also creates a “matches” table for historical context, demonstrating ClickHouse’s ability to ingest streaming data in real time without batch processing, a key feature for dynamic applications.
Generating Commentary with AI
The core innovation lies in generating human-like commentary using an LLM, specifically OpenAI’s model. Mark and Dunith design a Streamlit-based web application, dubbed the “Live Text Commentary Admin Center,” where commentators can manually input text or trigger AI-generated summaries. The application queries ClickHouse for recent events (e.g., the last minute or game) using SQL, converts results to JSON, and feeds them into the LLM with a prompt instructing it to write concise, present-tense summaries for tennis fans. For example, a query retrieving the last game’s events might yield, “Zverev and Alcaraz slug it out in an epic five-set showdown.” While effective with frontier models like GPT-4, smaller models like Llama 3 struggled, highlighting the need for robust LLMs. The generated text is published to a Redpanda “live_text” topic, enabling flexible consumption.
Broadcasting and Future Applications
To deliver commentary to end users, Mark and Dunith employ Server-Sent Events (SSE) via a FastAPI server, streaming Redpanda’s “live_text” topic to a Streamlit web app. This setup mirrors real-world applications like Wikipedia’s recent changes feed, ensuring low-latency updates. The demo showcases commentary appearing in real time, with potential extensions like tweeting updates or storing them in a data warehouse. Beyond sports, Dunith highlights the architecture’s versatility for domains like live auctions, traffic updates, or food delivery tracking (e.g., Uber Eats notifications). Future enhancements include fine-tuning smaller LLMs, integrating fine-grained statistics via text-to-SQL, or summarizing multiple matches for comprehensive coverage, demonstrating the pattern’s adaptability for real-time generative applications.