Time-limited template search: results depend on load and run (evt_synthesis, auto, sandwich sampling)

Open
#564 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
testing-qa

Research direction

Start by reading the golden comparisons in #557, #558, #562, and #563, then inspect the time-limited search in evt_synthesis and auto, the nonneg chain's lowest-terms step, and evt_sandwich sampling. Run make golden-rerun to reproduce the reported differences. Done means synthesis results are repeatable under load unless a reported hard safety stop fires, golden comparisons are stable, and the lowest-terms cost is measured with the escape_counter shift explained or resolved.

Written by the indexing model from the issue text.

Description

area: analysis bug priority: medium topic: loop strategies

Problem

evt_synthesis (and auto, which tries it with a time limit) searches templates of growing size until a time limit.
The result depends on how many templates fit into that limit. The golden comparisons of #557, #558, #562 and #563
show the effect:

  • Load-dependent: under parallel load, a run tries a few templates more or fewer (e.g. 74 vs 75, 26 vs 27).
    Run alone, both sides match. Examples: random_walk_counter, dueling_cowboys, uniform_sampling_loop.
  • Nondeterministic even alone: st_petersburg (evt_synthesis, both engines) gives different template
    counts from one run to the next, alone and with PYTHONHASHSEED=0 (#563).
  • A stable shift from a code change: for escape_counter (evt_synthesis, SymPy), the code after #558 tries
    one template fewer, also alone and twice. The likely cause is the new lowest-terms step of the nonneg chain,
    which costs time inside the limit. An extra check that only proves more thus makes a time-limited result weaker in
    a corner case.

So far no outcome (exact, bound, unknown) has changed. But a wall-clock limit makes the search irreproducible
across machines and loads by design. Every golden comparison has to re-measure these cases alone (make golden-rerun).

Related: the sampled decay of evt_sandwich on jump_counter varies in the fourth digit, alone as well (#554).
#473 is about the sandwich's time-limited exploration. #554 is about the printed term order.

Proposal (to decide in a design note)

  • Deterministic budget: limit the search by a count instead of wall-clock time, e.g. templates or degree, or
    solver steps. Keep the wall-clock time only as a hard safety stop, and report it when it fires.
  • Measure the cost of the nonneg chain per candidate, in particular the lowest-terms step. If it costs a
    noticeable share of the limit, order the checks so that cheap rejections come first.
  • Seed the sampling of evt_sandwich exploration from the program, so that its printed rates are reproducible.

Done when

  • evt_synthesis and auto give the same template count and result for the same program on every run and under
    load, unless the hard safety stop fires. In that case the result says so.
  • make golden shows no load-dependent or nondeterministic difference for the synthesis and sandwich cases.
  • The cost of the lowest-terms step is measured, and escape_counter gets its template back, or the shift is
    explained and accepted.
Dominant language
Python
Stars
6
Forks
2
Avg merge
1h 52m
Merged PRs (30d)
187

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from LKlinke/Prodigy

All issues in LKlinke/Prodigy

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.