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. Early results can establish direction, but a short fixed horizon can overstate magnitude. 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.0.tar.gz (11.2 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.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: swc_runtime-0.4.0.tar.gz
  • Upload date:
  • Size: 11.2 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.0.tar.gz
Algorithm Hash digest
SHA256 df6bdf600a49a793ad10c0cbeb79cddfa76a4c81eda423e521b180d9a5cbf187
MD5 99351e7e795165df7c7805a380b0709c
BLAKE2b-256 f86c1a049b7502ea702bcd4e2020760f570657f21afae61d6b9e2319026cf1f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for swc_runtime-0.4.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: swc_runtime-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 531570be0947f53de45d0aa54904ed5d7f86032d889acd84dc0a0ae2153833c9
MD5 7fe3e2b1f62ac371f2249f204aadb374
BLAKE2b-256 02f3ce7ae1f8fb83cc7fde5b0c48b890ceb25ce81adf7d4ac57c952fc0287d34

See more details on using hashes here.

Provenance

The following attestation bundles were made for swc_runtime-0.4.0-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