Skip to content

armgit / sie

Public Imported from GitHub
0

Open-source inference server and production cluster for all the models your agent needs.

docs(examples): drop the shipped LoRA routing patch (#652)

Yeonwoo Sung625bb415d0f1
diff --git a/examples/regulatory-rag/README.md b/examples/regulatory-rag/README.md
index 7c2e3dc96..17d41136b 100644
--- a/examples/regulatory-rag/README.md
+++ b/examples/regulatory-rag/README.md
@@ -52,7 +52,7 @@ Two model additions drive the pipeline:
### 1. Build a custom sie-server image
Everything the pipeline needs on the server side is packaged in
-[`server-plugin/`](./server-plugin): the patch, the adapter, the YAMLs.
+[`server-plugin/`](./server-plugin): the custom adapter and the model YAMLs.
```bash
# From this directory
@@ -109,7 +109,6 @@ regulatory-rag/
└── server-plugin/
├── README.md # What the plugin does, how to extend it
├── Dockerfile # Builds sie-server with the extensions baked in
- ├── encode_lora_routing.patch
├── adapters/
│ └── stablebridge_pruner/
│ └── __init__.py # Custom ModelAdapter, 659 lines
diff --git a/examples/regulatory-rag/server-plugin/Dockerfile b/examples/regulatory-rag/server-plugin/Dockerfile
index 49010f334..c70e18bdf 100644
--- a/examples/regulatory-rag/server-plugin/Dockerfile
+++ b/examples/regulatory-rag/server-plugin/Dockerfile
@@ -1,7 +1,5 @@
# Extends the public sie-server image with the regulatory-rag example's
# custom code:
-# - LoRA routing patch (maps options["lora_id"] onto options["lora"] so
-# named LoRA profiles actually activate at inference).
# - Custom Stablebridge pruner/highlighter adapter under
# sie_server.adapters.stablebridge_pruner.
# - Two extra model YAMLs:
@@ -9,6 +7,9 @@
# that activates sugiv/modernbert-us-stablecoin-encoder weights.
# * sugiv/stablebridge-pruner-highlighter served by the custom adapter.
#
+# Profile options["lora_id"] is already copied onto worker options["lora"]
+# by sie-server, so this image does not patch the encode route.
+#
# Build: docker build -t sie-regulatory ./server-plugin
# Run: docker run --platform linux/amd64 --gpus all -p 8080:8080 sie-regulatory
# (--platform flag only needed on Apple Silicon; linux/amd64 runs under Rosetta)
@@ -21,15 +22,6 @@ FROM ghcr.io/superlinked/sie-server:${SIE_TAG}
USER root
-# patch is needed to apply the LoRA routing fix; it is not in the base image.
-RUN apt-get update \
- && apt-get install -y --no-install-recommends patch \
- && rm -rf /var/lib/apt/lists/*
-
-# Apply the LoRA routing fix in place against the installed encode module.
-COPY encode_lora_routing.patch /tmp/encode_lora_routing.patch
-RUN cd / && patch -p0 /app/src/sie_server/api/encode.py < /tmp/encode_lora_routing.patch
-
# Drop in the custom adapter.
COPY adapters/stablebridge_pruner /app/src/sie_server/adapters/stablebridge_pruner
diff --git a/examples/regulatory-rag/server-plugin/README.md b/examples/regulatory-rag/server-plugin/README.md
index a17e6444c..ae35146de 100644
--- a/examples/regulatory-rag/server-plugin/README.md
+++ b/examples/regulatory-rag/server-plugin/README.md
@@ -8,8 +8,7 @@ once, run anywhere the parent `sie-server` runs.
| File | Role |
|------|------|
-| `Dockerfile` | Builds a patched `sie-server` image with everything below applied. |
-| `encode_lora_routing.patch` | 4-line server patch that maps `options["lora_id"]` onto `options["lora"]` so named LoRA profiles actually reach the worker batcher at inference time. |
+| `Dockerfile` | Builds a `sie-server` image with the custom adapter and model YAMLs below. |
| `adapters/stablebridge_pruner/__init__.py` | Custom `ModelAdapter` for unified reranking + token-level context pruning. 659 lines of production-ready Python. Wraps a frozen `BAAI/bge-reranker-v2-m3` with a trained `PruningHead` MLP (1024 → 512 → 1) and exposes both `score()` and `extract()` from one forward pass. |
| `models/answerdotai__ModernBERT-base.yaml` | Model config with a `us-regulatory` profile that activates `sugiv/modernbert-us-stablecoin-encoder` (a LoRA fine-tune) at request time. |
| `models/sugiv__stablebridge-pruner-highlighter.yaml` | Model config that wires the Stablebridge adapter up to `sie_id: sugiv/stablebridge-pruner-highlighter`, with `default` / `aggressive` / `conservative` pruning profiles. |
@@ -38,13 +37,13 @@ python rag_pipeline.py
SIE is an inference **cluster**, not a closed box. Everything in this
folder is code you could write for your own domain:
-- A **server patch** that adjusts routing for a feature not yet shipped upstream.
- A **custom adapter** that wraps a frozen base model with a trained head to add a new primitive (here: token-level pruning under `extract()`).
-- A **LoRA profile** registered in a model YAML so domain-adapted weights hot-load at request time without a separate deployment.
+- A **LoRA profile** registered in a model YAML so domain-adapted weights hot-load at request time without a separate deployment. The profile sets `options["lora_id"]`; sie-server already copies that onto worker `options["lora"]`, so no encode-route patch is required.
- Two new model IDs that the rest of the stack (SDK, router, autoscaler, monitoring) picks up automatically because they're registered the same way as any first-party SIE model.
## Version pinning
The `Dockerfile` accepts `SIE_TAG` for reproducibility. Pin that build
-arg to the CPU or CUDA tag you want to publish against, then verify the
-patch still applies cleanly when you move to a newer upstream SIE image.
+arg to the CPU or CUDA tag you want to publish against. LoRA id routing
+ships in current sie-server, so moving to a newer upstream image does
+not require re-applying a server patch.
diff --git a/examples/regulatory-rag/server-plugin/encode_lora_routing.patch b/examples/regulatory-rag/server-plugin/encode_lora_routing.patch
deleted file mode 100644
index c95b722ed..000000000
--- a/examples/regulatory-rag/server-plugin/encode_lora_routing.patch
+++ /dev/null
@@ -1,14 +0,0 @@
---- a/packages/sie_server/src/sie_server/api/encode.py
-+++ b/packages/sie_server/src/sie_server/api/encode.py
-@@ -298,6 +298,11 @@
- "message": str(e),
- },
- ) from e
-+
-+ # Map lora_id -> lora for worker batch routing
-+ # The worker's submit() reads options["lora"] to select the LoRA batcher,
-+ # while the profile config uses "lora_id" in runtime options.
-+ options["lora"] = lora
-
- # Get output_types: profile > request param > default
- output_types: list[str] = options.get("output_types") or (params.output_types if params else None) or ["dense"]