Skip to content

armgit / sie

Public Imported from GitHub
0

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

examples(contract-review-agent): 27B brain + 3.5-4B for the rest

svonava56f04519bbbd
diff --git a/examples/contract-review-agent/README.md b/examples/contract-review-agent/README.md
index 094397820..71b3e2fc3 100644
--- a/examples/contract-review-agent/README.md
+++ b/examples/contract-review-agent/README.md
@@ -10,11 +10,11 @@ Every value below is a real model in the [SIE catalog](https://superlinked.com/m
| Role in the agent | SIE model | SIE function |
|---|---|---|
-| Triage — classify the document type | `Qwen/Qwen3-0.6B` | chat |
-| **Orchestrator** — plan, call tools, assemble the review | `Qwen/Qwen3.5-4B` | chat + tools + JSON schema |
+| Triage — classify the document type | `Qwen/Qwen3.5-4B` | chat |
+| **Orchestrator** — plan, call tools, assemble the review | `Qwen/Qwen3.6-27B` (64K, non-thinking) | chat + tools + JSON schema |
| Vision — read the scanned signature page | `Qwen/Qwen3.5-4B` | chat + image |
-| Reasoning sub-agent — clause-risk analysis | `Qwen/Qwen3.5-4B` (↑ `Qwen3.6-27B` where served) | chat |
-| Text-to-SQL — query the obligations DB | `Qwen/Qwen3.5-4B` (↑ `Qwen3-4B-Instruct-2507`; or `defog/sqlcoder-7b-2` with `sql.mode: completions`) | chat |
+| Reasoning sub-agent — clause-risk analysis | `Qwen/Qwen3.5-4B` | chat |
+| Text-to-SQL — query the obligations DB | `Qwen/Qwen3.5-4B` (or `defog/sqlcoder-7b-2` with `sql.mode: completions`) | chat |
| Guardrail — safety / prompt-injection | `ibm-granite/granite-guardian-3.0-2b` (alias `guard`) | chat |
| OCR — scanned page → markdown | `lightonai/LightOnOCR-2-1B` | extract |
| Clause search — dense embeddings | `BAAI/bge-m3` | encode |
@@ -40,7 +40,7 @@ Agent(name="Risk Analyst", model=OpenAIChatCompletionsModel("Qwen/Qwen3.5-4B", o
The flow is **two agents** (which is what keeps a small open model reliable):
-1. An **investigator** (on `Qwen3.5-4B`) with seven tools and **no** structured `output_type` — so it can't short-circuit to a hallucinated answer and instead must call tools to learn anything about the contract:
+1. An **investigator** (on `Qwen3.6-27B`) with seven tools and **no** structured `output_type` — so it can't short-circuit to a hallucinated answer and instead must call tools to learn anything about the contract:
- `classify_document` (triage) · `read_signature_page` (vision) · `analyze_clause_risks` (delegates to the reasoning **sub-agent**) — generative LLMs
- `ocr_signature_page` · `extract_entities` (`extract`), `search_clauses` (`encode` + `score`), `query_obligations_db` (`completions`) — retrieval & extraction
- a `granite-guardian` **input guardrail** screens the request first (and fails open, logged, if the guard model is unavailable).
@@ -69,9 +69,9 @@ uv run review # uv run review --list to see available
uv run review --contract <slug> # review a specific one
```
-> **GPU sizing.** The generative roles (`orchestrator`, `vision`, `reasoning`, `sql`) are consolidated on
-> `Qwen/Qwen3.5-4B`, so one warm 4B vision+text model runs the demo on a single mid-size GPU; bump
-> `reasoning`/`sql` to the stronger `Qwen/Qwen3.6-27B` (H100/RTX PRO 6000) where the cluster serves it. A cold
+> **GPU sizing.** The brain (`orchestrator`, which also does the structured synthesis) runs on
+> `Qwen/Qwen3.6-27B` (64K, non-thinking) — an H100 / RTX PRO 6000; the shorter-context roles (`triage`,
+> `vision`, `reasoning`, `sql`) run on `Qwen/Qwen3.5-4B`. A cold
> cluster pays a one-time load per model on first use; the agent retries the "still
> provisioning" responses under `cluster.provision_timeout_s`. Keep bundles warm
> (`minReplicas: 1`) to skip the wait — and any model the cluster can't serve degrades
@@ -87,7 +87,7 @@ uv run review --contract <slug> # review a specific one
```yaml
models:
- reasoning: "Qwen/Qwen3.6-27B" # default 4B runs anywhere; bump to 27B on an H100-class cluster
+ sql: "defog/sqlcoder-7b-2" # a text-to-SQL specialist (also set sql.mode: completions)
ocr: "opendatalab/MinerU2.5-Pro-2604-1.2B" # try a different OCR model
```
@@ -106,7 +106,7 @@ The default corpus is **[CUAD](https://www.atticusprojectai.org/cuad/)** (Contra
## Notes
- Chat completions, tool calling, JSON-schema structured output, vision, and `/v1/completions` (set `sql.mode: completions` to route SQL through a completion-only model like `sqlcoder`) are all served over SIE's OpenAI-compatible API.
-- Text-to-SQL runs on `Qwen/Qwen3.5-4B` over chat by default. For stronger SQL, point `sql` at `Qwen/Qwen3-4B-Instruct-2507` (SIE's measured-best 4B text-to-SQL, Spider ≈0.70); to demo the completion path, set `sql: "defog/sqlcoder-7b-2"` with `sql.mode: completions`.
+- Text-to-SQL runs on `Qwen/Qwen3.5-4B` over chat; to demo the `/v1/completions` path instead, set `sql: "defog/sqlcoder-7b-2"` with `sql.mode: completions`.
- This is a demo of inference orchestration, **not legal advice**.
Apache-2.0, like the rest of SIE.
diff --git a/examples/contract-review-agent/config.yaml b/examples/contract-review-agent/config.yaml
index ccf409202..e64a7e48d 100644
--- a/examples/contract-review-agent/config.yaml
+++ b/examples/contract-review-agent/config.yaml
@@ -12,15 +12,14 @@ cluster:
# Every value is a real model in the SIE catalog (https://superlinked.com/models).
# Swap any line to try a different model; no other code changes.
models:
- # Generative LLMs — the agent "brains" (chat / tools / structured output).
- # Consolidated onto Qwen/Qwen3.5-4B for now: one warm 4B vision+text model
- # does the planning, vision, reasoning, and SQL jobs. Branch out per role
- # from there (see the ↑ hints) as the cluster grows.
- triage: "Qwen/Qwen3-0.6B" # fast, cheap doc-type classifier (kept tiny on purpose; no tools)
- orchestrator: "Qwen/Qwen3.5-4B" # plans, calls tools, assembles output (chat + tools + JSON schema)
- vision: "Qwen/Qwen3.5-4B" # reads scanned / signature pages (text + image)
- reasoning: "Qwen/Qwen3.5-4B" # clause-risk analysis; ↑ Qwen/Qwen3.6-27B on an H100-class cluster
- sql: "Qwen/Qwen3.5-4B" # text-to-SQL via chat (see sql.mode); ↑ Qwen/Qwen3-4B-Instruct-2507 for stronger SQL, or defog/sqlcoder-7b-2 with sql.mode=completions
+ # Generative LLMs — the agent "brains". Two Qwen models, both non-thinking:
+ # Qwen3.6-27B (64K ctx) is the brain — plans, reasons over long context, and
+ # synthesizes; Qwen3.5-4B (8K, vision LLM) handles the shorter-context tasks.
+ triage: "Qwen/Qwen3.5-4B" # fast doc-type classifier
+ orchestrator: "Qwen/Qwen3.6-27B" # the brain: plans, calls tools, synthesizes (chat + tools + JSON schema; 64K ctx)
+ vision: "Qwen/Qwen3.5-4B" # reads scanned / signature pages (text + image) — the vision LLM
+ reasoning: "Qwen/Qwen3.5-4B" # clause-risk analysis (short context)
+ sql: "Qwen/Qwen3.5-4B" # text-to-SQL via chat (see sql.mode); or defog/sqlcoder-7b-2 with sql.mode=completions
guard: "ibm-granite/granite-guardian-3.0-2b" # safety / prompt-injection guardrail (specialist; alias: guard)
# Retrieval + extraction tools (encode / score / extract):
ocr: "lightonai/LightOnOCR-2-1B" # scanned PDF / image -> markdown (latest OCR model)
@@ -39,7 +38,7 @@ guard:
threshold: 0.5
# Text-to-SQL calling convention. Chat/instruct models (Qwen3.5-4B,
-# Qwen3-4B-Instruct) take a chat prompt; completion-only specialists like
+# Qwen3.6-27B) take a chat prompt; completion-only specialists like
# defog/sqlcoder-7b-2 need their native template over /v1/completions — set
# mode: completions when you point `sql` at one of those.
sql:
diff --git a/examples/contract-review-agent/contract_review_agent/tools.py b/examples/contract-review-agent/contract_review_agent/tools.py
index 9eca475ad..75b5ee232 100644
--- a/examples/contract-review-agent/contract_review_agent/tools.py
+++ b/examples/contract-review-agent/contract_review_agent/tools.py
@@ -260,7 +260,7 @@ The query will run on a database with this schema:
Given the database schema, here is the SQLite query that answers [QUESTION]{question}[/QUESTION]:
"""
-# Chat-mode SQL prompt for instruct/chat models (Qwen3.5-4B, Qwen3-4B-Instruct).
+# Chat-mode SQL prompt for chat/instruct models (e.g. Qwen3.5-4B).
_SQL_CHAT_SYSTEM = (
"You are a text-to-SQL engine for SQLite. Given the schema and a question, "
"reply with ONE SQLite SELECT statement and nothing else — no prose, no "