On-Premises AI Coding Assistants: Enterprise Architecture and Deployment Practices

    Learn how to plan an enterprise-hosted AI coding assistant, from a four-layer platform architecture and concurrency-based capacity planning to model selection, GPU memory estimates, and a shared client integration pattern. The article explains the trade-offs behind keeping code and context inside a private environment.

    1. Why Enterprises Are Bringing AI Coding Assistants In-House

    Over the past two years, large language model–based coding assistants have evolved from personal productivity tools into team-level infrastructure. Code completion, legacy code explanation, unit test generation, and change review are becoming established parts of development workflows. Enterprises adopting these tools, however, typically face three challenges.

    The first is the data boundary. Source code, interface definitions, and internal documentation often contain critical intellectual property. Security and compliance teams may be reluctant to approve tools that send every request to an external service.

    The second is cost and reliability. Usage-based billing becomes harder to predict as engineering teams grow, while disruptions to external services can directly affect development work.

    The third is the reuse of internal knowledge. Architecture conventions, historical incident records, and coding standards deliver lasting value only when models can retrieve and use them within a controlled environment.

    On-premises deployment addresses these concerns by placing model inference services in an enterprise-owned data center or private cloud. Local computing resources handle requests by default, keeping code and context within the internal network.

    Local deployment does not automatically produce better results, however. Model capability, context management, integration quality, and operational maturity all influence the outcome and need to be evaluated separately.

    2. A Four-Layer Platform Architecture

    A practical local inference platform can generally be divided into four layers.

    1. Hardware resources: Provide accelerated compute, system memory, and storage. Accelerator memory capacity determines the size of models that can be deployed. System memory supports caching for concurrent sessions, while storage performance affects reads and writes for model files, logs, and vector indexes.
    2. Inference services: Load model weights, schedule batching and continuous batching, and expose a consistent request interface. This layer directly affects time to first token and overall throughput.
    3. Management and control: Handle model versioning, resource quotas, user authentication, request auditing, and health checks. Without this layer, multiple teams sharing resources can encounter contention and unclear ownership.
    4. Client integration: Includes editor extensions, internal command-line tools, and web interfaces. Clients should remain as stateless as possible, with session state centralized in controlled server-side storage.

    Interfaces between these layers should be standardized so that replacing a model or upgrading hardware does not require changes to higher-level applications.

    3. Capacity Planning: Start with Concurrency

    Before purchasing or allocating resources, distinguish between registered users and concurrent requests. These numbers are usually very different. An engineering organization may have hundreds of developers, but only a fraction will submit requests at any given moment.

    Use three variables for an initial estimate:

    • Active users: The number of people actually using the assistant during working hours. This is typically a subset of the total user base and should be calibrated with pilot data.
    • Request frequency per user: The average number of requests each active user submits per minute. Code completion requests are frequent but short, while question-and-answer requests are less frequent but longer. Measure them separately.
    • Average request duration: The time from submission to the complete response, including queueing and generation.

    Average concurrent requests can be approximated as:

    1. Concurrent requests ≈ Active users
    2. × Requests per user per second
    3. × Average request duration in seconds

    For example, suppose 50 developers are active at the same time. Each submits an average of two requests per minute, and each request takes 10 seconds to complete.

    The total request rate is:

    1. 50 × 2 ÷ 60 ≈ 1.67 requests per second

    Average concurrency is therefore:

    1. 1.67 × 10 ≈ 17 concurrent requests

    For peak periods, plan for capacity at two to three times this baseline.

    This calculation provides an order-of-magnitude estimate, not a final sizing result. Refine it using actual request logs.

    4. Model Selection and GPU Memory Estimates

    Model parameter count is directly related to GPU memory requirements. A rough estimate for model weights is:

    1. Weight memory (GB) ≈ Parameters (billions) × Bytes per parameter

    For a 70-billion-parameter model, weights stored in a 16-bit floating-point format require approximately 140 GB. With 8-bit quantization, that falls to roughly 70 GB; with 4-bit quantization, it falls to roughly 35 GB.

    Actual inference requires additional memory for the key-value cache, activations, and runtime overhead. Longer contexts and higher concurrency increase these requirements.

    Quantization reduces memory pressure but can reduce model quality. A practical selection process has four steps:

    1. Define the use cases. Code completion, refactoring, unit test generation, and code review have different quality and latency requirements. Set evaluation criteria for each.
    2. Build an internal evaluation set. Select samples from the team’s historical code, covering the main languages and frameworks. Attach automatically verifiable test cases to each sample.
    3. Compare candidate models and quantization configurations. Record pass rates, response times, and GPU memory usage. Choose the combination that offers the best overall performance within available resources.
    4. Define fallback behavior. Establish a clear degradation strategy for local service outages, such as retaining only basic code completion.

    5. Integration Example: A Shared Client Wrapper

    To avoid coupling every tool directly to a service endpoint, provide a lightweight internal client. Read configuration from environment variables, manage timeout and retry settings centrally, and avoid recording complete source code in logs.

    The following excerpt illustrates this pattern. The source ends at the final raise RuntimeError( statement, so the code is incomplete and is not executable as shown.

    1. import os
    2. import time
    3. import requests
    4. ENDPOINT = os.environ["LOCAL_INFER_ENDPOINT"]
    5. API_TOKEN = os.environ["LOCAL_INFER_TOKEN"]
    6. TIMEOUT_SECONDS = float(os.environ.get("LOCAL_INFER_TIMEOUT", "30"))
    7. MAX_RETRIES = 2
    8. def ask_code_assistant(prompt: str, max_tokens: int = 512) -> str:
    9. headers = {"Authorization": f"Bearer {API_TOKEN}"}
    10. payload = {"prompt": prompt, "max_tokens": max_tokens}
    11. last_error = None
    12. for attempt in range(MAX_RETRIES + 1):
    13. try:
    14. resp = requests.post(ENDPOINT, json=payload, headers=headers, timeout=TIMEOUT_SECONDS)
    15. resp.raise_for_status()
    16. return resp.json()["text"]
    17. except requests.RequestException as exc:
    18. last_error = exc
    19. time.sleep(2 ** attempt)
    20. raise RuntimeError(