DefaultThreads

DefaultThreads is the thread count the engine uses when the more specific ContextParameters.NThreads and NThreadsBatch are not set.

Quick reference

Type int
Default Environment.ProcessorCount - 1
Category Engine
Field on EngineParameters.DefaultThreads

What it does

When ContextParameters.NThreads is null, the engine falls back to DefaultThreads. Same for NThreadsBatch.

The default leaves one logical core free for the rest of your application. On an 8-core machine, the default is 7. On a 16-core machine, 15.

When to change it

Scenario Value
Default unset (uses ProcessorCount - 1)
Dedicated inference box Environment.ProcessorCount (all cores)
CPU-quota-limited container Fixed smaller number matching quota
Shared host with other heavy work Half ProcessorCount

For per-phase control (generation vs prompt processing), set NThreads and NThreadsBatch directly — they override DefaultThreads.

Example

var preset = new Qwen25Preset();
preset.EngineParameters.DefaultThreads = 4;
// Only 4 threads used when ContextParameters.NThreads is null.

using var api = AsposeLLMApi.Create(preset);

Interactions

What’s next