Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
FREEDOM251

Freedom251 › Blog › boson sampling

How to Run and Benchmark Your First Photonic Quantum Circuit

By Freedom251 Team · · 12 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The most reliable first experiment is a two-mode, non-Gaussian circuit: prepare the Fock state |1,0⟩, mix the modes with a beamsplitter, and measure photon numbers. Run it locally in Strawberry Fields, then repeat the same circuit at several Fock cutoffs and with both analytic and shot-based execution. Only after the result has converged should you compare runtimes, sampling statistics, or a remote photonic backend.

What a photonic quantum circuit is

A photonic quantum circuit processes information in optical modes rather than qubits. A mode can be a spatial path, time bin, frequency channel, or another distinguishable optical degree of freedom. The circuit applies continuous-variable operations such as state preparation, phase shifts, squeezing, and two-mode interferometer elements, followed by a measurement.

As an Amazon Associate I earn from qualifying purchases.

Strawberry Fields represents a circuit as a Program. The program declares the number of modes, operations are applied inside its context, and an engine executes it on a simulator or a remote backend. The Strawberry Fields documentation summarizes the model as: To construct a photonic quantum circuit in Strawberry Fields, a Program object must be created, and operations applied.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why begin with a two-mode non-Gaussian circuit

The state |1,0⟩ contains one photon in the first mode and vacuum in the second. A beamsplitter creates a controlled superposition of where that photon can be detected. The experiment is small enough to understand and inspect, but it is non-Gaussian, so it tests the Fock-state simulation path rather than only Gaussian phase-space calculations.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

PennyLane’s official hybrid-computation example uses this pattern and notes that the Strawberry Fields Fock backend is required for the non-Gaussian state. A Gaussian backend is appropriate for circuits made entirely from Gaussian operations and compatible measurements, but it is not the right first choice for a Fock-state input such as |1,0⟩.

Choose the execution route

Use a native Strawberry Fields program when you want direct access to Fock samples and the clearest correspondence between the circuit and its measured occupation numbers. Use the PennyLane plugin when the photonic circuit will become part of a differentiable or hybrid quantum-classical workflow.

Route Backend Best use Important controls or limits
Native Strawberry Fields Fock simulator Non-Gaussian states, occupation samples, direct photonic programs Set the engine cutoff; inspect the result object for samples
PennyLane plugin strawberryfields.fock Full continuous-variable simulation in PennyLane Declare wires and cutoff_dim; supported measurements differ from native execution
PennyLane plugin strawberryfields.gaussian Gaussian operations and photon-number-resolving measurements Not a substitute for Fock simulation of non-Gaussian state preparation
PennyLane plugin strawberryfields.gbs Gaussian boson sampling and graph-embedding experiments Use sampling and probability statistics suited to GBS
PennyLane plugin strawberryfields.remote Remote photonic backends Availability, queueing, pricing, and geography can change

The PennyLane-Strawberry Fields plugin documentation identifies release 0.29.1 and compatibility with PennyLane versions up to and including 0.29. Those version details are historical documentation facts, not a guarantee that a newly installed environment will expose identical APIs. Pin the versions in your own environment and check the installed documentation before relying on a gate or engine signature.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Run the first circuit natively in Strawberry Fields

1. Create a two-mode program

The following minimal program prepares |1,0⟩, applies a beamsplitter with angle 0.4 and phase 0.0, measures both modes in the Fock basis, and requests 1,000 samples.

import strawberryfields as sf
from strawberryfields import ops

prog = sf.Program(2)
with prog.context as q:
    ops.Fock(1) | q[0]
    ops.BSgate(theta=0.4, phi=0.0) | (q[0], q[1])
    ops.MeasureFock() | (q[0], q[1])

eng = sf.Engine('fock', backend_options={'cutoff_dim': 5})
result = eng.run(prog, shots=1000)
print(result.samples)

The names and call signatures above follow the documented Program/context/measurement pattern, but exact gate and engine APIs should be checked against the Strawberry Fields version installed on your machine. The critical elements are the two-mode Program, Fock preparation, a two-mode beamsplitter, Fock measurement, a Fock engine, and an explicit cutoff.

2. Understand the output

result.samples is a collection of measured occupation-number outcomes. Each shot contains one occupation value per mode. For the one-photon input, outcomes should be concentrated on configurations in which the total detected photon number is consistent with one photon, subject to the simulator model and any operations you add. Do not infer a physical detector limit from the largest number you happen to see; the simulator’s cutoff is a numerical truncation of the state basis.

3. Change the beamsplitter deliberately

The parameter theta controls the mixing strength and phi supplies a phase. Keep the circuit, cutoff, and shot count fixed while changing one parameter. A fair parameter sweep records the measured probability or expectation for every setting and uses the same uncertainty procedure for each point.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the PennyLane Fock device

The plugin exposes the Fock simulator through a PennyLane device declaration such as:

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
import pennylane as qml

dev = qml.device('strawberryfields.fock', wires=2, cutoff_dim=10)

The device stores each mode in the truncated basis |0⟩, |1⟩, …, |D−1⟩, where D is cutoff_dim. A PennyLane QNode can then prepare a Fock state, apply a beamsplitter, and return a supported expectation or probability measurement. Operation names and measurement constructors can vary across PennyLane and plugin releases, so inspect the version-matched API reference rather than copying a constructor blindly.

When PennyLane is the better choice

  • Use it when a classical optimizer, automatic differentiation, or another PennyLane device will be part of the same workflow.
  • Use the Fock device for non-Gaussian state preparation and full continuous-variable simulation.
  • Use the Gaussian device for Gaussian circuits where its specialized representation is sufficient.
  • Use the GBS device for graph-embedding operations and Gaussian boson-sampling probabilities or samples.

For raw occupation samples, native Strawberry Fields is often simpler. On the PennyLane Fock device, qml.state, qml.sample, and qml.density_matrix are not supported. Use supported expectation or probability measurements, or execute a native Strawberry Fields program with Fock measurements when the individual occupation records are essential.

Choose cutoff_dim correctly

cutoff_dim is a numerical approximation control. It keeps basis states from |0⟩ through |D−1⟩ in each mode; it is not a claim that a physical detector can only resolve D photon numbers. Increasing D allows higher-occupation components to be represented, but increases memory use and execution time.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The PennyLane Fock documentation describes minimum tracked-state scaling as MD for M modes and cutoff D. This is a scaling relationship, not a hardware benchmark or a promise that every implementation will consume exactly that amount of memory. More modes, stronger squeezing, larger photon-number inputs, and operations that populate high occupations all make a larger cutoff more important.

A practical convergence procedure

  1. Choose the observable or probability that answers your scientific question before selecting a cutoff.
  2. Run the unchanged circuit at a small starting cutoff, then repeat at successively larger values such as 5, 8, 10, 12, or another sequence that fits your memory budget.
  3. Compare the target quantity between adjacent cutoffs. Use an absolute or relative tolerance chosen in advance.
  4. Stop only when the quantity remains within that tolerance across a further increase. If it does not stabilize, the cutoff is still too small or the calculation is too resource-intensive for the chosen representation.
  5. Record the cutoff, observable, tolerance, and values in the benchmark report.

Convergence is observable-specific. A low-photon-number probability can appear stable while a tail probability, high-order moment, or gradient is still changing. If your paper or application uses several quantities, test each one that matters.

Symptoms of an insufficient cutoff

  • Probabilities or expectations move materially when D increases.
  • Results depend on the cutoff even though shots and the random seed are unchanged.
  • High-occupation outcomes are artificially clipped at the top of the basis.
  • Runtime appears unexpectedly low because the state representation is too aggressively truncated.

Benchmark the circuit fairly

A benchmark is more than a runtime number. It must distinguish numerical truncation, finite-shot noise, and machine-dependent performance. Freeze the experiment first, then vary one factor at a time.

1. Freeze the circuit definition

Record the number of modes, input states, every gate and parameter, measurement type, software versions, backend, cutoff dimension, shot count, and random seed whenever the API supports one. Save the source code and environment information with the result. A benchmark that omits the cutoff or backend cannot be reproduced meaningfully.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Establish cutoff convergence

Use the convergence procedure above before comparing implementations or parameter settings. If one result uses D=5 and another uses D=15 without evidence that both are converged, the comparison mixes algorithmic accuracy with performance.

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord | 6.35mm Jack, Durable Design, Stage and Home Studio Use, Low Noise Shielded Electric Cord for Bass, Keyboard, Amp, Mixer
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

3. Separate analytic and sampled execution

With shots=None, the PennyLane Fock device returns analytic expectation values. With a positive shot count, it estimates observables from circuit evaluations. Analytic execution removes shot noise but does not remove truncation error. Shot-based execution adds sampling uncertainty on top of whatever approximation the simulator uses. Report both when possible so these two error sources are not conflated.

4. Report statistical uncertainty

For every sampled observable, state the number of shots, the sample mean, a standard deviation or confidence interval, and the number of independent repetitions. Keep the shot budget fixed when comparing two parameter settings or two implementations. If repetitions use independent seeds, say so; if samples are reused through a cache, say that instead.

5. Measure resource cost

Record wall-clock time, peak memory when available, mode count, cutoff, and shots. State the processor, memory, operating system, Python version, simulator version, and whether compilation or warm-up time is included. Do not compare runtimes from different machines as if they were hardware-independent algorithmic results.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

6. Use a reference result

Compare each result with an analytic value, a larger-cutoff calculation, or a separately validated classical calculation. Name the reference and explain whether it tests truncation, sampling, or both. A larger cutoff is useful for checking convergence but is not automatically an exact answer.

Analytic values and samples answer different questions

An analytic run asks what the simulator predicts from its truncated state representation without drawing a finite sample set. A shot-based run asks what an experimenter would estimate after a specified number of executions. Neither replaces the other.

Question Preferred run What to report
Has the Fock representation converged? Analytic runs at several cutoffs Cutoff sequence, target quantity, tolerance, and differences
How noisy is an estimated expectation? Fixed-shot repetitions Shots, mean, spread or interval, and repetitions
What occupation patterns are produced? Native Fock measurements or a supported sampling workflow Samples, shot count, and any post-processing rule
How expensive is execution? Timed runs after defining warm-up policy Wall time, peak memory, machine, software, modes, cutoff, and shots

Do not compare an analytic expectation from one cutoff with a sampled estimate from another and call the difference a physical effect. First align the representation and then quantify sampling uncertainty.

Build a boson-sampling benchmark

For a linear-optical boson-sampling experiment, replace the single beamsplitter with an interferometer. Decompose the interferometer into two-mode beamsplitters and single-mode phase shifters, prepare the chosen input Fock pattern, and append Fock measurements. After execution, the measured occupation-number records are available through the result object’s samples attribute in the native workflow.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What to hold fixed

  • Number of modes and input photons.
  • Interferometer decomposition and every beamsplitter and phase parameter.
  • Fock cutoff and any loss or noise model.
  • Number of shots and random-seed policy.
  • Post-processing, including whether collisions are retained, discarded, or grouped.

Use output statistics suited to the question: individual sample frequencies, collision rates, marginal occupation probabilities, or a validated distance between distributions. State the statistic before looking at the results, because changing it after seeing the samples can bias the comparison.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Run a Gaussian boson-sampling variant

The Strawberry Fields GBS device is designed for Gaussian boson sampling. The documented feature set includes graph-embedding operations, Fock probabilities, cutoff_dim, shot-based execution, and optional caching of generated samples for repeated evaluations.

GBS has a different input model from the |1,0⟩ non-Gaussian demonstration. Use the GBS backend when squeezed-state inputs and graph-embedding operations are the object of study, not merely because it also produces photon-number samples.

Benchmarking cached versus uncached evaluations

If you enable sample caching for repeated evaluations, report that choice explicitly. Caching can remove repeated sample generation from later evaluations, so a cached timing measures a different workload from a fresh-sampling timing. Compare like with like: either disable caching for all runs or separate first-evaluation and cached-evaluation costs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Know the measurement restrictions

The PennyLane Fock device does not support qml.state, qml.sample, or qml.density_matrix. This matters when a tutorial assumes qubit-style access to a complete state vector or raw samples. Use a supported expectation or probability measurement for a PennyLane-only experiment. If the research question requires raw occupation records, execute a native Strawberry Fields program with MeasureFock and inspect result.samples.

A measurement API restriction is not the same as a physics limitation. It describes what that device interface returns to the caller. Changing to a native program or a different supported backend can change the available output without changing the optical circuit.

Move from simulation to photonic hardware

Make the local simulation reproducible before submitting anything remotely. A remote backend is useful when loss, detector statistics, calibration drift, queueing, or cloud execution is part of the research question. It is not automatically a more accurate version of the local Fock simulator.

  1. Validate the circuit locally with a pinned software environment and a demonstrated cutoff convergence.
  2. Define the hardware-facing question: ideal sampling, loss behavior, detector statistics, or end-to-end service performance.
  3. Submit the same logical program to the documented remote backend, recording backend name, date, region if relevant, queue delay, execution time, shots, and any device settings.
  4. Repeat enough times to separate run-to-run variation from the effect you are studying.
  5. Compare hardware output with a clearly identified reference, such as the converged local simulation or a noise-aware model.

Remote availability, pricing, queueing, and geographic access are volatile. Check the current plugin and Strawberry Fields service documentation at the time of execution and preserve the backend metadata with your data.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshoot common failures

The circuit runs out of memory

Reduce the number of modes, lower the cutoff temporarily, simplify the state preparation, or run fewer parameter points. Then perform a convergence study on the reduced problem. Do not silently keep the smaller cutoff in a final benchmark unless the target observable has been shown to be stable.

Results change when only the cutoff changes

Treat this as truncation error, not as a physical effect. Increase the cutoff until the target quantity meets the predefined tolerance, or report that the calculation has not converged.

You cannot obtain raw samples in PennyLane

This is expected for the PennyLane Fock device because the raw sample and state APIs listed above are unsupported. Use supported probabilities or expectations, or switch the sampling portion to a native Strawberry Fields program with Fock measurements.

The code fails after an upgrade

Check the installed Strawberry Fields, PennyLane, and plugin versions, then compare the gate and engine signatures with the documentation for that exact release. Pin a known-compatible environment for a benchmark and include those versions in the report.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Two machines produce different timings

Keep the circuit and numerical settings fixed, but report processor, memory, operating system, Python and library versions, thread settings when relevant, and whether compilation or initialization is included. A timing without this context is not portable.

Remote jobs appear inconsistent

Record backend identity, submission date, queue delay, shot count, device settings, and any service-side calibration information exposed by the API. Separate queue time from execution time and repeat the job before attributing a difference to the circuit.

A reproducible report template

A useful benchmark record can be organized as follows:

  • Circuit: modes, input state, operation sequence, parameters, and measurement.
  • Software: Python, Strawberry Fields, PennyLane, plugin, and operating-system versions.
  • Backend: Fock, Gaussian, GBS, or remote; include the device name and execution date.
  • Numerics: cutoff dimension, analytic or shot-based mode, shots, repetitions, seed policy, and caching.
  • Accuracy: target observables, convergence tolerance, cutoff sweep, and reference calculation.
  • Resources: wall-clock time, peak memory, processor, and mode count.
  • Results: means, uncertainty intervals, sample frequencies or probabilities, and any failed or discarded runs with reasons.

This record lets another reader distinguish a change in circuit behavior from a change in truncation, sampling, software, hardware, or service conditions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What a successful first benchmark demonstrates

A successful first run is not just a printed array of samples. It demonstrates that the program can be reconstructed, the non-Gaussian state is being simulated by the Fock backend, the chosen observable is stable at the reported cutoff, and the uncertainty from finite shots is quantified separately. Once those conditions are met, the same workflow scales conceptually to larger interferometers, GBS experiments, differentiable PennyLane models, and carefully documented remote executions.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

boson samplingFock simulationGaussian boson samplingPennyLanephotonic quantum computingquantum benchmarkingStrawberry Fields

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.