<?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>Forem: Kioumars Rahimi</title>
    <description>The latest articles on Forem by Kioumars Rahimi (@kioumars_rahimi).</description>
    <link>https://forem.com/kioumars_rahimi</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%2F1527174%2F819d80f7-6214-41be-9448-3327aa0db0c4.gif</url>
      <title>Forem: Kioumars Rahimi</title>
      <link>https://forem.com/kioumars_rahimi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/kioumars_rahimi"/>
    <language>en</language>
    <item>
      <title>LLDA: A New Paradigm in Large Language Models Using Diffusion Techniques</title>
      <dc:creator>Kioumars Rahimi</dc:creator>
      <pubDate>Thu, 22 May 2025 22:02:03 +0000</pubDate>
      <link>https://forem.com/kioumars_rahimi/llda-a-new-paradigm-in-large-language-models-using-diffusion-techniques-4cb4</link>
      <guid>https://forem.com/kioumars_rahimi/llda-a-new-paradigm-in-large-language-models-using-diffusion-techniques-4cb4</guid>
      <description>&lt;p&gt;In the rapidly evolving world of Natural Language Processing (NLP), Large Language Models (LLMs) like GPT have reshaped how machines understand and generate human language. These models typically rely on autoregressive architectures, predicting the next token based on the previous context. While powerful, this unidirectional approach has inherent limitations, such as the infamous reversal curse — difficulties in processing or generating text when future context matters.&lt;/p&gt;

&lt;p&gt;What is LLDA?&lt;br&gt;
LLDA (Large Language Diffusion Model) is a novel approach that addresses these limitations by incorporating diffusion-based methods alongside ideas from Generative Adversarial Networks (GANs). Instead of predicting tokens step-by-step in a sequence, LLDA introduces a two-step process:&lt;/p&gt;

&lt;p&gt;Token Masking: Certain tokens in a sentence are masked, similar to the approach used in models like BERT.&lt;/p&gt;

&lt;p&gt;Diffusion-based Token Reconstruction: The model reconstructs the masked tokens through a diffusion process, learning complex bidirectional dependencies between tokens.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model Type&lt;/th&gt;
&lt;th&gt;Prediction Style&lt;/th&gt;
&lt;th&gt;Directionality&lt;/th&gt;
&lt;th&gt;Generative Capability&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Autoregressive (e.g., GPT)&lt;/td&gt;
&lt;td&gt;Predict next token sequentially&lt;/td&gt;
&lt;td&gt;Unidirectional (causal)&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Masked LM (e.g., BERT)&lt;/td&gt;
&lt;td&gt;Predict masked tokens&lt;/td&gt;
&lt;td&gt;Bidirectional&lt;/td&gt;
&lt;td&gt;Limited (not fully generative)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;LLDA&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Mask + reconstruct via diffusion&lt;/td&gt;
&lt;td&gt;Bidirectional&lt;/td&gt;
&lt;td&gt;Fully generative&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;LLDA combines the benefits of both autoregressive and masked language models, while leveraging diffusion methods for enhanced token reconstruction.&lt;/p&gt;

&lt;p&gt;Solving the Reversal Curse&lt;br&gt;
The reversal curse refers to the difficulty models have in understanding or generating text sequences when the context is reversed or requires backward dependencies. LLDA’s bidirectional diffusion approach effectively tackles this issue, outperforming even state-of-the-art models like GPT-4o in this regard.&lt;/p&gt;

&lt;p&gt;Potential Applications&lt;br&gt;
Next-gen Language Models: LLDA’s architecture allows for better modeling of complex language dependencies.&lt;/p&gt;

&lt;p&gt;Advanced NLP Tasks: Machine translation, summarization, and question answering can benefit from LLDA’s bidirectional understanding.&lt;/p&gt;

&lt;p&gt;Deep Linguistic Understanding: Enhanced grasp of syntax and semantics thanks to two-way token dependency modeling.&lt;/p&gt;

&lt;p&gt;Conclusion&lt;br&gt;
LLDA introduces a powerful new framework for large language models by blending diffusion techniques with bidirectional token reconstruction. This approach breaks past the limitations of traditional models, offering promising improvements in both language understanding and generation.&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>nlp</category>
      <category>deeplearning</category>
      <category>ai</category>
    </item>
    <item>
      <title>Taking PWAs Beyond the Basics with Capacitor.js: Build Truly Native-Like Apps Using Web Tech</title>
      <dc:creator>Kioumars Rahimi</dc:creator>
      <pubDate>Tue, 20 May 2025 22:04:11 +0000</pubDate>
      <link>https://forem.com/kioumars_rahimi/taking-pwas-beyond-the-basics-with-capacitorjs-build-truly-native-like-apps-using-web-tech-2ooo</link>
      <guid>https://forem.com/kioumars_rahimi/taking-pwas-beyond-the-basics-with-capacitorjs-build-truly-native-like-apps-using-web-tech-2ooo</guid>
      <description>&lt;p&gt;Progressive Web Apps have come a long way. At first, they were just “nice to have a simple way to cache assets and add a home screen icon. But nowadays, PWAs can really feel like native apps. They work offline, send push notifications, access device hardware, and offer smooth animations.&lt;br&gt;
If you want to build something more than just a “basic PWA,” there’s one tool you should know: Capacitor.js. It lets you write your app in web tech (React, Vue, Angular, whatever you like), then wrap it as a native app with full access to native features without leaving your JavaScript comfort zone.&lt;br&gt;
In this article, I’ll share some advanced tips and tricks for building next-level PWAs with Capacitor. Let’s get into it.&lt;/p&gt;
&lt;h2&gt;
  
  
  Why Use Capacitor.js for PWAs?
&lt;/h2&gt;

&lt;p&gt;You might be familiar with Cordova or PhoneGap for wrapping web apps into native containers. Capacitor is kind of like their modern cousin — faster, simpler, and designed to work smoothly with today’s frameworks and build tools.&lt;/p&gt;

&lt;p&gt;With Capacitor, you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deploy your app as a PWA on the web Package the exact same code as native apps for iOS and Android&lt;/li&gt;
&lt;li&gt;Use plugins to access native APIs like camera, GPS, notifications, and more&lt;/li&gt;
&lt;li&gt;Manage splash screens, app lifecycle events, and hardware back buttons easily&lt;/li&gt;
&lt;li&gt;This means you don’t have to choose between web and native — you get the best of both worlds.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Going Beyond Caching: Real Offline Support
&lt;/h2&gt;

&lt;p&gt;A lot of PWAs just cache files and maybe some API responses to work offline. But what if your app needs complex offline capabilities? Like saving edits or tasks locally and syncing when the user gets back online?&lt;/p&gt;

&lt;p&gt;That’s where IndexedDB comes in. It’s like a database right inside the browser. Using libraries like Dexie.js makes it easy to store and query data offline.&lt;/p&gt;

&lt;p&gt;Here’s a simple example of storing and retrieving todos offline:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Dexie from 'dexie';

interface Todo {
  id?: number;
  title: string;
  done: boolean;
  updatedAt: Date;
}

const db = new Dexie('TodoDB');
db.version(1).stores({
  todos: '++id, title, done, updatedAt'
});

async function saveTodo(todo: Todo) {
  todo.updatedAt = new Date();
  await db.todos.put(todo);
}

async function getTodos() {
  return db.todos.orderBy('updatedAt').reverse().toArray();
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this setup, users can create or edit tasks without an internet connection, and your app stays fast and reliable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Syncing Data When Back Online
&lt;/h2&gt;

&lt;p&gt;Offline storage is great, but it’s not enough if the app can’t sync changes to the server. For this, the Background Sync API helps — it tells the browser to hold off requests until a stable connection is available.&lt;/p&gt;

&lt;p&gt;Here’s how you’d register a sync in your service worker:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;self.addEventListener('sync', event =&amp;gt; {
  if (event.tag === 'sync-todos') {
    event.waitUntil(syncTodos());
  }
});

async function syncTodos() {
  // Get unsynced todos from IndexedDB
  const todos = await getUnsyncedTodos();
  for (const todo of todos) {
    await sendToServer(todo);
    await markAsSynced(todo.id);
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And in your app, you listen for connectivity changes using Capacitor’s Network plugin to trigger this sync:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Network } from '@capacitor/network';

Network.addListener('networkStatusChange', status =&amp;gt; {
  if (status.connected) {
    navigator.serviceWorker.ready.then(sw =&amp;gt; sw.sync.register('sync-todos'));
  }
});

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means your app will automatically sync in the background, even if the user forgets to hit “sync” manually.&lt;/p&gt;

&lt;h2&gt;
  
  
  Native-Looking Splash Screens and Smooth Startup
&lt;/h2&gt;

&lt;p&gt;Nobody likes staring at a blank white screen while the app loads. Capacitor helps here too, with native splash screens that show instantly while your app bundles load.&lt;/p&gt;

&lt;p&gt;You can control this splash screen’s timing easily:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { SplashScreen } from '@capacitor/splash-screen';

SplashScreen.show({ showDuration: 2500, autoHide: false });

setTimeout(() =&amp;gt; {
  SplashScreen.hide();
}, 2500);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This little detail makes your app feel polished and professional.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Push Notifications That Work Everywhere

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Push notifications are tricky. The web push API works okay in browsers, but it can be inconsistent on mobile. Capacitor’s Push Notifications plugin lets you use native notifications on Android and iOS, while also supporting web.&lt;/p&gt;

&lt;p&gt;Here’s how you can register for push notifications:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { PushNotifications } from '@capacitor/push-notifications';

async function setupPush() {
  const perm = await PushNotifications.requestPermissions();
  if (perm.receive === 'granted') {
    await PushNotifications.register();
  }
}

PushNotifications.addListener('registration', token =&amp;gt; {
  console.log('Push token:', token.value);
  // Send token to your backend
});

PushNotifications.addListener('pushNotificationReceived', notification =&amp;gt; {
  console.log('Notification received:', notification);
});

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You get unified handling for push notifications, whether your users open your app from a browser or a native shell.&lt;/p&gt;

&lt;h2&gt;
  
  
  Accessing Hardware Features That Browsers Can’t Reach
&lt;/h2&gt;

&lt;p&gt;Need to access the camera, high-accuracy GPS, or the file system? Capacitor plugins have you covered.&lt;/p&gt;

&lt;p&gt;Example: taking a photo with native camera UI.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Camera, CameraResultType } from '@capacitor/camera';

async function snapPhoto() {
  const photo = await Camera.getPhoto({
    quality: 80,
    allowEditing: true,
    resultType: CameraResultType.Uri,
  });
  return photo.webPath;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This works consistently on native devices, and falls back gracefully to web APIs where needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Handling Gestures Like a Native App
&lt;/h2&gt;

&lt;p&gt;Smooth gestures and touch interactions are key for great UX. Capacitor’s Gesture API lets you handle swipes, taps, and drags the same way on web and native.&lt;/p&gt;

&lt;p&gt;Here’s a simple swipe handler in React:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Gesture } from '@capacitor/gesture';
import React, { useEffect, useRef } from 'react';

export function Swipeable({ onSwipeRight }: { onSwipeRight: () =&amp;gt; void }) {
  const ref = useRef&amp;lt;HTMLDivElement&amp;gt;(null);

  useEffect(() =&amp;gt; {
    if (!ref.current) return;
    const gesture = Gesture.create({
      el: ref.current,
      gestureName: 'swipe',
      onEnd: detail =&amp;gt; {
        if (detail.deltaX &amp;gt; 100) {
          onSwipeRight();
        }
      },
    });
    gesture.enable(true);
    return () =&amp;gt; gesture.destroy();
  }, [onSwipeRight]);

  return &amp;lt;div ref={ref} style={{ touchAction: 'pan-y' }}&amp;gt;Swipe me&amp;lt;/div&amp;gt;;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Making Your Code Play Nicely on Web &amp;amp; Native
&lt;/h2&gt;

&lt;p&gt;Capacitor lets you detect if you’re running inside a native container:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Capacitor } from '@capacitor/core';

if (Capacitor.isNativePlatform()) {
  // Call native-only APIs
} else {
  // Web fallback logic
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means you can gracefully enable or disable features depending on the platform, keeping a single codebase clean and maintainable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;Building PWAs today is about much more than caching and manifests. To deliver top-notch, reliable, native-grade experiences, you need to combine:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Robust offline data management&lt;/li&gt;
&lt;li&gt;Intelligent background syncing&lt;/li&gt;
&lt;li&gt;Native device integration with Capacitor&lt;/li&gt;
&lt;li&gt;Polished UX with splash screens and gestures&lt;/li&gt;
&lt;li&gt;Unified push notification handling&lt;/li&gt;
&lt;li&gt;Capacitor.js makes it surprisingly easy to do all this, letting you focus on your app instead of fighting platform quirks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you’re ready to build web apps that feel truly native, give Capacitor a spin — your users (and your sanity) will thank you.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
