ProgramEvolutionLlmUsage
Models & Types · AiDotNet.Evolution.Programs
Immutable totals describing how much language-model work a program-evolution run consumed.
For Beginners
This is the bill for the AI part of a run. It tells you how many times a new program
was requested, how many messages that actually took, how often the model’s answer had to be thrown away, and how
many tokens were spent if the provider told you. If ChatCalls is much larger than
Proposals, the model is frequently answering in a form the search cannot use, which is worth fixing
before scaling the run up.
How It Works
The counts separate two things that are easy to confuse. Proposals is how many times the search
asked for a new candidate; ChatCalls is how many requests were actually sent, which is larger
whenever an answer had to be retried with feedback. The gap between them is the honest cost of unusable answers,
and AbandonedProposals counts the proposals that never produced a child at all. The reference
OpenEvolve worker reports none of this: an unusable answer is logged and the iteration is silently lost.
Token counts are reported only when the provider supplies them, so a client that returns no usage information leaves them at zero rather than guessing. Because they are provider-reported rather than derived, they are safe to compare across runs on the same provider and unsafe to compare across different ones.
Constructors
| Constructor | Summary |
|---|---|
ProgramEvolutionLlmUsage(long proposals, long chatCalls, long retries, long abandonedProposals, long providerErrors, long inputTokens, long outputTokens) |
Initializes a usage total. |
Properties
| Property | Summary |
|---|---|
ProgramEvolutionLlmUsage Empty { get; } |
Gets a total with every count at zero, for runs that used no language model. |
double AbandonRate { get; } |
Gets the share of proposals that produced no child, or zero when nothing was proposed. |
double CallsPerProposal { get; } |
Gets the average number of requests spent per proposal, or zero when nothing was proposed. |
long AbandonedProposals { get; } |
Gets how many proposals produced no child program after every permitted retry. |
long ChatCalls { get; } |
Gets how many requests were sent to the chat client, including retries. |
long InputTokens { get; } |
Gets the prompt tokens the provider reported; zero when it reported none. |
long OutputTokens { get; } |
Gets the answer tokens the provider reported; zero when it reported none. |
long Proposals { get; } |
Gets how many candidate proposals were requested. |
long ProviderErrors { get; } |
Gets how many requests failed inside the chat client. |
long Retries { get; } |
Gets how many requests were retries sent after an unusable answer. |
long TotalTokens { get; } |
Gets the sum of the reported prompt and answer tokens. |
Methods
| Method | Summary |
|---|---|
ProgramEvolutionLlmUsage Add(ProgramEvolutionLlmUsage other) |
Adds two totals, for a run driven by more than one operator. |
string ToString() |
Returns the counts in a single line. |