<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Aditi Baheti</title>
    <description>The latest articles on DEV Community by Aditi Baheti (@aditi_baheti_f4a40487a091).</description>
    <link>https://dev.to/aditi_baheti_f4a40487a091</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1611004%2F3df2c2e9-9953-41d9-ba73-41b9faf22a81.jpg</url>
      <title>DEV Community: Aditi Baheti</title>
      <link>https://dev.to/aditi_baheti_f4a40487a091</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aditi_baheti_f4a40487a091"/>
    <language>en</language>
    <item>
      <title>Transforming Fashion with AI: Building a GenZ Trend Generator using Stable Diffusion 3 and DreamBooth LoRA</title>
      <dc:creator>Aditi Baheti</dc:creator>
      <pubDate>Mon, 26 Aug 2024 13:26:57 +0000</pubDate>
      <link>https://dev.to/aditi_baheti_f4a40487a091/transforming-fashion-with-ai-building-a-genz-trend-generator-using-stable-diffusion-3-and-dreambooth-lora-j3o</link>
      <guid>https://dev.to/aditi_baheti_f4a40487a091/transforming-fashion-with-ai-building-a-genz-trend-generator-using-stable-diffusion-3-and-dreambooth-lora-j3o</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In a world where fashion trends change rapidly, staying ahead of the curve is both a challenge and an opportunity. The ability to predict and generate trendy designs can empower brands to cater to their audience’s evolving tastes more effectively. During a recent hackathon, our team, SheCodes from IIT Jodhpur, developed an AI-powered solution aimed at revolutionizing the "Forward" section of Myntra by generating trendy fashion designs targeted at GenZ. This blog will take you through the journey of creating this innovative project using state-of-the-art AI techniques, including Stable Diffusion 3, DreamBooth, and LoRA (Low-Rank Adaptation).&lt;/p&gt;

&lt;h2&gt;
  
  
  Project Overview
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Objective
&lt;/h3&gt;

&lt;p&gt;The project’s primary goal was to enhance Myntra's "Forward" section by automating the generation of fashionable dress designs tailored for GenZ users. We achieved this by fine-tuning a Stable Diffusion 3 model with DreamBooth LoRA, allowing the AI to learn and generate designs based on specific text prompts.&lt;/p&gt;

&lt;h3&gt;
  
  
  Team Composition
&lt;/h3&gt;

&lt;p&gt;The project was executed by SheCodes, a team of three dedicated members:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Aditi Baheti&lt;/strong&gt; &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Aayushi Bhimani&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ritu Singh&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Implementation Stages
&lt;/h2&gt;

&lt;p&gt;Our project was divided into three major stages: &lt;strong&gt;Dataset Preparation&lt;/strong&gt;, &lt;strong&gt;Model Fine-Tuning&lt;/strong&gt;, and &lt;strong&gt;Inference &amp;amp; Deployment&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Dataset Preparation
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Collecting the Data
&lt;/h4&gt;

&lt;p&gt;The foundation of any AI model lies in the quality of its dataset. We began by collecting a diverse set of images and captions from Myntra's "Forward" section. Each image was paired with a detailed text description, capturing essential attributes such as color, style, length, and pattern. This ensured that the model could learn the intricate details of fashion trends that resonate with GenZ.&lt;/p&gt;

&lt;h4&gt;
  
  
  Secure Image Identification with SHA-256 Hashing
&lt;/h4&gt;

&lt;p&gt;To manage and maintain the integrity of our dataset, we employed &lt;strong&gt;SHA-256 hashing&lt;/strong&gt;. This cryptographic technique provided a unique identifier for each image, enabling us to handle large datasets efficiently and avoid duplicate entries. By ensuring the uniqueness of each image, we could maintain a high standard of data quality throughout the project.&lt;/p&gt;

&lt;h4&gt;
  
  
  Computing High-Dimensional Embeddings
&lt;/h4&gt;

&lt;p&gt;The next step involved computing high-dimensional embeddings for the image-text pairs in our dataset. These embeddings serve as a condensed representation of the data, capturing the most important features that the model would later use to generate new designs. This was achieved using a pre-trained text encoder and image processing pipeline from the Stable Diffusion model.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Model Fine-Tuning
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Loading Stable Diffusion 3 and DreamBooth LoRA
&lt;/h4&gt;

&lt;p&gt;Stable Diffusion 3, a state-of-the-art text-to-image generative model, formed the backbone of our project. We leveraged DreamBooth, a fine-tuning technique that allows the model to learn specific tasks, and LoRA, which enables fine-tuning with fewer parameters by focusing on low-rank adaptations. This combination allowed us to tailor the model specifically for generating fashion designs based on our curated dataset.&lt;/p&gt;

&lt;h4&gt;
  
  
  Configuring LoRA and Training the Model
&lt;/h4&gt;

&lt;p&gt;The model was fine-tuned by adjusting the LoRA parameters, such as the rank and alpha values, to optimize learning. This involved iteratively training the model on our dataset while monitoring key metrics like loss and gradient accumulation. By the end of the training phase, the model was adept at generating high-quality fashion designs that reflected current trends and resonated with GenZ preferences.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Inference and Deployment
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Generating Fashion Designs
&lt;/h4&gt;

&lt;p&gt;With the model fine-tuned, we moved on to the inference phase, where the model was tasked with generating new fashion designs based on user-provided prompts. The ability of the model to interpret and creatively respond to these prompts was key to demonstrating the potential of AI in fashion design.&lt;/p&gt;

&lt;h4&gt;
  
  
  Deployment with Gradio and Hugging Face
&lt;/h4&gt;

&lt;p&gt;For deployment, we chose &lt;strong&gt;Gradio&lt;/strong&gt;, an open-source tool that makes it easy to create web-based interfaces for machine learning models. Integrated with Hugging Face, this setup allowed us to create a real-time, interactive experience where users could input their fashion preferences and receive AI-generated designs instantly. This deployment showcased how the model could be integrated into Myntra's platform to enhance user engagement.&lt;/p&gt;

&lt;h2&gt;
  
  
  Technical Breakdown
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Understanding the Execution Flow
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foote33eyyu2q6bc1dbi9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foote33eyyu2q6bc1dbi9.png" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The overall execution of the project can be visualized in the flowchart provided. The process begins with collecting images from Myntra and applying SHA-256 hashing for secure identification. The images and captions are then transformed into embeddings using the DreamBooth fine-tuning method. These embeddings serve as the foundation for training the model, which is then fine-tuned using LoRA with Stable Diffusion 3. Finally, the model is deployed on Gradio, allowing users to generate fashion designs based on their prompts.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example Outputs
&lt;/h3&gt;

&lt;p&gt;To better understand the capabilities of our model, consider the following examples:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fby329hdav22u8621q26j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fby329hdav22u8621q26j.png" alt="Image description" width="800" height="169"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Input Prompt&lt;/strong&gt;: "Blue, white floral print tiered fit &amp;amp; flare dress, above the knee length, Square neck, Short, puffed sleeves."

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Output&lt;/strong&gt;: The model generates a dress design that closely matches the description, capturing the floral pattern, fit, and style as described.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjmqgubwppgg862nc5s3t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjmqgubwppgg862nc5s3t.png" alt="Image description" width="800" height="172"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Input Prompt&lt;/strong&gt;: "Beige-colored &amp;amp; black regular wrap top, Animal printed, V-neck, three-quarter, regular sleeves."

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Output&lt;/strong&gt;: The AI outputs a design that mirrors the input description, including the wrap style, animal print, and sleeve length.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;These examples highlight the model's ability to interpret complex fashion descriptions and translate them into visually appealing designs that align with current trends.&lt;/p&gt;

&lt;h2&gt;
  
  
  Potential Impact
&lt;/h2&gt;

&lt;p&gt;While this project was developed within the scope of a hackathon, its implications are far-reaching. The ability to automate fashion design using AI could significantly enhance the creative process for designers, reduce the time and effort required to produce new collections, and offer personalized shopping experiences for users. By integrating this technology into a platform like Myntra, brands can stay ahead of trends and cater more effectively to their audience, particularly the GenZ demographic.&lt;/p&gt;

&lt;h3&gt;
  
  
  Benefits to Myntra
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;For Designers&lt;/strong&gt;: Quick generation of diverse design options, reducing the time and effort required for the creative process.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;For Users&lt;/strong&gt;: Personalized, trendy fashion suggestions that enhance the shopping experience.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;For Myntra&lt;/strong&gt;: Increased user engagement and potentially higher conversion rates, contributing to overall business growth.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Our project demonstrates the potential of AI to revolutionize the fashion industry. By fine-tuning a state-of-the-art diffusion model with DreamBooth and LoRA, we were able to create a system capable of generating high-quality, trend-aligned fashion designs tailored to the preferences of GenZ. While the project was developed for a hackathon, the techniques and models we explored have real-world applications that could transform how fashion is designed and consumed.&lt;/p&gt;

&lt;p&gt;We invite you to explore our &lt;a href="https://github.com/bahetiaditi/Finetune_stable_diffusion3" rel="noopener noreferrer"&gt;GitHub repository&lt;/a&gt; for more details and to see how these techniques can be applied to other creative fields.&lt;/p&gt;

</description>
      <category>stablediffusion</category>
      <category>dreambooth</category>
      <category>lora</category>
      <category>hackathon</category>
    </item>
    <item>
      <title>An In-Depth Look at Audio Classification Using CNNs and Transformers</title>
      <dc:creator>Aditi Baheti</dc:creator>
      <pubDate>Wed, 03 Jul 2024 15:55:05 +0000</pubDate>
      <link>https://dev.to/aditi_baheti_f4a40487a091/an-in-depth-look-at-audio-classification-using-cnns-and-transformers-1981</link>
      <guid>https://dev.to/aditi_baheti_f4a40487a091/an-in-depth-look-at-audio-classification-using-cnns-and-transformers-1981</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Audio classification is a fascinating area of machine learning that involves categorizing audio signals into predefined classes. In this blog, we will delve into the specifics of an audio classification project, exploring the architectures, methodologies, and results obtained from experimenting with Convolutional Neural Networks (CNNs) and Transformers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Dataset
&lt;/h2&gt;

&lt;p&gt;The project utilized the &lt;strong&gt;ESC-50 dataset&lt;/strong&gt;, a compilation of environmental audio clips categorized into 50 different classes. Specifically, the &lt;strong&gt;ESC-10 subset&lt;/strong&gt; was used, narrowing the dataset to 10 categories for more focused experimentation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Architecture 1: Convolutional Neural Networks (CNNs)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Initial Setup
&lt;/h3&gt;

&lt;p&gt;The initial model setup for audio classification relied heavily on CNNs. These networks use convolutional layers to extract features from the audio signals progressively, increasing the output channel size from 16 to 64. Each convolutional layer is followed by a max-pooling layer to reduce the spatial dimensions and highlight the most critical features.&lt;/p&gt;

&lt;h4&gt;
  
  
  Original Model
&lt;/h4&gt;

&lt;p&gt;The original model focused solely on feature extraction without incorporating dropout, early stopping, or other regularization techniques. This led to a basic yet effective structure for understanding audio data's complex patterns.&lt;/p&gt;

&lt;h4&gt;
  
  
  Enhanced Model
&lt;/h4&gt;

&lt;p&gt;To combat overfitting and improve generalization, several enhancements were made:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Dropout&lt;/strong&gt;: Introduced to randomly deactivate neurons during training, thereby preventing over-reliance on specific paths.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Early Stopping&lt;/strong&gt;: Implemented to halt training when validation performance plateaued, ensuring the model does not overfit to the training data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Regularization&lt;/strong&gt;: Additional techniques were employed to further stabilize the training process and enhance generalization.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Results
&lt;/h3&gt;

&lt;p&gt;The use of k-fold cross-validation, with fold 1 reserved for validation, provided a comprehensive evaluation of the model's performance. Key observations from hyperparameter tuning include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Reduced Overfitting&lt;/strong&gt;: The enhanced model exhibited lower test losses and higher test accuracies, F1 scores, and ROC AUC values across all folds compared to the original model.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The following table summarizes the performance across different folds:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Fold 2 (Original)&lt;/th&gt;
&lt;th&gt;Fold 2 (Enhanced)&lt;/th&gt;
&lt;th&gt;Fold 3 (Original)&lt;/th&gt;
&lt;th&gt;Fold 3 (Enhanced)&lt;/th&gt;
&lt;th&gt;Fold 4 (Original)&lt;/th&gt;
&lt;th&gt;Fold 4 (Enhanced)&lt;/th&gt;
&lt;th&gt;Fold 5 (Original)&lt;/th&gt;
&lt;th&gt;Fold 5 (Enhanced)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Avg. Training Accuracy&lt;/td&gt;
&lt;td&gt;63.49%&lt;/td&gt;
&lt;td&gt;51.15%&lt;/td&gt;
&lt;td&gt;68.77%&lt;/td&gt;
&lt;td&gt;43.67%&lt;/td&gt;
&lt;td&gt;68.64%&lt;/td&gt;
&lt;td&gt;55.49%&lt;/td&gt;
&lt;td&gt;67.55%&lt;/td&gt;
&lt;td&gt;49.84%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Avg. Validation Accuracy&lt;/td&gt;
&lt;td&gt;34.25%&lt;/td&gt;
&lt;td&gt;38.42%&lt;/td&gt;
&lt;td&gt;39.17%&lt;/td&gt;
&lt;td&gt;35.00%&lt;/td&gt;
&lt;td&gt;38.54%&lt;/td&gt;
&lt;td&gt;40.64%&lt;/td&gt;
&lt;td&gt;38.44%&lt;/td&gt;
&lt;td&gt;43.97%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Test Loss&lt;/td&gt;
&lt;td&gt;7.7658&lt;/td&gt;
&lt;td&gt;1.5196&lt;/td&gt;
&lt;td&gt;4.4111&lt;/td&gt;
&lt;td&gt;1.4217&lt;/td&gt;
&lt;td&gt;4.1973&lt;/td&gt;
&lt;td&gt;1.5789&lt;/td&gt;
&lt;td&gt;4.4777&lt;/td&gt;
&lt;td&gt;1.5499&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Test Accuracy&lt;/td&gt;
&lt;td&gt;30.42%&lt;/td&gt;
&lt;td&gt;48.47%&lt;/td&gt;
&lt;td&gt;42.08%&lt;/td&gt;
&lt;td&gt;45.97%&lt;/td&gt;
&lt;td&gt;40.56%&lt;/td&gt;
&lt;td&gt;43.47%&lt;/td&gt;
&lt;td&gt;45.69%&lt;/td&gt;
&lt;td&gt;42.92%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;F1 Score&lt;/td&gt;
&lt;td&gt;0.26&lt;/td&gt;
&lt;td&gt;0.47&lt;/td&gt;
&lt;td&gt;0.40&lt;/td&gt;
&lt;td&gt;0.45&lt;/td&gt;
&lt;td&gt;0.41&lt;/td&gt;
&lt;td&gt;0.42&lt;/td&gt;
&lt;td&gt;0.44&lt;/td&gt;
&lt;td&gt;0.39&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ROC AUC&lt;/td&gt;
&lt;td&gt;0.72&lt;/td&gt;
&lt;td&gt;0.88&lt;/td&gt;
&lt;td&gt;0.81&lt;/td&gt;
&lt;td&gt;0.88&lt;/td&gt;
&lt;td&gt;0.78&lt;/td&gt;
&lt;td&gt;0.87&lt;/td&gt;
&lt;td&gt;0.80&lt;/td&gt;
&lt;td&gt;0.86&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Confusion Matrix and ROC Curve
&lt;/h3&gt;

&lt;p&gt;The confusion matrix and ROC curve for the best performing fold (Fold 2) highlight the classifier's ability to distinguish between most classes effectively. However, there are instances of misclassification, suggesting the need for further refinement in the model.&lt;/p&gt;

&lt;h2&gt;
  
  
  Architecture 2: Transformers
&lt;/h2&gt;

&lt;p&gt;Transformers, known for their success in natural language processing, were adapted for audio classification in this project. The core of this architecture involves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Convolutional Layers&lt;/strong&gt;: Used initially to extract basic audio features such as tones and rhythms.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transformer Blocks&lt;/strong&gt;: Employed to process these features using attention mechanisms, enabling the model to focus on different parts of the audio sequence dynamically.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-Head Attention&lt;/strong&gt;: Utilized to attend to various representation subspaces simultaneously, enhancing the model's interpretive capabilities.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Positional Encodings&lt;/strong&gt;: Incorporated to retain the sequential order of audio data, allowing the model to adapt positional information effectively.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Performance Metrics
&lt;/h3&gt;

&lt;p&gt;The transformer model was evaluated with different numbers of attention heads (1, 2, and 4). Key observations include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Two Heads Model&lt;/strong&gt;: This configuration outperformed others in terms of test accuracy and F1 score, suggesting an optimal balance between feature learning and generalization.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Four Heads Model&lt;/strong&gt;: Despite higher train accuracy, this model exhibited signs of overfitting, with less effective feature integration for classification.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The table below outlines the performance metrics for different configurations:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Number of Heads&lt;/th&gt;
&lt;th&gt;Train Accuracy&lt;/th&gt;
&lt;th&gt;Valid Accuracy&lt;/th&gt;
&lt;th&gt;Test Accuracy&lt;/th&gt;
&lt;th&gt;Train Loss&lt;/th&gt;
&lt;th&gt;Valid Loss&lt;/th&gt;
&lt;th&gt;Test Loss&lt;/th&gt;
&lt;th&gt;F1 Score&lt;/th&gt;
&lt;th&gt;ROC AUC&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1 Head&lt;/td&gt;
&lt;td&gt;80.74%&lt;/td&gt;
&lt;td&gt;46.39%&lt;/td&gt;
&lt;td&gt;43.47%&lt;/td&gt;
&lt;td&gt;0.5412&lt;/td&gt;
&lt;td&gt;2.5903&lt;/td&gt;
&lt;td&gt;2.9106&lt;/td&gt;
&lt;td&gt;0.41&lt;/td&gt;
&lt;td&gt;0.82&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2 Heads&lt;/td&gt;
&lt;td&gt;79.91%&lt;/td&gt;
&lt;td&gt;49.86%&lt;/td&gt;
&lt;td&gt;49.86%&lt;/td&gt;
&lt;td&gt;0.5778&lt;/td&gt;
&lt;td&gt;2.4115&lt;/td&gt;
&lt;td&gt;2.4757&lt;/td&gt;
&lt;td&gt;0.47&lt;/td&gt;
&lt;td&gt;0.86&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4 Heads&lt;/td&gt;
&lt;td&gt;81.71%&lt;/td&gt;
&lt;td&gt;44.86%&lt;/td&gt;
&lt;td&gt;42.78%&lt;/td&gt;
&lt;td&gt;0.5759&lt;/td&gt;
&lt;td&gt;2.6297&lt;/td&gt;
&lt;td&gt;2.4895&lt;/td&gt;
&lt;td&gt;0.40&lt;/td&gt;
&lt;td&gt;0.84&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Enhanced Model with Transformers
&lt;/h3&gt;

&lt;p&gt;The enhanced model employed additional techniques such as gradient clipping and the AdamW optimizer, coupled with a learning rate scheduler. This configuration significantly improved the model's stability and generalization capabilities.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Gradient Clipping&lt;/strong&gt;: Applied to prevent exploding gradients, ensuring stable training.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AdamW Optimizer&lt;/strong&gt;: Recognized for its weight decay regularization, enhancing the model's performance on validation data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The enhanced model demonstrated superior performance across several metrics:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Enhanced Model&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Train Accuracy&lt;/td&gt;
&lt;td&gt;79.81%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Validation Accuracy&lt;/td&gt;
&lt;td&gt;55.00%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Test Accuracy&lt;/td&gt;
&lt;td&gt;58.19%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Train Loss&lt;/td&gt;
&lt;td&gt;0.6030&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Validation Loss&lt;/td&gt;
&lt;td&gt;1.5191&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Test Loss&lt;/td&gt;
&lt;td&gt;1.1435&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;F1 Score&lt;/td&gt;
&lt;td&gt;0.56&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ROC AUC&lt;/td&gt;
&lt;td&gt;0.93&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Trainable Parameters
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;SoundClassifier&lt;/strong&gt;: Approximately 16.4 million trainable parameters.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AudioClassifierWithTransformer&lt;/strong&gt;: About 8.9 million trainable parameters.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This project illustrates the potential of both CNNs and Transformers in audio classification tasks. While CNNs provide a solid foundation for feature extraction, Transformers offer advanced capabilities through attention mechanisms, enhancing the model's ability to interpret complex audio signals. By incorporating regularization techniques and advanced optimizers, the enhanced models achieved significant improvements in generalization and stability, highlighting the importance of these strategies in machine learning.&lt;/p&gt;

&lt;p&gt;The results underscore the effectiveness of using a combination of traditional convolutional methods and modern transformer architectures to tackle the challenges of audio classification, paving the way for further innovations in this exciting field.&lt;/p&gt;




</description>
      <category>transformers</category>
      <category>deeplearning</category>
      <category>ai</category>
      <category>cnn</category>
    </item>
    <item>
      <title>From Day to Night: Building a CycleGAN for Image Translation</title>
      <dc:creator>Aditi Baheti</dc:creator>
      <pubDate>Wed, 03 Jul 2024 10:26:49 +0000</pubDate>
      <link>https://dev.to/aditi_baheti_f4a40487a091/from-day-to-night-building-a-cyclegan-for-image-translation-3pjd</link>
      <guid>https://dev.to/aditi_baheti_f4a40487a091/from-day-to-night-building-a-cyclegan-for-image-translation-3pjd</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Welcome to the exciting world of image translation! Have you ever wondered how a scene would look at night if you only have its day image? Using CycleGANs, we can transform images from one domain to another, like day to night and vice versa, without the need for paired examples. Let's dive into this fascinating journey and see how we can achieve this using CycleGANs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Generative Adversarial Networks (GANs)
&lt;/h3&gt;

&lt;p&gt;Generative Adversarial Networks (GANs) are a type of neural network where two models compete against each other. The Generator creates images, trying to fool the Discriminator, which attempts to distinguish between real and fake images. This adversarial process helps the Generator produce highly realistic images.&lt;/p&gt;

&lt;h3&gt;
  
  
  CycleGANs
&lt;/h3&gt;

&lt;p&gt;CycleGANs take GANs a step further by introducing cycle consistency. Instead of just one generator-discriminator pair, CycleGANs have two pairs, each learning to translate images from one domain to another. The cycle consistency ensures that if you translate an image from domain A to domain B and back to domain A, you should end up with the original image. This makes CycleGANs powerful for unpaired image-to-image translation tasks.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpkxgvzx4cdr3azmyrquy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpkxgvzx4cdr3azmyrquy.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Dataset Preparation
&lt;/h2&gt;

&lt;p&gt;Our dataset consists of day and night images. We split these images into training and testing sets to evaluate our model's performance. Specifically, we used 80% of the images for training and 20% for testing. The dataset comprises:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Training Day Images&lt;/strong&gt;: 417&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Testing Day Images&lt;/strong&gt;: 105&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Training Night Images&lt;/strong&gt;: 181&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Testing Night Images&lt;/strong&gt;: 46&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Splitting the dataset ensures that our model can generalize well to new, unseen data. The preparation of the dataset is crucial as it directly impacts the model's performance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hyperparameters
&lt;/h2&gt;

&lt;p&gt;Setting the right hyperparameters is key to training a successful model. For our CycleGAN, we carefully chose parameters such as the number of epochs, learning rate, batch size, and image size. These parameters control the training process and significantly influence the model's performance. Here are some of the essential hyperparameters we used:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Epoch&lt;/strong&gt;: Starting epoch for training.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;n_epochs&lt;/strong&gt;: Total number of epochs for training, set to 200.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Batch Size&lt;/strong&gt;: Number of images fed into the model at once, set to 4.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Learning Rate&lt;/strong&gt;: Set to 0.0002, controls how much to change the model in response to the estimated error each time the model weights are updated.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Decay Start Epoch&lt;/strong&gt;: Epoch at which learning rate decay starts, set to 100.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Image Size&lt;/strong&gt;: Dimensions to which images are resized before feeding into the model, set to 128x128 pixels.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Channels&lt;/strong&gt;: Number of color channels in the images, set to 3 (RGB).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lambda_cyc&lt;/strong&gt;: Weight for the cycle consistency loss, set to 10.0.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lambda_id&lt;/strong&gt;: Weight for the identity loss, set to 5.0.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Beta1 and Beta2&lt;/strong&gt;: Coefficients used for computing running averages of gradient and its square, set to 0.5 and 0.999, respectively.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Data Augmentation
&lt;/h2&gt;

&lt;p&gt;To make our model robust, we applied data augmentation techniques such as resizing, normalizing, and random flipping. These augmentations help the model learn to generalize better by seeing various transformations of the input images. In our implementation, we used:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Resizing&lt;/strong&gt;: Images are resized to 128x128 pixels using bicubic interpolation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Normalization&lt;/strong&gt;: Pixel values are normalized to the range [-1, 1].&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Random Flipping&lt;/strong&gt;: Although our current implementation does not include random flipping, this is a common technique used in data augmentation to make the model more robust.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Custom Dataset Class
&lt;/h2&gt;

&lt;p&gt;We created a custom dataset class to handle loading and transforming images from the day and night domains. This class reads images, applies the necessary transformations, and prepares the data for the model. It also supports unaligned image pairs, making it versatile for different datasets.&lt;/p&gt;

&lt;h3&gt;
  
  
  Unaligned Image Pairs
&lt;/h3&gt;

&lt;p&gt;In traditional supervised learning tasks, datasets consist of paired examples, where each input corresponds to a specific output. However, in many real-world scenarios, such paired datasets are not available. This is where unaligned image pairs come into play. Our dataset class supports unaligned image pairs, which means it can handle cases where the day and night images are not perfectly matched pairs. This flexibility is crucial for training on unpaired datasets, as it allows the model to learn from a broader range of examples, making it more generalizable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Replay Buffer
&lt;/h2&gt;

&lt;p&gt;A Replay Buffer is used to store previously generated images, which are then reused during training. This technique helps stabilize the training process by providing the Discriminator with a mix of recent and older generated images, preventing it from overfitting to the most recent ones. Our buffer stores up to 50 previously generated images.&lt;/p&gt;

&lt;h3&gt;
  
  
  Importance and Advantages of Replay Buffer
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Stabilizes Training&lt;/strong&gt;: By providing a mix of recent and older generated images, it prevents the Discriminator from becoming too adapted to the most recent outputs of the Generator.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Improves Generalization&lt;/strong&gt;: By reusing images, it helps the Generator learn to produce more varied and realistic images over time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Efficient Use of Data&lt;/strong&gt;: Ensures that generated images are not wasted and are used effectively to improve the model.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Implementation
&lt;/h3&gt;

&lt;p&gt;In our implementation, the Replay Buffer stores up to 50 previously generated images. When new images are generated, there is a 50% chance that an image from the buffer will be used instead. This randomness helps in keeping the training process dynamic and effective.&lt;/p&gt;

&lt;h2&gt;
  
  
  LambdaLR
&lt;/h2&gt;

&lt;p&gt;LambdaLR is a learning rate scheduler that helps in decaying the learning rate after a certain number of epochs. This is crucial for ensuring that the model converges smoothly without abrupt changes in learning rates, leading to better and more stable training. The scheduler adjusts the learning rate linearly starting from the decay start epoch.&lt;/p&gt;

&lt;h2&gt;
  
  
  Initialization of Convolutional Weights
&lt;/h2&gt;

&lt;p&gt;Initializing the weights of the convolutional layers correctly is vital for stable training. We used normal initialization, setting the mean to 0 and the standard deviation to 0.02, which is a standard practice for GANs. This helps in speeding up the convergence and achieving better results.&lt;/p&gt;

&lt;h2&gt;
  
  
  Model Architecture
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Generator
&lt;/h3&gt;

&lt;p&gt;Our Generator uses a ResNet architecture consisting of several convolutional layers, normalization layers, and residual blocks. Residual blocks are essential as they help in retaining the image features across layers, crucial for generating high-quality images. Here's a detailed breakdown:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Initial Convolution Block&lt;/strong&gt;: Pads and convolves the input image to start the feature extraction.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Downsampling Layers&lt;/strong&gt;: Reduce the spatial dimensions, increasing the feature depth.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Residual Blocks&lt;/strong&gt;: We used 19 residual blocks that maintain the image's features while allowing deeper layers to learn more abstract representations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Upsampling Layers&lt;/strong&gt;: Increase the spatial dimensions back to the original size.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Output Layer&lt;/strong&gt;: Produces the final translated image using a Tanh activation function.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpkvvqzgu15dyrf8t2sai.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpkvvqzgu15dyrf8t2sai.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  PatchGAN Discriminator
&lt;/h3&gt;

&lt;p&gt;Our Discriminator uses a PatchGAN architecture, focusing on classifying patches of the image as real or fake. This approach allows the model to capture fine details, making the generated images more realistic.&lt;/p&gt;

&lt;h4&gt;
  
  
  What is PatchGAN?
&lt;/h4&gt;

&lt;p&gt;PatchGAN is a type of GAN architecture that classifies each patch of the image as real or fake, rather than the entire image. This technique helps in capturing high-frequency details and textures, leading to more realistic outputs.&lt;/p&gt;

&lt;h4&gt;
  
  
  Advantages of PatchGAN
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Detail Preservation&lt;/strong&gt;: By focusing on small patches, it helps in preserving fine details and textures.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Computational Efficiency&lt;/strong&gt;: It is more computationally efficient than processing the entire image, making it faster and less resource-intensive.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Improved Realism&lt;/strong&gt;: Helps in generating images that are more visually appealing and realistic by focusing on local features.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Discriminator Architecture
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Convolutional Blocks&lt;/strong&gt;: Layers with convolution, normalization, and activation functions to extract features.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PatchGAN Output&lt;/strong&gt;: Outputs a matrix representing the probability of each patch being real.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Loss Functions
&lt;/h2&gt;

&lt;p&gt;We employed three types of loss functions to train our CycleGAN:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Adversarial Loss&lt;/strong&gt;: Ensures that the generated images look realistic by fooling the Discriminator, implemented using Mean Squared Error (MSE) loss.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cycle Consistency Loss&lt;/strong&gt;: Ensures that translating an image to the other domain and back results in the original image, implemented using L1 loss.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Identity Loss&lt;/strong&gt;: Ensures that images already in the target domain are preserved during translation, also implemented using L1 loss.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Optimizers and Gradient Clipping
&lt;/h2&gt;

&lt;p&gt;We used Adam optimizers to update the weights of our models, with separate optimizers for the Generators and Discriminators. Gradient clipping was applied to prevent the gradients from exploding, which helps in stabilizing the training process.&lt;/p&gt;

&lt;h2&gt;
  
  
  Training Procedure
&lt;/h2&gt;

&lt;p&gt;The training process involves the following steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Forward Pass&lt;/strong&gt;: Generate fake images using the Generators.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compute Losses&lt;/strong&gt;: Calculate adversarial, cycle consistency, and identity losses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Backward Pass&lt;/strong&gt;: Compute gradients and update model weights using the optimizers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gradient Clipping&lt;/strong&gt;: Clip gradients to a maximum value to prevent exploding gradients.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Learning Rate Scheduling&lt;/strong&gt;: Adjust the learning rate during training to ensure smooth convergence.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We also used a Replay Buffer to store previously generated images and a LambdaLR scheduler to adjust the learning rate during training.&lt;/p&gt;

&lt;h2&gt;
  
  
  Evaluation
&lt;/h2&gt;

&lt;p&gt;During evaluation, we generated images from the validation set and compared them with the real images. This helps us understand how well the model has learned the mappings between the domains. We saved model checkpoints periodically to monitor progress.&lt;/p&gt;

&lt;h3&gt;
  
  
  Visualization and Results
&lt;/h3&gt;

&lt;p&gt;After training our CycleGAN model, it is crucial to visualize the results to assess the quality of the image translations. Below are the visualizations of the real and generated images along with the training loss curves.&lt;/p&gt;

&lt;h4&gt;
  
  
  Image Translations
&lt;/h4&gt;

&lt;p&gt;The first image grid showcases the real images from the day and night domains and their corresponding generated counterparts. Each row contains:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;First Column&lt;/strong&gt;: Real day images.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Second Column&lt;/strong&gt;: Generated night images from the corresponding real day images.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Third Column&lt;/strong&gt;: Real night images.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fourth Column&lt;/strong&gt;: Generated day images from the corresponding real night images.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fksk4kbz0szgpebwieevs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fksk4kbz0szgpebwieevs.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Analysis of Image Translations
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Visual Quality&lt;/strong&gt;: The generated night images capture the dark tones and lighting typical of nighttime scenes. Similarly, the generated day images retain the brightness and color characteristic of daytime.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Detail Preservation&lt;/strong&gt;: The model manages to preserve significant details from the original images, such as buildings, streets, and landscapes, while translating the overall ambiance from day to night and vice versa.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Consistency&lt;/strong&gt;: There is a consistent style in the generated images, indicating that the model has learned the translation mapping effectively.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Training Loss Curves
&lt;/h4&gt;

&lt;p&gt;The second figure illustrates the training loss curves for both the Generator (G) and the Discriminator (D) over the training epochs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flo9yq31muqaty2yhk7tw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flo9yq31muqaty2yhk7tw.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Analysis of Training Loss Curves
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Generator Loss (G)&lt;/strong&gt;: The generator loss shows a decreasing trend, which suggests that the Generator is improving its ability to produce realistic images that can fool the Discriminator over time. There are fluctuations, which are typical in GAN training due to the adversarial nature.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Discriminator Loss (D)&lt;/strong&gt;: The discriminator loss remains relatively low and stable throughout the training process, indicating that the Discriminator effectively distinguishes between real and fake images. The stability of the discriminator loss is a good sign, suggesting that the training process is balanced.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Key Observations
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Training Stability&lt;/strong&gt;: The loss curves indicate that the training process was stable, with the Generator and Discriminator learning effectively from each other.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Improvement Over Time&lt;/strong&gt;: The gradual decrease in the Generator loss highlights that the model becomes better at generating realistic images as training progresses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Balanced Adversarial Training&lt;/strong&gt;: The consistent discriminator loss shows that the Discriminator is performing its role effectively without overwhelming the Generator, ensuring a balanced adversarial process.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These visualizations and analysis of the training loss curves demonstrate the effectiveness of our CycleGAN model in translating day images to night images and vice versa. The results indicate that the model has successfully learned the mappings between the two domains, producing realistic and visually appealing image translations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;CycleGANs are a powerful tool for image translation tasks without requiring paired datasets. By using adversarial, cycle consistency, and identity losses, CycleGANs can generate realistic translations between two domains. This implementation demonstrates the potential of CycleGANs in tasks such as day-to-night image translation, offering valuable insights into their workings and applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Generalization
&lt;/h2&gt;

&lt;p&gt;The model we built for day-to-night image translation is generalizable to other cyclic GAN datasets as well. For instance, it can be used for tasks like translating horses to zebras, summer to winter landscapes, or even artistic style transfer. The same principles and architectures apply, making CycleGANs a versatile solution for many image-to-image translation problems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Detailed Steps
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Dataset Preparation&lt;/strong&gt;: Collected images from day and night domains, split them into training and testing sets, and applied data augmentations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hyperparameters&lt;/strong&gt;: Defined key parameters such as learning rate, batch size, and the number of epochs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Custom Dataset Class&lt;/strong&gt;: Created a class to load and transform images, handling both aligned and unaligned image pairs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Replay Buffer&lt;/strong&gt;: Implemented a buffer to store and reuse previously generated images to stabilize training.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LambdaLR&lt;/strong&gt;: Used a learning rate scheduler to adjust the learning rate during training.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Initialization of Convolutional Weights&lt;/strong&gt;: Applied normal initialization to the convolutional layers for stable training.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Model Architecture&lt;/strong&gt;: Implemented Generators and Discriminators using ResNet and PatchGAN architectures, respectively.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Loss Functions&lt;/strong&gt;: Used adversarial, cycle consistency, and identity losses to train the models.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Optimizers and Gradient Clipping&lt;/strong&gt;: Used Adam optimizers and applied gradient clipping to prevent exploding gradients.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Training Loop&lt;/strong&gt;: Performed forward and backward passes, computed losses, updated model weights, and applied gradient clipping.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Evaluation&lt;/strong&gt;: Generated images from the validation set and saved model checkpoints periodically.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Visualization&lt;/strong&gt;: Displayed real and generated images side by side, labeled for clarity.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;By following these detailed steps, we implemented a CycleGAN model capable of translating images between day and night domains, demonstrating the versatility and power of GAN-based image translation.&lt;/p&gt;

&lt;p&gt;Feel free to reach out if you have any questions or need further clarification on any part of the implementation. Happy coding!&lt;/p&gt;

</description>
      <category>cyclegan</category>
      <category>deeplearning</category>
      <category>gan</category>
      <category>ai</category>
    </item>
    <item>
      <title>Bridging Linguistic Diversity: Evaluating and Advancing AI for Indian Languages</title>
      <dc:creator>Aditi Baheti</dc:creator>
      <pubDate>Tue, 11 Jun 2024 17:07:33 +0000</pubDate>
      <link>https://dev.to/aditi_baheti_f4a40487a091/bridging-linguistic-diversity-evaluating-and-advancing-ai-for-indian-languages-1pm0</link>
      <guid>https://dev.to/aditi_baheti_f4a40487a091/bridging-linguistic-diversity-evaluating-and-advancing-ai-for-indian-languages-1pm0</guid>
      <description>&lt;h2&gt;
  
  
  Bridging Linguistic Diversity: Evaluating and Advancing AI for Indian Languages
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Introduction to Language Models and Their Benchmarks
&lt;/h3&gt;

&lt;p&gt;Language models (LLMs) are at the heart of modern AI, enabling machines to understand and generate human language. The effectiveness of these models is gauged through benchmarks, which are standardized tests designed to evaluate their performance across various tasks. Benchmarks play a crucial role in identifying strengths, pinpointing weaknesses, and guiding improvements in LLMs.&lt;/p&gt;

&lt;p&gt;Key Aspects of Language Models:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Scale:&lt;/strong&gt; The ability to process vast amounts of data efficiently.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Adaptability:&lt;/strong&gt; Flexibility to perform a range of tasks from translation to summarization.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contextual Understanding:&lt;/strong&gt; Comprehension of context and subtleties in language.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Benchmarks: What, Why, and How
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What Are Benchmarks?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Benchmarks are standardized datasets and tasks used to assess the performance of language models. They provide a common ground for comparing different models.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Are They Important?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Benchmarks help in understanding how well models perform across different tasks, identifying areas for improvement, and driving the development of more capable AI systems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How Are They Conducted?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Models are evaluated on predefined tasks using metrics such as accuracy, precision, and recall. These tasks range from sentiment analysis to natural language inference.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Benchmarks
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;GLUE (General Language Understanding Evaluation):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Purpose:&lt;/strong&gt; Evaluates general language understanding tasks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tasks:&lt;/strong&gt; Includes sentiment analysis, sentence similarity, and natural language inference.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Advantages:&lt;/strong&gt; Comprehensive evaluation of model capabilities.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Limitations:&lt;/strong&gt; Primarily focused on English, which limits its applicability to other languages.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;SUPERGLUE:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Purpose:&lt;/strong&gt; Designed to challenge more advanced models beyond what GLUE offers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tasks:&lt;/strong&gt; Includes Boolean QA, commonsense reasoning, and coreference resolution.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Advantages:&lt;/strong&gt; Introduces more complex tasks requiring deeper understanding.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Limitations:&lt;/strong&gt; Resource-intensive and still centered on English.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Hellaswag:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Purpose:&lt;/strong&gt; Tests commonsense reasoning by predicting plausible continuations of events.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data Source:&lt;/strong&gt; Derived from ActivityNet Captions and WikiHow.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Advantages:&lt;/strong&gt; Focuses on practical scenarios and everyday reasoning.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Limitations:&lt;/strong&gt; Primarily in English, specific to certain types of reasoning.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;MMLU (Massive Multitask Language Understanding):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Purpose:&lt;/strong&gt; Evaluates the performance of models across a broad spectrum of subjects.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tasks:&lt;/strong&gt; Includes questions from standardized tests and professional exams.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Advantages:&lt;/strong&gt; Broad coverage of subjects and real-world relevance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Limitations:&lt;/strong&gt; Performance can vary significantly with small changes in test conditions, such as the order of answers or symbols.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Developing and Evaluating LLMs for Indian Languages
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;The Journey of IndicLLMs:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The journey of IndicLLMs began with IndicBERT in 2020, focusing on Natural Language Understanding (NLU). IndicBERT has over 400K downloads on Hugging Face, highlighting its widespread use. IndicBART followed in 2021, targeting Natural Language Generation (NLG). These models were developed with support from EkStep Foundation and Nilekani Philanthropies, despite the limited data and model scale available.&lt;/p&gt;

&lt;p&gt;With the introduction of large open models like Llama-2 and Mistral, the focus shifted towards adapting these models for Indic languages. Initiatives like OpenHathi (Base) and Airavata (Chat) have emerged, developing models tailored to different languages. These adaptations involve extending the tokenizer and embedding layer, followed by continual pretraining using data from existing multilingual corpora like mc4, OSCAR, and Roots.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Challenges in Indic Language Models:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data Scarcity:&lt;/strong&gt; Limited high-quality datasets for many Indian languages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dialectal Variations:&lt;/strong&gt; Managing diverse dialects and regional nuances.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Technological Gaps:&lt;/strong&gt; Need for more computational resources and standardized tools for development and evaluation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why Indic-Only Models Are Necessary:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Despite the capabilities of models like GPT-3.5 and GPT-4, there are specific reasons why Indic-only models are essential:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tokenization Efficiency:&lt;/strong&gt; Indic languages are not efficiently represented in English tokenizers, leading to inefficiencies.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance on Low-Resource Languages:&lt;/strong&gt; English models perform well with high-resource languages but struggle with low-to-medium resource languages like Oriya, Kashmiri, and Dogri.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Accuracy and Hallucinations:&lt;/strong&gt; Issues like hallucinations are more pronounced in Indic languages, significantly decreasing the accuracy of responses.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Samanantar Dataset
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Overview:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Samanantar is a large-scale parallel corpus collection designed to support machine translation and other NLP tasks. It contains 49.7 million sentence pairs between English and 11 Indic languages, representing two language families.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data Collection:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The data for Samanantar was collected from various sources, including news articles, religious texts, and government documents. The process involved identifying parallel sentences, scoring their similarity, and post-processing to ensure quality.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creation Process:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Parallel Sentences:&lt;/strong&gt; Identifying sentences that are translations of each other.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scoring Function:&lt;/strong&gt; Using LaBSE embeddings to determine the likelihood of sentences being translation pairs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Post-Processing:&lt;/strong&gt; Removing duplicates and ensuring high-quality sentence pairs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Challenges in Data Collection:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The inherent noisiness of web-sourced data is a significant challenge. The quality of content varies, often containing unwanted content like poorly translated text. Ensuring high-quality, relevant content is crucial, which is why human verification plays a vital role in the data collection pipeline.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sangraha Corpus: The Foundation for Indian LLMs
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Components:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Sangraha Verified:&lt;/strong&gt; Contains 48B tokens of high-quality, human-verified web crawled content in all 22 scheduled Indian languages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sangraha Synthetic:&lt;/strong&gt; Includes 90B tokens from translations of English Wikimedia into 14 Indian languages and 72B tokens from transliterations into Roman script.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sangraha Unverified:&lt;/strong&gt; Adds 24B tokens of high-quality, unverified data from existing collections like CulturaX and MADLAD-400.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  IndicGLUE
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Overview:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;IndicGLUE focuses on core NLU tasks like sentiment analysis, NER, and QA. It covers 11 Indian languages and primarily uses machine translations for some datasets. However, it is not explicitly designed for zero-shot evaluation, which limits its applicability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Tasks:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;News Category Classification:&lt;/strong&gt; Classifying news articles into predefined categories.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Named Entity Recognition (NER):&lt;/strong&gt; Identifying and classifying proper nouns and entities.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Headline Prediction:&lt;/strong&gt; Generating headlines for given texts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Question Answering (QA):&lt;/strong&gt; Answering questions based on given text passages.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  IndicXTREME
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Overview:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;IndicXTREME is a human-supervised benchmark designed to evaluate models on nine diverse NLU tasks across 20 Indian languages. It includes 105 evaluation sets, with 52 newly created for this benchmark, ensuring high quality and relevance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Features:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Largest Monolingual Corpora:&lt;/strong&gt; IndicCorp with 20.9B tokens across 24 languages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Human-Supervised Benchmark:&lt;/strong&gt; Emphasizes human-created or human-translated datasets.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tasks:&lt;/strong&gt; Covers 9 diverse NLU tasks, including classification, structure prediction, QA, and text retrieval.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero-Shot Testing:&lt;/strong&gt; Designed to test the zero-shot multilingual capabilities of pretrained language models.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Advantages Over IndicGLUE:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Broader Coverage:&lt;/strong&gt; Evaluates more languages and tasks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Higher Quality:&lt;/strong&gt; Human supervision ensures better accuracy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero-Shot Capabilities:&lt;/strong&gt; Tests generalization without specific training data.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  OpenHathi and Airavata LLM Models
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;OpenHathi:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Developed By:&lt;/strong&gt; Sarvam AI and AI4Bharat.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Base Model:&lt;/strong&gt; Extended from Llama 2.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Focus:&lt;/strong&gt; Foundational model for Hindi.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Key Features:&lt;/strong&gt; Trained on diverse Hindi datasets, open source for community use.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Airavata:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Developed By:&lt;/strong&gt; AI4Bharat and Sarvam AI.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Base Model:&lt;/strong&gt; Fine-tuned from OpenHathi.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Focus:&lt;/strong&gt; Instruction-tuned model for assistive tasks in Hindi.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Key Features:&lt;/strong&gt; Uses IndicInstruct dataset, with 7B parameters, optimized for generating Hindi instructions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Issues with Machine Translations for Indian Languages
&lt;/h3&gt;

&lt;p&gt;Machine translations play a crucial role in building datasets for Indic language models, but they come with significant challenges and limitations:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Context Loss:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Issue:&lt;/strong&gt; Machine translations often lose the nuanced meanings and context of the original text.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; Idiomatic expressions or cultural references can be inaccurately translated, leading to a loss of intended meaning.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Impact:&lt;/strong&gt; This affects the comprehension and relevance of the translated text, which can mislead the language model during training.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Partial Sentences:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Issue:&lt;/strong&gt; Translating partial sentences or phrases can lead to ambiguities and incorrect interpretations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; A phrase in English might not have a direct counterpart in an Indic language, leading to incomplete or inaccurate translations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Impact:&lt;/strong&gt; This can result in fragmented or nonsensical data that negatively impacts the model's learning process.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Order and Format Changes:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Issue:&lt;/strong&gt; Changes in the order of words or the format of sentences during translation can significantly alter the meaning.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; The structure of questions and answers can be altered, leading to inconsistencies in the data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Impact:&lt;/strong&gt; This inconsistency can cause models to perform poorly, as they struggle to interpret the translated text correctly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Bias Introduction:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Issue:&lt;/strong&gt; Automated translation processes can introduce or amplify biases present in the source or target languages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; Gender biases or cultural biases might be exaggerated or incorrectly represented in translations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Impact:&lt;/strong&gt; These biases can skew the training data, leading&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;to biased language models that do not perform equitably across different user groups.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cultural Nuances:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Issue:&lt;/strong&gt; Capturing the cultural context and nuances specific to Indic languages is challenging for machine translations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; Cultural references, local customs, and regional dialects might not be accurately translated.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Impact:&lt;/strong&gt; This can lead to misunderstandings and misinterpretations, reducing the effectiveness and relevance of the language model.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Resource Intensity:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Issue:&lt;/strong&gt; Ensuring high-quality translations requires significant computational and human resources.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; Manual verification and correction of machine-translated data can be resource-intensive.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Impact:&lt;/strong&gt; The high cost and effort involved can limit the scalability and feasibility of creating large, high-quality datasets.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Addressing These Challenges
&lt;/h3&gt;

&lt;p&gt;To overcome these challenges, several strategies can be employed:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Collaborative Translation Approach:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Combining machine translation with human validation to ensure accuracy and cultural relevance.&lt;/li&gt;
&lt;li&gt;Involving native speakers and linguists in the translation process to maintain context and nuance.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Standardized Guidelines:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Developing clear guidelines for translators to maintain consistency and quality across translations.&lt;/li&gt;
&lt;li&gt;Training translators to understand the specific requirements and nuances of NLP tasks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Contextual Embedding Techniques:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using advanced embedding techniques to preserve the context and meaning of sentences during translation.&lt;/li&gt;
&lt;li&gt;Implementing thresholding and post-processing steps to filter out low-quality translations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Multilingual Prompting Strategies:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Designing prompts that are suitable for multiple languages and contexts to improve model performance.&lt;/li&gt;
&lt;li&gt;Utilizing few-shot learning techniques to provide models with contextually relevant examples.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Bias Mitigation:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Conducting regular bias audits on translated datasets to identify and address potential biases.&lt;/li&gt;
&lt;li&gt;Ensuring datasets include diverse sources and contexts to reduce the impact of any single bias.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Resource Optimization:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using efficient translation tools and APIs to handle large-scale translations without compromising quality.&lt;/li&gt;
&lt;li&gt;Optimizing computational resources to manage the high demands of translation processes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By implementing these strategies, we can create more accurate, culturally relevant, and effective language models for Indian languages, ensuring they are robust and equitable for all users.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pariksha Benchmark
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Challenges with Existing Multilingual Benchmarks:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cross-Lingual Contamination:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Even if the multilingual version of a benchmark is not contaminated, the original English version might be. Models can use knowledge of the English benchmark through cross-lingual transfer, making the multilingual benchmark indirectly contaminated.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Loss of Cultural and Linguistic Nuances:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Direct translations of benchmarks created in English and in a Western context often lose crucial cultural and linguistic nuances. Specialized models need to be evaluated on these dimensions to ensure relevance and accuracy.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unsuitability of Standard Metrics:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Standard metrics used in many benchmarks, such as exact match and word overlap, are not suitable for Indian languages due to non-standard spellings. This can unfairly penalize a model for using slightly different spellings than those in the benchmark reference data.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Methodology:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step-by-Step Process:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Curating Evaluation Prompts:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;A diverse set of evaluation prompts is curated with the help of native speakers to ensure cultural and linguistic relevance.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Generating Model Responses:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Responses to the curated prompts are generated from the models under consideration, capturing a wide range of linguistic behaviors and outputs.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Evaluation Settings:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;The generated responses are evaluated in two settings:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Individual Evaluation:&lt;/strong&gt; Each response is evaluated on its own.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pairwise Comparison:&lt;/strong&gt; Responses are compared against each other to determine which one is better.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Constructing Leaderboards:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Scores from the evaluations are used to construct leaderboards, providing a clear ranking of model performance.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Introduction to ELO Rating System:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The ELO rating system, widely used in competitive games like chess, measures the relative skill levels of players. In the Pariksha Benchmark, we adapt the ELO rating system to evaluate and compare the performance of AI models based on their responses to evaluation prompts. This system allows us to convert human preferences into ELO ratings, predicting the win rates between different models.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Formulas and Explanation:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Expected Score (EA):&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgdi2656wer64n92akrbw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgdi2656wer64n92akrbw.png" alt="Image description" width="238" height="50"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Explanation:&lt;/strong&gt; This formula calculates the expected score for model A when compared to model B. (R_A) and (R_B) are the current ratings of models A and B, respectively. The expected score represents the probability of model A winning against model B.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Rating Update Formula:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faurwjjmiuysge996ifck.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faurwjjmiuysge996ifck.png" alt="Image description" width="218" height="48"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Explanation:&lt;/strong&gt; This formula updates the rating of model A after a comparison. (R_A) is the current rating, (R_A') is the new rating, (K) is a factor that determines the sensitivity of the rating system, (S_A) is the actual score (1 for a win, 0.5 for a draw, 0 for a loss), and (E_A) is the expected score calculated using the first formula. The rating is adjusted based on the difference between the expected outcome and the actual outcome, scaled by (K).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Bradley-Terry Model:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq140z00s6vlm0y0y4xwy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq140z00s6vlm0y0y4xwy.png" alt="Image description" width="174" height="62"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Explanation:&lt;/strong&gt; In the context of the Bradley-Terry model, which is used to estimate the log-likelihood of the underlying ELO, (p_i) and (p_j) are the performance parameters of models (i) and (j), respectively. This model assumes a fixed but unknown pairwise win-rate and estimates the probability that model (i) will outperform model (j).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;ELO Calculation Process:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step-by-Step Process:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Pairwise Comparison:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;For each prompt, responses from two models are compared.&lt;/li&gt;
&lt;li&gt;Human evaluators or an LLM decide which response is better.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Expected Score Calculation:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;The expected score (E_A) is calculated for model A against model B using the first formula.&lt;/li&gt;
&lt;li&gt;This gives the probability of model A winning against model B.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rating Update:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;After the comparison, the actual score (S_A) is determined (1 for a win, 0.5 for a draw, 0 for a loss).&lt;/li&gt;
&lt;li&gt;The new rating (R_A') is calculated using the second formula, updating model A’s rating based on its performance relative to the expectation.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bradley-Terry Model Application:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;The Bradley-Terry model is used to estimate the fixed pairwise win-rate, ensuring that the order of comparisons does not affect the ratings.&lt;/li&gt;
&lt;li&gt;The probability of one model outperforming another is calculated to provide a robust comparison framework.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Individual Metrics:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Linguistic Acceptability:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Measures if the text is in the correct language and grammatically correct. It is rated on a scale of 0-2.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Task Quality:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Assesses if the answer is of high quality and provides useful information. It is also rated on a scale of 0-2.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hallucination:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Checks if the answer contains untrue or made-up facts. It is rated on a binary scale of 0-1.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Inter-Rater Reliability Metrics:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Percentage Agreement (PA):&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Calculates the percentage of items on which annotators agree, ranging from 0 (no agreement) to 1 (perfect agreement).&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fleiss Kappa (κ):&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Measures inter-annotator agreement, accounting for the agreement occurring by chance.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kendall’s Tau:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;A correlation coefficient that measures the relationship between two columns of ranked data, used to compare leaderboards obtained through various evaluation techniques.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Higher agreement scores among human annotators compared to human-LLM pairs suggest that while GPT-4 performs well, human evaluators still provide more reliable and consistent evaluations. The variation across languages could point to specific challenges in those languages, such as syntax complexity or cultural nuances that GPT-4 might not fully grasp.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Way Forward: Developing Truly "Indian" Language Models
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Vision:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The goal is to develop models that go beyond multilingual capabilities to truly understand and generate culturally and contextually relevant content for all Indian users. This involves creating models that act as digital knowledge companions, comprehending cultural idioms, historical references, regional specifics, and diverse interaction styles.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Strategies:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;High-Quality Data Curation:&lt;/strong&gt; Ensuring datasets are comprehensive, diverse, and of high quality.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Human Supervision:&lt;/strong&gt; Leveraging language experts for data annotation and translation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Broad Evaluation:&lt;/strong&gt; Developing benchmarks like IndicXTREME to evaluate a wide range of tasks across multiple languages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Continual Adaptation:&lt;/strong&gt; Updating and refining models to keep pace with linguistic and cultural changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;The development and evaluation of Indic language models are crucial for advancing AI in India. By focusing on comprehensive data curation, human supervision, and robust evaluation frameworks, we can create models that are not only multilingual but truly multicultural. Initiatives like IndicXTREME, OpenHathi, Airavata, and IndicMT Eval are paving the way for a future where AI can seamlessly interact with and understand the diverse linguistic landscape of India. As we continue to innovate and refine these models, we move closer to achieving truly inclusive and effective AI solutions for all Indian languages.&lt;/p&gt;




</description>
      <category>llm</category>
      <category>benchmark</category>
      <category>ai</category>
      <category>indicmodels</category>
    </item>
  </channel>
</rss>
