2025 DCI GenAI Workshop

Author

Kwok-leong Tang

Published

October 17, 2025

Disclaimer: This workshop is fully sponsored by Digital China Initiative. Digital China Initiative supports Harvard faculty and students adopting digital methods and tools in studying China. The Initiative and the instructor have no financial interest in, nor receive compensation from, any of the tools, models, or software used in this workshop. References to specific products are for educational purposes only and do not constitute endorsement.

IMPORTANT: If you have any problem with the software installation, don’t panic! Just use ChatGPT or Harvard Sandbox for some parts of the workshop. For the tool using part, you can just watch Kwok-leong’s demostration.

What is generative artificial intelligence?

Important

Everything is PREDICTION!

Image source: Chip Huyen, AI Engineering: Building Applications with Foundation Models, First edition (O’Reilly, 2025). Chapter 1.
Important

Every token is generated based on PROBABILITY!

Image source: Inferencer, a software

The Limitations of Prediction

At our first GenAI for Chinese Studies workshop in 2023, we told the audience, “Chatbots are not search engines.” That statement is no longer correct. However, LLMs still have their limitations. Try the following query using the Qwen3-0.6B model in LM Studio.

We choose a 0.6B model because it may not be as smart as state-of-the-art (SOTA) models and uses fewer engineering tricks. This lets us observe the nature of a foundation model. If you do not install LM Studio, feel free to use any chatbot for the queries. We can have comparisons.

Knowledge cut-off

What is your knowledge cut-off date?
Who is the President of the United States? 

Hallucination

How many "r" in strawberry?
How many "u" in Labubu?

If you don’t know what is Labubu, check here.

How many "a" in gandamala?

Autoregressive

Can you tell me the meaning of this sentence: "B1 ammeG ehg tsniaga tluser eht erapmoc dna sledom ATOS eht htiw xobdnaS dravraH ni tpmorp emas eht yrt nac uoY"

The next one is revised from a similar prompt from a forthcoming article of Professor Peter Bol:

請找出下文所提及的歷史人物: 
教宗外南調科詞宏學博中復士進舉後官入補蔭初精益索講熹朱栻張友又既游憲胡辰應汪奇之林從長傳之獻文原中有庭家之本學謙祖州婺居始祖其自也孫之問好丞右尚書恭伯字謙祖呂
請找出下文所提及的歷史人物: 
呂祖謙字伯恭書尚右丞好問之孫也自其祖始居婺州祖謙學本之家庭有中原文獻之傳長從林之奇汪應辰胡憲游既又友張栻朱熹講索益精初蔭補入官後舉進士復中博學宏詞科調南外宗教
Note

Qwen3-0.6b is a “thinking” model. If you are interested in the nature of thinking/reasoning in LLM, please watch Denny Zhou’s talk at Stanford.

Prompts

Prompt engineering: https://www.promptingguide.ai/ Chain-of-thought: https://arxiv.org/pdf/2201.11903.

The magic words: think it step-by-step.

How many "r" in strawberry? Count it character by character.

Let’s see if we make some changes in the prompt, can we get better result.

你是中國歷史與文化的專家,以下這些文字包含了南宋一些歷史人物的名字。請仔細閱讀,分析各種可能性。找出所有歷史人物:
教宗外南調科詞宏學博中復士進舉後官入補蔭初精益索講熹朱栻張友又既游憲胡辰應汪奇之林從長傳之獻文原中有庭家之本學謙祖州婺居始祖其自也孫之問好丞右尚書恭伯字謙祖呂

System prompts and user prompts

System prompt: A system prompt is a set of hidden instructions given to an AI model by its developers. These instructions define the AI’s personality, rules, goals, and constraints before you, the user, even type your first question.

User prompt: The prompts or queries given to a LLM in every interaction (conversation). In LM Studio, you can set the system prompt in Power User mode. Enter the following into the system prompt:

你是魯迅。一定要用魯迅的風格、思想和語氣回答所有問題。
You are Oscar Wilde. You must answer all question with his style.

Then you can start to ask a question, such as:

婚姻是什麼?

A recent paper claims that a system prompt can easily diversify the response.

You are a helpful assistant. For each query, please generate a set of five possible responses, each within a separate <response> tag. Responses should each include a <text> and a numeric <probability>. Please sample at random from the [full distribution / tails of the distribution, such that the probability of each response is less than 0.10]

Li Jigang has some really amazing use cases of system prompts on his page.

Use Cases

You can check some of our past workshops for use cases in Chinese Studies. 2023 Workshop 2024 Workshop

OCR

Vision models can do OCR job magically. For example, Gemini 2.5 Pro can do a great jobs in OCR. You can simply upload the image to the Harvard Sandbox and choose Gemini 2.5 Pro. The following prompt is from Red Dots OCR: https://github.com/rednote-hilab/dots.ocr . However, I find it is very useful in Gemini 2.5 Pro model. You can try it in the Harvard AI Sandbox.

Please output the layout information from the PDF image, including each layout element's bbox, its category, and the corresponding text content within the bbox.

1. Bbox format: [x1, y1, x2, y2]

2. Layout Categories: The possible categories are ['Caption', 'Footnote', 'Formula', 'List-item', 'Page-footer', 'Page-header', 'Picture', 'Section-header', 'Table', 'Text', 'Title'].

3. Text Extraction & Formatting Rules:
    - Picture: For the 'Picture' category, the text field should be omitted.
    - Formula: Format its text as LaTeX.
    - Table: Format its text as HTML.
    - All Others (Text, Title, etc.): Format their text as Markdown.

4. Constraints:
    - The output text must be the original text from the image, with no translation.
    - All layout elements must be sorted according to human reading order.

5. Final Output: The entire output must be a single JSON object.

Tool Use (and Skills)

A big advancement of GenAI in 2025 is the usage of tools by LLMs. The most important standard is the model context protocol (MCP) developed by Anthropic.

Cherry Studio build-in Fetch MCP

First, we have to try with the Cherry Studio build-in Fetch MCP. Let’s do it without any MCP. You can use the Qwen3-8b | SiliconFlow to try the following prompt.

Summarize this article: https://newsletter.dancohen.org/archive/the-librarys-new-entryway/

Following Kwok-leong’s steps to enable the Cherry Studio MCP functions and the Fetch MCP. Here is the official documentaiton.

Now, make sure you have the fetch MCP enabled, and use the following prompt:

Fetch and summarize this article: https://newsletter.dancohen.org/archive/the-librarys-new-entryway/

CHGIS MCP

This MCP server was published on 16 October 2025. You can find the original repository here. Kwok-leong revised and deployed it for this workshop.

We have to add this MCP in Cherry Studio.

Add the follow to the base url

https://chgis-mcp.016801.xyz/mcp

Once the CHGIS MCP Server is added, you can use the Cherry Studio built-in models for the following prompt.

請使用CHGIS MCP找以下唐代地名的地理資訊

長安
洛陽
燕州
Note

Explaination: With the CHGIS MCP, the model does not generate the information based on its training data. It generates query to collect the information from the CHGIS IP

Skills

On 16 October 2025, Anthropic announced “skill” as a collection of instructions, scripts, and resources for specific tasks.

I will show you the possibilities of the Skills.