The independent file on technology, travel & lifeFrom Pakistan, for everywhere
Huzi Blogs.
The ArchiveSectionsSearch

Planning a trip? HTG Travels — flights, visas, hotels & Umrah, handled properly.

WhatsApp +92 317 5054959
Huzi Blogs.

An independent file on technology, travel and life — long-form guides written plainly, from Pakistan, for everywhere.

ShopMeet the Creator

Sections

  • Travel
  • Technology
  • Lifestyle
  • Programming
  • Sports
  • Linux
  • All sections

The Desk

  • The Archive
  • Search the file
  • Disclaimer & Data Privacy Policy
  • A project of huzi.pk

© 2026 blogs.huzi.pk — All rights reserved.

Set in Playfair Display & Inter

    HomeAIStory
    AI

    How Large Language Models Work: A Deep Dive

    H

    By Huzi

    File #212 · 3 min read

    Every chatbot you have ever argued with — ChatGPT, Claude, Gemini, DeepSeek — is doing one strange, simple thing: predicting the next token, again and again, at enormous speed.

    The quick answer: The essays, the bug fixes, the awkward poems all fall out of that single trick — and so do the failures. Nothing in the pipeline checks facts, which is why models hallucinate. Once you see the machinery, you can use the tool without trusting it blindly.

    Words become tokens

    Models cannot read; they compute. Your text is first chopped into tokens — chunks that are often words or pieces of words.

    "Unbelievable" may split into pieces, and Urdu or code-mixed Roman Urdu tends to shatter into many more tokens than English. That is one reason local-language prompts cost more and stumble more.

    Each token becomes a list of numbers; from there on, the model is doing arithmetic — nothing else.

    Attention: the 2017 idea that changed everything

    Older language models read text one word at a time and kept forgetting the start of long sentences. The 2017 paper "Attention Is All You Need" introduced the transformer, which reads everything at once and lets each word weigh every other word.

    In "the cat sat on the mat because it was tired", understanding "it" means attending strongly to "cat". That weighting mechanism is called attention.

    Because transformers process the whole sequence in parallel, they could be scaled up on GPU clusters — and scale, it turned out, was nearly everything.

    Training happens in three passes

    Stage What happens What you get
    Pre-training The model reads an enormous slice of the internet, guessing the next token; its billions of weights get nudged every time it guesses wrong Grammar, facts, a startling amount of reasoning
    Supervised fine-tuning Human-written examples of good answers teach it to behave like an assistant Assistant manners
    Alignment (RLHF) Reviewers rank different responses and the model is nudged toward the answers people prefer Chatbots that are polite, not merely fluent

    Out of that dumb repetition comes something that looks like understanding — worth remembering which parts were reading and which parts were rewards.

    The context window

    A model's working memory is its context window: everything it can hold in mind at once. Early chatbots managed a few thousand tokens, roughly a long email thread.

    Frontier models now claim windows in the millions of tokens — whole codebases, whole books. But attention dilutes as the window grows, and the marketing claim and everyday usefulness are not always the same thing.

    When a chatbot forgets the start of your conversation, you have met the window's edge.

    Why they hallucinate

    Here is the uncomfortable truth: nothing in that pipeline checks facts. The model's only obligation is to produce plausible next tokens.

    When the truthful continuation is not in its weights, it still produces the most statistically likely one — fluent, confident, and sometimes invented. This is not a bug waiting to be patched; it is the mechanism.

    The defences are practical:

    • Ask for sources — and actually open them.
    • Keep important facts out of the model and in your own documents — the retrieval pattern businesses use.
    • Never let confident prose substitute for verification.

    The same rule travels: an AI can draft an itinerary; a human desk confirms the flight actually exists. When remote work travels with you, HTG Travels books the workation side — human-checked flights, real hotels, no hallucinated connections.

    Pro tip: Roman Urdu shatters into far more tokens than plain English — same message, higher cost, more stumbles. Write the prompt in English when precision matters; save the Urdu for the reply.

    Gaza's reality is the opposite of a fluent guess — it is being documented by the people living it, at terrible cost.

    We predict professionally too: HTG Travels spots the next problem before it lands — the 2 a.m. cancellation, the missed connection, the visa snag mid-trip. Save +92 317 5054959 before you fly; being rebooked in minutes beats an hour of chatbot loops at a deserted counter.

    Presented by

    HTG Travels — Plan the Trip, Skip the Runaround

    Flights, visas, Umrah packages and Hunza–Skardu tours, handled end to end from our licensed Sialkot desk. Real fares, hotel names in writing, and a human who answers — before you pay a rupee.

    Flights & rebooking Visa files Umrah 2026–27 Northern tours
    Visit huzi.pkWhatsApp +92 317 5054959

    Sialkot, Pakistan · Licensed agency · Fast quotes on WhatsApp


    You Might Also Like

    Elegant Embroidered Swiss Lawn 3-Pc Suit | Sequins Patch & Digital Silk Dupatta

    Elegant Embroidered Swiss Lawn 3-Pc Suit | Sequins Patch & Digital Silk Dupatta

    PKR 4700

    Black All-Over Print Embroidered Lawn Suit 3-Pc | Printed Soft Chiffon Dupatta (2025)

    Black All-Over Print Embroidered Lawn Suit 3-Pc | Printed Soft Chiffon Dupatta (2025)

    PKR 4800

    Premium Heavy Embroidered Black Bridal Velvet Shawl | 4-Side Cutwork & Handwork

    Premium Heavy Embroidered Black Bridal Velvet Shawl | 4-Side Cutwork & Handwork

    PKR 5499

    Luxury Heavy Embroidered Velvet & Net Bridal Saree 2026 (7 Yards)

    Luxury Heavy Embroidered Velvet & Net Bridal Saree 2026 (7 Yards)

    PKR 9400

    Floral All-Over Print Embroidered Lawn Suit 3-Pc | Chiffon Dupatta (Summer 2025)

    Floral All-Over Print Embroidered Lawn Suit 3-Pc | Chiffon Dupatta (Summer 2025)

    PKR 4800

    Keep reading

    Related files

    AI
    English

    What is Generative AI? An Easy-to-Understand Explanation

    Generative AI makes new text, images, audio and code instead of just predicting — here is how transformers and diffusion models actually work, and the tools worth knowing: ChatGPT, Suno, Sora, Flux.

    By HuziFile #464

    Read
    AI
    English

    A Gentle Introduction to Natural Language Processing (NLP)

    NLP is how computers handle human language — and it was built English-first. What that means for Urdu, Punjabi, Sindhi, and Pashto, and why Pakistan's languages are the field's interesting frontier.

    By HuziFile #311

    Read
    AI
    English

    Deep Learning vs Machine Learning: What's the Difference in 2026?

    Deep learning is a subset of machine learning, not its rival — the difference is who engineers the features. A practical 2026 guide to when XGBoost still wins, when deep networks pay off, and the hybrid pattern production teams actually ship.

    By HuziFile #118

    Read
    AI
    English

    The Visionary Machine: Understanding Computer Vision in 2025

    How machines actually see — pixel grids, CNNs and Vision Transformers — explained through things you already use: face recognition, portrait mode, WhatsApp scans and Hawk-Eye in cricket.

    By HuziFile #463

    Read
    AI
    English

    The Rise of AI Tools: How Artificial Intelligence is Changing Productivity in 2025

    ChatGPT, Perplexity, NotebookLM, Cursor, Canva — the 2025 AI tool stack is genuinely useful and genuinely expensive. How to pick a few, use free tiers, and pay from Pakistan when cards fail.

    By HuziFile #414

    Read
    AI
    English

    The Hidden Carbon Bill of Generative AI: What Every Blogger Should Know in 2025

    Data centres, GPU electricity, and cooling water: the reported environmental cost of generative AI, and the practical choices that cut most of a blogger's AI footprint without guilt.

    By HuziFile #408

    Read
    Back to the archive