2025年3月27日 星期四

健康照護科技專題(二) Syllabus 2025 Fall Handout

(切換完整版課綱)

開場


Unit 1: AI Computer Vision

CNN (Convolutional Neural Networks) Handwashing

YOLO  (You Only Look Once) YOLOv7 list

ViT (Vision Transformers) wafer defects heat map comparison

VLM (Vision Language Models) nutrition analysis

Tesla AI Vision

HW#1 AI in Computer Vision


Unit 2: 盲人環境輔助理解,空間導航

空間資訊與識別輔助 


真實世界 3d 模型製作

HW#2 Understanding environments


Unit 3: 3d障礙偵測演算法

障礙偵測(Recast 原理)

動態障礙偵測

Simulating A Navigation Assistant with sonar 

HW#3 Obstacle detection



Unit 4: 避障演算法

Voronoi an introduction 

Voronoi 2D navigation (show Voronoi) (Rural Road 2d)

Voronoi-based Safe Routing Planning (Country Alley  2d)

Voronoi waypoints for navigation (share) (Campus Alley 3d) vs. non Voronoi 



  • Unit 5: 環境安全檢測與評估視覺化 using Claude

    Hazard detection (環境危害偵測)


    Home Hazard chain identification and animation (居家危害鏈偵測與危害視覺化)





    Unit 6: 心智活動與訊息處理

    多工任務訓練,延緩失智

    HW#6 Games for Health



    Unit 7: AI輔助情感分析 



    Mental Health App 心理健康遊戲應用程式的臨床驗證


    HW#7 諮商輔助


    HW#8


    2025年3月5日 星期三

    多個限制條件的複雜問題

     當AI面對包含多個限制條件的複雜問題時,確實存在難度。

    在注意力機制(Attention mechanism)中,模型需要同時關注多個條件,並且每個注意力分配都是基於概率的。當條件數量增加時,要同時滿足所有條件的概率會顯著降低,這就像是連續投擲硬幣並期望全部正面朝上一樣——條件越多,全部滿足的概率越低。

    這種情況下,模型可能會:

    • 忽略某些條件
    • 錯誤理解條件之間的關係
    • 在滿足一些條件的同時違反其他條件

    如果您有一個包含多個複雜條件的問題需要解決,我建議將問題分解成較小的部分,逐步處理每個條件,這樣會更容易得到準確的解答。


    2025年3月4日 星期二

    River Crossing 2, Part 2: Light Speed

     渡河問題2 (statement)  source 許元銘


    Code Gen 


    Use ChatGPT o1 to generate A* search


    4o fails to generate A* search that works



    Use Claude 3.7 standard mode to generate A* in Python to solve the River Crossing problem

    Sonnet 3.7 or Sonnet 3.5 to gen code (no reasoning)


    Gen python, run Python, animate (15-step solution)


    Run Python

    it takes 15 steps. (thanks to the python code generated by Claude)




    If you don't do Python, you can change the Python code you just generated to js. Run it in Claude.Use React to visualize the text results you just got. How to change to js code.

    However, the change of language might occasionally go wrong. It is better to go Python directly.


    another 15-step solution (A* in Python)



    yet another 15-step (A* in Python)

    one more 15-step (A* in Python)

    last 15-step (A* in Python)


    River 4 with One Daughter

     How about relaxing one of the constraints:


    solution exits. 





    Trial 1:  (Check o1 reasoning by Claude artifact using REACT), fails


    Trial 2: ChatGPT o1 reasoningClaude verification using REACT (It works. Rarely.)


    Trail 3: o1 


    Use Claude to generate A* in Python

    Python code


    Colab




    Verify by visualization



    2025年3月3日 星期一

    當 AI 推理模式跟你想的不一樣,怎麼辦

    以經典的渡河問題為例,即使我們明確要求Claude使用A*演算法,AI並不總是完全按照指令執行。原因有幾點:

    1. 思維模式與內部邏輯:Claude有自己的推理方式,可能會根據問題特性選擇它認為更適合的解決方案,例如使用啟發式搜尋(heuristic)結合回溯法(backtracking)來解決限制滿足問題(CSP),而非嚴格遵循A*。

    2. 執行環境限制:即使Claude能生成Python實現的A*演算法,但在網頁環境中,它只能執行JavaScript,無法實際運行Python代碼來驗證結果。

    3. 概念層次vs程式層次:要求Claude在「思維層次」使用A*與要求它「用程式實現A*」是不同的。在思維層次上,Claude可能會融合多種解題策略而非純粹的A*。

    當AI無法以推理模式解出問題時,我們可以「強迫」Claude使用A*思維來解決 - 引導AI按特定思路或洞見進行問題分析,即使不寫程式碼。這種方式能更好地引導AI的解題路徑。

    這也突顯了與AI工具互動時的重要性 - 不只是給予指令,有時還需要適當引導其思考過程,才能獲得我們期望的解題方法和結果。當然很多時候,AI並不需要這樣的導引。

    AI 與人類協作

     關於AI工具的基本行為模式與最佳化思考能力的差異。

    確實,大多數AI工具在默認情況下會產出符合基本要求的解法,而非必然尋求最佳解。當您提供額外的洞察力或優化參數(如減少不必要的時間、路程等)時,AI便有機會重新評估並提供更優質的答案。

    這種互動模式反映了人機協作的價值。AI會:

    1. 考量您提出的優化思路
    2. 嘗試實作並比較結果
    3. 若發現您的建議確實優於原方案,會承認並採納

    或者,AI可能會解釋演算法的本質(如A*算法需考量所有可能性),並感謝您指出原先解法的不足。

    這種交流正是人機協作寫作的典範 — 人類提供創新思維與洞察,AI則運用其計算能力與知識庫來評估、實作並完善這些想法。

    2025年3月2日 星期日

    會犯錯的機器更強大

    這觸及了人工智慧系統設計的深刻見解。允許機器犯錯、從錯誤中學習並回溯確實是一種強大的方法。

    當我們分解複雜任務時,我們為系統創造了以下機會:

    1. 識別某種特定方法何時無效
    2. 嘗試替代策略而無需從頭開始
    3. 從錯誤中漸進式學習

    這類似於人類解決問題的方式 - 我們很少一次就把事情做對。我們能夠說「這行不通」並轉變方向的能力對我們的智能至關重要。

    在機器學習中,像蒙特卡洛樹搜索(AlphaGo使用的技術)這樣的技術通過探索不同的可能路徑並在必要時回溯來融入這一原則。同樣,一些現代語言模型使用的方法可以在推理過程中重新審視並完善其思考。




    A profound insight about AI system design. Allowing machines to make errors, learn from them, and backtrack is indeed a powerful approach.

    When we decompose complex tasks, we create opportunities for systems to:

    1. Recognize when a particular approach isn't working
    2. Try alternative strategies without starting from scratch
    3. Learn incrementally from mistakes

    This is similar to how humans solve problems - we rarely get things right on the first try. Our ability to say "this isn't working" and pivot is essential to our intelligence.

    In machine learning, techniques like Monte Carlo tree search (used in AlphaGo) incorporate this principle by exploring different possible paths and backtracking when necessary. Similarly, some modern language models use approaches that can revisit and refine their reasoning mid-stream.


    晚餐接機大作戰(半導體廠製程排程): Part IV A* on thinking Level

      Try smart search. Prompt Claude Sonnet 3.7, ChatGPT o1, Grok 3 Think to perform A* search 


    (s)

    Solving the Thanksgiving Dinner Planning Problem with A* Search

    A* Trace

    Time Chart (Schedule)


    (me)

    Optimal

    Solving with A*

    Plan by A* (animation)

    Detailed Analysis of James's Decision at 2:00 PM (animation)


    Sub optimal

    Solving with A*



    ChatGPT o1 Reasoning, prompt "Use A*" , same result, no improvement


    晚餐接機大作戰(半導體廠製程排程): Part III Standard LLM vs. Reasoning

      Scheduling Parallelism in Plans problem  (Eng) (from source)


    感恩節全家晚餐大作戰





    Why non-reasoning LLM fails (source)







    Claude Sonnet 3.5 illustration of solution (happens to be optimum)





    ChatGPT o1 reasoning feasible outcome, optimized by human


    3.7 Extended
      41 s (misinterpreted)







    4 little experiments in a row (edits)
    not always woks (can misinterpret) 85 s

    3.7 extended 35 s (misinterpreted)

    3.7 Extended, 7 s  (misinterpretation), prompt "Use A*" 




      Grok 3 did it in 79 s



      What if Emily arrived at the airport at 4:30

      Sonnet 3.5 illustration (attention bias occurs. some constraints forgotten)

      ChatGPT o1 feasible (also optimum) at the first try. Solution space is tremendously limited.



      What if Emily arrived at the airport at 2:30


      Sonnet 3.5 illustration (attention bias occurs. some constraints forgotten)

      ChatGPT o1 reasoning feasible outcome, optimized by human






      晚餐接機大作戰(半導體廠製程排程): AI 協同軟體開發 Part II A* on Python Level, Achieving Parallelism

        Scheduling Parallelism in Plans problem  (Eng) (from source)


      Try smart search. Prompt Claude to generate A* search Algorithm



      Generate Python code base by using Claude Sonnet 3.5 (better than ChatGPT o1)



      To run Python, use Google Colab



      Tweak the program by trials and errors 


      Visualize results as Python can generate complex states










      Debug, Cleanup, Optimized by ChatGPT o1





      最佳解 最高的平行度,throughput 高,idle time 減少,critical path 短




      次佳解 因為James 似乎太奔波了,剛從機場回來,馬上得回去剛才的機場接人
      在工廠等於也就是機器人來回運動,但是沒有產出




      次佳解 Sarah 好忙,先烤火雞,換手給機場回來的 James,然後去機場接Emily,James 接手烤火雞,idle time 過長,而且造成沒有必要的 switchover 






                                                                                  

       我將分享一篇關於處理現實世界排程問題的智慧代理式人工智慧論文。我不會著重於總結論文內容或解釋其數學原理,而是要帶各位了解如何運用當前可用的人工智慧工具來解決論文中的問題。


      首先,我會展示為什麼 ChatGPT o1 的先進推理雖然能得出可行解,但無法獲得最佳解。接著,我會說明為什麼人工對程式的調整仍然很重要。最後,我將展示如何實現平行運算,以及如何實現智慧代理式人工智慧。


      I will share the following paper focusing on agentic AI that deals with real world scheduling problem (for example those in foundries). Instead of summarizing the paper and explaining its mathematics, I will guide you through the details how the problem is the paper can be solved using AI tools available right now. I will first show why ChatGPT o1 reasoning cannot get an optimal solution although it works out a feasible solution. Then I will demonstrate why human tweaks on the program still mater. Finally, I will show how parallelism is implemented and agentic AI is achieved.

      AI 可以生成 OK 解
      Human 可以進一步優化
      碰到瓶頸可以用AI
      找到最佳解(Lucky)