Skip to main content

TrueLoop Compute client with Envelope V2 assessment

Project description

swc-runtime - TrueLoop Compute client

This is the thin, standard-library client for the hosted TrueLoop runtime. The private update law remains server-side. Runtime calls keep the substrate-agnostic start → measure → step → end contract; Envelope V2 separately describes the application, substrate, hardware timing, coupling structure, and evidence boundary.

Install

python -m pip install swc-runtime

For a local/manual installation, download the reviewed client bundle, verify HASHES.sha256, and install its wheel:

python -m pip install ./swc_runtime/dist/swc_runtime-*-py3-none-any.whl

For source-only manual use, place the bundled swc/ folder beside your code.

Runtime quickstart

from swc import SWCOptimizer

opt = SWCOptimizer(license_key="EVAL-...", n=len(x0), mode="regulation", target=target)
x = opt.start(x0)
for _ in range(rounds):
    x = opt.step(measure(x), target=target)
opt.end()

The legacy jacobian= constructor argument is reserved and deprecated. The hosted runtime never consumed it, and this client no longer transmits it. Supplying it emits a nonfatal warning and does not change hosted execution or install a new controller.

Envelope V2

assess_envelope() separates applicability from performance:

  • DECLINE with structural_precondition means a checkable structural condition blocks use.
  • EVIDENCE with measured_evidence cites the nearest measured cell and its numbers. It is neutral, not a performance forecast.
  • MARGINAL with no_structural_bar means no structural condition blocks use and no measured cell matches. Run a race.

check_envelope() remains a verdict-string compatibility method. It can now return "EVIDENCE" as the neutral value for a measured cell.

from swc import SWCOptimizer, EnvelopeProfile

opt = SWCOptimizer(license_key="EVAL-...", n=4096, mode="regulation")
profile = EnvelopeProfile(
    application="photonic.mesh.regulation",
    substrate="photonic",
    mode="regulation",
    n_controls=4096,
    n_measurements=4096,
    measurement={
        "shape": "vector", "parallel": True, "direction_rich": True,
        "action_consistent": True, "objective_observable": True,
        "semantics": "full_vector_residual", "noise_sigma": 0.02,
    },
    plant={
        "drifting": True, "drift_per_round": 0.01, "locally_monotone": True,
        "retainable_configuration": True, "target_type": "vector_setpoint",
    },
    coupling={
        "present": True, "structure": "banded", "bandwidth": 3,
        "normalized_mass": 0.3, "conditioning_known": False,
    },
    hardware={"parallel_readout": True, "physical_hardware": False},
    baseline={"type": "unknown", "tuned": False, "model_access": "none",
              "demonstrated_performance": "unknown"},
    budget={"measurements_per_round": 1, "total_measurements": 300,
            "rounds": 300},
    evidence_profile="photonic.mesh.regulation.banded.v1",
)
report = opt.assess_envelope(profile)
assert report["verdict"] == "EVIDENCE"
assert report["evidence_tier"] == "measured_evidence"
print(report["evidence"]["measured_numbers"])

Legacy Regime requests remain accepted:

from swc import Regime
verdict = opt.check_envelope(Regime(drifting=True, coupled_plant=True,
                                    have_calibration=False,
                                    per_channel_error=True))

Unknown coupling structure is MARGINAL, not an automatic decline. Absence of calibration alone never triggers DECLINE.

Pilot race

Applicability can be checked from structure. Performance is measured on your plant, never forecast. race() alternates the hosted runtime and a reference arm on the same live plant until both residual histories plateau:

def measure_for_race(configuration):
    measurement = measure(configuration)
    residual = rms_error(measurement, target)
    return {"measurement": measurement, "residual": residual}

opt = SWCOptimizer(
    license_key="EVAL-...", n=len(x0),
    mode="regulation", target=target,
)
result = opt.race(
    "integrator",
    1.25,
    measure=measure_for_race,
    x0=x0,
    plateau_window=20,
    plateau_slope=1e-3,
    plateau_patience=3,
)
print(result["decision"], result["steady_state_advantage"])
print(result["acquisitions"])

The advantage is the reference steady-state residual divided by the runtime steady-state residual. min_advantage is your economic threshold. At or above it the result is CONTINUE; below it the result is ABORT and recommends the reference. If both arms do not plateau, the result is INCONCLUSIVE and no magnitude is reported.

In regulation mode the default reference is a tuned integrator. In optimization mode it is tuned SPSA. You may pass your own object with start(x0) and step(configuration, measurement, score=None, target=None).

The reference arm consumes acquisitions. The report calls these reference_tax and includes them in the total. The race is a paid diagnosis, not a free probe. A stable early direction checkpoint can guide the pilot. If that direction later reverses, direction_reliable_early is false and the report discloses the reversal. A short fixed horizon can overstate magnitude, so it is never used for the magnitude estimate. Magnitude is reported only after convergence.

Evidence boundary

The mesh scaling evidence uses a simulated nonlinear photonic-mesh plant with the live production TrueLoop runtime. Exact registered cells are M=0.3 at n=64, 256, 512, 1024, and 4096, plus M=0.7 only at n=256, with ±3 banding, measurement noise sigma 0.02, drift sigma 0.01 radians per round, three seeds, and 300 rounds.

Physical photonic-hardware transfer remains unverified. The n=4096, M=0.7 combination was not tested. Discrete cells are not a continuous performance guarantee.

Full docs: https://trueloopcompute.com/docs/envelope

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

swc_runtime-0.4.1.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swc_runtime-0.4.1-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file swc_runtime-0.4.1.tar.gz.

File metadata

  • Download URL: swc_runtime-0.4.1.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for swc_runtime-0.4.1.tar.gz
Algorithm Hash digest
SHA256 091e02c111545a14bfe02276a0ffba0381b98df0cc9761e289653bf83f578c24
MD5 70387cd0ce6404147afd59139d615a3e
BLAKE2b-256 7db34313c5c26d1e74bf7544509885c0f026ccf7d8e2ede869decf78601793cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for swc_runtime-0.4.1.tar.gz:

Publisher: publish-client.yml on MatthewLeibel/Neotech

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file swc_runtime-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: swc_runtime-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for swc_runtime-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c180232b98c6cea759623178e9fa67f85b0114e156100fcd9db049e2aa89fd99
MD5 4aa2b79d0e6321216fe7dbe3168f3958
BLAKE2b-256 8ef6d130b8cf9e94812fda6c4d70b1d8eb9704e51a48cc14078633e130d7a1d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for swc_runtime-0.4.1-py3-none-any.whl:

Publisher: publish-client.yml on MatthewLeibel/Neotech

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page