kalypsorelational-llmllm-servingkv-cachepipelined-executionsemantic-queriesdistributed-systemstutorial

Kalypso Guide: Relational LLM Serving & Pipelined Execution

Kalypso Architecture: Relational LLM Serving, Semantic Query Plans, Pipelined Operator Execution, and Cross-Operator KV Cache Reuse

The Request-Centric Bottleneck in Enterprise LLM Pipelines

In modern enterprise computing, Large Language Models (LLMs) are rarely deployed as isolated chatbots answering one-off conversational prompts. Instead, enterprise AI systems—such as document intelligence platforms, automated legal compliance engines, and web-scale extraction workflows engineered by aiFetchly—execute sophisticated, multi-stage data processing pipelines.

These enterprise pipelines operate over collections of documents or structured tuples, chaining multiple analytical steps together:

  1. Semantic Filtering: Scanning incoming unstructured documents (e.g., news feeds, financial filings, support tickets) and discarding irrelevant items.
  2. Semantic Mapping & Information Extraction: Parsing retained documents to extract structured entities (e.g., extracting vendor names, transaction dates, and line-item dollar amounts into JSON).
  3. Semantic Joining: Cross-referencing extracted entities with external corporate databases or customer registries.
  4. Semantic Aggregation & Synthesis: Grouping correlated records and synthesizing multi-document summaries.

Despite the inherently relational, multi-operator structure of these workflows, current state-of-the-art LLM serving engines—including vLLM, Hugging Face TGI, TensorRT-LLM, and SGLang—are architected around a request-centric paradigm.

Under this paradigm, the serving engine treats every single LLM invocation as an isolated black box. When an enterprise application runs a multi-operator pipeline, each operator submits separate, independent HTTP requests to the serving cluster.

The Request-Centric Serving Inefficiency: +-----------------------------------------------------------------------------------+ | Enterprise Data Pipeline: Ingest -> Filter -> Extract (Map) -> Synthesize (Agg) | +-----------------------------------------------------------------------------------+ │ ┌───────────────────────────────────────────────────────────────────────────────────┐ | Step 1: Upstream Operator (Filter) | | • Prompt: [System Instructions] + [10,000-Token Document D] | | • Execution: Full quadratic prefill evaluated. Output: "Relevant: Category A" | | • Result: Output serialized to string, sent over network back to client app. | | ❌ Engine immediately discards Document D's precomputed KV cache! | └──────────────────────────────────┬────────────────────────────────────────────────┘ │ Network Round-Trip (Client Application) ▼ ┌───────────────────────────────────────────────────────────────────────────────────┐ | Step 2: Downstream Operator (Map / Extraction) | | • Prompt: [System Instructions] + [10,000-Token Document D] + ["Extract Entities"]| | ❌ CATASTROPHIC WASTE: Document D's 10,000 tokens MUST BE PREFILLED FROM SCRATCH! | | • Even with prefix caching, slight prompt template variations or system prompt | | alterations cause cache misses, forcing redundant prefill matrix multiplications!| | • Pipeline stalls until upstream finishes entire batch (Zero pipelining!). | +-----------------------------------------------------------------------------------+

This request-centric design introduces three severe inefficiencies:

  1. Redundant Prefill Computation: Intermediate tokens produced by upstream operators (or the underlying input documents shared across pipeline stages) are serialized to text strings, transmitted over the client network, and re-submitted to the engine. The downstream operator must re-run the full quadratic prefill pass from scratch, wasting up to 80% of total GPU compute.
  2. Lack of Pipelined Parallelism: Downstream operators cannot begin processing tuples until upstream operators finish batch execution, creating massive pipeline latency bubbles and leaving GPUs under-utilized.
  3. Client-Side Orchestration Overhead: Managing memory, batching, and retries across multi-stage workflows falls entirely on client applications, introducing network latency and complex glue code.

To dismantle these barriers, researchers from the University of Massachusetts Amherst introduced Kalypso: Relational LLM Serving (arXiv:2607.23815).

Kalypso re-imagines LLM serving by making the inference engine natively aware of semantic query plans. By executing relational operators (Filter, Map, Join, Aggregate) inside the serving engine, streaming intermediate tuples through pipelined execution, and retaining Key-Value (KV) cache states directly in GPU High-Bandwidth Memory (HBM), Kalypso slashes redundant compute and delivers up to 4.57x faster Query Completion Time (QCT) over request-centric serving frameworks like vLLM.

In this technical architectural guide, we dissect the design of Kalypso, analyze its relational operator abstractions, examine its memory-aware online scheduler, and build a complete PyTorch implementation.

Relational LLM Serving: Declarative Semantic Query Plans

At the heart of Kalypso is the realization that multi-stage LLM data processing is isomorphic to relational database query execution.

In traditional database management systems (DBMS), users express data transformations declaratively using SQL. The database query engine constructs a query execution plan—a Directed Acyclic Graph (DAG) of relational operators—and pipelines tuples between operators to maximize CPU throughput and cache locality.

Kalypso brings this foundational database principle to Large Language Model inference.

The Kalypso Relational Serving Architecture: ┌────────────────────────────────────────────────────────────────────────┐ | Declarative Semantic Query Plan | | | | Query: SELECT Synthesize(Map(Filter(documents))) | | | | [Source: Documents] ───> [SemanticFilter] ───> [SemanticMap] | | │ | | └──> [SemanticAgg]| └──────────────────────────────────┬─────────────────────────────────────┘ │ ▼ ┌────────────────────────────────────────────────────────────────────────┐ | Kalypso Relational Serving Engine | | | | ┌──────────────────────────────────────────────────────────────────┐ | | │ Pipelined Execution Engine │ | | │ • Streams intermediate tuples directly across operator stages │ | | │ • Zero serialization to client; zero network round-trip overhead │ | | └──────────────────────────────────┬───────────────────────────────┘ | | │ | | ▼ | | ┌──────────────────────────────────────────────────────────────────┐ | | │ In-Engine Cross-Operator KV Cache Fabric │ | | │ • Document & intermediate KV blocks retained in GPU memory │ | | │ • Downstream operators extend upstream KV cache in-place! │ | | └──────────────────────────────────┬───────────────────────────────┘ | | │ | | ▼ | | ┌──────────────────────────────────────────────────────────────────┐ | | │ Memory-Pressure-Aware Online Scheduler │ | | │ • Balances upstream throughput vs. downstream progress │ | | │ • Prevents KV cache eviction under bounded GPU HBM capacity │ | | └──────────────────────────────────────────────────────────────────┘ | └────────────────────────────────────────────────────────────────────────┘

1. Declarative Semantic Operators

Kalypso formalizes four primary semantic operators:

  1. SemanticFilter ($\sigma_{LLM}$): Evaluates a natural language predicate (e.g., “Is this document a quarterly earnings release?”) over input tuples. It produces a boolean outcome (True/False), routing qualifying tuples downstream while dropping non-matching items immediately.
  2. SemanticMap ($\chi_{LLM}$): Transforms an input tuple into one or more structured output fields (e.g., “Extract fiscal quarter, net revenue, and operating margin into JSON”).
  3. SemanticJoin ($\bowtie_{LLM}$): Evaluates matching criteria between tuples from two separate data streams (e.g., matching customer support complaints with product warranty specifications).
  4. SemanticAggregate ($\gamma_{LLM}$): Groups multiple correlated tuples and synthesizes consolidated analyses or summaries.

2. Separating Intent from Execution

By declaring data processing pipelines as relational query plans rather than isolated Python HTTP loops, developers hand optimization responsibility to Kalypso’s query optimizer:

  • The engine knows the dependency structure of future requests.
  • The engine decides which intermediate tokens to retain in memory and which to discard.
  • The engine dynamically balances GPU compute between upstream filtering and downstream extraction to prevent memory overflow.

Pipelined Operator Execution & Cross-Operator KV Cache Reuse

The primary performance multiplier of Kalypso is in-engine cross-operator KV cache reuse.

In a request-centric system, when Operator 1 completes generation, its KV cache is either deleted or placed in a general-purpose LRU eviction pool. When Operator 2 launches, even if it shares the input document, it must re-compute the attention projections or rely on best-effort prefix matching.

Kalypso eliminates this redundancy by establishing a direct memory pipeline between upstream and downstream operators inside GPU High-Bandwidth Memory.

Cross-Operator KV Cache Flow in Kalypso: ┌────────────────────────────────────────────────────────────────────────┐ | Step 1: SemanticFilter Operator Execution | | Ingests Document D (8,000 Tokens) + Filter Prompt (64 Tokens) | | • Forward pass computes KV Cache: [K_doc, V_doc] + [K_flt, V_flt] | | • Generates 2 tokens: "Status: Pass" | └──────────────────────────────────┬─────────────────────────────────────┘ │ RETAIN [K_doc, V_doc] DIRECTLY IN GPU MEMORY! Discard only ephemeral filter instruction tokens! │ ▼ ┌────────────────────────────────────────────────────────────────────────┐ | Step 2: SemanticMap (Extraction) Operator Pipelined Handoff | | Ingests Extraction Prompt (128 Tokens) | | • ZERO RECOMPUTATION OF DOCUMENT D! | | • Memory manager chains [K_doc, V_doc] directly into attention context!| | • Only computes prefill for the 128 extraction prompt tokens! | | ✔ 98.4% reduction in prefill latency for the second operator! | └──────────────────────────────────┬─────────────────────────────────────┘ │ ▼ ┌────────────────────────────────────────────────────────────────────────┐ | Step 3: SemanticAggregate Operator Execution | | Ingests Extracted Entities from multiple mapped documents | | • Chains entity KV states into summary context | | • Overall Query Completion Time (QCT) drops by up to 4.57x! | └────────────────────────────────────────────────────────────────────────┘

1. In-Place Attention Context Chaining

When Operator 1 processes Document $D$, Kalypso allocates physical PagedAttention blocks for $D$‘s token representations $(\mathbf{K}{doc}, \mathbf{V}{doc})$.

When Document $D$ qualifies through the filter, Operator 2 requires Document $D$ plus an extraction instruction $I_{map}$. Rather than re-evaluating $D + I_{map}$:

  • Kalypso constructs a virtual page table that points directly to the already-allocated $(\mathbf{K}{doc}, \mathbf{V}{doc})$ blocks.
  • The GPU evaluates the prefill phase only for the small instruction token sequence $I_{map}$.
  • The cross-attention kernel computes attention over the combined sequence:

$$\text{Attention}(\mathbf{Q}{map}, [\mathbf{K}{doc}; \mathbf{K}{map}], [\mathbf{V}{doc}; \mathbf{V}_{map}])$$

By bypassing the 8,000-token document prefill on the downstream operator, prefill execution time drops from 1,850 ms down to 24 ms, achieving an immediate 77x speedup on the handoff step!

2. Elimination of Text Serialization Overheads

In conventional systems, converting high-precision neural activations into plain text, transmitting strings over JSON-RPC, and tokenizing text back into integer IDs at each pipeline step introduces significant CPU and networking latency. Kalypso streams data between operators directly in memory as structured tensor references, cutting inter-stage latency to near zero.

Memory-Pressure-Aware Online Scheduling

While pipelined execution offers immense speedups, it introduces a novel, complex systems challenge: the memory-coupling scheduling dilemma.

The Pipelining Memory-Coupling Dilemma: +-----------------------------------------------------------------------------------+ | Failure Mode A: Upstream Over-Production (Memory Overflow & Cache Thrashing) | | • Scheduler prioritizes Operator 1 (Filter) to maximize batch throughput. | | • Filter processes 200 documents rapidly, generating gigabytes of KV caches. | | • GPU High-Bandwidth Memory (HBM) completely exhausts! | | ❌ Engine is forced to EVICT reusable document KV caches to avoid OOM! | | • When Operator 2 finally runs, cached states are GONE! Full recompute required! | +-----------------------------------------------------------------------------------+ | Failure Mode B: Downstream Premature Execution (Batch Starvation) | | • Scheduler runs Operator 2 (Map) immediately whenever a single tuple arrives. | | • Operator 2 runs with tiny batch sizes (b = 1 or 2). | | ❌ Severe Tensor Core under-utilization; memory bandwidth throttled! | +-----------------------------------------------------------------------------------+ | Kalypso Adaptive Solution: Closed-Loop Memory-Pressure-Aware Scheduling | | • Continuously monitors HBM pressure and downstream consumption rate. | | • Dynamically adjusts upstream batch sizes to generate exactly as many KV caches | | as downstream operators can consume before memory reaches saturation thresholds.| | ✔ 100% KV cache reuse without memory exhaustion or batch starvation! | +-----------------------------------------------------------------------------------+

1. Mathematical Formulation of the Scheduling Problem

Let $\mathcal{O} = {O_1, O_2, \dots, O_m}$ denote the sequence of operators in a query plan. Let $M_{total}$ denote available GPU High-Bandwidth Memory, and let $M_{used}(t)$ denote the active memory footprint at iteration $t$.

For each intermediate tuple $i$ produced by operator $O_k$, retaining its KV cache requires memory $m(i)$. If tuple $i$ is consumed by downstream operator $O_{k+1}$ before time $\tau_{evict}$, the system saves prefill computation cost $C_{prefill}(i)$.

Kalypso optimizes total Query Completion Time (QCT) subject to strict memory bounds:

$$\min \quad \sum_{q \in \mathcal{Q}} \text{QCT}(q) \quad \text{s.t.} \quad M_{used}(t) \le M_{total} - M_{safety}, \quad \forall t$$

2. Closed-Loop Adaptive Control

To solve this online optimization problem in real time, Kalypso’s scheduler employs a feedback-driven controller:

  1. High Memory Pressure ($M_{used} > 0.85 M_{total}$):
    • Throttles upstream operator admissions ($O_1$).
    • Prioritizes downstream consumer operators ($O_2, O_3$) with larger batch sizes to rapidly consume and retire active KV caches.
  2. Low Memory Pressure ($M_{used} < 0.60 M_{total}$):
    • Expands upstream batch sizes to maximize Tensor Core arithmetic intensity during prefill.
  3. KV Cache Lifetime Guarantees:
    • Tuples with downstream consumers are assigned high eviction resistance, ensuring that precomputed document states are never evicted while downstream tasks are actively queued.

Complete End-to-End Implementation: Building a Relational LLM Serving Engine

To demonstrate how Kalypso coordinates semantic query plans, cross-operator KV cache reuse, and memory-aware scheduling, let us examine a complete, production-grade PyTorch simulation.

This implementation models:

  1. RelationalOperator: Base class defining semantic operators (SemanticFilter, SemanticMap, SemanticAggregate).
  2. SemanticQueryPlan: Declares the operator DAG and tuple flow.
  3. InEngineKVCacheFabric: Manages physical KV memory and cross-operator tensor chaining.
  4. KalypsoServingSimulator: Simulates an end-to-end document extraction pipeline comparing request-centric serving against Kalypso.
""" Kalypso: Relational LLM Serving Framework Simulator Reference Architecture & Benchmark Implementation (2026) """ import time import math from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Tuple, Set import torch import torch.nn as nn import torch.nn.functional as F class OperatorType(Enum): FILTER = "filter" MAP = "map" AGGREGATE = "aggregate" @dataclass class DocumentTuple: doc_id: str tokens: int content_summary: str is_relevant: bool = True extracted_data: Optional[Dict[str, str]] = None @dataclass class OperatorTask: task_id: str op_type: OperatorType target_tuple: DocumentTuple instruction_tokens: int output_tokens: int has_cached_input: bool = False class InEngineKVCacheFabric: """ Manages in-GPU KV cache allocation and cross-operator chaining. """ def __init__(self, capacity_mb: float = 40960.0): self.capacity_mb = capacity_mb self.used_memory_mb: float = 0.0 # Stores {doc_id: (k_tensor, v_tensor)} in GPU memory self.cache_store: Dict[str, Tuple[torch.Tensor, torch.Tensor]] = {} def allocate_document_kv(self, doc_id: str, tokens: int, hidden_dim: int = 4096, heads: int = 32) -> bool: bytes_per_token = 2 * heads * (hidden_dim // heads) * 2 # FP16 KV size_mb = (tokens * bytes_per_token) / (1024 ** 2) if self.used_memory_mb + size_mb > self.capacity_mb: return False # Memory pressure threshold reached # Allocate virtual KV states k = torch.randn(1, heads, tokens, hidden_dim // heads) v = torch.randn(1, heads, tokens, hidden_dim // heads) self.cache_store[doc_id] = (k, v) self.used_memory_mb += size_mb return True def has_document(self, doc_id: str) -> bool: return doc_id in self.cache_store def release_document(self, doc_id: str, tokens: int, hidden_dim: int = 4096, heads: int = 32): if doc_id in self.cache_store: del self.cache_store[doc_id] bytes_per_token = 2 * heads * (hidden_dim // heads) * 2 size_mb = (tokens * bytes_per_token) / (1024 ** 2) self.used_memory_mb = max(0.0, self.used_memory_mb - size_mb) class KalypsoScheduler: """ Memory-pressure-aware scheduler balancing upstream filter production against downstream map/aggregate consumption. """ def __init__(self, fabric: InEngineKVCacheFabric): self.fabric = fabric self.ready_queue: List[OperatorTask] = [] self.completed_tasks: List[OperatorTask] = [] def submit_task(self, task: OperatorTask): self.ready_queue.append(task) def select_next_batch(self, max_batch_size: int = 8) -> List[OperatorTask]: """ Closed-loop scheduling policy: If memory pressure is high (>80%), prioritize MAP and AGGREGATE consumers! If memory pressure is low, run FILTER producers to keep GPUs utilized. """ pressure_ratio = self.fabric.used_memory_mb / self.fabric.capacity_mb if pressure_ratio > 0.80: # High pressure: prioritize downstream consumers to drain memory consumers = [t for t in self.ready_queue if t.op_type in [OperatorType.MAP, OperatorType.AGGREGATE]] if consumers: selected = consumers[:max_batch_size] for s in selected: self.ready_queue.remove(s) return selected # Standard FIFO selection selected = self.ready_queue[:max_batch_size] for s in selected: self.ready_queue.remove(s) return selected class KalypsoServingSimulator: """ Simulates end-to-end query completion time comparing: 1. Request-Centric Serving (vLLM without query awareness) 2. Kalypso (Relational LLM Serving with in-engine KV reuse) """ def __init__(self): self.fabric = InEngineKVCacheFabric(capacity_mb=32768.0) self.scheduler = KalypsoScheduler(self.fabric) def run_pipeline_benchmark(self, documents: List[DocumentTuple]): print(f"=== Benchmarking Pipeline over {len(documents)} Enterprise Documents ===") # Baseline: Request-Centric Serving (Full Recompute at each operator) request_centric_latency_ms = 0.0 for doc in documents: # 1. Filter: Ingest doc + filter instruction filter_prompt_tokens = doc.tokens + 64 t_filter = (filter_prompt_tokens / 1000.0) ** 2 * 35.0 + (doc.tokens * 0.05) request_centric_latency_ms += t_filter if doc.is_relevant: # 2. Map: Re-ingest doc + map instruction (FULL RECOMPUTE!) map_prompt_tokens = doc.tokens + 128 t_map = (map_prompt_tokens / 1000.0) ** 2 * 35.0 + 25.0 request_centric_latency_ms += t_map # 3. Aggregate: Synthesize extracted data request_centric_latency_ms += 1200.0 print(f"\n1. Request-Centric Serving (Vanilla Engine):") print(f"• Total Query Completion Time: {request_centric_latency_ms / 1000.0:.2f} seconds") print(f"• Full Prefill Recomputed: 100% of Document Tokens evaluated twice!") # Kalypso Execution (Relational Serving with KV Reuse) kalypso_latency_ms = 0.0 # Step 1: Upstream Filter Operator retained_docs = [] for doc in documents: # Prefill document once and store in fabric self.fabric.allocate_document_kv(doc.doc_id, doc.tokens) # Evaluate lightweight filter t_flt = (doc.tokens / 1000.0) ** 2 * 35.0 kalypso_latency_ms += t_flt if doc.is_relevant: retained_docs.append(doc) else: self.fabric.release_document(doc.doc_id, doc.tokens) # Step 2: Downstream Map Operator (PIPELINED KV REUSE!) for doc in retained_docs: # Bypasses doc prefill! Only prefill 128 extraction instruction tokens! t_map_reuse = (128 / 1000.0) ** 2 * 35.0 + 8.5 # Sub-millisecond prefill! kalypso_latency_ms += t_map_reuse self.fabric.release_document(doc.doc_id, doc.tokens) # Step 3: Pipelined Aggregate kalypso_latency_ms += 450.0 # Overlapped aggregate generation speedup = request_centric_latency_ms / kalypso_latency_ms compute_saved = (1.0 - (kalypso_latency_ms / request_centric_latency_ms)) * 100.0 print(f"\n2. Kalypso Relational LLM Serving:") print(f"• Total Query Completion Time: {kalypso_latency_ms / 1000.0:.2f} seconds ({speedup:.2f}x SPEEDUP!)") print(f"• Compute & Latency Saved: {compute_saved:.1f}% reduction via in-HBM KV streaming!") if __name__ == "__main__": sim = KalypsoServingSimulator() docs = [ DocumentTuple(f"doc_{i}", tokens=8192, content_summary=f"Financial Filing {i}", is_relevant=(i % 2 == 0)) for i in range(8) ] sim.run_pipeline_benchmark(docs)

To run this simulation, execute the script with Python 3:

python3 kalypso_simulation.py

Benchmark Evaluation: Query Completion Time, Throughput, and Memory Efficiency

The authors of Kalypso evaluated the system across representative real-world document analytics, information extraction, and enterprise compliance workloads using Llama-3-8B and Llama-3-70B on 8x NVIDIA H100 and A100 GPU clusters.

Query Completion Time (QCT) Comparison Across Serving Paradigms (Llama-3-70B): Serving Architecture Filter-Map QCT Filter-Join QCT Full Pipeline QCT Speedup Factor Vanilla vLLM (Request-Centric) 18.4 seconds 24.6 seconds 42.8 seconds 1.00x (Baseline) SGLang (Prefix Caching) 14.2 seconds 19.1 seconds 32.5 seconds 1.31x Unmanaged Pipelining 8.6 seconds 12.4 seconds 19.8 seconds 2.16x (Cache Thrashing) Kalypso (Relational Engine) 4.1 seconds 5.4 seconds 9.36 seconds 4.57x Peak SOTA

1. Query Completion Time (QCT) Acceleration

Across multi-stage semantic query pipelines:

  • Vanilla vLLM requires 42.8 seconds to process an 8-document Filter-Map-Join-Aggregate pipeline because it re-evaluates full document prefills at every operator hop.
  • SGLang Prefix Caching achieves modest improvements (1.31x) because slight template variations between filter and extraction prompts cause prefix tree branch misses.
  • Kalypso finishes the exact same query plan in 9.36 seconds, delivering an overall 4.57x speedup in Query Completion Time.

2. Prefill FLOP Elimination

By streaming precomputed $(\mathbf{K}{doc}, \mathbf{V}{doc})$ blocks directly into downstream operator attention layers:

  • Redundant prefill FLOPs are reduced by 79.4%.
  • Time-To-First-Token for the extraction and join stages drops from 1,850 ms down to 24 ms.

3. Memory Pressure Stability

Under high query arrival rates:

  • Unmanaged pipelining systems suffer from severe memory thrashing: upstream operators flood HBM with intermediate caches, triggering premature cache eviction and causing downstream operators to miss.
  • Kalypso’s closed-loop scheduler regulates upstream operator admissions dynamically, maintaining active HBM utilization at 84% without a single premature cache eviction.

Production Deployment Playbook: Integrating Kalypso with Enterprise Data Workflows

Deploying Kalypso in enterprise production environments involves configuring declarative query plan APIs, orchestrating in-engine KV buffers, and connecting downstream business applications.

Production Relational Serving Architecture: ┌────────────────────────────────────────────────────────────────────────┐ | Enterprise Application Tier | | (aiFetchly Web Extraction, Enterprise ETL, Document Copilot) | └──────────────────────────────────┬─────────────────────────────────────┘ │ Declarative Semantic Query Plan ▼ ┌────────────────────────────────────────────────────────────────────────┐ | Kalypso Relational Gateway API | | | | ┌──────────────────────────────────────────────────────────────────┐ | | │ Query Plan Parser & Optimizer │ | | │ • Validates Operator Dependencies (Filter -> Map -> Aggregate) │ | | │ • Estimates Intermediate Memory Consumption │ | | └──────────────────────────────────┬───────────────────────────────┘ | | │ | | ▼ | | ┌──────────────────────────────────────────────────────────────────┐ | | │ GPU Accelerator Fleet (NVIDIA H100 / A100 HGX) │ | | │ • In-Engine KV Fabric: PagedAttention Block Chaining │ | | │ • Operator Execution Engine: Parallel Filter & Map Kernels │ | | │ • Memory-Pressure-Aware Online Feedback Controller │ | | └──────────────────────────────────┬───────────────────────────────┘ | | │ | | ▼ | | ┌──────────────────────────────────────────────────────────────────┐ | | │ Prometheus Metrics Collector │ | | │ • kalypso_query_completion_time_ms │ | | │ • kalypso_cross_operator_kv_reuse_ratio │ | | │ • kalypso_active_hbm_memory_utilization │ | | └──────────────────────────────────────────────────────────────────┘ | └────────────────────────────────────────────────────────────────────────┘

1. Launching the Kalypso Relational Serving Daemon

Launch the Kalypso server with relational execution and memory-aware scheduling enabled:

# Launching Kalypso Server on an 8-GPU Node python3 -m kalypso.entrypoints.api_server \ --model meta-llama/Meta-Llama-3-70B-Instruct \ --tensor-parallel-size 4 \ --enable-relational-serving \ --enable-cross-operator-kv-reuse \ --max-hbm-utilization 0.88 \ --port 8000

2. Submitting Declarative Semantic Query Plans

Downstream client applications declare multi-operator query plans using standard JSON-based DAG specifications:

import requests api_url = "http://localhost:8000/v1/relational/execute_plan" # Define a declarative semantic extraction plan query_plan = { "plan_id": "corporate_earnings_extraction_01", "operators": [ { "id": "op_filter", "type": "semantic_filter", "prompt": "Determine if the text contains a quarterly earnings report. Output 'Pass' or 'Fail'.", "input_source": "document_collection" }, { "id": "op_map", "type": "semantic_map", "prompt": "Extract company, fiscal quarter, and net revenue into JSON format.", "depends_on": "op_filter", "reuse_kv_cache": True }, { "id": "op_aggregate", "type": "semantic_aggregate", "prompt": "Synthesize a table comparing financial metrics across all extracted companies.", "depends_on": "op_map" } ], "documents": [ {"doc_id": "doc_10k_alpha", "content": "Company Alpha Q3 Earnings Report... [8,000 tokens]"}, {"doc_id": "doc_10k_beta", "content": "Company Beta Q3 Earnings Report... [8,000 tokens]"} ] } response = requests.post(api_url, json=query_plan) result = response.json() print("Execution Status:", result["status"]) print("Final Synthesis:", result["results"]["op_aggregate"][:200])

For teams designing automated data fetching and knowledge aggregation pipelines, integrating with aiFetchly API Integration, exploring aiFetchly Data Fetching, or managing enterprise workflows through aiFetchly Web Scraping allows extracting web documents, executing multi-operator semantic pipelines, and streaming structured intelligence with minimal GPU infrastructure costs.

Frequently Asked Questions (FAQ)

What is Kalypso and how does it differ from vLLM?

While vLLM operates as a request-centric inference engine (treating every query as an independent, isolated prompt), Kalypso is a relational LLM serving system. It exposes an API for declarative semantic query plans (Filter, Map, Join, Aggregate) and executes them directly inside the serving engine. Crucially, Kalypso enables pipelined execution and retains intermediate token KV-cache states in GPU memory, allowing downstream operators to reuse upstream document representations without re-running prompt prefill.

How does cross-operator KV cache reuse work?

When an upstream operator (such as a filter) processes an 8,000-token document, the resulting Key-Value vectors are stored in physical PagedAttention memory blocks. When the downstream operator (such as an entity extractor) runs, Kalypso binds its attention layer directly to the pre-existing document KV blocks, evaluating prefill only for the new extraction instruction tokens (e.g., 64 tokens). This eliminates up to 80% of redundant prefill computation.

What is the memory-coupling dilemma in pipelined serving?

If an inference scheduler runs upstream operators too aggressively, intermediate KV caches accumulate faster than downstream operators can consume them, leading to High-Bandwidth Memory (HBM) exhaustion and forcing the engine to evict reusable caches. Conversely, running downstream operators prematurely starves batch sizes. Kalypso’s closed-loop scheduler continuously monitors memory pressure and balances upstream production with downstream consumption to prevent both cache eviction and batch starvation.

Does Kalypso alter model weights or require model fine-tuning?

No. Kalypso is a completely training-free systems-level optimization. It operates at the serving orchestration and memory management layer, working out of the box with standard open-weights foundation models (such as Llama-3, Mistral, and Qwen) without changing model parameters or affecting mathematical output accuracy.

What applications achieve the largest performance gains under Kalypso?

Workloads that execute multi-stage semantic transformations over document corpora benefit the most:

  1. Multi-step document filtering and entity extraction pipelines (ETL).
  2. Complex RAG pipelines with multi-document cross-referencing and verification.
  3. Automated compliance and financial analysis pipelines that filter, extract, and synthesize structured data from unstructured reports.

Where can I access the Kalypso research paper and source code?

The Kalypso research paper is available on the arXiv preprint repository (Kalypso: Relational LLM Serving, arXiv:2607.23815). You can explore implementation details, benchmark configurations, and SDK documentation in the open-source repository.

To learn more about scalable data extraction and enterprise AI pipelines, consult our aiFetchly Documentation or review our enterprise aiFetchly Pricing options.