diff --git a/404.html b/404.html index f128c7c..faef608 100644 --- a/404.html +++ b/404.html @@ -4,4 +4,4 @@ 2016 - 2025 Eric X. Liu -[de23f04] \ No newline at end of file +[c25cd89] \ No newline at end of file diff --git a/about/index.html b/about/index.html index 39edf27..ec32479 100644 --- a/about/index.html +++ b/about/index.html @@ -4,4 +4,4 @@ 2016 - 2025 Eric X. Liu -[de23f04] \ No newline at end of file +[c25cd89] \ No newline at end of file diff --git a/categories/index.html b/categories/index.html index 873f895..ac1cac6 100644 --- a/categories/index.html +++ b/categories/index.html @@ -4,4 +4,4 @@ 2016 - 2025 Eric X. Liu -[de23f04] \ No newline at end of file +[c25cd89] \ No newline at end of file diff --git a/index.html b/index.html index ed2833a..ae1a4e5 100644 --- a/index.html +++ b/index.html @@ -4,4 +4,4 @@ 2016 - 2025 Eric X. Liu -[de23f04] \ No newline at end of file +[c25cd89] \ No newline at end of file diff --git a/index.xml b/index.xml index 04f6e12..f48f163 100644 --- a/index.xml +++ b/index.xml @@ -1,4 +1,5 @@ -Eric X. Liu's Personal Page/Recent content on Eric X. Liu's Personal PageHugoenSun, 03 Aug 2025 08:37:28 -0700A Deep Dive into PPO for Language Models/posts/a-deep-dive-into-ppo-for-language-models/Sat, 02 Aug 2025 00:00:00 +0000/posts/a-deep-dive-into-ppo-for-language-models/<p>Large Language Models (LLMs) have demonstrated astonishing capabilities, but out-of-the-box, they are simply powerful text predictors. They don&rsquo;t inherently understand what makes a response helpful, harmless, or aligned with human values. The technique that has proven most effective at bridging this gap is Reinforcement Learning from Human Feedback (RLHF), and at its heart lies a powerful algorithm: Proximal Policy Optimization (PPO).</p> +Eric X. Liu's Personal Page/Recent content on Eric X. Liu's Personal PageHugoenMon, 04 Aug 2025 03:59:37 +0000Supabase Deep Dive: It's Not Magic, It's Just Postgres/posts/supabase-deep-dive/Sun, 03 Aug 2025 00:00:00 +0000/posts/supabase-deep-dive/<p>In the world of Backend-as-a-Service (BaaS), platforms are often treated as magic boxes. You push data in, you get data out, and you hope the magic inside scales. While this simplicity is powerful, it can obscure the underlying mechanics, leaving developers wondering what&rsquo;s really going on.</p> +<p>Supabase enters this space with a radically different philosophy: <strong>transparency</strong>. It provides the convenience of a BaaS, but it’s built on the world&rsquo;s most trusted relational database: PostgreSQL. The &ldquo;magic&rdquo; isn&rsquo;t a proprietary black box; it&rsquo;s a carefully assembled suite of open-source tools that enhance Postgres, not hide it.</p>A Deep Dive into PPO for Language Models/posts/a-deep-dive-into-ppo-for-language-models/Sat, 02 Aug 2025 00:00:00 +0000/posts/a-deep-dive-into-ppo-for-language-models/<p>Large Language Models (LLMs) have demonstrated astonishing capabilities, but out-of-the-box, they are simply powerful text predictors. They don&rsquo;t inherently understand what makes a response helpful, harmless, or aligned with human values. The technique that has proven most effective at bridging this gap is Reinforcement Learning from Human Feedback (RLHF), and at its heart lies a powerful algorithm: Proximal Policy Optimization (PPO).</p> <p>You may have seen diagrams like the one below, which outlines the RLHF training process. It can look intimidating, with a web of interconnected models, losses, and data flows.</p>Mixture-of-Experts (MoE) Models Challenges & Solutions in Practice/posts/mixture-of-experts-moe-models-challenges-solutions-in-practice/Wed, 02 Jul 2025 00:00:00 +0000/posts/mixture-of-experts-moe-models-challenges-solutions-in-practice/<p>Mixture-of-Experts (MoEs) are neural network architectures that allow different parts of the model (called &ldquo;experts&rdquo;) to specialize in different types of inputs. A &ldquo;gating network&rdquo; or &ldquo;router&rdquo; learns to dispatch each input (or &ldquo;token&rdquo;) to a subset of these experts. While powerful for scaling models, MoEs introduce several practical challenges.</p> <h3 id="1-challenge-non-differentiability-of-routing-functions"> 1. Challenge: Non-Differentiability of Routing Functions diff --git a/posts/a-deep-dive-into-ppo-for-language-models/index.html b/posts/a-deep-dive-into-ppo-for-language-models/index.html index da9c074..2ea933e 100644 --- a/posts/a-deep-dive-into-ppo-for-language-models/index.html +++ b/posts/a-deep-dive-into-ppo-for-language-models/index.html @@ -23,4 +23,4 @@ where δ_t = r_t + γV(s_{t+1}) - V(s_t)

  • γ (gam 2016 - 2025 Eric X. Liu -[de23f04] \ No newline at end of file +[c25cd89] \ No newline at end of file diff --git a/posts/espresso-theory-application-a-guide-for-the-breville-barista-pro/index.html b/posts/espresso-theory-application-a-guide-for-the-breville-barista-pro/index.html index 707e512..fb1e0cf 100644 --- a/posts/espresso-theory-application-a-guide-for-the-breville-barista-pro/index.html +++ b/posts/espresso-theory-application-a-guide-for-the-breville-barista-pro/index.html @@ -20,4 +20,4 @@ Our overarching philosophy is simple: isolate and change only one variable at a 2016 - 2025 Eric X. Liu -[de23f04] \ No newline at end of file +[c25cd89] \ No newline at end of file diff --git a/posts/index.html b/posts/index.html index 6343db0..1ebd185 100644 --- a/posts/index.html +++ b/posts/index.html @@ -1,6 +1,7 @@ Posts · Eric X. Liu's Personal Page
    \ No newline at end of file +[c25cd89] \ No newline at end of file diff --git a/posts/index.xml b/posts/index.xml index 9c19cea..9bd04c8 100644 --- a/posts/index.xml +++ b/posts/index.xml @@ -1,4 +1,5 @@ -Posts on Eric X. Liu's Personal Page/posts/Recent content in Posts on Eric X. Liu's Personal PageHugoenSun, 03 Aug 2025 08:37:28 -0700A Deep Dive into PPO for Language Models/posts/a-deep-dive-into-ppo-for-language-models/Sat, 02 Aug 2025 00:00:00 +0000/posts/a-deep-dive-into-ppo-for-language-models/<p>Large Language Models (LLMs) have demonstrated astonishing capabilities, but out-of-the-box, they are simply powerful text predictors. They don&rsquo;t inherently understand what makes a response helpful, harmless, or aligned with human values. The technique that has proven most effective at bridging this gap is Reinforcement Learning from Human Feedback (RLHF), and at its heart lies a powerful algorithm: Proximal Policy Optimization (PPO).</p> +Posts on Eric X. Liu's Personal Page/posts/Recent content in Posts on Eric X. Liu's Personal PageHugoenMon, 04 Aug 2025 03:59:37 +0000Supabase Deep Dive: It's Not Magic, It's Just Postgres/posts/supabase-deep-dive/Sun, 03 Aug 2025 00:00:00 +0000/posts/supabase-deep-dive/<p>In the world of Backend-as-a-Service (BaaS), platforms are often treated as magic boxes. You push data in, you get data out, and you hope the magic inside scales. While this simplicity is powerful, it can obscure the underlying mechanics, leaving developers wondering what&rsquo;s really going on.</p> +<p>Supabase enters this space with a radically different philosophy: <strong>transparency</strong>. It provides the convenience of a BaaS, but it’s built on the world&rsquo;s most trusted relational database: PostgreSQL. The &ldquo;magic&rdquo; isn&rsquo;t a proprietary black box; it&rsquo;s a carefully assembled suite of open-source tools that enhance Postgres, not hide it.</p>A Deep Dive into PPO for Language Models/posts/a-deep-dive-into-ppo-for-language-models/Sat, 02 Aug 2025 00:00:00 +0000/posts/a-deep-dive-into-ppo-for-language-models/<p>Large Language Models (LLMs) have demonstrated astonishing capabilities, but out-of-the-box, they are simply powerful text predictors. They don&rsquo;t inherently understand what makes a response helpful, harmless, or aligned with human values. The technique that has proven most effective at bridging this gap is Reinforcement Learning from Human Feedback (RLHF), and at its heart lies a powerful algorithm: Proximal Policy Optimization (PPO).</p> <p>You may have seen diagrams like the one below, which outlines the RLHF training process. It can look intimidating, with a web of interconnected models, losses, and data flows.</p>Mixture-of-Experts (MoE) Models Challenges & Solutions in Practice/posts/mixture-of-experts-moe-models-challenges-solutions-in-practice/Wed, 02 Jul 2025 00:00:00 +0000/posts/mixture-of-experts-moe-models-challenges-solutions-in-practice/<p>Mixture-of-Experts (MoEs) are neural network architectures that allow different parts of the model (called &ldquo;experts&rdquo;) to specialize in different types of inputs. A &ldquo;gating network&rdquo; or &ldquo;router&rdquo; learns to dispatch each input (or &ldquo;token&rdquo;) to a subset of these experts. While powerful for scaling models, MoEs introduce several practical challenges.</p> <h3 id="1-challenge-non-differentiability-of-routing-functions"> 1. Challenge: Non-Differentiability of Routing Functions diff --git a/posts/mixture-of-experts-moe-models-challenges-solutions-in-practice/index.html b/posts/mixture-of-experts-moe-models-challenges-solutions-in-practice/index.html index 2a88dd5..4a52517 100644 --- a/posts/mixture-of-experts-moe-models-challenges-solutions-in-practice/index.html +++ b/posts/mixture-of-experts-moe-models-challenges-solutions-in-practice/index.html @@ -44,4 +44,4 @@ The Top-K routing mechanism, as illustrated in the provided ima 2016 - 2025 Eric X. Liu -[de23f04] \ No newline at end of file +[c25cd89] \ No newline at end of file diff --git a/posts/supabase-deep-dive/index.html b/posts/supabase-deep-dive/index.html new file mode 100644 index 0000000..0fa251f --- /dev/null +++ b/posts/supabase-deep-dive/index.html @@ -0,0 +1,93 @@ +Supabase Deep Dive: It's Not Magic, It's Just Postgres · Eric X. Liu's Personal Page

    Supabase Deep Dive: It's Not Magic, It's Just Postgres

    In the world of Backend-as-a-Service (BaaS), platforms are often treated as magic boxes. You push data in, you get data out, and you hope the magic inside scales. While this simplicity is powerful, it can obscure the underlying mechanics, leaving developers wondering what’s really going on.

    Supabase enters this space with a radically different philosophy: transparency. It provides the convenience of a BaaS, but it’s built on the world’s most trusted relational database: PostgreSQL. The “magic” isn’t a proprietary black box; it’s a carefully assembled suite of open-source tools that enhance Postgres, not hide it.

    This deep dive will deconstruct that suite. We will move beyond the basics to explore the architectural patterns, security models, and development workflows that allow you to build robust, scalable applications. We will cover:

    • The Supabase Blueprint: A procedural guide to designing your application.
    • The Pillars of Supabase: A detailed look at Auth, Storage, Functions, and Realtime.
    • Transactional Realtime: How Supabase guarantees data consistency in a live environment.
    • Best Practices: The practical knowledge you need before writing a single line of code.

    The Guiding Philosophy: Your Database as the Source of Truth + +Link to heading

    The most critical shift when adopting Supabase is to see your database as more than just a data store. It is your single source of truth. This means your database schema is responsible for:

    • Structure: The tables and columns that define your data.
    • Relationships: The foreign keys that link tables together.
    • Integrity: The constraints (NOT NULL, UNIQUE) that ensure your data is always valid.
    • Security: The access control rules that define who can do what.

    By leveraging PostgreSQL’s native power, you get full ACID compliance (Atomicity, Consistency, Isolation, Durability) out of the box. You don’t need to worry about application-level code to prevent orphan records or inconsistent states; the database guarantees it for you.

    The Supabase Design Blueprint: A Procedural Guide + +Link to heading

    To build a scalable application, follow a structured design process that moves from abstract ideas to concrete implementation.

    Phase 1: Conceptual Modeling (The Blueprint) + +Link to heading

    Before touching the Supabase dashboard, map out your application on paper.

    1. Identify the “Nouns”: These are your core data objects, which will become your database tables. For a project management app, they are projects, tasks, users, comments.
    2. Define the “Verbs”: These are the user actions. “A user creates a task.” “A user assigns a task to another user.” These actions will inform your security policies and APIs.
    3. Map Relationships: How do the nouns connect? A task belongs to one project. A user can have many tasks. A project can have many users (a many-to-many relationship, requiring a project_users join table).

    Phase 2: The Foundation (Schema & Migrations) + +Link to heading

    Translate your model into SQL. For any serious project, use the Supabase CLI to manage this process.

    1. Develop Locally: Run a full Supabase stack on your machine with supabase start.
    2. Create Migration Files: Write your CREATE TABLE statements in SQL files. Define columns, data types, and foreign key REFERENCES to enforce your relationships.
    3. Version Control: Commit these migration files to Git. Your database schema is now version-controlled alongside your application code.
    4. Deploy: Use supabase db push to apply your migrations to your live production database. This workflow is safe, repeatable, and professional.

    Phase 3: The Security Layer (Row Level Security) + +Link to heading

    This is not an optional step. RLS is the cornerstone of Supabase security.

    1. Deny by Default: For any table holding user data, immediately enable RLS. This blocks all access until you explicitly grant it.
    ALTER TABLE tasks ENABLE ROW LEVEL SECURITY;
    +
    1. Write “Allow” Policies: Create policies based on your user stories. Policies are SQL rules that the database enforces on every single query.
    -- Users can see tasks in projects they are a member of.
    +CREATE POLICY "Allow read access to tasks in user's projects"
    +ON tasks FOR SELECT
    +USING (
    +  EXISTS (
    +    SELECT 1 FROM project_users
    +    WHERE project_users.project_id = tasks.project_id
    +    AND project_users.user_id = auth.uid()
    +  )
    +);
    +
    +-- Users can only insert tasks for themselves.
    +CREATE POLICY "Allow users to create their own tasks"
    +ON tasks FOR INSERT
    +WITH CHECK ( auth.uid() = tasks.assignee_id );
    +

    The auth.uid() function is a special Supabase utility that securely returns the ID of the logged-in user making the request.

    Phase 4: The APIs (Data Access) + +Link to heading

    With your data structured and secured, you can now build the access points.

    • For Simple CRUD: Use Supabase’s auto-generated API. It’s convenient, respects all your RLS policies, and is perfect for simple reads and writes on a single table.
    const { data, error } = await supabase.from('tasks').select('*');
    +
    • For Complex Logic: Use PostgreSQL Functions (RPC). Encapsulate complex JOINs or multi-step transactions into a single, callable function. This reduces network chattiness and keeps your business logic secure on the server.
    -- A function to get a task and its project name in one call
    +CREATE OR REPLACE FUNCTION get_task_with_project(task_id_input int)
    +RETURNS TABLE (task_title text, project_name text) AS $$
    +BEGIN
    +  RETURN QUERY
    +    SELECT tasks.title, projects.name
    +    FROM tasks
    +    JOIN projects ON tasks.project_id = projects.id
    +    WHERE tasks.id = task_id_input;
    +END;
    +$$ LANGUAGE plpgsql;
    +
    // Called simply from the frontend
    +const { data, error } = await supabase.rpc('get_task_with_project', { task_id_input: 123 });
    +

    A Tour of the Core Services + +Link to heading

    Beyond the database, Supabase provides a suite of essential tools.

    Authentication + +Link to heading

    A complete user management system that integrates directly with your database. When a user signs up, a corresponding entry is created in the managed auth.users table, which you can then reference in your own tables.

    // Sign up a new user and handle social logins with ease
    +const { data, error } = await supabase.auth.signUp({ email, password });
    +const { data, error } = await supabase.auth.signInWithOAuth({ provider: 'github' });
    +

    Storage + +Link to heading

    A simple, S3-compatible object store for managing files like user avatars or documents. It’s integrated with Postgres and RLS, allowing you to write fine-grained access policies on files and folders (buckets).

    // Upload a user avatar to a public 'avatars' bucket
    +const { error } = await supabase.storage
    +  .from('avatars')
    +  .upload(`public/${userId}.png`, file);
    +

    Edge Functions vs. Database Functions + +Link to heading

    It’s critical to know when to use which.

    • Database Functions (SQL): For data-intensive logic inside your database.
    • Edge Functions (TypeScript/Deno): For connecting to the outside world. Use them to call third-party APIs (like Stripe for payments) or run computations that are not well-suited for SQL. This is where you use your secret service_role key, as the function runs in a trusted server environment.

    The Realtime Engine: A Pub/Sub System for Postgres + +Link to heading

    Supabase’s Realtime engine is a powerful feature for building live, interactive experiences.

    How it Works: Logical Replication + +Link to heading

    It’s not magic; it leverages a core PostgreSQL feature.

    1. When you enable Realtime on a table, Supabase creates a Publication for it.
    2. The Realtime server subscribes to this publication via a Logical Replication Slot.
    3. When a transaction is successfully committed to your database, the change is written to Postgres’s Write-Ahead Log (WAL).
    4. The WAL change is then sent to the Realtime server through the replication slot.
    5. The server converts this database event into a JSON payload and broadcasts it over a WebSocket to all subscribed clients.

    Transactional Integrity + +Link to heading

    The most important guarantee of this system is its relationship with database transactions. An event is only broadcast after a transaction is fully and successfully committed. If a transaction is rolled back due to an error, the replication slot receives nothing, and no Realtime event is ever sent. This means you can trust that every Realtime message you receive corresponds to data that is permanently and consistently stored in your database.

    Use Cases and Limitations + +Link to heading

    • Use For: Small, JSON-based messages like chat messages, live notifications, activity feeds, and presence indicators (“who’s online”). Use the broadcast feature for ephemeral data like cursor positions that you don’t need to save.
    • Do NOT Use For: Large, continuous data streams. It is not a replacement for WebRTC for video/audio calls. The system is designed for small, infrequent payloads.
    const channel = supabase.channel('public:messages');
    +
    +// Subscribe to new rows in the 'messages' table
    +channel
    +  .on(
    +    'postgres_changes',
    +    { event: 'INSERT', schema: 'public', table: 'messages' },
    +    (payload) => {
    +      console.log('New message received!', payload.new);
    +      // Update your UI here
    +    }
    +  )
    +  .subscribe();
    +

    Final Words of Advice + +Link to heading

    • Frontend Freedom: Supabase is frontend-agnostic, but meta-frameworks like Next.js and SvelteKit offer a “golden path” with Auth Helpers that simplify server-side rendering and data fetching.
    • Embrace the CLI: Use the Supabase CLI for a professional, safe, and repeatable development workflow. Don’t manage your production schema by clicking in the UI.
    • Know Your Keys: Use the public anon key in the browser. Guard the secret service_role key and only use it in secure server environments like Edge Functions.
    • Indexes Matter: For fast queries on large tables, CREATE INDEX on frequently queried columns. Performance is not automatic.

    By understanding these principles, you can leverage Supabase not as a simple BaaS, but as a powerful, transparent, and scalable platform for building next-generation applications on the solid foundation of PostgreSQL.

    \ No newline at end of file diff --git a/posts/t5-the-transformer-that-zigged-when-others-zagged-an-architectural-deep-dive/index.html b/posts/t5-the-transformer-that-zigged-when-others-zagged-an-architectural-deep-dive/index.html index e60e0a0..57dc12a 100644 --- a/posts/t5-the-transformer-that-zigged-when-others-zagged-an-architectural-deep-dive/index.html +++ b/posts/t5-the-transformer-that-zigged-when-others-zagged-an-architectural-deep-dive/index.html @@ -30,4 +30,4 @@ But to truly understand the field, we must look at the pivotal models that explo 2016 - 2025 Eric X. Liu -[de23f04] \ No newline at end of file +[c25cd89] \ No newline at end of file diff --git a/posts/useful/index.html b/posts/useful/index.html index 010f65a..e3f6752 100644 --- a/posts/useful/index.html +++ b/posts/useful/index.html @@ -9,4 +9,4 @@ One-minute read
    • [de23f04] \ No newline at end of file +[c25cd89] \ No newline at end of file diff --git a/sitemap.xml b/sitemap.xml index 48901dc..79d93ac 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -1 +1 @@ -/posts/a-deep-dive-into-ppo-for-language-models/2025-08-03T03:28:39+00:00weekly0.5/2025-08-03T08:37:28-07:00weekly0.5/posts/2025-08-03T08:37:28-07:00weekly0.5/posts/mixture-of-experts-moe-models-challenges-solutions-in-practice/2025-08-03T06:02:48+00:00weekly0.5/posts/t5-the-transformer-that-zigged-when-others-zagged-an-architectural-deep-dive/2025-08-03T03:41:10+00:00weekly0.5/posts/espresso-theory-application-a-guide-for-the-breville-barista-pro/2025-08-03T04:20:20+00:00weekly0.5/posts/useful/2025-08-03T08:37:28-07:00weekly0.5/about/2020-06-16T23:30:17-07:00weekly0.5/categories/weekly0.5/tags/weekly0.5 \ No newline at end of file +/2025-08-04T03:59:37+00:00weekly0.5/posts/2025-08-04T03:59:37+00:00weekly0.5/posts/supabase-deep-dive/2025-08-04T03:59:37+00:00weekly0.5/posts/a-deep-dive-into-ppo-for-language-models/2025-08-03T03:28:39+00:00weekly0.5/posts/mixture-of-experts-moe-models-challenges-solutions-in-practice/2025-08-03T06:02:48+00:00weekly0.5/posts/t5-the-transformer-that-zigged-when-others-zagged-an-architectural-deep-dive/2025-08-03T03:41:10+00:00weekly0.5/posts/espresso-theory-application-a-guide-for-the-breville-barista-pro/2025-08-03T04:20:20+00:00weekly0.5/posts/useful/2025-08-03T08:37:28-07:00weekly0.5/about/2020-06-16T23:30:17-07:00weekly0.5/categories/weekly0.5/tags/weekly0.5 \ No newline at end of file diff --git a/tags/index.html b/tags/index.html index e787054..99c2c27 100644 --- a/tags/index.html +++ b/tags/index.html @@ -4,4 +4,4 @@ 2016 - 2025 Eric X. Liu -[de23f04] \ No newline at end of file +[c25cd89] \ No newline at end of file