<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Keerthi Rapolu on Medium]]></title>
        <description><![CDATA[Stories by Keerthi Rapolu on Medium]]></description>
        <link>https://medium.com/@keerthiofrapolu?source=rss-2666e607f4f2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*2jczBR0C_tBiJojt</url>
            <title>Stories by Keerthi Rapolu on Medium</title>
            <link>https://medium.com/@keerthiofrapolu?source=rss-2666e607f4f2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 10:18:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@keerthiofrapolu/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Know Before You Spend: The Missing Layer in Cloud Cost Governance]]></title>
            <link>https://medium.com/the-ink-home/know-before-you-spend-the-missing-layer-in-cloud-cost-governance-85da195b5a98?source=rss-2666e607f4f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/85da195b5a98</guid>
            <category><![CDATA[finops]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Keerthi Rapolu]]></dc:creator>
            <pubDate>Mon, 08 Jun 2026 19:47:56 GMT</pubDate>
            <atom:updated>2026-06-09T12:05:48.870Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Why most cloud waste is discovered too late — and what happens when governance moves before billing.</em></p><p>CLOUD ENGINEERING · FINOPS · RESEARCH</p><p><strong>Keerthi Rapolu</strong> — Research collaboration with Sreeja Katta — May 2026</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LC2R-bxAipF9XkwJEnXIDg.png" /></figure><p>Cloud optimization tools are good. The dashboards are detailed, the anomaly detection is accurate, and the right-sizing recommendations are often correct. None of that changes the fundamental problem: almost every action those tools trigger happens <em>after the cost has already been incurred.</em></p><p>Consider what that looks like in practice. A data engineering team submits a 20-node Spark cluster to run an ETL pipeline expected to take two hours. The job finishes in 37 minutes. The cluster stays running. Six hours later it is still idle, accumulating compute charges at the full provisioned rate. By the time a FinOps dashboard flags the anomaly and someone terminates it, the bill includes hundreds of dollars in waste that cannot be recovered. An alert fired. A ticket was opened. The optimization arrived after the fact.</p><p>This pattern repeats across cloud environments at every scale. The tooling is not the problem — the <strong>timing</strong> is. Every stage of a traditional FinOps workflow — telemetry collection, cost record generation, anomaly detection, recommendation, human review — adds latency between the moment waste begins and the moment governance can act on it. By the time the response arrives, billing has already closed on that compute.</p><p>This observation led to the question that became a research project: <strong>what if cloud governance could act before billing begins?</strong></p><h4>Explore the Project</h4><p>GitHub Repository<em> —</em></p><p><a href="https://github.com/Keerthi-Rapolu/intent-aware-cloud-governance">GitHub - Keerthi-Rapolu/intent-aware-cloud-governance: Intent-Aware Cloud Governance (IACG) Framework</a></p><p>Research Paper<em> — </em><a href="https://github.com/Keerthi-Rapolu/intent-aware-cloud-governance/releases/tag/v1.0"><em>PBCP: Pre-Billing Cost Prevention</em></a></p><p>Live Demo<em> — </em><a href="https://intent-aware-cloud-governance.streamlit.app/"><em>Interactive Streamlit application</em></a></p><p>The result is <strong>PBCP — Pre-Billing Cost Prevention</strong>. This article explains how it works, what it measures, and what we learned building it.</p><h4>1. The Hidden Timing Problem in FinOps</h4><p>The dominant model for cloud cost management is reactive by design. Workloads run, resources are consumed, billing records are generated, and a cost management platform ingests those records and surfaces anomalies. The optimization cycle operates on the output of billing, not the input to provisioning.</p><p>This means the system’s observation window begins after execution and ends after cost is committed. The only window in which waste can actually be prevented — before provisioning — is the one window that most governance tools never touch.</p><blockquote><em>THE STRUCTURAL GAP</em></blockquote><blockquote><em>Traditional cloud governance tools optimize workloads that have already run. Pre-billing governance prevents waste on workloads that haven’t started yet. These are not competing approaches — they operate at different points in the lifecycle. Few cloud governance systems explicitly focus on cost prevention in the pre-billing window.</em></blockquote><p>There are three structural reasons why existing tools don’t close this gap.</p><h4><strong>Post-execution blindness</strong></h4><p>Most governance systems observe waste only after execution has begun — often after billing has already closed. By the time a cluster is flagged as idle, it has been idle for hours. The waste cannot be recovered; only the next workload can benefit from the insight.</p><h4>Semantic ignorance</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*zGL8PdUfqO0j02N2Sd8tEw.png" /></figure><p>CPU utilization at 20% is suspicious for a compute-intensive ML training job but expected for a latency-sensitive streaming service. Idle time after a job completes is waste for a batch ETL workload but correct behavior for an always-on API worker. Without understanding workload intent, a governance system cannot distinguish expected low utilization from anomalous low utilization. It observes a signal but cannot interpret its meaning.</p><p>This is not a telemetry quality problem. Better metrics would not solve it. The system needs to know what the workload was supposed to do before it can evaluate whether the workload is doing it.</p><h4>Advisory-only workflows</h4><p>Even when systems identify waste in near-real-time, most stop at a recommendation. They surface the problem and wait for a human to act. Advisory workflows are valuable for reporting, but a system designed for pre-billing governance must be able to block, correct, or suggest — automatically — before cost is incurred. Recommendations that require human review reintroduce the latency that made the timing problem unsolvable in the first place.</p><blockquote>Telemetry tells you what a workload did. Intent tells you what it was supposed to do. Most governance systems only have the first half of that sentence.</blockquote><h4>2. Why Optimization Happens Too Late</h4><p>The timing problem compounds across the lifecycle. A workload runs, billing records are generated on a multi-hour lag, a cost platform ingests them, an anomaly is flagged, a recommendation surfaces, an engineer acts — and the next provisioning cycle finally reflects the optimization. Every step in that chain happens after execution. The change applies to a future workload, not the one that generated the waste.</p><p>This is not a fixable inefficiency in the existing model. It is the model. To prevent waste rather than optimize it retrospectively, the intervention point must move to before provisioning — which requires reasoning about what a workload is likely to do before it runs.</p><h4>3. Reframing Cost Governance as Prevention</h4><p>The insight that drove PBCP’s design: cloud waste is largely predictable from information that is available at submission time. Workload descriptions, resource requests, team-level metadata, and historical execution patterns from similar workloads all exist before the first line of code runs. If governance can reason about that information early enough, it can estimate whether a requested configuration is likely to produce waste — and act on that estimate before billing begins.</p><p>This reframes cost governance from a post-billing analytics problem into a <strong>pre-billing control problem</strong>.</p><p>The distinction changes what interventions are possible:</p><ul><li><strong>Post-billing:</strong> recommend changes for the next workload</li><li><strong>During execution:</strong> correct actively running resources when divergence becomes visible</li><li><strong>Pre-billing (before provisioning):</strong> block or auto-correct before any cost is incurred at all</li></ul><p>PBCP operates at all three points, but its primary contribution is the pre-billing stage — the part of the lifecycle that existing tools leave entirely uncovered.</p><h4>4. Introducing PBCP</h4><p>PBCP — Pre-Billing Cost Prevention — is an intent-aware governance framework organized around three stages: <strong>Prevent</strong>, <strong>Correct</strong>, and <strong>Learn</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aRf93RM_myFEJWDYLSiuYA.png" /></figure><p>It is worth walking through the Prevent phase concretely, because it is the part of the design that has no equivalent in existing tools. When a workload is submitted, the system first extracts its intent from the natural-language description — what kind of job it is, what it expects to produce, and how sensitive it is to resource changes. That intent representation is used to query a FAISS index of historical workload runs, retrieving the five closest cases by semantic similarity. Those neighbors supply empirical priors: what did similar workloads actually consume, how long did they run, and how often did they diverge from their declared intent? The simulator combines the submitted configuration with those priors to estimate the likely cost exposure if the workload runs unchanged. Finally, the EV decision engine compares the expected waste savings from intervention against the cost and risk of intervening — and produces a governance decision before the first dollar of compute is billed.</p><p>Correct handles the cases that slip through: divergence patterns that only become visible after launch. Learn closes the loop by feeding outcomes from both stages back into the policy system, so each generation of workloads improves the quality of prevention for the next.</p><h4>5. Cost Prevention Score (CPS)</h4><p>Before building anything, I needed a metric that measured whether prevention was working — and one that was resistant to gaming.</p><p>The <strong>Cost Prevention Score (CPS)</strong> measures how much potential waste the system prevents before billing, relative to the full cost exposure if the workload had run unchanged. The denominator is always the <em>unchanged cost exposure</em> — what the workload would have cost without any intervention. A CPS of 0.5 means the system prevented half of the potential waste before billing began.</p><blockquote><strong>CPS is bounded by design</strong></blockquote><blockquote>CPS is capped at 1.0 regardless of intervention aggressiveness. A system that blocks every workload achieves a CPS of 1.0 — and also breaks every workload. This is exactly the failure mode that ESR guards against. CPS only tells you how much waste was prevented; it does not tell you whether the prevention was safe.</blockquote><h4>6. Execution Success Rate (ESR)</h4><p>CPS alone can be gamed by a system that is simply too aggressive. Block everything and your prevention score is perfect — and your infrastructure is unusable. I introduced <strong>Execution Success Rate (ESR)</strong> as a direct anti-gaming constraint.</p><p>ESR measures whether the system’s interventions preserve useful execution. The metric I actually report in the paper is <strong>Valid CPS</strong>:</p><pre>Valid CPS = CPS × ESR</pre><p>If ESR drops because the system is over-blocking, Valid CPS drops even if raw CPS stays high. You only get credit for prevention that doesn’t break the workloads it governs. In our benchmark, the system maintained an ESR of <strong>0.981</strong>–98.1% of governed workloads completed successfully — which confirms that the prevention actions were operationally safe, not just metric-maximizing.</p><h4>7. Pre-Execution Simulation</h4><p>To apply governance before execution, PBCP needs to estimate what will happen if a workload runs unchanged. This is the job of the pre-execution simulator.</p><h4>Intent inference</h4><p>The first step is encoding what the workload is trying to do. Given a natural-language job description — something like <em>“nightly ETL pipeline, processes 500GB of customer transactions, writes to Snowflake, expected to complete in under two hours”</em> — the system infers a structured workload-intent representation capturing type, recurrence, urgency, sensitivity to resource changes, and expected behavioral profile. In the full local version of PBCP this uses a DistilBERT embedding model; the hosted demo uses keyword-based inference to avoid model loading overhead at startup.</p><h4>Historical similarity retrieval</h4><p>With an embedding in hand, the system queries a FAISS index of historical workload runs to find the nearest cases by semantic similarity. These neighbors provide empirical priors on likely utilization, duration, and cost — grounded in what actually happened with similar workloads rather than static rule-based assumptions.</p><pre># Retrieve k nearest neighbors from FAISS index<br>embedding = intent_model.encode(workload_description)<br>distances, indices = faiss_index.search(embedding, k=5)<br>neighbors = [workload_history[i] for i in indices[0]]<br><br># Derive empirical priors from similar historical workloads<br>utilization_prior = np.mean([n[&quot;utilization&quot;] for n in neighbors])<br>cost_prior        = np.mean([n[&quot;actual_cost&quot;] for n in neighbors])</pre><h4>Cost simulation</h4><p>The simulator combines workload intent with historical priors to predict likely utilization and cost for the submitted configuration. In our calibration experiment, the simulator achieved a utilization MAE of <strong>0.054</strong> across 96 samples — well within the acceptance gate of 0.10.</p><blockquote>Why simulation error is expected and acceptable</blockquote><blockquote>Pre-execution cost prediction carries inherent uncertainty: job duration is unknown at submission time, and runtime behavior can diverge from intent in ways the simulator cannot foresee. The simulator is not trying to perfectly predict cost — it is estimating whether the submitted configuration is likely to diverge significantly enough to warrant intervention. Moderate prediction error is acceptable here; runtime correction handles the cases that slip through.</blockquote><h3>8. Decision-Theoretic Intervention</h3><p>Once the simulator produces an estimate, the system needs to decide what to do. The <strong>Expected Value (EV) Decision Engine</strong> weighs predicted waste savings against intervention cost and execution risk before choosing an action. Governance is not free — blocking a workload that should run is a failure, and auto-correcting a well-configured workload introduces delay. The decision engine treats intervention as a cost-sensitive control problem rather than a fixed rule trigger.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*V_dCTh194St4MmRa1dv9Mw.png" /></figure><p>In the showcase experiment, PBCP applied AUTO_CORRECT to a 20-node ETL cluster, reducing it to 10 nodes before billing began. The prevented cost was $15.36 on that single workload, with a CPS of 0.500. The dollar amount is not the point — the point is governance timing. The waste path was altered before the cluster was ever provisioned.</p><h4>9. Prevent → Correct → Learn</h4><p>Pre-execution simulation covers the pre-provisioning window, but it cannot catch everything. Some divergence patterns only become visible after a workload launches: a correctly-sized job that runs far longer than expected, an ML training process that escapes its cost envelope, or an idle period that begins mid-execution when a dependency stalls.</p><h4>Runtime correction</h4><p>The runtime optimizer monitors launched workloads for divergence between declared intent and observed behavior. In Exp 2, a runaway ML training job continued accumulating cost far beyond its expected completion window. The runtime system caught it and applied a checkpoint-and-stop intervention. The prevented cost was <strong>$97.92</strong>.</p><p>That number matters for a specific reason: it represents a class of failure that pre-execution simulation explicitly cannot handle. The job was correctly configured at submission time — the problem emerged only after launch, when it failed to converge within its expected window. Runtime correction is not a fallback for failed prevention; it is a necessary complement that covers the failure modes the pre-billing stage cannot reach. Together, the two stages cover the full lifecycle.</p><h4>Policy learning</h4><p>Each intervention — successful or missed — generates evidence that feeds back into the policy system. Over repeated workload generations, policies update based on accumulated outcomes rather than relying on a fixed rule set. The compounding effect of this feedback loop was the most surprising result in the research.</p><p>In Exp 6, the full PBCP system with learning active reached a peak CPS of <strong>0.733</strong>. The same system with learning frozen reached only <strong>0.013</strong>. In our controlled benchmark, policy learning produced a <strong>56× improvement</strong> relative to the same system with learning disabled — attributable entirely to accumulated policy evidence.</p><blockquote>What 56× actually means</blockquote><blockquote>In our controlled benchmark, policy learning produced a 56× improvement relative to the same system with learning disabled. This is a controlled ablation — PBCP with learning enabled versus the same system with learning frozen — not a comparison to any external tool. Results from production deployment would differ based on workload composition and telemetry quality. The point is that the learning stage is not optional: without it, the system plateaus near zero effectiveness.</blockquote><h3>10. Key Results</h3><p>PBCP was evaluated on a controlled benchmark of 500 workloads and 28,423 runs across six workload classes: ETL, ad-hoc analytics, ML training, LLM pipelines, batch processing, and streaming.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gfbI1VeGhPsQmPdoMq4PhQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/917/1*1BMND-1LTYqNkyjf0vUWaw.png" /></figure><p>All results are from a controlled synthetic benchmark. Production results would vary based on workload composition, telemetry quality, and calibration.</p><h4>11. Lessons Learned</h4><p>Building PBCP taught me several things I did not fully anticipate going in.</p><h4>Governance timing is the core design variable</h4><p>I initially framed this as a prediction problem: build a better cost model. It turned out to be a timing problem: move the decision point earlier. The prediction quality matters, but less than I expected. A moderately accurate pre-execution estimate that arrives before provisioning is more valuable than a highly accurate post-billing report that arrives after billing closes, because only one of them can prevent waste.</p><h4>ESR is as important as CPS</h4><p>It is easy to build a system that scores well on prevention metrics by being overly aggressive. The ESR constraint was essential to making PBCP useful rather than just high-scoring. Any governance system that does not explicitly track the cost of over-intervention will drift toward over-restriction — and produce a system that improves the bill by making the infrastructure unusable.</p><h4>The feedback loop is where the value compounds</h4><p>In our controlled benchmark, policy learning produced a 56× improvement relative to the same system with learning disabled — the most surprising result in the research. The individual prevention components — simulation, retrieval, decision engine — each contribute. But the compounding effect of feeding outcomes back into policy was far larger than any single component improvement. Systems that do not learn from their interventions plateau quickly, regardless of how well they are initialized.</p><h4>Semantic intent is the hardest part to get right</h4><p>The framing I described in Section 1 — that existing tools reason about what a workload did, not what it was trying to do — turns out to be hard to operationalize. Intent inference from natural-language descriptions is noisy. Short job descriptions lose information. Teams that write terse submission metadata give the system less to work with. In production, the quality of intent inference would be directly constrained by how much description is available at submission time.</p><h4>Synthetic benchmarks have real limits</h4><p>All results here are from a controlled synthetic environment. Real cloud workloads have higher variance, noisier telemetry, more edge cases, and organizational constraints that a benchmark cannot capture. PBCP is a research prototype. The path from prototype to production deployment would require calibration against real telemetry and integration with existing enforcement infrastructure.</p><h4>12. Future Directions</h4><h4>Infrastructure-as-code integration</h4><p>The most natural enforcement point for pre-billing governance is the IaC layer — sitting between terraform plan and terraform apply, or at a Kubernetes admission webhook. At that point, the full resource specification is available, the workload hasn&#39;t started, and no cost has been incurred. PBCP&#39;s architecture is compatible with this model: the EV decision engine can return a governance action that a CI/CD pipeline enforces automatically. The non-trivial part is integration — connecting intent inference to real IaC metadata schemas and ensuring simulation latency stays acceptable. Depending on organizational deployment requirements, a longer simulation window may be acceptable for scheduled workloads; interactive provisioning would need a lighter-weight approximation.</p><h4>Multi-tenant and cross-workload reasoning</h4><p>The current system governs workloads individually. In practice, cloud waste is often caused by interaction effects — multiple teams competing for shared resources, or cross-team pipelines creating cascading idle periods. Extending PBCP to reason across concurrent workloads is an open problem requiring team-level and project-level context in the intent model.</p><h4>Real-time intent tracking</h4><p>Intent is currently inferred once at submission time. Workload intent can evolve mid-execution — a job expected to be short-lived might be extended, or a batch pipeline repurposed. A system that can update its intent model in response to runtime signals would be significantly more robust in dynamic environments.</p><p>Continue Reading: <strong><em>The IFS Perspective</em></strong></p><p>This article covered the prevention side of PBCP — intent inference, pre-execution simulation, and the EV decision engine.</p><p>For the complementary perspective on how workload alignment is measured and how divergence is detected and explained, read Sreeja Katta’s article covering:</p><ul><li>Intent-Fit Score (IFS) — measuring alignment between declared intent and runtime behavior</li><li>Intent-Behavior Discrepancy (IBD) — the divergence detection framework</li><li>Root Cause Analysis — why a workload diverged from its expected behavior</li><li>Anomaly Detection — distinguishing expected low utilization from governance failures</li><li>Prevention Feedback Loops — how IFS signals improve future governance decisions</li></ul><p><a href="#sreeja-article-link">Sreeja’s article —</a></p><p><a href="https://medium.com/@sreejakatta02/beyond-cpu-thresholds-using-intent-fit-score-to-detect-cloud-workload-misalignment-efbbf722e975">Beyond CPU Thresholds: Using Intent-Fit Score to Detect Cloud Workload Misalignment</a></p><blockquote><strong>Cloud governance should not start after the bill arrives. It should start before resources are provisioned.</strong></blockquote><p><strong>Keerthi Rapolu</strong> is a researcher focused on cloud systems, cost governance, and intent-aware infrastructure. This work was developed in collaboration with <strong>Sreeja Katta</strong>, whose contributions to the IFS subsystem, anomaly detection, and prevention feedback loops are described in the companion article.</p><p><a href="https://github.com/Keerthi-Rapolu/intent-aware-cloud-governance">GitHub</a> · <a href="https://github.com/Keerthi-Rapolu/intent-aware-cloud-governance/releases/tag/v1.0">Paper PDF</a> · <a href="https://intent-aware-cloud-governance.streamlit.app/">Live Demo</a></p><blockquote>This story is Published in <a href="https://medium.com/the-ink-home"><strong>The Ink Home</strong></a>.</blockquote><blockquote>A sanctuary for reflections on (<strong>Life</strong>), (<strong>Tech</strong>), (<strong>Writing</strong>), (<strong>Productivity</strong>), and (<strong>Mental Health</strong>).<br>✍️ <strong>We are welcoming new voices</strong>. Whether you are a beginner or a pro, <a href="https://medium.com/the-ink-home/newsletter"><strong>Join our Community</strong></a> to share your story.<br><strong>Let’s build a better internet, one story at a time.<br></strong>=&gt; <a href="https://theinkhome.live/">Website</a> | <a href="https://www.linkedin.com/company/the-ink-home/">Linkedin</a> | <a href="https://web.facebook.com/61582621220914">Facebook</a> | <a href="http://instagram.com/the_ink_home">Insta</a> |</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85da195b5a98" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-ink-home/know-before-you-spend-the-missing-layer-in-cloud-cost-governance-85da195b5a98">Know Before You Spend: The Missing Layer in Cloud Cost Governance</a> was originally published in <a href="https://medium.com/the-ink-home">The Ink Home</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Enterprise Text-to-SQL Systems Fail Without Metadata Reasoning]]></title>
            <link>https://medium.com/@keerthiofrapolu/why-enterprise-text-to-sql-systems-fail-without-metadata-reasoning-bc3c2a4b7e48?source=rss-2666e607f4f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc3c2a4b7e48</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Keerthi Rapolu]]></dc:creator>
            <pubDate>Mon, 25 May 2026 00:00:12 GMT</pubDate>
            <atom:updated>2026-05-25T22:32:56.382Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6OQQ9kHV2NXv3wRdECwhLQ.png" /></figure><p><em>Most discussions of enterprise text-to-SQL focus on whether the LLM can produce correct SQL. This one focuses on a different question: whether the system should attempt generation at all.</em></p><p><em>This is a design paper, not a deployment report. The system described here is a research prototype built to explore one architectural idea: that deterministic metadata reasoning before LLM generation produces more trustworthy behavior than retrieval-then-generate pipelines. The benchmark evidence is synthetic. The failures it catches are realistic by design, not by observation.</em></p><p><em>That framing matters because the argument does not depend on a production deployment to be valid. It depends on whether the failure modes it addresses — semantic ambiguity, governance violations, hallucinated joins, missing schema grounding — are real problems in enterprise analytics. They are. Anyone who has worked with a data warehouse at scale has seen at least one of them.</em></p><p><em>Here’s the architecture, here’s what the benchmark shows, and here’s where it falls short.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g1O1B_T7Tomre5dWkuqYHg.png" /></figure><h4><strong>The Hidden Failure Modes of Enterprise Text-to-SQL</strong></h4><p>Enterprise text-to-SQL failures are subtle because many of them still produce syntactically valid SQL. A query can compile, execute, and return data while still being wrong in the ways that matter most to analytical systems. The failure surface is not primarily parser correctness. It is trust.</p><p>In this paper, <em>trust-aware</em> refers to system behavior that constrains generation based on explicit metadata grounding, governance validation, and confidence thresholds.</p><p>In enterprise environments, several failure modes recur:</p><ul><li><strong>Semantic ambiguity.</strong> Terms such as revenue, customer, or active can map to multiple business definitions. Picking one silently is a correctness failure.</li><li><strong>Hallucinated joins.</strong> Metadata retrieval may surface relevant tables without proving that those tables can be joined safely. A model can be relevant and still be structurally unusable.</li><li><strong>Governance violations.</strong> A query may target PCI-tagged models, expose PII columns, or cross domain boundaries that a given role should not access.</li><li><strong>Unsafe warehouse scans.</strong> Broad or unrestricted analytical requests can imply extremely large scans, especially on partitioned event tables.</li><li><strong>Insufficient schema grounding.</strong> A user term may not exist in the manifest or glossary at all, creating pressure for the model to invent support that does not exist.</li></ul><p>These are not edge cases. They are the routine operating conditions of enterprise analytics systems. A text-to-SQL assistant that does not reason over them explicitly may appear useful in simplified environments while remaining operationally unsafe in practice.</p><h4>Why Retrieval Alone Is Not Reasoning</h4><p>Modern RAG pipelines solve one real problem well: they retrieve candidate context. In the text-to-SQL setting, that usually means table descriptions, column metadata, lineage hints, or prior query examples. Retrieval is necessary, but it is not sufficient.</p><p>The distinction matters because the safety and correctness decision is not reducible to semantic similarity.</p><ul><li>Retrieving fct_orders does not resolve whether revenue means revenue_gross or revenue_net.</li><li>Retrieving both dim_customer and support_tickets does not prove there is a clean join path between them.</li><li>Retrieving payment_events because it lexically matches payments does not override governance tags such as pci.</li><li>Retrieving a large partitioned table does not justify an unrestricted historical scan without a time filter.</li></ul><p>Retrieval answers: <em>What metadata is nearby?</em></p><p>Enterprise reasoning must answer a different set of questions:</p><ul><li>Which candidate interpretation is semantically justified?</li><li>Is there a reliable join path?</li><li>Is the query safe for this user and this dataset?</li><li>Is confidence high enough to proceed?</li><li>Should the system generate SQL at all?</li></ul><p>That difference is the thesis of this architecture. Retrieval is one signal. It is not the system’s decision procedure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*raTcL22Ivj8jjxez1mOZ8A.png" /></figure><h4>Designing a Trust-Aware Metadata Reasoning System</h4><p>The system described here is built around a deterministic metadata reasoning layer that sits between the user query and final SQL generation. The language model, when used, receives only a constrained execution plan. It does not receive the full burden of deciding intent, join validity, governance safety, or confidence thresholds by itself.</p><p>Deterministic planning constrains critical trust decisions to explicit system logic rather than relying entirely on probabilistic prompt behavior.</p><blockquote>SQL generation should be the final translation step, not the place where trust-critical reasoning first occurs.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/869/1*W1MnZbeV766glUcVqLKpKw.png" /></figure><p>This structure is intentionally constrained. It does not attempt to turn the system into a general-purpose agent, a multi-tool framework, or a dashboard-first application. The emphasis is on trustworthy decision-making.</p><h4>Deterministic Planning Before LLM Generation</h4><p>The reasoning pipeline is organized as a sequence of deterministic stages:</p><ol><li><strong>Intent Extraction.</strong> The system classifies the query intent, such as lookup, segmentation, trend, or aggregation, and extracts basic temporal cues.</li><li><strong>Metadata Retrieval.</strong> Candidate models are ranked using composite retrieval rather than raw vector similarity alone.</li><li><strong>Join Path Reasoning.</strong> The graph layer searches for lineage-backed paths between candidate models and scores them using foreign-key strength, proximity, and lexical column similarity.</li><li><strong>Ambiguity Detection.</strong> Competing metric definitions, candidate columns, and weakly separated join alternatives trigger clarification or refusal.</li><li><strong>Governance Validation.</strong> PII, RBAC, scan risk, and unsafe patterns are evaluated before any generation step proceeds.</li><li><strong>Confidence Propagation.</strong> Retrieval, join, governance, completeness, and intent signals are combined so the weakest trustworthy component governs the decision.</li><li><strong>SQL Generation or Refusal.</strong> Only after the prior stages succeed does the system emit SQL.</li></ol><p>Each stage exists because it answers a distinct systems question. This is not redundancy. It is decomposition. The point is to avoid collapsing every uncertainty into a single prompt and hoping the model resolves it correctly.</p><p>One concrete enterprise case makes the join-reasoning requirement clearer. Consider the request customers with failed payments after support escalation. This is not a single-table lookup. It requires traversing multiple business domains: support_tickets → customer_master → payment_events. To answer safely, the system must verify that a lineage-backed join path actually exists, that the customer identifiers are compatible across the models, that there are not multiple competing routes through intermediate entities, and that governance restrictions on payment data do not block access.</p><h4>Honest Refusal as a First-Class System Behavior</h4><p>One of the strongest differences between this system and generic text-to-SQL pipelines is that refusal is treated as a product behavior, not as an embarrassing exception.</p><p>Consider a query such as show revenue by region. If revenue maps to both revenue_gross and revenue_net, the system should not “do its best.” It should refuse cleanly and explain the ambiguity. In analytical systems, silently selecting the wrong metric is frequently worse than returning no SQL.</p><p>The same logic applies when schema grounding fails. If a request such as show me xyz_metric_zz99 does not map to the glossary or graph, the correct response is INSUFFICIENT_SCHEMA. This is not a weakness to hide. It is the right operating behavior when the metadata evidence is missing.</p><p>The implemented failure taxonomy currently distinguishes GOVERNANCE_BLOCKED, UNSAFE_QUERY, INSUFFICIENT_SCHEMA, WEAK_JOIN, SEMANTIC_CONFLICT, AMBIGUOUS_JOIN, TEMPORAL_AMBIGUITY, and LOW_CONFIDENCE. That taxonomy gives the system a vocabulary for why generation stopped.</p><h4>Confidence Propagation Across the Planning Pipeline</h4><p>The system does not treat confidence as a single opaque scalar attached after the fact. Confidence is propagated across several planning signals: retrieval quality, join-path confidence, governance clearance, metadata completeness, and intent clarity.</p><p>The current implementation uses a weakest-link model in which the minimum trusted component, adjusted by intent clarity, governs the final confidence. That design is intentionally conservative. A query with excellent semantic retrieval but poor join confidence should not receive a high final score. Likewise, a governance-hard-blocked query should not be rescued by strong lexical similarity.</p><blockquote>Confidence should describe whether the plan is trustworthy, not whether the language model sounds fluent.</blockquote><p>In the current demo environment, this also exposed a useful weakness: some benign single-entity queries were being refused because the default non-embedding retrieval fallback was too weak. Improving that fallback increased benchmark accuracy and allowed the interface to surface at least one genuine SQL-generation path. That outcome is exactly what a benchmark should reveal.</p><h4>Governance-Aware SQL Orchestration</h4><p>Enterprise analytics systems must reason about more than semantics. They also need policy awareness.</p><p>The governance layer evaluates three categories:</p><ol><li><strong>PII and restricted data.</strong> Models and columns tagged as PCI, restricted, confidential, or hard PII create immediate blocks.</li><li><strong>Role-based access.</strong> Candidate models are compared against the user’s allowed domains and blocked tags.</li><li><strong>Query cost risk.</strong> Estimated scan volume and unsafe patterns, such as unrestricted historical scans on large partitioned tables, are surfaced and may block execution.</li></ol><p>This matters because enterprise risk is not only about what SQL says. It is also about what the SQL would do. A request such as show all payments is not merely a retrieval problem. It is a governance problem. In the current synthetic environment, payment_events is PCI-tagged and carries high scan cost. The correct system behavior is to block before generation, not to generate and hope downstream controls catch the issue later.</p><h4><strong>Evaluation and Benchmark Results</strong></h4><p>The architecture claims several things: that it can refuse honestly, block unsafe requests, classify failures explicitly, and propagate confidence through deterministic planning. Those claims need evidence.</p><p>To make the behavior measurable, the repository includes a grouped benchmark runner that evaluates five fixture categories: answerable queries, ambiguity cases, hallucination resistance via missing-schema queries, governance violations, and unsafe operational queries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4nPvvPAAJ0DdA6DjvtXkuw.png" /><figcaption>Benchmark results across five evaluation categories</figcaption></figure><p>These results tell a more useful story than a polished demo alone could: governance and unsafe-query behavior are already strong, ambiguity handling is highly reliable on the current fixture set, and answerable-query recovery is improving but still incomplete.</p><p>The benchmark suite is synthetic and the fixtures were designed by the same author as the system. Governance and unsafe-query recall of 1.00 on self-authored tests do not prove production readiness; they show that the system’s trust behaviors are explicit enough to be measured, challenged, and improved over time.</p><p>The benchmark intentionally prioritizes trustworthy refusal behavior over unconstrained SQL generation. From a systems perspective, that is a defensible trade. It is better for the system to be conservatively correct than fluently wrong. The 0.33 answerable-query accuracy is therefore the number that matters most for honest calibration.</p><p>The current implementation also has clear limitations. It depends heavily on metadata quality, lineage completeness, and governance tagging accuracy. Sparse or inconsistent metadata reduces retrieval confidence, weakens join validation, and increases refusal rates even when a human analyst might be able to recover the intent manually.</p><h4>Rethinking Enterprise AI Safety for Analytics Systems</h4><p>The main architectural insight of this work is not about prompts, embeddings, or front-end presentation. It is about where reasoning should happen.</p><p>If the system leaves semantic disambiguation, join validation, governance judgment, and confidence thresholding to the final SQL generation step, it has already made the most important design mistake. At that point the model is being asked to invent the trust boundary instead of respecting one.</p><blockquote>The more useful question is not:<strong> Can the LLM generate SQL?</strong></blockquote><blockquote>The more important question is: <strong>Should the system generate SQL at all?</strong></blockquote><p>That shift changes the design space. It leads naturally toward explicit metadata grounding, deterministic planning, honest refusal, confidence propagation, and governance-first orchestration. It also produces a system that can be evaluated as a reasoning pipeline rather than a demo of prompt fluency.</p><p>This prototype does not answer that question completely. What it does is make the question concrete, implement one approach to it, and measure the result honestly.</p><p>For practitioners, that is the key takeaway. In enterprise analytics, the quality of the system is not measured only by how often it returns SQL. It is measured by how reliably it knows when not to.</p><p>— -</p><p>Repository: <a href="https://github.com/Keerthi-Rapolu/Trust-Aware-Metadata-Intelligence">Trust-Aware-Metadata-Intelligence</a><br>Full paper PDF: <a href="https://medium.com/docs/paper.pdf">paper.pdf</a><br>Live demo: <a href="https://trust-aware-metadata-intelligence.streamlit.app/">trust-aware-metadata-intelligence.streamlit.app</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc3c2a4b7e48" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>