Skip to content
Why did we open-source our inference engine? Read the post

How to generate text with SIE

The generate primitive runs text generation on small LLMs you host yourself. Same client, same routing, and the same model catalog as the other primitives, so a generation model sits alongside your encoders and rerankers instead of behind a separate service.

Pass a model, a prompt, and a token budget. max_new_tokens is required.

from sie_sdk import SIEClient
client = SIEClient("http://localhost:8080")
result = client.generate(
"Qwen/Qwen3-4B-Instruct-2507",
"Write a one-sentence summary of vector search.",
max_new_tokens=128,
)
print(result["text"])
OptionTypeDescription
max_new_tokensintHard cap on output tokens. Required.
temperaturefloatSampling temperature. Defaults to 1.0.
top_pfloatNucleus sampling cutoff. Defaults to 1.0.
stoplist of stringsStop sequences that end generation early.

The result carries the generated text, a finish_reason, token usage, and SIE-native timing (ttft_ms, tpot_ms). See the SDK Reference for the full surface.

Stream tokens as they arrive with stream_generate. It yields chunks, each carrying a text_delta; the terminal chunk (done) also carries usage and ttft_ms.

for chunk in client.stream_generate(
"Qwen/Qwen3-4B-Instruct-2507",
"Write a haiku about vector search.",
max_new_tokens=64,
):
print(chunk.get("text_delta", ""), end="", flush=True)
if chunk.get("done"):
print(f"\nttft_ms={chunk.get('ttft_ms')}")

Generation models are listed in the Model Catalog alongside the encoders and rerankers. Qwen/Qwen3-4B-Instruct-2507 is a solid default; Qwen/Qwen3-0.6B is a smaller, faster option for short prompts.

On a multi-pool cluster, generation models may run on a dedicated GPU pool. Target it with the gpu parameter, for example gpu="rtx6000", so the request lands on a pool that serves the generation bundle.

Contact us

Tell us about your use case and we'll get back to you shortly.