{"id":25694292,"url":"https://github.com/sinanuozdemir/quick-start-guide-to-llms","last_synced_at":"2025-05-16T11:03:47.201Z","repository":{"id":183124940,"uuid":"651139866","full_name":"sinanuozdemir/quick-start-guide-to-llms","owner":"sinanuozdemir","description":"The Official Repo for \"Quick Start Guide to Large Language Models\"","archived":false,"fork":false,"pushed_at":"2025-05-13T19:19:44.000Z","size":96277,"stargazers_count":277,"open_issues_count":1,"forks_count":160,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-05-16T11:02:44.672Z","etag":null,"topics":["ai","bert","deepseek","distillation","generative-ai","gpt","llama-4","llm","machine-learning","multimodal","nlp","quantization","rag"],"latest_commit_sha":null,"homepage":"https://www.amazon.com/Quick-Start-Guide-Language-Models-dp-0135346568/dp/0135346568","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sinanuozdemir.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-06-08T15:25:01.000Z","updated_at":"2025-05-14T17:45:48.000Z","dependencies_parsed_at":"2023-07-23T02:00:53.480Z","dependency_job_id":"94067373-76a0-4dde-b44a-2f5757ea4ff7","html_url":"https://github.com/sinanuozdemir/quick-start-guide-to-llms","commit_stats":null,"previous_names":["sinanuozdemir/quick-start-guide-to-llms"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinanuozdemir%2Fquick-start-guide-to-llms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinanuozdemir%2Fquick-start-guide-to-llms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinanuozdemir%2Fquick-start-guide-to-llms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinanuozdemir%2Fquick-start-guide-to-llms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sinanuozdemir","download_url":"https://codeload.github.com/sinanuozdemir/quick-start-guide-to-llms/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254518383,"owners_count":22084374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","bert","deepseek","distillation","generative-ai","gpt","llama-4","llm","machine-learning","multimodal","nlp","quantization","rag"],"created_at":"2025-02-24T23:52:03.836Z","updated_at":"2025-05-16T11:03:47.175Z","avatar_url":"https://github.com/sinanuozdemir.png","language":"Jupyter Notebook","funding_links":[],"categories":["NLP"],"sub_categories":[],"readme":"# Quick Start Guide to Large Language Models - Second Edition\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.amazon.com/Quick-Start-Guide-Language-Models-dp-0135346568/dp/0135346568\"\u003eGet your copy today\u003c/a\u003e and please leave a rating/review to tell me what you thought! ⭐⭐⭐⭐⭐\n\u003c/p\u003e\n\n\u003cp align=\"center\" href=\"https://www.amazon.com/Quick-Start-Guide-Language-Models-dp-0135346568/dp/0135346568\"\u003e\n  \u003cimg src=\"images/qsllm2e.jpg\" href=\"https://www.amazon.com/Quick-Start-Guide-Language-Models-dp-0135346568/dp/0135346568\" alt=\"Quick Start Guide to Large Language Models\" width=\"300\"\u003e\n\u003c/p\u003e\n\n\nWelcome to the GitHub repository for the **\"Quick Start Guide to Large Language Models - Second Edition\"**. This repository contains the code snippets and notebooks used in the book, demonstrating various applications and advanced techniques in working with Transformer models and large language models (LLMs). [View the code for the First Edition here](https://github.com/sinanuozdemir/quick-start-guide-to-llms/tree/1e)\n\n\n## Repository Structure\n\n### Directories\n\n- `notebooks`: Contains Jupyter notebooks for each chapter in the book.\n- `data`: Contains the datasets used in the notebooks.\n- `images`: Contains images and graphs used in the notebooks.\n\n### Notebooks\n\nBelow is a list of the notebooks included in the `notebooks` directory, organized by the chapters in the book.\n\n#### Part I - Introduction to Large Language Models\n\n- **Chapter 2: Semantic Search with LLMs**\n  - [`02_semantic_search.ipynb`](notebooks/02_semantic_search.ipynb): An introduction to semantic search using OpenAI and open-source models.\n\n- **Chapter 3: First Steps with Prompt Engineering**\n  - [`03_prompt_engineering.ipynb`](notebooks/03_prompt_engineering.ipynb): A guide to effective prompt engineering for instruction-aligned LLMs.\n\n- **Chapter 4: The AI Ecosystem: Putting the Pieces Together**\n  - [`04_rag_retrieval.ipynb`](notebooks/04_rag_retrieval.ipynb): Building a Retrieval-Augmented Generation (RAG) pipeline.\n  - [`04_agent.ipynb`](notebooks/04_agent.ipynb): Constructing an AI agent using LLMs and other tools.\n\n#### Part II - Getting the Most Out of LLMs\n\n- **Chapter 5: Optimizing LLMs with Customized Fine-Tuning**\n  - [`05_bert_app_review.ipynb`](notebooks/05_bert_app_review.ipynb): Fine-tuning a BERT model for app review classification.\n  - [`05_openai_app_review_fine_tuning.ipynb`](notebooks/05_openai_app_review_fine_tuning.ipynb): Fine-tuning OpenAI models for app review classification.\n\n- **Chapter 6: Advanced Prompt Engineering**\n  - [`06_adv_prompt_engineering.ipynb`](notebooks/06_adv_prompt_engineering.ipynb): Advanced techniques in prompt engineering, including output validation and semantic few-shot learning.\n\n\n  - [`06_adv_prompt_engineering - DEEPSEEK.ipynb`](notebooks/06_adv_prompt_engineering%20-%20DEEPSEEK.ipynb): Extending the MathQA case study to Deepseek V3 and R1. Prompting still seems to matter :) \n\n  - [`06_adv_prompt_engineering - Llama 4.ipynb`](notebooks/06_adv_prompt_engineering%20-%20Llama4.ipynb): Extending the MathQA case study to Llama 4 Scout. Interesting the prompt responds well to CoT but not as much to Few-shot prompting on this benchmark.\n\n- **Chapter 7: Customizing Embeddings and Model Architectures**\n  - [`07_recommendation_engine.ipynb`](notebooks/07_recommendation_engine.ipynb): Building a recommendation engine using custom fine-tuned LLMs and embeddings.\n\n#### Part III - Advanced LLM Usage\n\n- **Chapter 9: Moving Beyond Foundation Models**\n  - [`09_constructing_a_vqa_system.ipynb`](notebooks/09_constructing_a_vqa_system.ipynb): Step-by-step guide to constructing a Visual Question Answering (VQA) system using GPT-2 and Vision Transformer.\n  - [`09_using_our_vqa.ipynb`](notebooks/09_using_our_vqa.ipynb): Using the VQA system built in the previous notebook.\n  - [`09_flan_t5_rl.ipynb`](notebooks/09_flan_t5_rl.ipynb): Using Reinforcement Learning (RL) to improve FLAN-T5 model outputs.\n\n- **Chapter 10: Advanced Open-Source LLM Fine-Tuning**\n  - [`10_SAWYER_LLAMA_SFT.ipynb`](notebooks/10_SAWYER_LLAMA_SFT.ipynb): Fine-tuning the Llama-3 model to create the SAWYER bot.\n  - [`10_SAWYER_Reward_Model.ipynb`](notebooks/10_SAWYER_Reward_Model.ipynb): Training a reward model from human preferences for the SAWYER bot.\n  - [`10_SAWYER_RLF.ipynb`](notebooks/10_SAWYER_RLF.ipynb): Applying Reinforcement Learning from Human Feedback (RLHF) to align the SAWYER bot.\n  - [`10_SAWYER_USE_SAWYER.ipynb`](notebooks/10_SAWYER_USE_SAWYER.ipynb): Using the SAWYER bot.\n  - [`10_anime_category_classification_model_freezing.ipynb`](notebooks/10_anime_category_classification_model_freezing.ipynb): Fine-tuning a BERT model for anime category classification, comparing layer freezing techniques.\n  - [`10_latex_gpt2.ipynb`](notebooks/10_latex_gpt2.ipynb): Fine-tuning GPT-2 to generate LaTeX formulas.\n  - [`10_optimizing_fine_tuning.ipynb`](notebooks/10_optimizing_fine_tuning.ipynb): Best practices for optimizing fine-tuning of transformer models.\n\n- **Chapter 11: Moving LLMs into Production**\n  - [`11_distillation_example_1.ipynb`](notebooks/11_distillation_example_1.ipynb): Exploring knowledge distillation techniques for transformer models.\n  - [`11_distillation_example_2.ipynb`](notebooks/11_distillation_example_2.ipynb): Advanced distillation methods and applications.\n  - [`11_llama_quantization.ipynb`](notebooks/11_llama_quantization.ipynb): Quantizing Llama models for efficient deployment.\n\n- **Chapter 12: Evaluating LLMs**\n  - [`12_llm_calibration.ipynb`](notebooks/12_llm_calibration.ipynb): Techniques for calibrating LLM outputs.\n  - [`12_llm_gen_eval.ipynb`](notebooks/12_llm_gen_eval.ipynb): Methods for evaluating the generative capabilities of LLMs.\n  - [`12_cluster.ipynb`](notebooks/12_cluster.ipynb): Clustering techniques for analyzing LLM outputs.\n  - Probing - There are over a dozen notebooks for Probing so I will only share a few key ones here:\n\t  - [Llama-3 8B Instruct with prompt \"Who is {NAME}\"](https://colab.research.google.com/drive/1e1d9fATVjVun-_tPj4vS_DSTGaIfxs01?usp=sharing)\n\t  - [BERT-large-cased no prompt](https://colab.research.google.com/drive/1cizgoh1J6Y-DHBrOkNTFo9Y1CypjwuQM?usp=sharing)\n\t  - [Mistral-7B-Instruct-v0.3 with prompt \"Who is {NAME}\"](https://colab.research.google.com/drive/1VL3betxqVZ_H3_8XmLbjE0hEjaoy-HPV?usp=sharing)\n\n## How to Use\n\nTo use this repository:\n\n1. **Clone the repository to your local machine:**\n\n```bash\ngit clone https://github.com/yourusername/quick-start-llms.git\n```\n\n2. **Navigate to the notebooks directory and open the Jupyter notebook of your choice:**\n\n```bash\ncd quick-start-llms\n```\n\n3. **Install the necessary libraries:**\n\n```bash\npip install -r requirements.txt\n```\n\nNote: Some notebooks may require specific datasets, which can be found in the data directory.\n\n## Contributing\nContributions are welcome! If you have any additions, corrections, or enhancements, feel free to submit a pull request.\n\n## Disclaimer\nThis repository is for educational purposes and is meant to accompany the \"Quick Start Guide to Large Language Models - Second Edition\" book. Please refer to the book for in-depth explanations and discussions of the topics covered in the notebooks.\n\n# More From Sinan\n\n1. Check out Sinan's Newsletter [AI Office Hours](https://ai-office-hours.beehiiv.com/) for more AI/LLM content!\n2. Sinan has a podcast called [Practically Intelligent](https://podcasts.apple.com/us/podcast/practically-intelligent/id1678774315) where he chats about the latest and greatest in AI!\n3. Follow the [Getting Started with Data, LLMs and ChatGPT Playlist on O'Reilly](https://www.oreilly.com/playlists/2953f6c7-0e13-49ac-88e2-b951e11388de) for a curated list of Sinan's work!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinanuozdemir%2Fquick-start-guide-to-llms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsinanuozdemir%2Fquick-start-guide-to-llms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinanuozdemir%2Fquick-start-guide-to-llms/lists"}