This repository provides resources and demos related to AI-assisted coding, autoregressive large language models (LLMs), and advanced prompt engineering techniques.
- AI-Assisted Coding
- Autoregressive Large Language Models (LLMs)
- Prompt Engineering 201
The repository contains a Jupyter Notebook (AI_ASSISTED_CODING.ipynb
) demonstrating AI-assisted coding techniques using language models.
Autoregressive LLMs predict the next word based on input text and operate as probability kernels.
- Next-Word Prediction: Given a prefix, the model generates the most likely next word.
- Stochastic Nature: A given input may produce different outputs sampled from probability distributions, which can result in inconsistencies or hallucinations.
- Probability Calculations: Language models assign probabilities to sequences of words based on prior observations.
- Base LLM (Pre-Trained): Trained on large text corpora to predict the next word in a sentence.
- Instruction-Tuned LLM (Fine-Tuned): Optimized to follow instructions and improve response accuracy using techniques such as:
- Supervised Fine-Tuning (SFT)
- Reinforcement Learning with Human Feedback (RLHF)
- Direct Preference Optimization (DPO)
- Temperature: Controls randomness (higher values = more creativity, lower values = more deterministic responses).
- Top-p (Nucleus Sampling): Limits token selection to the most probable subset.
- LogProbs: Logs probability scores for debugging and confidence analysis.
- Penalties:
- Frequency Penalty: Reduces repetition of frequent words.
- Presence Penalty: Encourages diverse outputs by avoiding repeated phrases.
- Max Tokens: Limits response length.
- Stop Sequences: Defines token sequences that halt text generation.
- n & best_of: Controls the number of completions generated.
The repository includes a Jupyter Notebook (PROMPT_ENGINEERING.ipynb
) demonstrating prompt optimization techniques for LLMs.
- Understanding Model Behavior: Fine-tuning prompts to achieve desired responses.
- Controlling Creativity & Accuracy: Adjusting parameters for structured, coherent, and relevant outputs.
- Debugging Model Responses: Using log probabilities to refine prompts.
To explore the concepts, run the provided Jupyter Notebooks:
AI_ASSISTED_CODING.ipynb
– AI-assisted coding demonstrations.PROMPT_ENGINEERING.ipynb
– Advanced prompt engineering strategies.
- DeepLearning.AI – ChatGPT Prompt Engineering
- Stanford NLP (CS224N)
- AI Engineering Research
For contributions, open a pull request or create an issue in this repository. Happy coding!