AI Search Architecture: Engineering Ad Relevance, Agentic Commerce, and Compute Scaling

    This article presents a reusable technical framework for building generative search systems, covering traffic quality evaluation, ad relevance modeling, automated bidding loops, agent-facing commerce protocols, consumer and enterprise workload design, and layered compute capacity planning. It includes illustrative pseudocode and engineering checklists that teams can use directly for implementation.

    Generative search is turning one-off queries into multi-turn return visits, and pushing ad systems from keyword matching toward semantic understanding and agent-driven transactions. This article abstracts a reusable technical framework from a neutral perspective, covering traffic quality evaluation, ad relevance modeling, closed-loop smart bidding, general commerce protocol design, consumer subscription and enterprise adoption, and layered planning of compute supply and capital expenditure. It includes illustrative code and engineering checklists so teams can map the ideas directly to implementation.

    1. Phenomenon abstraction: from query entry point to agentic transactions

    The source material describes a cloud vendor’s progress in generative search, advertising systems, and compute expansion. Once the branding is stripped away, three general technical threads emerge:

    1. Entry point shift: search is moving from single-turn Q&A to multi-turn conversations, making return visits and session duration core metrics;
    2. Transaction path shift: advertising is moving from display-slot auctions to semantic-relevance-driven smart bidding, with an emerging commerce protocol layer for agent execution;
    3. Supply constraint shift: inference and training demand is surging, and compute (in-house accelerators, general-purpose GPUs, data centers) is becoming a long-term barrier.

    These three threads are not isolated. The entry point determines context length and cache hit rate, the transaction path determines online inference QPS and latency budget, and supply constraints determine cost per token and scaling pace. Engineering teams must place all three on the same capacity table and optimize them jointly.

    2. Technical foundations for return visits and session duration

    Improving return visits comes down to “recoverable session state plus accumulative results.” Practical design points:

    • Tiered session storage: keep short-term context in a low-latency cache, write long-term preferences to object storage and logging services; hot/cold tiering reduces per-request cost;
    • Incremental retrieval: extract entities from multi-turn conversations into structured fragments, reuse the vector index, and avoid full recomputation every turn;
    • Streaming output and first-token optimization: first-token latency drives retention; split retrieval, reranking, and generation into a pipeline, run retrieval and reranking in parallel, and stream on the generation side.

    Illustrative interface (pseudocode, expressing only the tiering idea):

    1. session = load_session(user_id, ttl=short_term)
    2. ctx = build_context(session, long_term_profile, retrieved_chunks)
    3. stream = llm.generate(ctx, stream=True, max_tokens=1024)
    4. emit_first_token_within(300ms)

    Engineering checklist: set an upper bound on the context budget for multi-turn sessions; apply semantic-level caching to repeated queries; explicitly model the “no results / low confidence” path to avoid wasting compute on idle loops.

    3. Modeling approach for a nearly 10% ad relevance improvement

    Relevance gains typically come from three changes: semantic recall, contextual reranking, and a feedback loop.

    1. Semantic recall: use nearest-neighbor retrieval between query intent vectors and product/service description vectors, replacing pure literal matching;
    2. Contextual reranking: feed session history, region, and time slot as features into the ranking model, outputting a relevance score and a quality score;
    3. Feedback loop: feed impressions, clicks, and conversions back as training samples, iterating weekly to prevent distribution drift.

    It is important to stress that relevance improvement must be jointly constrained with user experience metrics; otherwise it degrades into clickbait-style matching. Set a relevance floor threshold and frequency caps to avoid borrowing short-term gains against long-term retention.

    4. Closed-loop control for smart bidding and ROI improvement

    Smart bidding is essentially a constrained online control problem: adjust the bid multiplier in real time under budget and ROI targets. It can be abstracted as:

    • State: current spend, remaining budget, historical conversion rate, estimated competition intensity;
    • Action: bid multiplier, traffic filtering switch;
    • Reward: conversion value minus cost, plus a budget smoothing penalty.

    Illustrative control logic:

    1. if spent_today > 0.8 * budget:
    2. bid_multiplier *= 0.9
    3. elif predicted_cvr > baseline * 1.2:
    4. bid_multiplier = min(bid_multiplier * 1.05, cap)

    Engineering-wise, decouple the “prediction service” from the “control service”: the prediction side outputs pCVR/pCTR, and the control side handles smoothing and clamping to avoid jitter. The full pipeline needs aligned instrumentation to ensure a consistent attribution window; otherwise ROI evaluation becomes distorted.

    5. Universal Commerce Protocol (UCP): the interface contract for agentic commerce

    The material mentions jointly building an intelligent agent e-commerce ecosystem with multiple parties. Neutralized, it can be understood as a “commerce protocol layer for machine agents,” whose core is enabling agents to discover, order, fulfill, and handle after-sales. Design points:

    • Standardized capability description: describe inventory, pricing, delivery, and returns with machine-readable capability manifests;
    • Transaction idempotency: order and payment interfaces must support idempotency keys to prevent duplicate charges from agent retries;
    • Permissions and auditing: tiered authorization for agent credentials, with audit logs for all write operations;
    • Exception fallback: define compensation flows for timeouts, partial fulfillment, and price changes.

    Illustrative contract (pseudocode):

    1. POST /orders { idempotency_key, agent_id, items[], price_snapshot }
    2. -> 200 { order_id, status, eta }
    3. on timeout: query by idempotency_key, never blind retry

    The value of this kind of protocol is turning “humans finding services” into “agents acting on behalf of users,” with significantly higher requirements for latency, consistency, and security than traditional page interactions.

    6. The dual wheels of consumer AI and enterprise adoption

    The material reports subscription scale and month-over-month growth in enterprise edition monthly active users. Abstracted, these are two workload types:

    • Consumer side: high concurrency, short context, strong streaming, cost-sensitive, requiring extreme caching and quantization;
    • Enterprise side: long context, strong permissions, auditing and private deployment needs, requiring fine-grained quotas and isolation.

    The recommendation is a unified gateway with pooled scheduling: the consumer pool pursues throughput and cost, while the enterprise pool pursues isolation and SLA. Quotas, rate limiting, and canary releases are handled at the gateway layer to avoid duplicated implementation in business code.

    7. Layered planning for compute expansion and capital expenditure

    “Processing over 16 billion tokens per minute” means the inference side is under sustained high pressure. Capacity planning is recommended in three layers:

    1. Training layer: large clusters, tolerance for low utilization, throughput-oriented;
    2. Inference layer: low latency, elastic scaling, cost-per-token-oriented;
    3. Edge/cache layer: semantic caching and result reuse, directly cutting peak QPS.

    Cost estimation can use a simplified model:

    1. daily_tokens = qps * 86400 * avg_tokens_per_req
    2. peak_factor = 2.0 # tidal factor
    3. required_throughput = daily_tokens / 86400 * peak_factor

    For scaling pace, in-house accelerators and general-purpose GPUs should be deployed in a hybrid manner: use in-house chips for stable baseline load to amortize cost, and general-purpose GPUs as a fallback for bursts and heterogeneous models. Data center siting must consider power, network latency, and compliance at the same time.

    8. Implementation checklist

    • Have you established tiered session storage and semantic caching, and is first-packet latency on target;
    • Does ad relevance have a floor threshold and frequency caps to avoid experience erosion;
    • Does smart bidding apply clamping and smoothing, and is the attribution window unified;
    • Are agent transaction interfaces idempotent, auditable, and compensable;
    • Are the consumer pool and enterprise pool isolated, with quotas and canary releases unified at the gateway;
    • Is compute layered, with in-house chips for baseline and general-purpose GPUs for peak, and is cost per token observable.

    Conclusion

    Generative search, intelligent advertising, agentic commerce protocols, and compute expansion are essentially different facets of the same “semantic understanding—real-time decision—scaled supply” loop. If developers and enterprise readers advance along a layered architecture and place experience metrics, relevance constraints, bid control, and capacity cost on the same table for joint optimization, they can stay robust and sustainable as the ecosystem evolves rapidly.