Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating docs for qiskit-transpiler-service #1435

Merged
merged 13 commits into from
May 29, 2024
7 changes: 6 additions & 1 deletion docs/transpile/ai-transpiler-passes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,9 @@ The following custom collection passes for Cliffords, Linear Functions and Permu
- *CollectLinearFunctions*: Collects blocks of `SWAP` and `CX` as `LinearFunction` objects and stores the original sub-circuit to compare against it after synthesis.
- *CollectPermutations*: Collects blocks of `SWAP` circuits as `Permutations`.

These custom collection passes limit the sizes of the collected sub-circuits so that they are supported by the AI synthesis passes, so it is recommended to use them after the routing passes and before the synthesis passes for a better overall optimization.
These custom collection passes limit the sizes of the collected sub-circuits so they are supported by the AI synthesis passes. Therefore, it is recommended to use them after the routing passes and before the synthesis passes for a better overall optimization.
cbjuan marked this conversation as resolved.
Show resolved Hide resolved


## Citation
Eric-Arellano marked this conversation as resolved.
Show resolved Hide resolved

If you use any AI feature from the Qiskit transpiler service in your research, use [the recommended citation](./qiskit-transpiler-service#citation).
abbycross marked this conversation as resolved.
Show resolved Hide resolved
39 changes: 35 additions & 4 deletions docs/transpile/qiskit-transpiler-service.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@ pip install qiskit-transpiler-service

By default, the package tries to authenticate to IBM Quantum services with the defined Qiskit API token, and uses your token from the `QISKIT_IBM_TOKEN` environment variable or from the file `~/.qiskit/qiskit-ibm.json` (under the section `default-ibm-quantum`).

*Note*: This package requires Qiskit SDK 1.0 by default.
*Note*: This package requires Qiskit SDK v1.X.

## qiskit-transpiler-service transpile options

- `backend_name` (optional, str) - A backend name as it would be expected by QiskitRuntimeService (for example, `ibm_sherbrooke`). If this is set, the transpile method uses the layout from the specified backend for the transpilation operation. If any other option is set that impacts these settings, such as `coupling_map`, the `backend_name` settings are overridden.
- `coupling_map` (optional, List[List[int]]) - A valid coupling map list (for example, [[0,1],[1,2]]). If this is set, the transpile method uses this coupling map for the transpilation operation. If defined, it overrides any value specified for `target`.
- `optimization_level` (int) - The potential optimization level to apply during the transpilation process. Valid values are [1,2,3], where 1 is the least optimization (and fastest), and 3 the most optimization (and most time-intensive).
- `ai` (bool) - Whether to use AI capabilities during transpilation. The AI capabilities available can be for `AIRouting` transpiling passes or other AI synthesis methods. If this value is `True`, the service applies different AI-powered transpiling passes depending on the `optimization_level` requested.
- `ai` ("true", "false", "auto") - Whether to use AI capabilities during transpilation. The AI capabilities available can be for `AIRouting` transpiling passes or other AI synthesis methods. If this value is `"true"`, the service applies different AI-powered transpiling passes depending on the `optimization_level` requested. If `"false"`, it uses the latest Qiskit transpiling features without AI. Finally, if `"auto"`, the service decides whether to apply the standard Qiskit heuristic passes or the AI-powered passes based on your circuit.
abbycross marked this conversation as resolved.
Show resolved Hide resolved
- `qiskit_transpile_options` (dict) - A Python dictionary object that can include any other option that is valid in the [Qiskit `transpile()` method](defaults-and-configuration-options). If the `qiskit_transpile_options` input includes `optimization_level`, it is discarded in favor of the `optimization_level` specified as parameter input. If the `qiskit_transpile_options` includes any option not recognized by the Qiskit `transpile()` method, the library raises an error.

For more information about the available `qiskit-transpiler-service` methods, see the [qiskit-transpiler-service API reference](/api/qiskit-transpiler-service). To learn more about the service API, see the [Qiskit Transpiler Service REST API documentation.](/api/qiskit-transpiler-service-rest)

## Examples

Expand All @@ -51,7 +52,7 @@ The following examples demonstrate how to transpile circuits using the Qiskit tr

cloud_transpiler_service = TranspilerService(
backend_name="ibm_sherbrooke",
ai=False,
ai="false",
optimization_level=3,
)
transpiled_circuit = cloud_transpiler_service.run(circuit)
Expand All @@ -68,12 +69,42 @@ The following examples demonstrate how to transpile circuits using the Qiskit tr

cloud_transpiler_service = TranspilerService(
backend_name="ibm_sherbrooke",
ai=True,
ai="true",
optimization_level=1,
)
transpiled_circuit = cloud_transpiler_service.run(circuit)
```

3. Produce a similar circuit and transpile it while letting the service to decide whether to use the AI-powered transpiling passes.


```python
from qiskit.circuit.library import EfficientSU2
from qiskit_transpiler_service.transpiler_service import TranspilerService

circuit = EfficientSU2(101, entanglement="circular", reps=1).decompose()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a simpler circuit you can use? With examples, it's useful to keep simple the less relevant details. Here, we only want to express that we have a QuantumCircuit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do agree we could do it with any QuantumCircuit, yet we want to showcase from the beginning this works for big circuits, that's the reason for that particular one


cloud_transpiler_service = TranspilerService(
backend_name="ibm_sherbrooke",
ai="auto",
optimization_level=1,
)
transpiled_circuit = cloud_transpiler_service.run(circuit)
```

## Citation

If you use any AI feature from the Qiskit transpiler service in your research, use the following recommended citation:
abbycross marked this conversation as resolved.
Show resolved Hide resolved

```
@misc{2405.13196,
Author = {David Kremer and Victor Villar and Hanhee Paik and Ivan Duran and Ismael Faro and Juan Cruz-Benito},
Title = {Practical and efficient quantum circuit synthesis and transpiling with Reinforcement Learning},
Year = {2024},
Eprint = {arXiv:2405.13196},
}
```

## Next steps

<Admonition type="tip" title="Recommendations">
Expand Down
Loading