Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Evaluations no longer associate incorrect inputs with predictions #2676

Merged
merged 2 commits into from
Oct 11, 2024

Conversation

tssweeney
Copy link
Collaborator

@tssweeney tssweeney commented Oct 11, 2024

I introduced a bug: #2434 which resulted in the predict_and_score (and child calls) having an incorrect input refs getting assigned to the input. The result is that the inputs are effectively all the same (however the outputs are different). This results in a number of odd effects since the system thinks all the predictions are against the same row:

Screenshot 2024-10-11 at 10 48 58

So, what was the issue here? Well a classic case of mutating a closure variable before executing the function! duh!

For more details, consider this basic example:

for ndx, row in enumerate(self._prefetched_rows):
  next_id_future = wc.future_executor.defer(    # <--- this `defer` schedules the function to be ran in a new thread.
    lambda: cached_table_ref.row_digests[ndx]   # <---- this `ndx` is mutated by the outer iterator
  )

Since the execution of the function is delayed, by the time the inner function executes, ndx has been changed!. Changing parallelism to 0 fixes this (since the defer becomes an immediate blocking call).

I double checked everywhere and there are no other such cases of this pattern. Interestingly, @andrewtruong and I basically discussed this exact thing in extensive detail when he reviewed the original PR. We wrote tests and everything. I just missed this one call site!

@tssweeney tssweeney requested a review from a team as a code owner October 11, 2024 17:56
@circle-job-mirror
Copy link

@tssweeney tssweeney merged commit e10ce15 into master Oct 11, 2024
99 checks passed
@tssweeney tssweeney deleted the tim/fix_evals branch October 11, 2024 18:12
@github-actions github-actions bot locked and limited conversation to collaborators Oct 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants