hchevva commited on
Commit
d42a662
·
verified ·
1 Parent(s): 0974bf5

Update quread/llm_explain.py

Browse files
Files changed (1) hide show
  1. quread/llm_explain.py +13 -25
quread/llm_explain.py CHANGED
@@ -38,41 +38,29 @@ def _build_grounded_prompt(
38
  top_lines = [f"- {b}: {p:.4f}" for b, p in probs_top]
39
 
40
  return f"""
41
- You are a quantum computing tutor. Use ONLY the data below. Do NOT invent gates, probabilities, or results.
 
 
42
 
43
- Write the response in Markdown with these headings:
44
-
45
- ## Gate-by-gate explanation
46
- Explain what each operation did in plain English.
47
-
48
- ## What the results mean
49
- Explain superposition vs entanglement based on the probabilities shown.
50
-
51
- ## Compare to a Bell state
52
- Say whether this matches any Bell state (|Φ+>, |Φ->, |Ψ+>, |Ψ->). If it matches, name it.
53
- If it differs, explain exactly how it differs.
54
-
55
- ## How this looks on real hardware
56
- Explain what would change on a real device: shot noise, readout error, decoherence, and why 00/11 might appear slightly.
57
-
58
- ## Debugging tips (2)
59
- Give 2 concrete tips (endianness, control/target, measurement mapping).
60
-
61
- DATA (do not go beyond this):
62
  Qubits: {n_qubits}
63
-
64
- Circuit operations:
65
  {chr(10).join(ops_lines)}
66
 
67
- Final state (ket-like summary):
68
  {state_ket}
69
 
70
- Top measurement probabilities:
71
  {chr(10).join(top_lines)}
72
 
73
  Shots: {shots if shots is not None else "N/A"}
74
 
75
- Answer:
 
 
 
 
 
76
  """.strip()
77
 
78
 
 
38
  top_lines = [f"- {b}: {p:.4f}" for b, p in probs_top]
39
 
40
  return f"""
41
+ You are a quantum tutor. Use ONLY the DATA section.
42
+ Do NOT repeat instructions or the DATA. Do NOT restate the question.
43
+ Write ONLY the ANSWER section.
44
 
45
+ ### DATA
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  Qubits: {n_qubits}
47
+ Ops:
 
48
  {chr(10).join(ops_lines)}
49
 
50
+ State:
51
  {state_ket}
52
 
53
+ Top probs:
54
  {chr(10).join(top_lines)}
55
 
56
  Shots: {shots if shots is not None else "N/A"}
57
 
58
+ ### ANSWER
59
+ A) Gate-by-gate:
60
+ B) Meaning (superposition/entanglement):
61
+ C) Bell-state comparison (Φ±, Ψ±):
62
+ D) Real hardware (noise + why forbidden states may appear):
63
+ E) Debug tips (2):
64
  """.strip()
65
 
66