ProjectWithSourceCodes
1.03K subscribers
340 photos
8 videos
68 files
1.38K links
Free Source Code Projects for Students ๐Ÿš€ | Python | Java | Android | Web Dev | AI/ML | Final Year Projects | BCA โ€ข BTech โ€ข MCA | Interview Prep | Job Alerts

Website: https://updategadh.com
Download Telegram
๐Ÿš€ Generative AI Interview Questions with Answers (Part 6)
2๏ธโƒฃ6๏ธโƒฃ What is an AI API?
๐Ÿ‘‰ An AI API is an interface that allows an application to send requests to an AI model and receive its output without directly managing the model's internal implementation.
๐Ÿ“Œ Basic flow:
Application โ†’ API Request โ†’ AI Model โ†’ API Response โ†’ Application

Examples of applications:
๐Ÿ”น Chatbots
๐Ÿ”น Content Generation
๐Ÿ”น AI Assistants
๐Ÿ”น Document Processing
๐Ÿ”น Code Generation
2๏ธโƒฃ7๏ธโƒฃ What is Model Serving?
๐Ÿ‘‰ Model Serving is the process of making a trained AI model available for inference so applications can send input and receive predictions or generated outputs.
๐Ÿ“Œ Typical architecture:
User Request
โ†“
API / Server
โ†“
AI Model
โ†“
Prediction
โ†“
Response

๐Ÿ’ก Model serving can be implemented using cloud infrastructure, dedicated servers, or edge devices.
2๏ธโƒฃ8๏ธโƒฃ What is Semantic Search?
๐Ÿ‘‰ Semantic Search finds information based on the meaning and context of a query, rather than relying only on exact keyword matches.
Example:
Query:
"How can I reset my password?"

May retrieve:
"Steps to recover your account credentials"

๐Ÿ’ก Semantic search commonly uses embeddings and vector similarity.
2๏ธโƒฃ9๏ธโƒฃ What is Vector Search?
๐Ÿ‘‰ Vector Search finds items that are similar in vector space by comparing their embeddings.
๐Ÿ“Œ Basic flow:
User Query
โ†“
Create Embedding
โ†“
Vector Search
โ†“
Similar Results

Applications:
๐Ÿ”น RAG Systems
๐Ÿ”น AI Search
๐Ÿ”น Recommendation Systems
๐Ÿ”น Document Retrieval
๐Ÿ”น Similarity Matching
3๏ธโƒฃ0๏ธโƒฃ What is an AI Pipeline?
๐Ÿ‘‰ An AI Pipeline is a sequence of connected steps used to process data, run AI models, and produce results.
Example:
User Input
โ†“
Data Processing
โ†“
Embedding / Feature Extraction
โ†“
Model
โ†“
Post-Processing
โ†“
Final Output

A Generative AI pipeline may include:
๐Ÿ”น Input Validation
๐Ÿ”น Retrieval
๐Ÿ”น Prompt Construction
๐Ÿ”น Model Inference
๐Ÿ”น Output Validation
๐Ÿ”น Response Generation
๐Ÿ’ก Pipelines help organize complex AI applications into manageable stages.
๐Ÿ’ฌ Save this for your Generative AI interview preparation!
๐Ÿ”ฅ Next Part will cover 5 questions on LLM Architecture, Self-Attention, Encoder vs Decoder, Pretraining & Inference.
#GenerativeAI #GenAI #AI #LLM #SemanticSearch #VectorSearch #AIAPI #ModelServing #AIInterview #InterviewQuestions
โ˜•๏ธ Java Interview Questions with Answers (Part 1)
1๏ธโƒฃ What is Java?
๐Ÿ‘‰ Java is a high-level, object-oriented programming language designed to be portable across different platforms.
Key features:
๐Ÿ”น Object-Oriented
๐Ÿ”น Platform Independent
๐Ÿ”น Secure
๐Ÿ”น Robust
๐Ÿ”น Multithreaded
๐Ÿ”น Automatic Memory Management
๐Ÿ“Œ Write Once, Run Anywhere is commonly associated with Java's platform independence.
2๏ธโƒฃ What is JVM?
๐Ÿ‘‰ JVM stands for Java Virtual Machine. It executes Java bytecode and provides the runtime environment required to run Java applications.
๐Ÿ“Œ Basic flow:
Java Source Code
โ†“
Compiler
โ†“
Bytecode
โ†“
JVM
โ†“
Output

๐Ÿ’ก JVM implementations are platform-specific, which allows the same Java bytecode to run on different operating systems.
3๏ธโƒฃ What is the Difference Between JDK, JRE, and JVM?
๐Ÿ‘‰ These three components have different roles:
๐Ÿ”น JVM โ†’ Executes Java bytecode
๐Ÿ”น JRE โ†’ JVM + libraries required to run Java applications
๐Ÿ”น JDK โ†’ JRE/runtime components + development tools such as the Java compiler
๐Ÿ“Œ JDK โ†’ Development
๐Ÿ“Œ JRE โ†’ Running applications
๐Ÿ“Œ JVM โ†’ Executing bytecode
4๏ธโƒฃ What is a Class in Java?
๐Ÿ‘‰ A class is a blueprint for creating objects. It defines data and behavior through fields, methods, constructors, and other members.
Example:
class Student {
String name;
int age;

void display() {
System.out.println(name + " " + age);
}
}

๐Ÿ’ก Objects are created from classes.
5๏ธโƒฃ What is an Object in Java?
๐Ÿ‘‰ An object is an instance of a class. It contains state represented by fields and behavior provided by methods.
Example:
class Student {
String name;

void display() {
System.out.println(name);
}
}

public class Main {
public static void main(String[] args) {
Student s = new Student();

s.name = "Rahul";
s.display();
}
}

๐Ÿ“Œ Class โ†’ Blueprint
๐Ÿ“Œ Object โ†’ Instance of the class

๐Ÿ’ฌ Save this for your next Java interview preparation!

๐Ÿ”ฅ Part 2 will cover 5 important questions on Inheritance, Polymorphism, Encapsulation, Abstraction & Constructors.
#Java #JavaInterview #JavaProgramming #Programming #OOP #CodingInterview #SoftwareEngineer #InterviewQuestions #Developer #TechInterview
๐Ÿš€ Generative AI Interview Questions with Answers (Part 7)
3๏ธโƒฃ1๏ธโƒฃ What is LLM Architecture?
๐Ÿ‘‰ LLM architecture refers to the design and components used to build a Large Language Model. Modern LLMs commonly use Transformer-based architectures.
๐Ÿ“Œ Basic flow:
Input Text
โ†“
Tokenization
โ†“
Token Embeddings
โ†“
Transformer Layers
โ†“
Output Probabilities
โ†“
Generated Text

๐Ÿ’ก The exact architecture can differ between models.
3๏ธโƒฃ2๏ธโƒฃ What is Self-Attention?
๐Ÿ‘‰ Self-Attention allows a model to determine which tokens in an input are most relevant to each other while processing a sequence.
Example:
"The animal didn't cross the road because it was tired."

Attention helps the model consider relationships between words across the sentence.
๐Ÿ“Œ Self-Attention is a core component of Transformer architectures.
3๏ธโƒฃ3๏ธโƒฃ What is the Difference Between Encoder and Decoder in Transformers?
๐Ÿ‘‰ Encoder and Decoder are two major Transformer components.
๐Ÿ”น Encoder โ†’ Primarily processes input and builds contextual representations.
๐Ÿ”น Decoder โ†’ Generates output tokens, often using previously generated tokens as context.
Examples:
Encoder โ†’ Understanding / Representation
Decoder โ†’ Text Generation

๐Ÿ’ก Some models use encoder-only architectures, some decoder-only, and some use both.
3๏ธโƒฃ4๏ธโƒฃ What is Pretraining in LLMs?
๐Ÿ‘‰ Pretraining is the initial large-scale training stage where an LLM learns general language patterns, relationships, and representations from a large dataset.
๐Ÿ“Œ Basic process:
Large Dataset
โ†“
Tokenization
โ†“
Model Training
โ†“
Learned Parameters
โ†“
Pretrained Model

๐Ÿ’ก Pretraining provides the foundation that can later be adapted for specific applications.
3๏ธโƒฃ5๏ธโƒฃ What is Inference in an LLM?
๐Ÿ‘‰ LLM inference is the process of using a trained model to generate an output for a given input.
Example:
User Prompt
โ†“
Tokenization
โ†“
LLM
โ†“
Next-Token Prediction
โ†“
Generated Response

๐Ÿ’ก During inference, the model uses its learned parameters to generate output rather than learning new parameters.
๐Ÿ’ฌ Save this for your Generative AI interview preparation!
๐Ÿ”ฅ Next Part will cover 5 questions on Tokens, Token Embeddings, Positional Encoding, Attention Heads & Transformer Layers.
#GenerativeAI #GenAI #LLM #Transformer #AI #ArtificialIntelligence #LLMInterview #AIInterview #MachineLearning #InterviewQuestions
๐Ÿš€ How to Run AI Models Locally with Python Using Ollama

Want to run AI models directly on your own computer? ๐Ÿค–๐Ÿ’ป
In this beginner-friendly tutorial, learn how to use Ollama + Python to run local AI models and build your own AI applications.

๐Ÿ”ฅ What You'll Learn:
โœ… Install Ollama
โœ… Download and run an AI model
โœ… Connect Ollama with Python
โœ… Use "chat()" and "generate()"
โœ… Build a Python AI chatbot
โœ… Maintain conversation history
โœ… Stream AI responses
โœ… Explore local AI project ideas

๐Ÿ’ก Perfect for Python developers, AI learners, and students who want to experiment with Local LLMs.

๐Ÿ“– Read the Complete Tutorial:
๐Ÿ‘‰ https://updategadh.com/run-ai-models-locally-with-python/

๐Ÿ”” Join for More Projects & Tutorials:
๐Ÿ‘‰ @ProjectWithSourceCode

#Ollama #Python #AI #ArtificialIntelligence #LocalAI #LLM #PythonAI #GenerativeAI #AIChatbot #MachineLearning #PythonTutorial #AITutorial #LocalLLM #AIProjects
๐Ÿš€ Generative AI Interview Questions with Answers (Part 8)
3๏ธโƒฃ6๏ธโƒฃ What is Token Embedding in an LLM?
๐Ÿ‘‰ Token Embedding converts each token into a numerical vector representation that a neural network can process.
๐Ÿ“Œ Basic flow:
Text
โ†“
Tokens
โ†“
Token IDs
โ†“
Embeddings
โ†“
Transformer

Example:
"AI is powerful"
โ†“
[Token IDs]
โ†“
[Vector Representations]

๐Ÿ’ก Embeddings allow the model to represent relationships between tokens mathematically.
3๏ธโƒฃ7๏ธโƒฃ What is Positional Encoding?
๐Ÿ‘‰ Positional Encoding provides information about the position or order of tokens in a sequence.
This is important because attention mechanisms alone do not inherently encode token order.
Example:
"The dog chased the cat"
โ†“
Position Information
โ†“
Model understands token order

๐Ÿ’ก Different Transformer architectures use different approaches to represent positional information.
3๏ธโƒฃ8๏ธโƒฃ What is a Multi-Head Attention Mechanism?
๐Ÿ‘‰ Multi-Head Attention uses multiple attention mechanisms (heads) so the model can capture different relationships within the same input.
๐Ÿ“Œ Simplified flow:
Input
โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
Head 1 Head 2 Head 3 ...
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ†“
Combined
โ†“
Output

๐Ÿ’ก Different heads can learn different types of relationships between tokens.
3๏ธโƒฃ9๏ธโƒฃ What is a Transformer Layer?
๐Ÿ‘‰ A Transformer layer is a repeated building block of a Transformer model. Depending on the architecture, it typically contains attention mechanisms and feed-forward neural network components, along with normalization and residual connections.
๐Ÿ“Œ Simplified structure:
Input
โ†“
Attention
โ†“
Feed-Forward Network
โ†“
Output

๐Ÿ’ก Multiple Transformer layers are stacked together to build larger models.
4๏ธโƒฃ0๏ธโƒฃ What is Next-Token Prediction?
๐Ÿ‘‰ Next-token prediction is the process of predicting the most likely next token based on the previous context.
Example:
Input:
"Machine learning is"

Possible next tokens:
"powerful"
"important"
"used"

The model calculates probabilities for possible next tokens and selects one according to its decoding strategy.
๐Ÿ“Œ Context โ†’ Probability Distribution โ†’ Next Token โ†’ Repeat
๐Ÿ’ก Autoregressive language models generate text one token at a time.
๐Ÿ’ฌ Save this for your Generative AI interview preparation!
๐Ÿ”ฅ Next Part will cover 5 questions on Attention Q, K, V, Softmax, Logits, Sampling & Decoding.
#GenerativeAI #GenAI #LLM #Transformer #AI #ArtificialIntelligence #Attention #DeepLearning #AIInterview #InterviewQuestions
โ˜•๏ธ Java Interview Questions with Answers (Part 2)
6๏ธโƒฃ What is Inheritance in Java?
๐Ÿ‘‰ Inheritance allows a class to acquire fields and methods from another class. It helps create reusable and hierarchical code.
Example:
class Animal {
void eat() {
System.out.println("Eating");
}
}

class Dog extends Animal {
void bark() {
System.out.println("Barking");
}
}

public class Main {
public static void main(String[] args) {
Dog d = new Dog();

d.eat();
d.bark();
}
}

๐Ÿ“Œ Dog inherits the eat() method from Animal.
7๏ธโƒฃ What is Polymorphism in Java?
๐Ÿ‘‰ Polymorphism means one interface or method name can represent different behaviors.
Two common forms are:
๐Ÿ”น Compile-time Polymorphism โ†’ Method Overloading
๐Ÿ”น Runtime Polymorphism โ†’ Method Overriding
Example of Overloading:
class Calculator {
int add(int a, int b) {
return a + b;
}

int add(int a, int b, int c) {
return a + b + c;
}
}

๐Ÿ’ก The same method name add() works with different parameter lists.
8๏ธโƒฃ What is Encapsulation in Java?
๐Ÿ‘‰ Encapsulation means bundling data and methods together while controlling direct access to the data.
Example:
class Student {
private int age;

public void setAge(int age) {
this.age = age;
}

public int getAge() {
return age;
}
}

๐Ÿ“Œ private prevents direct access from outside the class.
๐Ÿ’ก Encapsulation helps protect object state and provides controlled access.
9๏ธโƒฃ What is Abstraction in Java?
๐Ÿ‘‰ Abstraction means hiding implementation details and exposing only the essential functionality.
Java supports abstraction using:
๐Ÿ”น Abstract Classes
๐Ÿ”น Interfaces
Example:
abstract class Animal {
abstract void sound();

void sleep() {
System.out.println("Sleeping");
}
}

class Dog extends Animal {
void sound() {
System.out.println("Bark");
}
}

๐Ÿ’ก The user of Animal does not need to know how sound() is implemented internally.
๐Ÿ”Ÿ What is a Constructor in Java?
๐Ÿ‘‰ A constructor is a special member used to initialize an object when it is created.
Example:
class Student {
String name;

Student(String name) {
this.name = name;
}

void display() {
System.out.println(name);
}
}

public class Main {
public static void main(String[] args) {
Student s = new Student("Rahul");
s.display();
}
}

๐Ÿ“Œ Constructor name must match the class name.
๐Ÿ’ก Constructors do not have a return type, including void.
๐Ÿ’ฌ Save this for your Java interview preparation!
๐Ÿ”ฅ Part 3 will cover 5 important questions on Method Overloading, Method Overriding, this, super & static.
#Java #JavaInterview #JavaProgramming #OOP #CodingInterview #Programming #SoftwareEngineer #InterviewQuestions #Developer #TechInterview
๐Ÿง  AI Search Algorithms Interview Questions with Answers (Part 3)
1๏ธโƒฃ1๏ธโƒฃ What is Uniform Cost Search (UCS)?
๐Ÿ‘‰ Uniform Cost Search expands the node with the lowest path cost from the starting point.
๐Ÿ“Œ It uses:
Priority = Path Cost

๐Ÿ’ก UCS is useful when different actions have different costs.
โฑ๏ธ Time Complexity: Depends on the search space
๐Ÿ’พ Space Complexity: Depends on the search space
1๏ธโƒฃ2๏ธโƒฃ What is Bidirectional Search?
๐Ÿ‘‰ Bidirectional Search runs two searches simultaneously:
๐Ÿ”น One from the initial state
๐Ÿ”น One from the goal state
The searches continue until they meet.
Start โ†’ โ†’ โ†’ โ† โ† โ† Goal
โ†“
Meet

๐Ÿ’ก It can significantly reduce the search depth for suitable problems.
1๏ธโƒฃ3๏ธโƒฃ What is Local Search in AI?
๐Ÿ‘‰ Local Search algorithms focus on the current state and its neighboring states rather than maintaining a complete search path.
Examples:
๐Ÿ”น Hill Climbing
๐Ÿ”น Simulated Annealing
๐Ÿ”น Local Beam Search
๐Ÿ’ก Local search is commonly used for optimization problems where the goal is to find a good solution rather than necessarily reconstructing a path.
1๏ธโƒฃ4๏ธโƒฃ What is Simulated Annealing?
๐Ÿ‘‰ Simulated Annealing is a local optimization algorithm that sometimes accepts a worse solution temporarily to escape local optima.
๐Ÿ“Œ Basic idea:
Current Solution
โ†“
Generate Neighbor
โ†“
Better? โ†’ Accept
Worse? โ†’ Sometimes Accept
โ†“
Continue

๐Ÿ’ก The probability of accepting worse solutions gradually decreases as the algorithm progresses.
1๏ธโƒฃ5๏ธโƒฃ What is a Genetic Algorithm?
๐Ÿ‘‰ A Genetic Algorithm is an optimization technique inspired by natural selection and evolution.
Main steps:
๐Ÿ”น Initialize Population
๐Ÿ”น Evaluate Fitness
๐Ÿ”น Selection
๐Ÿ”น Crossover
๐Ÿ”น Mutation
๐Ÿ”น Repeat
Population
โ†“
Fitness
โ†“
Selection
โ†“
Crossover + Mutation
โ†“
New Population

๐Ÿ’ก Genetic Algorithms are useful for complex optimization problems where traditional methods may be difficult to apply.
๐Ÿ’ฌ Save this for your AI interview preparation!
๐Ÿ”ฅ Next: Advanced Coding โ€“ Part 4
#AI #ArtificialIntelligence #AISearch #GeneticAlgorithm #SimulatedAnnealing #AIInterview #InterviewQuestions
๐Ÿš€ Advanced Coding Interview Questions with Answers (Part 4)
1๏ธโƒฃ6๏ธโƒฃ Find the Shortest Path Using Dijkstra's Algorithm
๐Ÿ‘‰ Dijkstra's Algorithm finds the shortest path from a source node to other nodes in a graph with non-negative edge weights.
import heapq

def dijkstra(graph, start):
distances = {node: float("inf") for node in graph}
distances[start] = 0

heap = [(0, start)]

while heap:
distance, node = heapq.heappop(heap)

if distance > distances[node]:
continue

for neighbor, weight in graph[node]:
new_distance = distance + weight

if new_distance < distances[neighbor]:
distances[neighbor] = new_distance
heapq.heappush(heap, (new_distance, neighbor))

return distances

โฑ๏ธ Time Complexity: O((V + E) log V)
1๏ธโƒฃ7๏ธโƒฃ Implement a Trie
๐Ÿ‘‰ A Trie is a tree-based data structure commonly used for prefix searching and autocomplete.
class TrieNode:
def __init__(self):
self.children = {}
self.is_end = False


class Trie:
def __init__(self):
self.root = TrieNode()

def insert(self, word):
node = self.root

for char in word:
if char not in node.children:
node.children[char] = TrieNode()

node = node.children[char]

node.is_end = True

def search(self, word):
node = self.root

for char in word:
if char not in node.children:
return False
node = node.children[char]

return node.is_end

โฑ๏ธ Time Complexity: O(L) per operation
L = length of the word
1๏ธโƒฃ8๏ธโƒฃ Find Connected Components Using Union-Find
๐Ÿ‘‰ Union-Find, also called Disjoint Set Union (DSU), efficiently manages groups of connected elements.
class DSU:
def __init__(self, n):
self.parent = list(range(n))

def find(self, x):
if self.parent[x] != x:
self.parent[x] = self.find(self.parent[x])
return self.parent[x]

def union(self, a, b):
root_a = self.find(a)
root_b = self.find(b)

if root_a != root_b:
self.parent[root_b] = root_a

๐Ÿ’ก It is commonly used in graph connectivity and Kruskal's algorithm.
โฑ๏ธ Amortized Time: Nearly O(1) per operation with path compression and union by rank/size.
1๏ธโƒฃ9๏ธโƒฃ Rotate a Matrix 90 Degrees Clockwise
๐Ÿ‘‰ Rotate an n ร— n matrix 90 degrees clockwise in place.
def rotate(matrix):
n = len(matrix)

for i in range(n):
for j in range(i + 1, n):
matrix[i][j], matrix[j][i] = (
matrix[j][i],
matrix[i][j]
)

for row in matrix:
row.reverse()

return matrix

matrix = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]

print(rotate(matrix))

๐Ÿ“Œ Output:
[[7, 4, 1],
[8, 5, 2],
[9, 6, 3]]

โฑ๏ธ Time Complexity: O(nยฒ)
๐Ÿ’พ Space Complexity: O(1)
2๏ธโƒฃ0๏ธโƒฃ Solve the 0/1 Knapsack Problem
๐Ÿ‘‰ Given items with weights and values, find the maximum value that can be placed in a bag with limited capacity.
def knapsack(weights, values, capacity):
dp = [0] * (capacity + 1)

for i in range(len(weights)):
for w in range(capacity, weights[i] - 1, -1):
dp[w] = max(
dp[w],
dp[w - weights[i]] + values[i]
)

return dp[capacity]

print(knapsack([1, 3, 4], [15, 50, 60], 4))

๐Ÿ“Œ Output:
65

โฑ๏ธ Time Complexity: O(n ร— capacity)
๐Ÿ’พ Space Complexity: O(capacity)
๐Ÿ’ฌ Save this for your advanced coding interview preparation!
๐Ÿ”ฅ Next: Generative AI โ€“ Part 9
#Coding #DSA #Python #AdvancedCoding #Algorithms #DynamicProgramming #Graphs #InterviewQuestions
๐Ÿš€ Generative AI Interview Questions with Answers (Part 9)
4๏ธโƒฃ1๏ธโƒฃ What are Query, Key, and Value (Q, K, V) in Attention?
๐Ÿ‘‰ In the attention mechanism, each token is transformed into three vectors:
๐Ÿ”น Query (Q) โ†’ What information am I looking for?
๐Ÿ”น Key (K) โ†’ What information do I contain?
๐Ÿ”น Value (V) โ†’ What information should I provide?
A simplified attention calculation is:
Attention(Q, K, V)
= softmax(QKแต€ / โˆšdโ‚–)V

๐Ÿ’ก Q, K, and V help the model determine which tokens should receive more attention.
4๏ธโƒฃ2๏ธโƒฃ What are Logits in an LLM?
๐Ÿ‘‰ Logits are the raw numerical scores produced by a model before they are converted into probabilities.
๐Ÿ“Œ Simplified flow:
Input
โ†“
LLM
โ†“
Logits
โ†“
Softmax
โ†“
Probabilities
โ†“
Next Token

๐Ÿ’ก Higher relative logits generally correspond to higher probabilities after softmax.
4๏ธโƒฃ3๏ธโƒฃ What is Softmax in AI?
๐Ÿ‘‰ Softmax converts a set of numerical scores into a probability distribution.
For example:
Logits
โ†“
Softmax
โ†“
Token A โ†’ 0.70
Token B โ†’ 0.20
Token C โ†’ 0.10

๐Ÿ“Œ The probabilities sum to approximately 1.
๐Ÿ’ก Softmax is commonly used for converting model scores into probabilities over possible classes or tokens.
4๏ธโƒฃ4๏ธโƒฃ What is Greedy Decoding?
๐Ÿ‘‰ Greedy decoding selects the highest-probability token at each generation step.
Example:
Token probabilities

A โ†’ 0.70
B โ†’ 0.20
C โ†’ 0.10

Selected โ†’ A

๐Ÿ“Œ It is simple and deterministic for a fixed model/input, but it may not always produce the most desirable overall sequence.
4๏ธโƒฃ5๏ธโƒฃ What is Sampling in Generative AI?
๐Ÿ‘‰ Sampling selects the next token probabilistically from a distribution rather than always choosing the highest-probability token.
Common decoding controls include:
๐Ÿ”น Temperature
๐Ÿ”น Top-P
๐Ÿ”น Top-K
๐Ÿ“Œ Sampling can produce more varied outputs than greedy decoding.
๐Ÿ’ก The exact behavior depends on the model and decoding settings.
๐Ÿ’ฌ Save this for your Generative AI interview preparation!
๐Ÿ”ฅ Next: Java Interview Questions โ€“ Part 3
#GenerativeAI #GenAI #LLM #Transformer #Attention #Softmax #AIInterview #InterviewQuestions #MachineLearning