Skip to content

fix(pulse-designer): pin Δt so the vetted template fixes gate time T (#613) - #2174

Open
jacktrnr wants to merge 1 commit into
mainfrom
fix/613-template-fixed-T
Open

jacktrnr wants to merge 1 commit into
mainfrom
fix/613-template-fixed-T

Conversation

@jacktrnr

@jacktrnr jacktrnr commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Closes #613

Problem

The vetted pulse-designer template (scores/pulse-designer/templates/solve.jl) built its problem with PiccoloOptions(timesteps_all_equal = true), which the comments and interview treat as "fixed gate time T." In Piccolo 2.2 / DirectTrajOpt 0.11 that option forces a uniform mesh but leaves the duration free (Piccolo.jl#317, DirectTrajOpt.jl#145). The solves were really uniform-mesh, free-duration ones. Measured on main's template (T = 10, N = 11, 15 iters): the solved duration came back as 10.633 ns in one run and 10.284 ns in another.

Change

  • Template: drop the all-equal option and pin every timestep to the construction grid's step: Δt_nominal = T / (N - 1), Δt_bounds = (Δt_nominal, Δt_nominal). This is the same idiom Piccolo 2.2's own tests use for a fixed duration. MadNLP's fixed_variable_treatment = MadNLP.RelaxBound was already on the default arm, so the fixed (lb == ub) Δt variables are handled.
  • SCORE.md facet map: a time_mode: fixed row that names the pinned-Δt idiom and warns that timesteps_all_equal is not fixed T. Compiled-score goldens regenerated (GEN_GOLDEN=1).
  • packs/quantum-control/corrector/integrity.toml: sha256 of the template refreshed.
  • Scope follows the issue: the one construction line only. The other templates that still use timesteps_all_equal = true (templates/solve_template.jl, solve_template_hp.jl, solve_rydberg_cz.jl, scores/pasqal-mis/templates/solve.jl, the exemplars and pasqal demos, skeleton_free.jl) are not changed here and have the same semantics. They need a follow-up if they also mean fixed T.

Tests

  • Fast (CI): test/scores/vetted_solver.test.ts adds a pin that the template sets Δt_bounds = (Δt_nominal, Δt_nominal) with Δt_nominal = T / (N - 1) and no timesteps_all_equal = true. It failed before the change and passes after. test/scores/: 342/342 pass. pnpm --filter amicode test: 5814 passed. The 2 SSE chunk-timing perf tests failed only while Julia solves were loading the machine, and they pass in isolation (84/84).
  • Slow (new): test/slow/pulse_designer_fixed_T.test.ts runs the real template (N = 11, max_iter = 15) and asserts that get_duration(pulse.jld2 traj) equals T within 1e-6·T. It was run against a Piccolo 2.2.0 / DTO 0.11.0 env: RED on main's template (off by 0.284 ns) and GREEN on this branch (about 60 s).
    • Harness caveat (pre-existing, not changed here): test/setup_hermetic_env.ts deletes every AMICO_* env var, so AMICO_TEST_JULIA_PROJECT never reaches the slow suites. template.test.ts and verify_harness.test.ts silently skip, and so does this new test. I ran it with a throwaway config that omits that setup file. The repo's shipped packages/extension/julia/Manifest.toml and ~/.amico/julia are also still on Piccolo 2.1 / DTO 0.10, which the template's own version probe refuses. Both look worth their own issues.

Re-vet (AC 2)

Six family gates at the template's default FILL-IN (T = 10, N = 50, max_iter = 60, SOLVER = :default/MadNLP, 3-level transmon), Piccolo 2.2.0 / DTO 0.11.0. One unseeded run per gate, 3 in parallel:

gate subspace F iters solved duration
X 0.99955 60 10.000000000000
Y 0.99982 60 10.000000000000
Z 0.99965 60 10.000000000001
H 0.99993 60 10.000000000000
√X 0.99981 60 10.000000000000
T 0.99990 60 9.999999999996

All six stay above the vetted floor (F > 0.999), and the duration is pinned at T.

Still needs re-vetting by a human before release: the issue asks for a re-vet against the changed landscape. The numbers above are one unseeded run each, on a local env I provisioned, not through amico run on the provisioned fleet env. S was not run (it is not in the original six). Before shipping, please run the canonical vet: seeded or multi-seed, through amico run, on the 2.2 env, and the Altissimo/Ipopt arms if those are part of the vet. Then confirm no regression.

Release note (AC 3)

Vetted pulse template now really fixes the gate time. The single-qubit pulse-designer template used Piccolo's all-equal timestep option, which keeps the mesh uniform but lets the total duration float, so a solved pulse could come back a few percent longer or shorter than the T you asked for. The template now pins every timestep to T/(N-1), so the pulse lasts exactly T. Fidelities were re-vetted on the six family gates (all F > 0.999). Earlier solves may have a different duration than requested. Check get_duration on old pulse.jld2 files before reusing them as fixed-T warm starts.

(The repo has no written compatibility policy that I could find. This text is meant for docs/releases/0.4.1.md when the release notes are put together.)

🤖 Generated with Claude Code

…ate time T (#613)

`PiccoloOptions(timesteps_all_equal = true)` forces a uniform mesh but leaves
one free duration scale (Piccolo.jl#317, DirectTrajOpt.jl#145), so the vetted
single-qubit template solved uniform-free-duration, not the fixed T the
interview promises. Replace it with `Δt_bounds = (Δt_nominal, Δt_nominal)`,
`Δt_nominal = T / (N - 1)` (the construction grid's spacing).

- vetted_solver.test.ts: pin the construction (fast, CI)
- slow/pulse_designer_fixed_T.test.ts: run the real template on a tiny grid
  and assert the solved duration equals T (gated on AMICO_TEST_JULIA_PROJECT)
- SCORE.md facet map: `time_mode: fixed` row; goldens + integrity hash regenerated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0f40c701-0f44-41c0-bb44-fd8231c46506
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vetted pulse template: timesteps_all_equal=true is uniform-free-duration, not fixed T — switch to pinned Δt_bounds (re-vet flag)

1 participant