garynbc diary EN中文

Finally the ART is here.

twenty years, 900 entries

Notes from banking floors, hostels and wet markets since 2003. Search a word, or pick a topic and a year.

New book How Many Hours Are You Worth? · Pre-order S$22.90 →
try: · browse topics & years →

Turning the pages…

AI - Understanding Generative AI and LLM

Let see what i am doing here is to take down AI notes that I self studied online so you if you are interested otherwise I use this as a knowledge base for myself to reference in the future. My opinion is that as education is getting less and less relevant, relevant today obselent tomorrow. It currently about learning how to study effectively and asking the right questions. 

I will structure my AI into 80/20 to hit all the important concept and end up with something to implement at the end. Join me with this weekly updated AI learning material and see how I slowly turn knowledge into something useful for my website. First let use going into LLM model which is fundmental in the whole AI topic. 

1. The LLM Landscape: Closed vs. Open Models

Right now, the AI world is split between proprietary cloud models and free, open-weight models you can download and run yourself:

  • The Cloud Flagships: Proprietary models like Google Gemini 4 (Carbon, Argon, and Neon), Meta Muse Wonder, and Anthropic Claude Opus 5.5 top the performance charts for complex reasoning, software engineering, and multimodal tasks.
  • The Open-Weight Leaders: Free, open-weight models have nearly closed the performance gap while giving users total control and privacy:
    • DeepSeek V4.1: The standout open-source leader for math, logic, and coding, released under an unrestricted MIT license.
    • Meta Llama 4 (Scout & Maverick): Built for native image-and-text understanding and massive context windows capable of analyzing entire codebases or books in one prompt.

2. How LLMs "Think": System 1 vs. System 2

Early LLMs operated purely like human System 1 thinking—fast, instinctive, and reliant on immediate pattern recognition. That made them fluent writers, but prone to rushing into math or logic mistakes.

Modern reasoning models (such as Gemini 4 High/xHigh, DeepSeek R1/V4.1, and Claude Opus 5.5) simulate System 2 thinking. Before showing you a final answer, they spend extra computing time generating a private internal monologue to break down steps, catch errors, and backtrack if an idea doesn't work. While it is computational search rather than human consciousness, toggling "reasoning mode" on makes a dramatic difference for coding, math, and strategy.


3. Running AI Offline on a MacBook M2 (And Why It Beats Windows Laptops)

You don’t need an internet connection or monthly subscription to use generative AI. With free tools like LM Studio, Ollama, or Jan, you can run compressed versions of DeepSeek and Llama directly on a MacBook M2.

  • The Magic of 4-Bit Quantization (Q4): Full-sized flagship models require massive server farms. To fit on a laptop, developers compress model weights from 16-bit precision down to 4-bit (Q4). This shrinks the file size by ~70–75% while keeping ~98–99% of the model's intelligence. For example, a 14B model that normally needs ~28 GB of RAM drops to ~8.5 GB.
  • Why Apple Silicon Wins: Most Windows laptops split memory between system RAM and a small pool of GPU VRAM (often 6GB–8GB), causing large AI models to crash or slow down. A MacBook M2 uses Unified Memory, allowing the GPU to access almost all of your laptop's RAM at high speed while running quietly on battery power.

MacBook M2 Hardware Guide:

  • 8 GB RAM: Run 7B–8B Q4 models (great for fast general chat, writing, and basic code).
  • 16 GB – 24 GB RAM: Run 14B–32B Q4 models (ideal for web design, coding, audio transcription, and deeper analysis).
  • 32 GB+ RAM: Run 70B+ Q4 models for heavy research and large documents.
  • Storage: Keep 10 GB to 50 GB of free SSD space for model files.

4. Four Ways to Turn a General LLM into a Domain Expert

If you want an AI to specialize in your specific industry, codebase, or workflow, there are four main ways to customize it:

  • System Prompts & Few-Shot Prompting: Giving the model strict rules, a persona, and example input/output pairs in its setup instructions—good for fast tone control, formatting, and workflow rules with zero coding.
  • RAG (Retrieval-Augmented Generation): Connecting the model to your own documents or databases so it looks up real-time facts before answering—good for private document Q&A, customer support, and frequently updated knowledge.
  • Fine-Tuning (LoRA / QLoRA): Training a small adapter layer on hundreds of specialized examples to adjust how the model thinks—good for learning niche jargon, proprietary code, or specialized writing styles.
  • Tool Use & Agentic Workflows: Giving the model access to APIs, calculators, or live software so it can take action and verify data—good for live research, math/financial modeling, and multi-step task automation.

5. Top 5 LLM Security Risks (And How to Avoid Them)

As AI researcher Andrej Karpathy has pointed out, LLMs process your instructions and external data as one continuous stream of text—making them vulnerable to clever manipulation. Here are the top five risks to keep in mind:

  • Hidden Trick Instructions (Prompt Injection): Attackers hide secret commands inside emails, PDFs, or websites that trick the AI into following their orders instead of yours—avoid this by never letting AI automatically process untrusted files or links without your review.
  • Too Much Freedom (Excessive Agency): If an AI agent is connected to your email, bank, or files, a single mistake or hack lets it delete data or send messages on your behalf—avoid this by giving the AI read-only permissions and requiring your manual click before it takes any real action.
  • Tricking the Rules (Jailbreaks): Clever wording, roleplay, or coded language can still fool an AI into ignoring its built-in safety rules—avoid this by using an extra, separate safety filter to double-check what the AI reads and writes.
  • Leaking Private Info (Data Disclosure): Hackers can trick an AI into revealing your private chat history, passwords, or internal documents through hidden web links—avoid this by never pasting sensitive personal data into public AI chats and blocking auto-loading external links.
  • Tainted AI Models (Data Poisoning): Downloaded open-source models or training files can contain hidden "sleeper" triggers planted by hackers—avoid this by only downloading AI models from official, trusted sources and verifying their file signatures.


Finally the art is here

Garynbc's Diary · Save and stay a free life

Search the diary

Twenty years of entries

overseaDo More Work Lesstravelemotionalpurchasing and sellingGatheringrantingfoodhandphoneoutingreviewsPodcastVietnamreflectionGarynbc TheoremSembcorpnewsGadgetsJapanSchool EventsschooltutorialBirthdaycitibankclubbingjobPurchasingProductivitydaily blogfamilytechnologyMoneyreminiscenceArmyHealth & Wellnessfrugal livingBromptonHanoiself-improvementvideoscampresolutionshenyangJakartaJournalLifestyleRetirementbe societyfactsfoldieInvestmentJackieNokia N8Special Guestargumentativeblogbook reviewfinancial planninghomestayleather craftphotographywork exchangeAI & AutomationBook SummaryFishingGuidesRES Examcapitalismhainanreality TVtoast masterwedding3sixtyAIBangkokBookBook WritingBusiness TripContentmentDreamFishing GearGiving BackMVReal Estate Salespersonblogginggardeninghandmadepopularscams哲学4D FrameworkCEAChangi AirportClaudeFishing Tackle ExhibitionImpulse BuyingIndonesiaJBLKulaiLoy KrathongPer DiemProperty agent examReal EstateSalesmanshipSingapore PropertySingapore property agentSinglishStartupStaycationSubtitlesTeachingTheoryTobiWhisperWish ListYun Nanbankinghumorrolexthailand24-Hour Rule30 Hour FamineAI BubbleAirport LoungeApp DevelopmentBank StocksBeauty and the GeekBlack White TalkBlossom LoungeBudgetingCapCutCareer PlanningCentral WorldChinese TutorCoffeeCommunityCooker HoodCooking SteakCopilotCouple TalkCredit Card PerksCriminologyCurrent AffairsDIYDeclutteringDeepSeekDelayed GratificationDividend InvestingDollar Cost AveragingDragonPassDuolingoEasySingEasySing Mini DuoEggingEmergency FundEncore 2EnoughExam RantExperiencesFive-Star HotelFlight DelayFlower CrabFood SurplusFrugal TravelGrabGratitudeGreedHai PhongHobbiesHome AudioHome CookingIFTE 2026Income InvestorIndonesian FoodInfidelityInterior DesignInvestingJakarta TrafficJensen HuangKampong SpiritKaraokeKindnessKnowing EnoughLanguage LearningLast minute revisionLearning with AILuggageMall of IndonesiaManifestationMarket CorrectionMarriageMicro CelebrationMortgage RefinancingNasi BakarNon-ProfitNvidiaOCROne In One OutOnline TeachingOnline TutoringPersonal FinancePhu QuocPickleballPreplyProperty agent careerProperty agent tipsProperty exam revisionQueenstownQueenstown KakiREITsRES Paper 1RES Paper 2RelationshipsRepairRetirement PlanningReusable Over DisposableSDICSEOSalesScam SeriesSide HustlesSide ProjectsSimple LivingSingaporeSingapore StocksSingapore real estateSingha BeerSlasherSquid FishingStoryboardSubdomainSupper ClubTeaching ChineseTerminal 21Terminal 4Thai FoodTippingTravel ComparisonTravel FishingUOBUse What You OwnVibe CodingVideo EditingVietnam TravelWat YannawaYouTubebuyincasecarcollaborationfarmingforexknowledgeminimalismmobile logmoomoorecraftsentimentalsolopreneurtraining痣相学
M1, Starhub, Singtel GPRS 3G settingRolex green hulk vs BatmanIs finnciti a scam? a layman perspectiveHard reset samsung wave 8500, secret codeFinally .rmbv format playback on mobileRuk Sam Sao (Triangle Love)