pennylane
하는 일
PennyLane은 양자 회로를 만들고 최적화하도록 돕습니다. 양자 계산을 PyTorch나 JAX 같은 인공지능 모델과 결합해, 분자 에너지 계산이나 양자 회로 검증 같은 복잡한 문제를 해결할 수 있게 합니다.
사용하는 경우
- ✓조정 가능한 매개변수를 가진 양자 회로를 최적화할 때.
- ✓양자 계산과 고전(AI) 계산을 섞은 모델을 만들 때.
- ✓분자 에너지를 계산하거나 양자 최적화 문제를 풀 때.
스킬 링크
https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/pennylane/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“수소 분자의 에너지를 계산하는 양자 회로를 만들고, VQE 알고리즘으로 최적화해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
PennyLane은 양자 회로를 정의하도록 하고, 머신러닝 도구로 회로의 매개변수를 조정할 수 있게 합니다. 회로를 컴퓨터에서 시뮬레이션하거나, 설정하면 실제 양자 하드웨어로 보낼 수도 있습니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
PennyLane
When to use
Use PennyLane to optimize parameterized circuits, build hybrid quantum-classical models, estimate molecular energies, or compare a validated circuit across devices. This skill targets stable PennyLane 0.45.1. The local examples use small synthetic systems; successful optimization does not establish quantum advantage, molecular accuracy, or hardware fidelity.
Installation
Create a dedicated environment; provider plugins and compiler dependencies should be resolved separately from unrelated scientific packages:
uv venv --python 3.13 .venv-pennylane
uv pip install --python .venv-pennylane/bin/python "pennylane==0.45.1"
PennyLane 0.45 requires NumPy 2+. Core installation includes Lightning. For ML, use the tested JAX 0.7.1/JAXlib 0.7.1 pair or PyTorch; do not assume the latest JAX is supported by this PennyLane release. See device setup for optional plugin versions and their verification limits.
Workflow
- Fix the problem convention: feature ordering and label encoding for ML; Hamiltonian sign for optimization; units, charge, multiplicity, basis, active space and mapping for chemistry.
- Build a small analytic
default.qubitcircuit. Keep the quantum function separate from the QNode when reusing it on another backend. - Check a known value and a gradient against an analytic or finite-difference
result before training. Use trainable
pennylane.numpyarrays for Autograd, framework-native tensors for Torch/JAX. - Optimize while recording objective, gradient norm, seeds, ansatz shape and
package versions.
step_and_costreturns the cost before its update; evaluate the objective again for final reporting. - Validate independently: held-out examples and classical baselines for ML; particle number and a sector-appropriate classical reference for VQE; enumerated small instances for QAOA.
- Introduce finite shots/noise, report uncertainty, inspect decomposed resources, then select a current accessible hardware backend and execution budget. Plugin portability does not guarantee identical gates, measurements or gradients.
Quick start: value, gradient and optimization
This self-contained example is executed by the skill's tests.
import pennylane as qml
from pennylane import numpy as np
dev = qml.device("default.qubit", wires=1)
@qml.qnode(dev, interface="autograd", diff_method="backprop")
def energy(theta):
qml.RY(theta, wires=0)
return qml.expval(qml.Z(0))
theta = np.array(0.3, requires_grad=True)
assert np.allclose(energy(theta), np.cos(theta))
assert np.allclose(qml.grad(energy)(theta), -np.sin(theta))
opt = qml.GradientDescentOptimizer(stepsize=0.2)
for _ in range(80):
theta = opt.step(energy, theta)
final_energy = float(energy(theta))
assert final_energy < -0.999
print(f"[OK] final expectation = {final_energy:.6f}")
Load the relevant reference
- Getting started: QNodes, shots, random streams, trainability, batched parameters and simulator selection.
- Quantum circuits: controls, measurement feedback, wire ordering, QFT, transforms and current resource access.
- Quantum ML: executed TorchLayer and JAX training, stable classifier loss, feature scaling and evaluation.
- Quantum chemistry: H2 UCCSD, units, particle sector checks, dipoles, active spaces, geometry and excited-state caveats.
- Devices: simulators, provider contracts, credentials, current target discovery and source-only integration boundaries.
- Optimization: gradient checks, SPSA, QNG, MaxCut sign and exact QUBO-to-Ising conversion.
- Advanced features: templates, noise, parametrized Hamiltonian evolution, Catalyst and error-correction examples.
Failure checks
- Samples/counts require finite shots; states require a supporting simulator.
Use
qml.set_shotson the QNode rather than mutating device shots. - Mid-circuit measurement values are symbolic. Use
qml.cond, not Pythonif m. qml.specsin 0.45.1 returnsCircuitSpecs; access.resources, not obsolete top-level dictionary keys. Record the transform level and account for split tapes.qml.qaoa.maxcutproduces negative cut size. Minimize it directly.
…
자주 묻는 질문
양자 회로란 무엇인가요?
양자 비트(큐비트)를 조작해 계산을 수행하는 명령의 순서(양자 게이트)입니다. 양자 컴퓨터를 위한 프로그램과 같다고 생각하면 됩니다.
VQE/QAOA 같은 변분 양자 알고리즘이란 무엇인가요?
조정 가능한 매개변수를 가진 양자 회로와 고전 컴퓨터를 함께 사용해 문제의 최선의 해를 찾는 방법입니다. 예를 들어 분자의 최소 에너지나 최적화 문제의 해를 찾습니다.
제 컴퓨터에서 실행할 수 있나요?
네, PennyLane은 컴퓨터에서 양자 회로를 시뮬레이션할 수 있습니다. 실제 양자 하드웨어에서 실행하려면 특정 제공자에 대한 접근을 설정해야 합니다.
상세 정보
작성자의 원본 설명
Builds and differentiates PennyLane quantum circuits, hybrid PyTorch or JAX models, molecular VQE and QAOA workflows. Use for variational quantum algorithms, quantum machine learning, simulator validation, and moving validated circuits to provider plugins. For hardware-specific compilation use qiskit or cirq; for open-system dynamics use qutip.
인기도
- GitHub 스타
- 51k
- 순위
- #3525
- 라이선스
- MIT
- 업데이트
- 2026. 10. 15.
댓글
- …
이 저장소의 다른 스킬
13c-metabolic-flux
51k탄소-13 동위원소 추적 데이터를 사용해 대사 흐름(플럭스)을 추정합니다. 세포 대사와 생화학 경로를 분석할 때 유용합니다.
adaptyv
51kAdaptyv API를 사용해 단백질 특성 분석 실험을 설계합니다. 비용을 추정하고, 서열을 제출하며, 실험실 결과를 확인하는 데 도움이 됩니다.
aeon
51k시계열 데이터에 대해 머신러닝 작업을 수행합니다. 순차 데이터를 분류하고, 예측하고, 이상을 탐지하고, 패턴을 찾을 때 유용합니다.
alphagenome
51k유전 변이에 대해 미리 계산된 게놈 영향을 조회합니다. 변이가 게놈에 주는 영향을 이해하도록 점수와 설명을 제공합니다.