[{"content":" I contribute to Haystack, deepset’s open-source agent framework. My work focuses on how agents retrieve evidence from documents and knowledge graphs. Python Haystack GraphRAG gRPC Haystack on GitHub Selected contributions # Graph retrieval. I built a FalkorDB retriever that uses the graph schema to translate natural-language questions into read-only Cypher queries. I also extended the document store to write graph labels and relationships from document metadata at indexing time. Agents can then query those relationships without modifying the graph. Embeddings. I added SPLADE sparse embedders and gRPC support for Hugging Face Text Embeddings Inference, including streaming document batches. SPLADE represents text as weighted terms for search. For models that instead produce a vector per token, I built vLLM multivector embedders for both queries and documents, preserving fine-grained matches between a question and a passage. Document processing. I authored the Gotenberg integration so Haystack pipelines can convert source documents to PDF through a separate service before parsing and indexing them. I extended OpenDataLoader PDF to return embedded images as Haystack documents, so figures can be retrieved alongside text. I also added asynchronous metadata extraction and concurrent embedding requests for document pipelines. ","externalUrl":null,"permalink":"/projects/haystack/","section":"Projects","summary":"Graph retrieval, embeddings and document conversion for Haystack, deepset’s open-source agent framework.","title":"Haystack contributions","type":"projects"},{"content":" Taking GLiNER extraction, classification and decision models from local inference to reusable APIs and Haystack pipelines. Python vLLM Haystack Docker I built vllm-gliner to serve GLiNER2 and GLiNER2.5 extraction and classification models, including the GLiNER2.5 Decide decision model, through vLLM. It adds DeBERTa model, pooling and request-processing plugins, with Docker images for NVIDIA GPUs and x86-64 CPUs.\nGitHub repository Model serving # Entity extraction over HTTP: expose schema-based extraction through /pooling, including character spans, confidence scores and token usage. Efficient inference: integrate DeBERTa attention kernels, model pooling and IO processing with vLLM\u0026rsquo;s serving infrastructure. CPU and GPU deployments: provide model-preparation tooling and Docker Compose configurations for both environments. These serving capabilities are supplied by the project\u0026rsquo;s vLLM plugins.\nDecision models # GLiNER2.5 Decide turns text into structured decisions rather than generated prose. I added an opt-in endpoint plugin for the OpenAI-compatible /v1/decisions API and vLLM\u0026rsquo;s /v1/systemone API, answering multiple classification questions in a single model pass.\nThe Decisions API supports choices, predicate probabilities and scores—for example, identifying a support request\u0026rsquo;s intent, whether it asks for cancellation, and its urgency together. Decide uses a closed-set classification head, not an autoregressive language-model vocabulary, and also remains accessible through /pooling.\nCompanion project: gliner-haystack # gliner-haystack connects the inference server to Haystack pipelines. Its text and document extractors accept labels at runtime, return entity spans and confidence scores, and enrich new documents without changing their existing text or metadata.\nFor example, a Haystack indexing pipeline can tag entities before it writes documents to a store:\nsequenceDiagram accTitle: Entity extraction in a Haystack pipeline accDescr: The document extractor sends text and entity labels to a separate GLiNER server, then returns copies of the documents with entity metadata. participant P as Pipeline participant H as Document extractor participant V as gliner via vLLM P-\u003e\u003eH: Documents + labels H-\u003e\u003eV: POST /pooling V--\u003e\u003eH: Spans + scores H--\u003e\u003eP: Enriched documents GLiNERDocumentExtractor enriches documents; GLiNERTextExtractor returns entities for a text input without creating a document. Both are clients of the inference server. Document processing can also run asynchronously with bounded concurrency while preserving input order.\nServing code and deployment examples Haystack components and pipeline examples ","externalUrl":null,"permalink":"/projects/gliner-model-serving/","section":"Projects","summary":"Serve GLiNER extraction, classification and decision models on CPUs or GPUs, with structured decision APIs and Haystack integration.","title":"GLiNER model serving","type":"projects"},{"content":" A Python execution tool for agents, with each MCP session assigned its own isolated Docker container. Go MCP Python Docker I built Code Executor MCP as a Go server using MCP\u0026rsquo;s Streamable HTTP transport. Its execute_python tool accepts Python code and optional package requirements, then returns the program\u0026rsquo;s standard output.\nGitHub repository Session lifecycle # sequenceDiagram accTitle: A Python execution session accDescr: The MCP server assigns a dedicated container, returns the Python program's output and destroys the container when the session ends. participant C as MCP client participant S as Go server participant D as Container C-\u003e\u003eS: Open session S-\u003e\u003eD: Reserve from pool C-\u003e\u003eS: execute_python S-\u003e\u003eD: Run Python offline D--\u003e\u003eS: Standard output S--\u003e\u003eC: Tool result C-\u003e\u003eS: End session S-\u003e\u003eD: Destroy container The client can call execute_python repeatedly in the same session. If a call requests packages, the server installs them with uv before disconnecting the network and running the code. Calls are serialised, and installed packages stay in that session’s container until it is destroyed.\nExplore further # Configuration and deployment guidance Pool lifecycle and concurrency tests ","externalUrl":null,"permalink":"/projects/code-executor-mcp/","section":"Projects","summary":"Give agents a Python execution tool with session-scoped packages, bounded Docker containers and automatic cleanup.","title":"Code Executor MCP","type":"projects"},{"content":" Bringing Rust-based tokenisation into Go services without introducing a separate inference service. Go Rust cgo Tokenisation I built splintr-go, Go bindings for the Rust splintr tokeniser through cgo. It exposes native tokenisation through a Go API, with explicit control over native-resource lifetime.\nGitHub repository Capabilities # Encode and decode: convert text to token IDs and back, with bundled pretrained vocabularies or a supplied Hugging Face tokenizer.json. Parallel batches: encode and decode batches using native parallelism for larger inputs while preserving input order. Streaming decoding: incrementally decode generated token IDs, buffering split UTF-8 characters until they can be emitted correctly. Concurrency and cleanup: support concurrent tokeniser calls and explicit Close methods for releasing native resources. Distribution: provide platform-specific native release archives and documented build and linking instructions. Integration notes # The bindings use cgo and require a native library and C toolchain. Bundled vocabularies can be loaded without runtime downloads; the upstream documentation lists their compatibility and separate licences. Streaming support is for decoding, not incremental encoding.\nGo API reference and examples Available pretrained vocabularies Native-library release instructions ","externalUrl":null,"permalink":"/projects/splintr-go/","section":"Projects","summary":"Bring Rust tokenisation to Go with cgo bindings, parallel batch operations, streaming decoding and explicit resource cleanup.","title":"splintr-go","type":"projects"},{"content":"","date":"14 November 2026","externalUrl":null,"permalink":"/notes/configuring-vllm-for-production/","section":"Notes","summary":"","title":"Configuring vLLM for Production","type":"notes"},{"content":"","date":"14 November 2026","externalUrl":null,"permalink":"/","section":"Max D. Swain","summary":"","title":"Max D. Swain","type":"page"},{"content":"","date":"14 November 2026","externalUrl":null,"permalink":"/notes/","section":"Notes","summary":"","title":"Notes","type":"notes"},{"content":"Notes, CV text and original diagrams by Max Swain are licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). Credit Max Swain, link to the original work and licence, and indicate any changes.\nSite customisations \u0026amp; reusable code examples by Max Swain, including code blocks in Notes, are licensed under the MIT License below.\nThird-party materials, including the Blowfish theme, its artwork and dependencies, the vLLM logo, the Leonardo emblem and the Lancaster University shield, retain their own rights and are not covered by these grants.\nTechnology logos in the CV retain their respective owners’ rights. Monochrome brand marks are supplied by Simple Icons (CC0); Azure and gRPC marks come from Devicon (MIT License). The DeepEval and SGLang icons come from their official repositories (DeepEval, Apache 2.0; SGLang, Apache 2.0). The Docling logo comes from its official repository (MIT License). Logos identify technologies used and do not imply endorsement.\nMIT License # Copyright (c) 2026 Max Swain\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \u0026ldquo;Software\u0026rdquo;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \u0026ldquo;AS IS\u0026rdquo;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","date":"14 November 2026","externalUrl":null,"permalink":"/licenses/","section":"Max D. Swain","summary":"","title":"Licences","type":"page"},{"content":"","externalUrl":null,"permalink":"/authors/","section":"Authors","summary":"","title":"Authors","type":"authors"},{"content":"","externalUrl":null,"permalink":"/categories/","section":"Categories","summary":"","title":"Categories","type":"categories"},{"content":" Senior AI Engineer building secure, scalable AI platforms and tools that make complex engineering work simpler. Edinburgh, UK · GitHub · LinkedIn\nExperience # Senior AI Engineer Apr 2025 – Present Leonardo · Edinburgh Own the internal AI platform and lead its delivery across engineering teams. Work alongside engineers to understand their workflows. Release early versions, then interview both frequent and infrequent users to understand what usage figures alone cannot explain. Guide architecture decisions and mentor engineers through deployment.\nModel access and permissions. Built a Go gateway that routes requests to self-hosted models and Azure AI Foundry. It authenticates users, enforces rate limits and controls which tools each user and agent may call, adding less than a millisecond of gateway overhead. Agent tools. Developed multi-agent systems and built tool-using agents with Pydantic AI, handling tool calls through the OpenAI Responses API. Wrote three multi-user Model Context Protocol (MCP) servers in Go and Python to connect agents to CloudBees and Bitbucket. Retrieval and evaluation. Led delivery of a self-hosted GraphRAG chatbot that combines semantic retrieval with graph context for sensitive documents. Measured how highly the retriever ranked relevant documents using Haystack’s NDCG metric. Used DeepEval regression tests and custom evaluations to check agent behaviour as prompts changed. Inference. Served language, vision-language, embedding, entity extraction and decision models using vLLM and Text Embeddings Inference (TEI). Extended vLLM and tuned serving configurations, including speculative decoding and parallel inference. Production operations. Instrumented the gateway and AI services with Prometheus and Grafana; used GlitchTip to trace requests and investigate application errors. Introduced fortnightly releases across Azure and on-premises Kubernetes, with automated checks in CloudBees and rolling, zero-downtime updates through Argo CD. Engineering workflows. Built pipelines to extract, clean and join data, increasing synthetic-data generation speed by approximately 30×. Consolidated signal reading and processing into one installable tool that ran faster than real time and approximately 15× faster than the previous workflow. AI Engineer Sep 2024 – Mar 2025 Leonardo · Edinburgh Led the rollout of AI applications to hundreds of internal engineers. The applications served tens of thousands of requests a day with no downtime during working hours.\nServed as technical lead for full-stack engineering applications. Built FastAPI services backed by Elasticsearch, MongoDB and PostgreSQL, and improved testing and performance as the applications scaled. Wrote high-performance readers for complex proprietary formats so engineers could process existing datasets. Developed synthetic-data generators for AI training. Owned and administered the AI/ML team’s Azure infrastructure and the developer workstations used by engineers across the business. Graduate Systems Engineer Sep 2023 – Aug 2024 Leonardo · Edinburgh Completed Leonardo’s accelerated 12-month graduate programme within the Global Combat Air Programme Data \u0026amp; AI/ML team.\nLed development of a system for querying, processing and serving large engineering datasets. This technical leadership earned a nomination for Leonardo’s 2024 innovation award. Wrote readers and processors for legacy formats and built extraction, transformation and loading (ETL) pipelines. Combined optical, radar and GPS records so engineers could analyse the sources together. Supported the team’s AI/ML infrastructure, maintaining and upgrading the systems used for engineering work. Mathematical Physics Research Intern Jul 2022 Lancaster University · Lancaster Co-developed a purely functional language for symbolic mathematics in Haskell, working on its parser and built-in functions.\nImplemented the parser that translated text into the Haskell data types used to represent expressions. Implemented arithmetic on both numbers and symbols, including exponentiation. Implemented built-in functions including Type, Subs and Print, and added support for user-defined mathematical functions. Used Git to collaborate on the language and Stack to automate builds and tests. Selected work # Haystack (deepset) # Contributed GraphRAG and FalkorDB text-to-Cypher retrieval, SPLADE sparse embedders and gRPC support for Hugging Face TEI. Built the Gotenberg document converter and improved asynchronous document-store operations and embedding throughput.\nGLiNER model serving # Built vLLM plugins to serve GLiNER on CPUs and GPUs, with a DeBERTa encoder and fused Triton attention. Added GLiNER2.5 Decide endpoints and Haystack components for entity extraction.\nCode Executor MCP # Built a Go MCP server for stateful Python execution in isolated Docker sandboxes, with session-scoped packages, automatic cleanup and optional gVisor isolation.\nsplintr-go # Created Go bindings for Splintr tokenisation, including parallel batch processing, bundled vocabularies and explicit native-resource cleanup.\nTechnical skills # Languages # Python Go TypeScript Bash C Haskell AI and retrieval # vLLM SGLang Pydantic AI Docling Haystack GraphRAG DeepEval Azure AI Foundry MCP Infrastructure # Azure Linux Docker Kubernetes Argo CD CI/CD CloudBees Jenkins GitHub Actions Prometheus Grafana GlitchTip / Sentry Data and APIs # FastAPI gRPC PostgreSQL MongoDB Elasticsearch Graph databases Education # MPhys (Hons) — Theoretical Physics Oct 2019 – Jul 2023 Lancaster University · Lancaster Grade: First Class Honours.\nMaster’s project: Programmed a Metropolis–Hastings Markov chain Monte Carlo algorithm in C to sample the Boltzmann distribution, generating a classical distribution of hundreds of interacting dipolar atoms in a quadratic trapping potential. Combined this with CASINO variational and diffusion Monte Carlo algorithms to investigate supersolidity in dipolar atomic systems confined to traps.\nModules included:\nAdvanced Electrodynamics and Gravity Advanced Relativity and Gravity Computer Modelling Gauge Theories Quantum information processing Semiconductor Device Physics ","externalUrl":null,"permalink":"/cv/","section":"Max D. Swain","summary":"","title":"Curriculum vitae","type":"page"},{"content":" Open-source work in AI inference, retrieval, agent tooling and tokenisation. More projects on GitHub.\n","externalUrl":null,"permalink":"/projects/","section":"Projects","summary":"","title":"Projects","type":"projects"},{"content":"","externalUrl":null,"permalink":"/series/","section":"Series","summary":"","title":"Series","type":"series"},{"content":"","externalUrl":null,"permalink":"/tags/","section":"Tags","summary":"","title":"Tags","type":"tags"}]