Skip to content

Commit 5a69601

Browse files
committed
adjusted extra headings
1 parent e24318d commit 5a69601

File tree

4 files changed

+37
-71
lines changed

4 files changed

+37
-71
lines changed

content/posts/machine learning/deep learning/NLP/Gemma2+RAG/index.md

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ llm_model = HuggingFaceLLM(model_name="google/gemma-2-9b-it",
182182

183183

184184

185-
## Direct LLM Querying
185+
## 5. Direct LLM Querying
186186
This part demonstrates direct querying of the LLM:
187187

188188
* It defines a list of queries about superconductivity.
@@ -207,20 +207,14 @@ for query in queries[:]:
207207
)
208208
```
209209

210-
Which scientists contributed the most to superconductivity?
211-
Which are the differences between Type-I and Type-II superconductors? Describe magnetical properties and show formulas.
212-
What are the London Equation? Why are they important?
213-
Solve this problem: Consider a bulk superconductor containing a cylindrical hole of 0.1 mm diameter. There are 7 magnetic flux quanta trapped in the hole. Find the magnetic field in the hole.
214-
215-
216-
217210
```python
218211
for i, resp in enumerate(llm_responses):
219212
display(Markdown("## " + queries[i] + "\n" + resp.text))
220213
```
221214

222215

223-
### Which scientists contributed the most to superconductivity?
216+
<span style="font-size:1.5em;font-weight:700"> Which scientists contributed the most to superconductivity? </span>
217+
224218

225219

226220
It's impossible to name just a few scientists who "contributed the most" to superconductivity, as it's a field built on the work of many brilliant minds over decades.
@@ -248,11 +242,8 @@ It's important to remember that scientific progress is a collaborative effort, b
248242

249243

250244

245+
<span style="font-size:1.5em;font-weight:700">Which are the differences between Type-I and Type-II superconductors? Describe magnetical properties and show formulas. </span>
251246

252-
### Which are the differences between Type-I and Type-II superconductors? Describe magnetical properties and show formulas.
253-
254-
255-
#### Type-I vs. Type-II Superconductors
256247

257248
Superconductors are materials that exhibit zero electrical resistance below a critical temperature (Tc). They are classified into two main types: Type-I and Type-II, based on their response to magnetic fields.
258249

@@ -300,8 +291,7 @@ Superconductors are materials that exhibit zero electrical resistance below a cr
300291

301292

302293

303-
304-
### What are the London Equation? Why are they important?
294+
<span style="font-size:1.5em;font-weight:700"> What are the London Equation? Why are they important? </span>
305295

306296

307297
The London equations are a set of equations that describe the behavior of superconductors. They were first derived by Fritz and Heinz London in 1935.
@@ -342,7 +332,7 @@ Despite their limitations, the London equations are a cornerstone of superconduc
342332

343333

344334

345-
### Solve this problem: Consider a bulk superconductor containing a cylindrical hole of 0.1 mm diameter. There are 7 magnetic flux quanta trapped in the hole. Find the magnetic field in the hole.
335+
<span style="font-size:1.5em;font-weight:700"> Solve this problem: Consider a bulk superconductor containing a cylindrical hole of 0.1 mm diameter. There are 7 magnetic flux quanta trapped in the hole. Find the magnetic field in the hole. </span>
346336

347337

348338
Here's how to solve the problem:
@@ -383,7 +373,7 @@ Let me know if you'd like me to calculate the numerical value of the magnetic fi
383373

384374

385375

386-
## Vector Store and Index Creation
376+
## 6. Vector Store and Index Creation
387377
This section sets up the vector store and creates the index:
388378

389379
* It initializes a FAISS index with the embedding dimension of 384 (the same as the embedding model)
@@ -410,7 +400,7 @@ index.storage_context.persist()
410400

411401

412402

413-
## RAG Querying
403+
## 7. RAG Querying
414404
* Compare these results with the previous Direct LLM queries
415405
* The default *similarity_top_k* values is 3. However, I set it up to 5 to have more exhaustive answers.
416406
* We expect more accurate and truthful answers. Anyway, when asked about London Equations, they are wrong. Also in the first query, direct LLM provides only few scientists but do not quote "Josephson" in any case (even after multiple generation).
@@ -441,7 +431,7 @@ for i, resp in enumerate(rag_responses):
441431
```
442432

443433

444-
### Which scientists contributed the most to superconductivity?
434+
<span style="font-size:1.5em;font-weight:700"> Which scientists contributed the most to superconductivity? </span>
445435
Sources: _['Lecture1.pdf', 'Lecture1.pdf', 'Lecture1.pdf', 'Lecture1.pdf', 'Lecture1.pdf']_
446436

447437

@@ -467,7 +457,7 @@ The text emphasizes the importance of understanding the microscopic mechanism of
467457

468458

469459

470-
### Which are the differences between Type-I and Type-II superconductors? Describe magnetical properties and show formulas.
460+
<span style="font-size:1.5em;font-weight:700"> Which are the differences between Type-I and Type-II superconductors? Describe magnetical properties and show formulas. </span>
471461
Sources: _['Lecture2.pdf', 'Lecture2.pdf', 'Lecture1.pdf', 'Lecture3.pdf', 'Lecture1.pdf']_
472462

473463

@@ -515,7 +505,7 @@ Let me know if you have any other questions.
515505

516506

517507

518-
### What are the London Equation? Why are they important?
508+
<span style="font-size:1.5em;font-weight:700"> What are the London Equation? Why are they important? </span>
519509
Sources: _['Lecture1.pdf', 'Lecture3.pdf', 'Lecture3.pdf', 'Lecture3.pdf', 'Lecture1.pdf']_
520510

521511

@@ -555,7 +545,7 @@ The provided text highlights the historical development of superconductivity the
555545

556546

557547

558-
### Solve this problem: Consider a bulk superconductor containing a cylindrical hole of 0.1 mm diameter. There are 7 magnetic flux quanta trapped in the hole. Find the magnetic field in the hole.
548+
<span style="font-size:1.5em;font-weight:700"> Solve this problem: Consider a bulk superconductor containing a cylindrical hole of 0.1 mm diameter. There are 7 magnetic flux quanta trapped in the hole. Find the magnetic field in the hole.</span>
559549
Sources: _['Lecture3.pdf', 'Lecture3.pdf', 'Lecture3.pdf', 'Lecture3.pdf', 'Lecture3.pdf']_
560550

561551

@@ -599,7 +589,7 @@ Let me know if you have any further questions.
599589

600590

601591

602-
## Conclusion
592+
## 8. Conclusion
603593
This implementation demonstrates the power of RAG in combining the strengths of large language models with the ability to retrieve and utilize specific, relevant information. By using FAISS for efficient similarity search and a state-of-the-art language model like Gemma-2-9b, this system can provide informed, context-aware responses to complex queries about superconductivity.
604594
The comparison between direct LLM responses and RAG responses would likely show the benefits of RAG in providing more detailed, accurate, and source-backed information. This approach is particularly valuable in domains requiring up-to-date or specialized knowledge, where the LLM's pre-trained knowledge might be insufficient or outdated.
605595

public/index.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

public/posts/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ <h5 class="card-title">Gemma-2 &#43; RAG &#43; LlamaIndex &#43; VectorDB</h5>
510510
<div class="card-footer">
511511
<span class="float-start">
512512
Sunday, July 14, 2024
513-
| 15 minutes </span>
513+
| 14 minutes </span>
514514
<a
515515
href="/posts/machine-learning/deep-learning/nlp/gemma2&#43;rag/"
516516
class="float-end btn btn-outline-info btn-sm">Read</a>

0 commit comments

Comments
 (0)