AWS Security ChangesHomeSearch

AWS braket documentation change

Service: braket · 2025-10-22 · Documentation low

File: braket/latest/developerguide/braket-jobs-hyperparameters.md

Summary

Updated hyperparameter documentation with simplified code examples, changed job configuration to use notebook execution patterns, and added instructions for accessing hyperparameters via job metadata

Security assessment

The changes focus on workflow simplification and notebook integration rather than addressing security vulnerabilities. While the updated hyperparameter access method (via AwsQuantumJob metadata) could improve data handling practices, there is no explicit mention of security controls, vulnerability fixes, or security-related configurations in the diff.

Diff

diff --git a/braket/latest/developerguide/braket-jobs-hyperparameters.md b/braket/latest/developerguide/braket-jobs-hyperparameters.md
index e0d56c77a..e14f879e2 100644
--- a//braket/latest/developerguide/braket-jobs-hyperparameters.md
+++ b//braket/latest/developerguide/braket-jobs-hyperparameters.md
@@ -7 +7 @@
-You can define hyperparameters needed by your algorithm, such as the learning rate or step size, when you create a hybrid job. Hyperparameter values are typically used to control various aspects of the algorithm, and can often be tuned to optimize the algorithm's performance. To use hyperparameters in a Braket hybrid job, you need to specify their names and values explicitly as a dictionary. Note that the values must be of the string datatype. You specify the hyperparameter values that you want to test when searching for the optimal set of values. The first step to using hyperparameters is to set up and define the hyperparameters as a dictionary, which can be seen in the following code:
+You can define hyperparameters needed by your algorithm, such as the learning rate or step size, when you create a hybrid job. Hyperparameter values are typically used to control various aspects of the algorithm, and can often be tuned to optimize the algorithm's performance. To use hyperparameters in a Braket hybrid job, you need to specify their names and values explicitly as a dictionary. Specify the hyperparameter values to test when searching for the optimal set of values. The first step to using hyperparameters is to set up and define the hyperparameters as a dictionary, which can be seen in the following code.
@@ -10,6 +10 @@ You can define hyperparameters needed by your algorithm, such as the learning ra
-    # Defining the number of qubits used
-    n_qubits = 8
-    # Defining the number of layers used
-    n_layers = 10
-    # Defining the number of iterations used for your optimization algorithm
-    n_iterations = 10
+    from braket.devices import Devices
@@ -17,5 +12 @@ You can define hyperparameters needed by your algorithm, such as the learning ra
-    hyperparams = {
-        "n_qubits": n_qubits, 
-        "n_layers": n_layers, 
-        "n_iterations": n_iterations
-    }
+    device_arn = Devices.Amazon.SV1
@@ -23 +14,3 @@ You can define hyperparameters needed by your algorithm, such as the learning ra
-You would then pass the hyperparameters defined in the code snippet given above to be used in the algorithm of your choice with something that looks like the following:
+    hyperparameters = {"shots": 1_000}
+
+Then pass the hyperparameters defined in the code snippet given above to be used in the algorithm of your choice. To run the following code example, create a directory named “src” in the same path as your hyperparameter file. Inside of the "src" directory, add [0_Getting_started_papermill.ipynb](https://github.com/amazon-braket/amazon-braket-examples/blob/main/examples/hybrid_jobs/7_Running_notebooks_as_hybrid_jobs/src/0_Getting_started_papermill.ipynb), [notebook_runner.py](https://github.com/amazon-braket/amazon-braket-examples/blob/main/examples/hybrid_jobs/7_Running_notebooks_as_hybrid_jobs/src/notebook_runner.py), and [requirements.txt](https://github.com/amazon-braket/amazon-braket-examples/blob/main/examples/hybrid_jobs/7_Running_notebooks_as_hybrid_jobs/src/requirements.txt) code files. 
@@ -29,3 +21,0 @@ You would then pass the hyperparameters defined in the code snippet given above
-    # Name your job so that it can be later identified
-    job_name = f"qcbm-gaussian-training-{n_qubits}-{n_layers}-" + str(int(time.time()))
-    
@@ -33,13 +23,6 @@ You would then pass the hyperparameters defined in the code snippet given above
-        # Run this hybrid job on the SV1 simulator
-        device="arn:aws:braket:::device/quantum-simulator/amazon/sv1",
-        # The directory or single file containing the code to run.
-        source_module="qcbm",
-        # The main script or function the job will run.
-        entry_point="qcbm.qcbm_job:main",
-        # Set the job_name
-        job_name=job_name,
-        # Set the hyperparameters
-        hyperparameters=hyperparams,
-        # Define the file that contains the input data
-        input_data="data.npy", # Or input_data=s3_path
-        # wait_until_complete=False,
+        device=device_arn,
+        source_module="src",
+        entry_point="src.notebook_runner:run_notebook",
+        input_data="src/0_Getting_started_papermill.ipynb",
+        hyperparameters=hyperparameters,
+        job_name=f"papermill-job-demo-{int(time.time())}",
@@ -48,3 +31,2 @@ You would then pass the hyperparameters defined in the code snippet given above
-###### Note
-
-In order to learn more about input data see the [Inputs](./braket-jobs-inputs-and-outputs.html#braket-jobs-inputs) section.
+    # Print job to record the ARN
+    print(job)
@@ -52 +34 @@ In order to learn more about input data see the [Inputs](./braket-jobs-inputs-an
-The hyperparameters would then be loaded into the hybrid job script using the following code:
+To access your hyperparameters from _within_ your hybrid job script, see the `load_jobs_hyperparams()` function in the [notebook_runner.py](https://github.com/amazon-braket/amazon-braket-examples/blob/main/examples/hybrid_jobs/7_Running_notebooks_as_hybrid_jobs/src/notebook_runner.py) python file. To access your hyperparameters _outside_ of your hybrid job script, run the following code. 
@@ -55,7 +37 @@ The hyperparameters would then be loaded into the hybrid job script using the fo
-    import json
-    import os
-    
-    # Load the Hybrid Job hyperparameters
-    hp_file = os.environ["AMZN_BRAKET_HP_FILE"]
-    with open(hp_file, "r") as f:
-        hyperparams = json.load(f)
+    from braket.aws import AwsQuantumJob
@@ -63 +39,3 @@ The hyperparameters would then be loaded into the hybrid job script using the fo
-###### Note
+    # Get the job using the ARN
+    job_arn = "arn:aws:braket:us-east-1:111122223333:job/5eabb790-d3ff-47cc-98ed-b4025e9e296f"  # Replace with your job ARN
+    job = AwsQuantumJob(arn=job_arn)
@@ -65 +43,4 @@ The hyperparameters would then be loaded into the hybrid job script using the fo
-For more information about how to pass information like the input data and the device arn to the hybrid job script, see this github [page](https://github.com/amazon-braket/amazon-braket-examples/blob/main/examples/hybrid_jobs/1_Quantum_machine_learning_in_Amazon_Braket_Hybrid_Jobs/qcbm/qcbm.py).
+    # Access the hyperparameters
+    job_metadata = job.metadata()
+    hyperparameters = job_metadata.get("hyperParameters", {})
+    print(hyperparameters)
@@ -67 +48 @@ For more information about how to pass information like the input data and the d
-A couple guides that are very useful for learning about how to use hyperparameters are given by the [QAOA with Amazon Braket Hybrid Jobs and PennyLane](https://github.com/amazon-braket/amazon-braket-examples/blob/main/examples/hybrid_jobs/2_Using_PennyLane_with_Braket_Hybrid_Jobs/Using_PennyLane_with_Braket_Hybrid_Jobs.ipynb) and [Quantum machine learning in Amazon Braket Hybrid Jobs](https://github.com/amazon-braket/amazon-braket-examples/blob/main/examples/hybrid_jobs/1_Quantum_machine_learning_in_Amazon_Braket_Hybrid_Jobs/Quantum_machine_learning_in_Amazon_Braket_Hybrid_Jobs.ipynb) tutorials.
+For more information on learning how to use hyperparamters, see the [QAOA with Amazon Braket Hybrid Jobs and PennyLane](https://github.com/amazon-braket/amazon-braket-examples/blob/main/examples/hybrid_jobs/2_Using_PennyLane_with_Braket_Hybrid_Jobs/Using_PennyLane_with_Braket_Hybrid_Jobs.ipynb) and [Quantum machine learning in Amazon Braket Hybrid Jobs](https://github.com/amazon-braket/amazon-braket-examples/blob/main/examples/hybrid_jobs/1_Quantum_machine_learning_in_Amazon_Braket_Hybrid_Jobs/Quantum_machine_learning_in_Amazon_Braket_Hybrid_Jobs.ipynb) tutorials.
@@ -75 +56 @@ To use the Amazon Web Services Documentation, Javascript must be enabled. Please
-Define the environment for your algorithm script
+Running Braket hybrid jobs in your own container
@@ -77 +58 @@ Define the environment for your algorithm script
-(Advanced) PennyLane with Amazon Braket
+Configure your hybrid job instance