What to Build After Local LLM Deployment: Practical Workflows and Engineering Details

    This article explains what teams can do after deploying a large language model locally, focusing on three common patterns: embedding inference into office tools, building a private knowledge base Q&A system, and running batch processing pipelines. Using a spreadsheet integration as the main example, it walks through a three-layer architecture (interaction, middleware, inference), environment preparation, middleware configuration, VBA calling code, streaming response handling, prompt and output format control, optional RAG enhancement, security and cost practices, and a troubleshooting order. The goal is to show how to automate high-frequency tasks such as summarization, extraction, classification, and Q&A while keeping data within the internal network.

    1. Why Local Deployment Is the Starting Point, Not the Finish Line

    Many teams treat local deployment as the finish line: model weights are downloaded, the inference process stays running, and the command line returns results. In reality, this only prepares the compute. Value comes from embedding model capabilities into the tools people already use every day. The core benefits of going local are not simply “getting it to run,” but three things: compliance certainty from keeping data inside the internal network, stability from being able to run offline, and the freedom to modify the inference pipeline because you control it.

    The three most common ways to put a local model to work are:

    • Embed it into office tools: connect inference to spreadsheets, documents, and ticketing systems so users do not have to switch tools.
    • Build a private knowledge base Q&A system: chunk and vectorize internal policies, product manuals, and operations guides, then answer with retrieval augmentation.
    • Create batch processing pipelines: summarize, classify, and extract information from logs, reports, and ticket text in bulk, replacing repetitive manual work.

    This article focuses on the first pattern, because it is the easiest for non-technical colleagues to accept and the one that exposes the most engineering details.

    2. Overall Architecture: Three Decoupled Layers

    Instead of connecting a spreadsheet directly to the model, split the system into three layers:

    1. Interaction layer: buttons and cell ranges in the spreadsheet software, responsible for collecting questions and displaying results.
    2. Middleware layer: a local HTTP service that handles authentication, parameter validation, prompt assembly, streaming response aggregation, and logging.
    3. Inference layer: a local inference runtime that loads a quantized model and exposes a compatible calling interface. If knowledge base capability is needed, attach a retrieval service for recall.

    The value of decoupling is that switching models, changing ports, adding authentication, or adding caching only touches the middleware, while the spreadsheet-side code stays stable. If addresses, keys, and parsing logic are all hard-coded into macros, migration costs rise quickly.

    3. Environment Preparation Checklist

    • A machine with sufficient memory (when running medium-sized quantized models, memory and VRAM capacity matter more than CPU core count).
    • A local inference runtime for pulling and hosting open-source weight models; choose model specs based on the machine configuration.
    • A knowledge base or middleware service for session management, workspace isolation, and unified authentication.
    • Spreadsheet software with macro execution enabled; developers need basic macro programming skills.
    • An internal CA or self-signed certificate (if the middleware uses HTTPS).

    Note: a larger model is not always better. Context length, quantization precision, and concurrency together determine memory usage and time-to-first-token. Start with a small spec to validate the pipeline, then scale up gradually.

    4. Middleware Configuration

    In the middleware configuration file, complete three things: fill in the inference runtime service address, specify the model name to call, and enable API authentication with a generated access key. Name workspaces in all lowercase with hyphens to avoid path and parameter matching issues.

    Also enable access logs and latency statistics, with fields at minimum including: request ID, question length, time-to-first-token, total time, token usage, and response status. Without these metrics, you cannot tell whether “slow” means the model is slow or the network is slow.

    5. Spreadsheet-Side Calling Implementation (Example)

    Open the macro editor (shortcut Alt + F11), insert a module. The core logic is: read the question cell → assemble the request → send → parse → write the result cell.

    1. Sub AskLocalModel()
    2. Dim q As String, body As String, resp As String
    3. Dim http As Object, url As String, key As String
    4. q = ThisWorkbook.Sheets(1).Range("A2").Value
    5. If Len(Trim(q)) = 0 Then Exit Sub
    6. url = "http://localhost:3001/api/v1/workspace/demo/stream-chat"
    7. key = "locally generated access key"
    8. Set http = CreateObject("MSXML2.XMLHTTP")
    9. http.Open "POST", url, False
    10. http.setRequestHeader "Content-Type", "application/json"
    11. http.setRequestHeader "Authorization", "Bearer " & key
    12. body = "{""message"":""" & Replace(q, """", """""") & """,""mode"":""chat""}"
    13. http.send body
    14. If http.Status = 200 Then
    15. resp = http.responseText
    16. ThisWorkbook.Sheets(1).Range("A4").Value = ExtractAnswer(resp)
    17. Else
    18. ThisWorkbook.Sheets(1).Range("A4").Value = "Call failed: " & http.Status
    19. End If
    20. End Sub

    Two things must be added in practice:

    • Escaping: if a question contains double quotes, line breaks, or commas, direct string concatenation breaks the JSON. Build the request body with proper JSON serialization instead.
    • Timeout and retry: synchronous requests freeze the interface. Set a timeout and apply a limited number of backoff retries on timeout.

    6. Streaming Responses and Handling the “Thinking Process”

    If the middleware returns an event stream (text fragments separated by events), a synchronous request receives the entire raw text, from which you need to extract the answer and reasoning fragments. A more robust approach is to have the middleware also provide a non-streaming aggregation endpoint so the spreadsheet side only takes the final text. If you really want to show the thinking process, write reasoning fragments and the formal answer into two separate cells so users do not mistake a draft for a conclusion.

    The parsing function must be fault-tolerant: return an empty string for missing fields, return a readable error for unexpected structures, rather than throwing a runtime error that halts the macro.

    7. Prompt and Output Format Control

    State three things clearly in the prompt: role, constraints, and output format. For example, require “give the conclusion first, then no more than three supporting points, and finally flag any uncertainties.” If you need structured results, ask for JSON output and validate it against a schema in the middleware, retrying once automatically if validation fails. This significantly reduces the chance of half-finished text appearing in the spreadsheet.

    Chunk policy documents and product manuals by heading hierarchy, vectorize them, and store them in a local vector database. On each question, recall a few fragments first, then assemble them into the prompt. Key points: keep the recall count in single digits, tag fragments with their source, and require the answer to cite sources. This improves accuracy and makes manual verification easier.

    9. Security and Cost

    • Do not hard-code keys in macros; read them from a local configuration file or environment variables.
    • Have the middleware listen only on the loopback address. If local network sharing is needed, use internal access controls and HTTPS.
    • Limit question length and filter sensitive information; desensitize logs before writing them to disk.
    • Set concurrency limits and a queue so multiple users clicking at once do not overload the machine; add a local cache layer for high-frequency repeated questions.

    10. Troubleshooting Order

    First, check whether the middleware log shows any request. Then check the status code (authentication failure, wrong path, and model name mismatch are the most common). Next, look at time-to-first-token to judge whether it is model loading or an overly long context. Finally, check the parsing logic on the spreadsheet side. Following this order, most problems can be located within ten minutes.

    11. Conclusion

    The value after local deployment depends on which workflow you connect it to. With a spreadsheet as the entry point, middleware as the hub, and local inference as the foundation, you can automate high-frequency actions such as summarization, extraction, classification, and Q&A without sacrificing data boundaries. To further reduce operational burden, you can also evaluate migrating capabilities such as model hosting, vector retrieval, and logging with monitoring alerts to general-purpose cloud product combinations, for example the container platform, object storage, and log services offered by Baidu AI Cloud, using elastic compute to handle peaks while keeping the local pipeline for sensitive data.