Open-source inference server and production cluster for all the models your agent needs.
Python bgecolbertdata-pipelinedeep-learningembeddingsinferenceinference-serverinformation-retrievalllmmlmlopsnatural-language-processingnlppythonrerankingretrievalretrieval-augmented-generationsemantic-searchspladevector-search
perf(models): load five more DeBERTa-v3 GLiClass models with bucketed CUDA graphs (#422)
svonavaaa9b3230142f
diff --git a/packages/sie_sdk/README.md b/packages/sie_sdk/README.mdindex 3ef4079cb..ddb6bfb5b 100644--- a/packages/sie_sdk/README.md+++ b/packages/sie_sdk/README.md@@ -152,10 +152,13 @@ billed. The other items still succeed.On a CUDA server, the operator can load the DeBERTa-based GLiClass models withCUDA graphs, which cut the CPU time spent launching kernels. With `bucketed`graphs, sequence lengths and batch sizes are padded to buckets, which moves-probabilities slightly, as batching requests together does. `gliclass-base-v1.0`,-`gliclass-large-v1.0` and `opir-multitask-large-v1.0` load with `bucketed`-graphs by default: their probabilities differed from eager execution by up to-0.019 in our tests, with no top label changed. Send+probabilities slightly, as batching requests together does. The DeBERTa-v3+models (`gliclass-small-v1.0`, `gliclass-base-v1.0`, `gliclass-large-v1.0`,+`gliclass-base-v3.0`, `gliclass-large-v3.0`, the base and large instruct models+and `opir-multitask-large-v1.0`) load with `bucketed` graphs by default: their+probabilities differed from eager execution by up to 0.019 in our tests, and a+top label changed only where eager's top two labels were closer than eager+execution's own batch-to-batch variation. Send`options={"cuda_graphs": "off"}` to run a request eagerly; a request cannotturn graphs on. See the server README for each model's measurements and thememory graphs use.diff --git a/packages/sie_server/README.md b/packages/sie_server/README.mdindex bbb9abc11..ffedd7487 100644--- a/packages/sie_server/README.md+++ b/packages/sie_server/README.md@@ -103,37 +103,66 @@ loaded with graphs. It cannot turn graphs on: any other value is refused.Padding is masked, and padded rows are dropped before scoring, but a longersequence or a larger batch rounds fp16 sums differently, the same kind of-change batching requests together makes. We compared `bucketed` with eager-execution on the 384 CVE descriptions from `examples/typed-decisions`, three-questions each, asked one at a time, as separate groups and as joint groups,-plus 65 long documents. Each input was sent three times (long documents-twice), so that graphs were recorded and then replayed: 11,538 answers per-model. The three models that ship with graphs were measured again with padded-batches, adding the same questions over 3- and 5-item requests (18,450-answers). A small change can still flip a near tie between the top two-labels:--| Model | Largest probability change | Top label changed | Shipped profile |-|--|--|--|--|-| `gliclass-small-v1.0` | 0.0039 | 3 answers | `off` |-| `gliclass-base-v1.0` | 0.0068 | none | `bucketed` |-| `gliclass-large-v1.0` | 0.0063 | none | `bucketed` |-| `gliclass-base-v3.0` | 0.0054 | 3 | `off` |-| `gliclass-large-v3.0` | 0.0093 | 3 | `off` |-| `gliclass-instruct-base-v1.0` | 0.0076 | 12 | `off` |-| `gliclass-instruct-large-v1.0` | 0.0098 | 18 | `off` |-| `opir-multitask-large-v1.0` | 0.0190 | none | `bucketed` |-| `gliclass-multilang-mini` (100 descriptions, no joint groups: 2,016 answers) | 0.0227 | 3 | `off` |+change batching requests together makes. A small change can flip a near tie+between the top two labels, and eager execution flips some near ties too,+depending on which inputs share its batch.++**When a speed-up ships enabled.** A shipped GLiClass profile enables a+speed-up that changes scores, such as `bucketed` graphs, only when both hold+against eager execution on the evaluation sets below:++1. no probability moves by more than 0.02;+2. every answer whose top label changes had an eager top-two margin smaller+ than eager's own regrouping noise, δ_eager: the largest probability change+ eager execution makes on the same inputs when they share a batch with other+ inputs.++A top label that changes under the second condition was a near tie that eager+fp16 execution already flips under batching.++**Evaluation sets.** The main set is the 384 CVE descriptions from+`examples/typed-decisions`, three questions each, asked one at a time, as+separate groups and as joint groups, plus 65 long documents: 4,041 answers per+model. The instruction set asks the same descriptions the three questions with+short labels and the question as the instruction: 1,152 answers. The rule+applies to each set on its own. The eager reference sends one input per+request. δ_eager is the largest change among four eager runs that batch each+input with others: in pairs, and in groups of eight in dataset order and in two+shuffled orders. `bucketed` sent the inputs one per request three times (long+documents twice), so graphs were recorded and then replayed. Measured on an L4+in fp16; each cell gives the main set, then the instruction set:++| Model | Largest probability change | δ_eager | Top labels changed (largest eager margin) | Shipped profile |+|--|--|--|--|--|+| `gliclass-small-v1.0` | 0.0046 / 0.0034 | 0.0056 / 0.0039 | 2 (0.0000) / none | `bucketed` |+| `gliclass-base-v1.0` | 0.0068 / 0.0056 | 0.0061 / 0.0061 | none / none | `bucketed` |+| `gliclass-large-v1.0` | 0.0059 / 0.0088 | 0.0078 / 0.0107 | none / none | `bucketed` |+| `gliclass-base-v3.0` | 0.0054 / 0.0054 | 0.0063 / 0.0054 | 1 (0.0005) / none | `bucketed` |+| `gliclass-large-v3.0` | 0.0093 / 0.0107 | 0.0088 / 0.0122 | 2 (0.0020) / none | `bucketed` |+| `gliclass-instruct-base-v1.0` | 0.0076 / 0.0063 | 0.0078 / 0.0063 | 4 (0.0056) / none | `bucketed` |+| `gliclass-instruct-large-v1.0` | 0.0088 / 0.0039 | 0.0125 / 0.0054 | 7 (0.0017) / 1 (0.0006) | `bucketed` |+| `opir-multitask-large-v1.0` | 0.0144 / 0.0146 | 0.0247 / 0.0225 | none / none | `bucketed` |+| `opir-multitask-multilang-v1.0` | 0.0756 / 0.0093 | 0.0848 / 0.0122 | 15 (0.0260) / none | `off` |+| `gliclass-multilang-mini` | 0.0347 / 0.0479 | 0.0317 / 0.0376 | 5 (0.0056) / 3 (0.0618) | `off` |++A top label that changed did so in every pass; the table counts each answer+once.++Requests of several items pad their batch as well (3 items to 4, 5 to 8). Asked+in 3- and 5-item requests and compared with eager execution of the same+requests, the eight models that ship with graphs moved no probability by more+than 0.0190 (`opir-multitask-large-v1.0`) and 0.0093 for every other model,+and every top label that changed had an eager margin below the model's+δ_eager.`exact` changed nothing. A forward whose batch size is already a bucket (oneitem, for example) scores exactly as it did before batches were padded.-The shipped profiles load with `bucketed` graphs only where no top label-changed: `gliclass-base-v1.0`, `gliclass-large-v1.0` and-`opir-multitask-large-v1.0`. Their probabilities can differ from eager-execution by up to the amounts above. To run one of them eagerly, set-`cuda_graphs: off` in its profile, or send `options={"cuda_graphs": "off"}` with-a request. The other models load with `off`.+The DeBERTa-v3 models meet the rule and their shipped profiles load with+`bucketed` graphs. The two mDeBERTa models, `gliclass-multilang-mini` and+`opir-multitask-multilang-v1.0`, moved probabilities by more than 0.02 and+load with `off`. To run a model eagerly, set `cuda_graphs: off` in its+profile, or send `options={"cuda_graphs": "off"}` with a request.Graphs apply on CUDA to the DeBERTa-based GLiClass models: the v1.0 models,`gliclass-base-v3.0` and `gliclass-large-v3.0`, the base and large instructdiff --git a/packages/sie_server/models/knowledgator__gliclass-base-v3.0.yaml b/packages/sie_server/models/knowledgator__gliclass-base-v3.0.yamlindex eebb79d85..f9ded050e 100644--- a/packages/sie_server/models/knowledgator__gliclass-base-v3.0.yaml+++ b/packages/sie_server/models/knowledgator__gliclass-base-v3.0.yaml@@ -19,6 +19,9 @@ profiles:adapter_options:loadtime:classification_type: single-label+ # Replay forwards as CUDA graphs over bucketed lengths; "off" runs them eagerly.+ # See "GLiClass CUDA graphs" in packages/sie_server/README.md.+ cuda_graphs: bucketedruntime:threshold: 0.0multi-label:diff --git a/packages/sie_server/models/knowledgator__gliclass-instruct-base-v1.0.yaml b/packages/sie_server/models/knowledgator__gliclass-instruct-base-v1.0.yamlindex 2f22fc351..6828edf8e 100644--- a/packages/sie_server/models/knowledgator__gliclass-instruct-base-v1.0.yaml+++ b/packages/sie_server/models/knowledgator__gliclass-instruct-base-v1.0.yaml@@ -19,6 +19,9 @@ profiles:adapter_options:loadtime:classification_type: single-label+ # Replay forwards as CUDA graphs over bucketed lengths; "off" runs them eagerly.+ # See "GLiClass CUDA graphs" in packages/sie_server/README.md.+ cuda_graphs: bucketedruntime:threshold: 0.0multi-label:diff --git a/packages/sie_server/models/knowledgator__gliclass-instruct-large-v1.0.yaml b/packages/sie_server/models/knowledgator__gliclass-instruct-large-v1.0.yamlindex 4abb4c0ec..90953626f 100644--- a/packages/sie_server/models/knowledgator__gliclass-instruct-large-v1.0.yaml+++ b/packages/sie_server/models/knowledgator__gliclass-instruct-large-v1.0.yaml@@ -19,6 +19,9 @@ profiles:adapter_options:loadtime:classification_type: single-label+ # Replay forwards as CUDA graphs over bucketed lengths; "off" runs them eagerly.+ # See "GLiClass CUDA graphs" in packages/sie_server/README.md.+ cuda_graphs: bucketedruntime:threshold: 0.0multi-label:diff --git a/packages/sie_server/models/knowledgator__gliclass-large-v3.0.yaml b/packages/sie_server/models/knowledgator__gliclass-large-v3.0.yamlindex ebbc98591..0cd41201e 100644--- a/packages/sie_server/models/knowledgator__gliclass-large-v3.0.yaml+++ b/packages/sie_server/models/knowledgator__gliclass-large-v3.0.yaml@@ -19,5 +19,8 @@ profiles:adapter_options:loadtime:classification_type: single-label+ # Replay forwards as CUDA graphs over bucketed lengths; "off" runs them eagerly.+ # See "GLiClass CUDA graphs" in packages/sie_server/README.md.+ cuda_graphs: bucketedruntime:threshold: 0.0diff --git a/packages/sie_server/models/knowledgator__gliclass-small-v1.0.yaml b/packages/sie_server/models/knowledgator__gliclass-small-v1.0.yamlindex 5f18c4a81..527339174 100644--- a/packages/sie_server/models/knowledgator__gliclass-small-v1.0.yaml+++ b/packages/sie_server/models/knowledgator__gliclass-small-v1.0.yaml@@ -19,5 +19,8 @@ profiles:adapter_options:loadtime:classification_type: single-label+ # Replay forwards as CUDA graphs over bucketed lengths; "off" runs them eagerly.+ # See "GLiClass CUDA graphs" in packages/sie_server/README.md.+ cuda_graphs: bucketedruntime:threshold: 0.0diff --git a/packages/sie_server/tests/adapters/test_gliclass_cuda_graphs.py b/packages/sie_server/tests/adapters/test_gliclass_cuda_graphs.pyindex 990398d3e..afe47493c 100644--- a/packages/sie_server/tests/adapters/test_gliclass_cuda_graphs.py+++ b/packages/sie_server/tests/adapters/test_gliclass_cuda_graphs.py@@ -34,10 +34,17 @@ from sie_server.types.inputs import InvalidInputError_MODELS_DIR = Path(__file__).resolve().parents[2] / "models"# The shipped profiles that load with graphs: DeBERTa-v3 models whose bucketed-# scores changed no top label against eager execution (see the server README).+# scores moved no probability by more than 0.02 against eager execution and+# changed a top label only where eager's top two were closer than eager's own+# batching noise (see "GLiClass CUDA graphs" in the server README)._BUCKETED_BY_DEFAULT = {+ "knowledgator/gliclass-small-v1.0","knowledgator/gliclass-base-v1.0","knowledgator/gliclass-large-v1.0",+ "knowledgator/gliclass-base-v3.0",+ "knowledgator/gliclass-large-v3.0",+ "knowledgator/gliclass-instruct-base-v1.0",+ "knowledgator/gliclass-instruct-large-v1.0","knowledgator/opir-multitask-large-v1.0",}