factorio-learning-environment icon indicating copy to clipboard operation
factorio-learning-environment copied to clipboard

Timing metrics and tracker

Open kantneel opened this issue 7 months ago • 4 comments

Add a tracker for timing metrics. This is essential for timing-sensitive experiments and eventually for getting real-time performance. Some relevant changes:

  • claude and async openai clients (used for more than just openai models) are now set with max_retries=0 so that all retry logic is kept within llm_factory.py and hence trackable.
  • timing metrics are printed in stdout for now (see screenshot below). Retry timing is not explicitly captured but accumulated as 'unaccounted' time and shown as such in the totals.
  • Program has a new timing_metrics field. Needs to be updated in DB.

kantneel avatar May 25 '25 06:05 kantneel

In this example, there was one retry (seen as a 529 at the top). The timing metrics show two distinct calls to claude. There is 2s of unaccounted time which came from the tenacity retry logic waiting for 2 seconds.

Screenshot 2025-05-25 at 2 07 04 PM

kantneel avatar May 25 '25 06:05 kantneel

Looks good. We have a field of elapsed time also being returned from the actions in the client.py which may be useful.

JackHopkins avatar May 27 '25 08:05 JackHopkins

Can you clarify where is this elapsed time being returned? Having trouble finding it.

kantneel avatar May 27 '25 10:05 kantneel

It was in controller.py but it seems to have been removed from the object we send back. Should be straightforward to turn it back on.

The variable is ‘elapsed’. Which is the execution time of the tool in milliseconds (round trip).

On 27 May 2025, at 11:06, Neel Kant @.***> wrote:

kantneel left a comment (JackHopkins/factorio-learning-environment#207) https://github.com/JackHopkins/factorio-learning-environment/pull/207#issuecomment-2911945631 Can you clarify where is this elapsed time being returned? Having trouble finding it.

— Reply to this email directly, view it on GitHub https://github.com/JackHopkins/factorio-learning-environment/pull/207#issuecomment-2911945631, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5T6OXJLCCXRAWWFMJ7USD3AQ2L3AVCNFSM6AAAAAB53MFKESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSMJRHE2DKNRTGE. You are receiving this because you commented.

JackHopkins avatar May 27 '25 10:05 JackHopkins