Skip to content

feat: Add centralized embedding-service/ to eliminate per-component model loading (ADR-004) #77

Closed as not planned

Description

@GunaPalanivel

Problem

sentence-transformers + torch are installed independently across 5 components. The README explicitly flags this under "Future Improvements".

Component Current Impact
pipelines/*.py pytorch:2.3.0-cuda base ~8 GB image, 5–10 min install per run
server/app.py, server-https/app.py SentenceTransformer per-process ~2–3 GB image bloat
kagent-feast-mcp/mcp-server/server.py SentenceTransformer local Same bloat, no sharing

Solution

Deploy all-mpnet-base-v2 as a standalone FastAPI microservice with model weights baked at build time. All 5 components call POST /embed via HTTP.

Why standalone FastAPI over KServe InferenceService (#48):

  • No KServe cluster dependency — works on any K8s, Docker Compose, or local
  • Zero cold-start — model baked into image, no HuggingFace download at runtime
  • Simpler: one container, one endpoint

Files

File Change
embedding-service/app.py New — FastAPI /embed, model loaded once at startup
embedding-service/Dockerfile New — model weights baked at build time
manifests/embedding-service/ New — K8s Deployment + ClusterIP Service
pipelines/*.py (2 files) pytorch:2.3.0 → python:3.9; batch-64 HTTP embedding
server/app.py, server-https/app.py Remove SentenceTransformer; httpx.AsyncClient embedding call
kagent-feast-mcp/mcp-server/server.py HTTP embedding call
*/requirements.txt (5 files) Remove sentence-transformers + torch

Impact

Metric Before After
Pipeline base image ~8 GB ~50 MB
Per-run install time 5–10 min ~30 sec
Model cold-start HuggingFace download per run Zero
Components with torch dep 5 0

Related

Activity

  1. added 4 commits that reference this issue on Feb 28, 2026
    70f523a
    9148732
    320aaf7
    496aebe
  2. chasecadet commented on Nov 20, 2026

    @chasecadet
    Contributor

    Thank you for reporting this!

    We are closing pre-restructure issues targeting the legacy server/, server-https/, manifests/, kagent-feast-mcp/, or in-process SentenceTransformer prototype code. In #207, #210, #233, #240, and #249, kubeflow/docs-agent migrated to dedicated TEI (text-embeddings-inference), FastMCP (docs-agent-mcp/mcp-server/), shared modular KFP pipelines (docs-agent-mcp/pipelines/), and Helm charts (docs-agent-mcp/charts/).

    If you still observe an equivalent issue on the current main stack, please feel free to open a new issue using the current issue templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions