NLP • Large Language Models • Multimodal AI • RAG • Agentic AI • LLM Alignment
I am an M.Sc. student in Artificial Intelligence at the University of Tehran, with a primary focus on Natural Language Processing, Large Language Models, Retrieval-Augmented Generation, and Agentic AI.
My work spans both foundational NLP implementations and modern LLM-based systems, including:
- LangGraph-based and custom ReAct agents with multi-tool orchestration
- Retrieval-Augmented Generation over domain-specific documents
- Sparse and dense retrieval with BM25, FAISS, and semantic embeddings
- Semantic search and vector databases
- Metadata-aware retrieval and LLM-based reranking
- Parameter-efficient fine-tuning with LoRA for instruction tuning and sentiment classification
- Decoder-only Transformers implemented from scratch
- LLM alignment with SFT, Reward Modeling, PPO, DPO, ORPO, and LLM-as-a-Judge evaluation
- Multilingual LLM trustworthiness evaluation across accuracy, faithfulness, language disparity, and cross-lingual consistency
- Vision-Language Model inference, dynamic-resolution analysis, visual-token efficiency, and multimodal LoRA fine-tuning
- Prompt engineering, Chain-of-Thought, few-shot prompting, and In-Context Learning
- Transformer-based Text-to-SQL generation
- Word embedding models implemented from scratch
- Text and URL classification
- Persian NLP preprocessing and statistical language modeling
- LLM and RAG evaluation
I am particularly interested in building reproducible, well-evaluated, and practical AI systems that connect core machine-learning concepts with modern generative AI techniques.
I have served as a Graduate Teaching Assistant for Machine Learning at the University of Tehran, contributing to assignments, projects, quizzes, student support, and practical machine-learning instruction.
I have also contributed to educational activities related to Large Language Models and applied AI, including implementation-oriented exercises and project-based learning materials.
In addition, I have experience teaching Python programming, with an emphasis on programming fundamentals, problem solving, and practical implementation.
An end-to-end agentic travel assistant built with LangGraph that dynamically routes user requests across seven specialized tools.
The system supports:
- Flight search
- Hotel search
- Restaurant recommendations
- Weather retrieval
- Currency information
- Semantic FAQ retrieval
- RAG-based multi-day trip planning
It integrates external APIs, web search, semantic retrieval, LanceDB vector stores, sentence-transformer embeddings, and a ReAct-style LangGraph workflow.
The project also includes an interactive CLI and a 14-scenario end-to-end evaluation suite for testing tool selection and agent behavior.
Technologies:
Python LangGraph LangChain RAG LanceDB Sentence Transformers Amadeus API Tavily LlamaParse
An agentic Retrieval-Augmented Generation system for Persian legal question answering over Iranian legal documents.
The project includes a complete document-to-answer pipeline with:
- PDF text extraction and OCR
- Persian text normalization
- Legal article and clause parsing
- Metadata-aware vector retrieval
- Query rewriting
- Intent classification
- Structured metadata extraction
- LLM-based document reranking
- Relevance checking and controlled retrieval retry
- Grounded Persian answer generation
- RAGAS-based evaluation
- Node-level latency analysis
Legal chunks are embedded using multilingual E5 embeddings and indexed in LanceDB.
Technologies:
Python LangGraph LangChain RAG LanceDB RAGAS DeepSeek-OCR vLLM Sentence Transformers Hazm
A two-part project exploring tool-augmented LLM agents and retrieval-augmented question answering with open-source language models.
Builds a custom ReAct-style research assistant around Qwen2.5-7B-Instruct with explicit action parsing, conversational memory, multi-step tool orchestration, and error recovery.
The agent can autonomously use seven tools for:
- Web search
- Web-page reading
- Wikipedia retrieval
- Arithmetic and date calculations
- Current-date lookup
- Text summarization
- Geographic geocoding and distance calculation
The experiments evaluate multi-hop reasoning, recent-information retrieval, tool failure recovery, and robustness against unavailable information.
Compares three document-grounded multiple-choice QA configurations using Qwen2.5-0.5B-Instruct:
- Vanilla LLM without retrieval
- BM25 sparse RAG
- FAISS dense RAG with sentence-transformer embeddings
All pipelines share the same structured JSON output schema and are evaluated on a 50-question benchmark.
Final benchmark accuracy:
- Dense RAG: 90%
- BM25 RAG: 80%
- Vanilla LLM: 76%
The experiments also include question-level analysis of cases where retrieved context improves or misleads the language model.
Technologies:
Python PyTorch LangChain Hugging Face Transformers Qwen2.5 ReAct RAG BM25 FAISS Sentence Transformers Structured Output OpenStreetMap
A multilingual LLM trustworthiness evaluation framework comparing direct generation with a modular Generator → Verifier → Reviser pipeline on parallel XQuAD question-answering data.
The project evaluates Qwen2.5-0.5B-Instruct across English, Arabic, German, Spanish, and Turkish using aligned question IDs for controlled cross-lingual comparison.
The evaluation covers:
- Exact Match, Token F1, and Fuzzy Match
- Evidence grounding and explanation faithfulness
- Direct vs. modular inference
- English vs. non-English performance gaps
- Best- and worst-language disparity
- Standard deviation across languages
- Worst-language performance
- Cross-lingual consistency across parallel questions
The modular pipeline improves overall Exact Match from 35.5% to 37.1% and produces a larger improvement in faithfulness from 67.4% to 76.7%.
The experiments also show that stronger aggregate performance does not necessarily imply stronger multilingual stability: cross-lingual consistency decreases slightly from 0.816 to 0.805 under the modular pipeline.
Technologies:
Python PyTorch Hugging Face Transformers Hugging Face Datasets Qwen2.5 XQuAD Multilingual NLP LLM Evaluation Faithfulness Cross-Lingual Evaluation RapidFuzz
An experimental study of Vision-Language Model efficiency, dynamic image resolution, visual-token compression, and parameter-efficient multimodal fine-tuning using Qwen3.5-0.8B on ScienceQA.
The project compares three multimodal inference configurations:
- Pretrained high-resolution baseline
- Pretrained low-resolution baseline
- LoRA fine-tuned low-resolution model
The experiments analyze:
- Visual and text token composition
- Dynamic-resolution processing
- High- vs. low-resolution inference
- Visual-token reduction
- Input sequence compression
- Inference latency
- Accuracy–efficiency trade-offs
- Visual redundancy
- Multimodal LoRA fine-tuning
Reducing image resolution lowers the mean number of visual tokens from 186.34 to 19.76, with an overall visual-token reduction of 89.40%.
The pretrained model's accuracy decreases from 68% to 56% under the low-resolution constraint, while LoRA fine-tuning at the same resolution raises accuracy to 76%, outperforming both pretrained configurations.
Technologies:
Python PyTorch Hugging Face Transformers Hugging Face Datasets PEFT LoRA Qwen3.5 ScienceQA Vision-Language Models Multimodal Learning Dynamic Resolution Visual Tokens
A collection of parameter-efficient fine-tuning experiments with LoRA across generative and discriminative NLP tasks.
The repository contains two projects:
Fine-tunes TinyLlama-1.1B-Chat-v1.0 for instruction following using Supervised Fine-Tuning and LoRA.
The project includes:
- Instruction-following dataset preparation
- Chat-template formatting
- Multilingual tokenizer comparison
- Supervised Fine-Tuning
- LoRA adaptation of attention projections
- FP16 and gradient-checkpointed training
- LoRA adapter saving and model merging
- Base vs. fine-tuned response comparison
- Quantitative instruction-following evaluation with IFEval
Applies LoRA to albert-base-v1 for binary sentiment classification on IMDb movie reviews.
The project includes:
- Custom PyTorch datasets and DataLoaders
- Base-model evaluation
- LoRA adaptation of ALBERT attention layers
- Parameter-efficient fine-tuning
- Accuracy, Precision, Recall, and F1-score evaluation
- Confusion-matrix and error analysis
- Base vs. fine-tuned prediction comparison
The LoRA-adapted ALBERT model improves test accuracy from 50.16% to 91.34% while training only 0.4319% of the model parameters, including the LoRA adapters and classification head.
Technologies:
Python PyTorch Hugging Face Transformers PEFT LoRA TinyLlama ALBERT Sentiment Classification vLLM lm-evaluation-harness IFEval
A practical implementation and comparison of major LLM post-training and preference-alignment methods using Qwen2.5-0.5B-Instruct.
The project implements a complete alignment pipeline with:
- Supervised Fine-Tuning on preferred responses
- Pairwise Reward Modeling with Bradley-Terry loss
- PPO with reward-model feedback and KL regularization
- Direct Preference Optimization with a frozen SFT reference model
- ORPO for joint supervised and preference optimization without a reference model
- Response-only log-probability objectives
- Dynamic padding, gradient accumulation, and checkpoint management
- Cross-method training and preference analysis
- Qualitative generation comparison
- LLM-as-a-Judge evaluation against human preference labels
- Position-bias analysis for automated judges
The experiments compare the optimization behavior and tradeoffs of SFT, PPO, DPO, and ORPO. In the recorded runs, DPO produced strong preference separation, while the LLM-as-a-Judge experiment also demonstrated the importance of validating automated evaluators for low human agreement and position sensitivity.
Technologies:
Python PyTorch Hugging Face Transformers TRL Qwen2.5 RLHF Reward Modeling PPO DPO ORPO LLM Alignment LLM-as-a-Judge
A decoder-only Transformer implemented from scratch in PyTorch for character-level autoregressive name generation.
The project implements the core Transformer components directly, including:
- Character-level tokenization
- Sinusoidal positional encoding
- Causal masking
- Scaled dot-product attention
- Multi-head self-attention
- Pre-layer normalization
- Residual connections
- Position-wise feed-forward networks
- Stacked decoder blocks
- Autoregressive next-token prediction
- Greedy decoding and temperature sampling
The model contains 3 decoder layers, 4 attention heads, and 153K trainable parameters and is trained from scratch on more than 1.8 million name samples.
Generated names are analyzed across different decoding temperatures and compared with names from the original dataset to study the effect of sampling on output diversity.
Technologies:
Python PyTorch Transformers from Scratch Self-Attention Autoregressive Language Modeling Character-Level Modeling
A collection of inference-time LLM experiments exploring how prompt design and contextual demonstrations influence the behavior of an instruction-tuned language model.
Using Gemma 3 270M IT, the project compares several prompting strategies:
- Role-based and persona prompting
- Structured system and user messages
- Direct prompting
- Chain-of-Thought prompting
- Few-shot prompting
- In-Context Learning
- Prompt-based arithmetic reasoning
- Qualitative failure analysis
The experiments show how system instructions can substantially change tone and technical depth, how Chain-of-Thought can improve multi-step reasoning, and how few-shot demonstrations can help the model infer task-specific patterns without updating model parameters.
The project also analyzes a case where the model reaches the correct final answer through incorrect intermediate reasoning, highlighting the importance of evaluating reasoning quality separately from answer correctness.
Technologies:
Python PyTorch Hugging Face Transformers Gemma 3 Prompt Engineering In-Context Learning Few-Shot Prompting Chain-of-Thought
A Transformer-based project for translating natural-language questions and database schemas into SQL queries.
Two different generation architectures are implemented and compared:
- BART — Encoder–Decoder sequence-to-sequence modeling
- GPT-2 — Decoder-Only causal language modeling
The project includes:
- Schema-aware input construction
- Transformer fine-tuning
- Prefix masking for causal training
- Beam-search SQL generation
- Raw Exact Match
- Normalized Exact Match
- SQL normalization
- Automatic error tagging
- Prediction-level error analysis
The comparison highlights practical differences between Encoder–Decoder and Decoder-Only architectures for structured text generation.
Technologies:
Python PyTorch Hugging Face Transformers BART GPT-2 SQL sqlparse
Two NLP projects covering representation learning from scratch and embedding-based neural text classification.
Implements:
- Continuous Bag-of-Words
- Skip-Gram
- Vocabulary construction
- Rare-word handling
- Custom PyTorch datasets
- Embedding training
- Cosine-similarity analysis
- t-SNE visualization
The models are trained on WikiText-2 without using prebuilt Word2Vec implementations.
Uses pretrained FastText embeddings to represent AG News articles and trains a neural classifier with:
- Batch Normalization
- GELU
- Dropout
- AdamW
- Label smoothing
- Learning-rate scheduling
- Early stopping
Evaluation includes Accuracy, Macro-F1, classification reports, confusion matrices, and error analysis.
Technologies:
Python PyTorch Word2Vec FastText Hugging Face Datasets scikit-learn
A collection of implementations covering fundamental NLP algorithms and statistical language-processing techniques.
The repository includes:
- Regular expressions
- Email validation and lookup
- Levenshtein distance
- Minimum-edit-distance spell correction
- Rule-based tokenization
- Byte Pair Encoding
- WordPiece
- Analysis of tokenizer behavior and limitations
- Persian text preprocessing
- BPE tokenization
- 2-gram, 4-gram, and 8-gram models
- Laplace smoothing
- Interpolation
- Backoff
- Perplexity evaluation
- Probabilistic text generation
- Temperature-controlled sampling
The project focuses on understanding NLP algorithms through direct implementation rather than relying only on high-level libraries.
Technologies:
Python NumPy Pandas Regular Expressions Hugging Face Tokenizers
Two classical machine-learning classification projects covering email spam detection and phishing URL detection.
The email project includes from-scratch implementations of:
- Logistic Regression
- Mini-batch gradient descent
- Multinomial Naive Bayes
- Laplace smoothing
- Z-score normalization
- Accuracy, Precision, Recall, and F1-score
The phishing-detection project extracts structural and statistical features directly from raw URLs and compares Logistic Regression, Multinomial Naive Bayes, and Gaussian Naive Bayes classifiers.
Technologies:
Python NumPy Pandas scikit-learn Regular Expressions
Python SQL Object-Oriented Programming
PyTorch scikit-learn Neural Networks Classification Model Evaluation
Text Preprocessing Tokenization N-grams Word2Vec FastText Text Classification Sentiment Analysis Sequence Classification Sequence-to-Sequence Modeling Multilingual NLP Cross-Lingual Evaluation
Hugging Face Transformers Sentence Transformers PEFT LoRA Supervised Fine-Tuning Instruction Tuning Parameter-Efficient Fine-Tuning Reward Modeling RLHF PPO DPO ORPO LLM Alignment Prompt Engineering In-Context Learning Few-Shot Prompting Chain-of-Thought
Vision-Language Models Multimodal Learning Multimodal Inference Visual Tokens Dynamic Resolution Visual-Token Analysis Multimodal Fine-Tuning ScienceQA
RAG Sparse Retrieval Dense Retrieval BM25 FAISS Semantic Search Metadata-Aware Retrieval Embeddings Reranking Vector Databases LanceDB
LangChain LangGraph ReAct Tool Calling Tool Orchestration Action Parsing Multi-Tool Workflows Conversational State
RAGAS IFEval lm-evaluation-harness LLM-as-a-Judge Human Preference Evaluation Position Bias Analysis Faithfulness Answer Relevancy Multilingual Evaluation Cross-Lingual Consistency Language Disparity Analysis Tool-Selection Evaluation
OpenAI-compatible APIs Gemini API Tavily Search Amadeus API
Pandas NumPy Matplotlib
Qwen2.5 Qwen3.5 TinyLlama ALBERT Gemma 3 BART GPT-2 BGE E5 FastText Word2Vec
Git GitHub Jupyter Notebook Google Colab VS Code
I am currently focused on:
- Retrieval-Augmented Generation
- Agentic and multi-tool AI systems
- LLM alignment and preference optimization
- Multilingual LLM evaluation, trustworthiness, and reliability
- Efficient multimodal and Vision-Language Model systems
- Instruction tuning and parameter-efficient adaptation
- Prompt engineering and in-context learning
- Semantic retrieval and reranking
- Domain-specific NLP systems
- Reproducible AI experimentation
I am particularly interested in exploring:
- Advanced RAG architectures
- Agent planning and memory
- Multi-agent systems
- Tool-augmented language models
- Vision-Language Models and multimodal reasoning
- Retrieval and reranking strategies
- LLM alignment and human preference learning
- Prompting, in-context learning, and reasoning reliability
- Preference optimization
- Efficient fine-tuning
- Efficient multimodal inference and visual-token optimization
- Domain-specific language models
- Grounded and reliable generative AI
I am interested in research, collaboration, and opportunities related to:
Natural Language Processing • Large Language Models • Multimodal AI • RAG • Agentic AI • Applied AI Research