AI, ML and Gen AI interview questions

Machine learning basics, evaluation, LLMs, transformers, prompting, RAG and how ChatGPT works.

1. What is the difference between AI, machine learning and deep learning?

AI is the broad goal of machines doing tasks that need human intelligence. Machine learning is a part of AI where systems learn patterns from data instead of being explicitly programmed. Deep learning is a part of ML that uses neural networks with many layers, behind image recognition and language models.

Asked in: Wipro Elite NTH

2. What are supervised, unsupervised and reinforcement learning?

Supervised learning trains on labelled examples to predict labels (spam detection, price prediction). Unsupervised learning finds structure in unlabelled data (clustering customers). Reinforcement learning learns by trial and error from rewards (game playing, robotics).

Asked in: Deloitte

3. What is linear regression?

A supervised method that predicts a number by fitting a straight line (or plane) y = mx + c to the data, choosing the line that minimises the squared errors. Logistic regression, despite its name, is used for classification.

Asked in: LTIMindtree

4. What is overfitting and how do you prevent it?

The model learns the training data, including its noise, so it does well on training data but poorly on new data. Prevent it with more data, simpler models, regularisation, dropout, early stopping and cross-validation.

5. What are accuracy, precision, recall and F1 score?

Accuracy is the share of correct predictions. Precision is how many predicted positives are really positive; recall is how many real positives were found. F1 is the harmonic mean of precision and recall, useful when classes are imbalanced.

6. What is NLP?

Natural Language Processing lets computers understand and generate human language. Tasks include translation, sentiment analysis, chatbots, summarisation and named-entity recognition. Modern NLP is dominated by transformer models.

7. What is a large language model (LLM)?

A deep neural network, usually a transformer, trained on huge amounts of text to predict the next token (word piece). From that one skill it can answer questions, write code, summarise and translate. GPT, Claude, Gemini and Llama are examples.

Asked in: Accenture

8. How does ChatGPT work?

It is a transformer-based LLM. First it is pre-trained on large text data to predict the next token. Then it is fine-tuned on example conversations and with human feedback (RLHF) to follow instructions and be helpful and safe. When you chat, it generates the reply one token at a time based on everything in the conversation so far.

Asked in: TCS NQT

9. What is a transformer and attention?

A neural-network architecture (2017) built on self-attention: each token looks at every other token and weighs how relevant it is, so the model captures context across the whole input. It processes tokens in parallel, which made training very large models practical.

10. What is prompt engineering?

Writing inputs that get better outputs from an LLM: give clear instructions and context, show examples (few-shot prompting), ask for a specific format, and ask it to reason step by step for harder problems.

11. What is RAG (retrieval-augmented generation)?

Before answering, the system searches a knowledge source (documents stored as embeddings in a vector database) for relevant passages and adds them to the prompt, so the LLM answers from up-to-date or private data with fewer made-up facts.

12. What is hallucination in Gen AI?

When a model produces confident but false or made-up information. Reduce it with RAG, asking for sources, lower temperature, verification steps and human review for important outputs.

13. What is the difference between fine-tuning and prompting?

Prompting changes only the input, not the model, and is quick and cheap. Fine-tuning further trains the model on task-specific examples to change its behaviour or style; it needs data and compute but can give consistent results for a narrow task.

14. What are embeddings?

Lists of numbers (vectors) that represent words, sentences or images so that similar meanings are close together. They power semantic search, recommendations and RAG.

All interview preparation