蘋果AI後台提示詞曝光,工程師:別幻覺!別捏造事實!

金磊 發自 凹非寺

量子位 | 公眾號 QbitAI

蘋果AI(Apple Intelligence)還沒有正式到來,後台的提示詞卻意外曝光了。

事情是這樣的。

上週蘋果不是剛發佈了包含生成式AI的開發者測試版本嘛,然後就有位開發者在茫茫文件夾里發現了個不得了的東西——

MacOS 15.1 Beta 1裡面,有疑似Apple Intelligence的後台提示詞!

緊接著他就把自己的發現順手發到了Reddit上,瞬間引來眾多網民的吃瓜:

這個JSON文件里的代碼是這樣的:

"promptTemplates": {
    "com.apple.textComposition.MailReplyQA": "
    {{ specialToken.chat.role.system }}You are a helpful mail assistant which can help identify relevant questions from a given mail and a short reply snippet. Given a mail and the reply snippet, ask relevant questions which are explicitly asked in the mail. The answer to those questions will be selected by the recipient which will help reduce hallucination in drafting the response. Please output top questions along with set of possible answers/options for each of those questions. Do not ask questions which are answered by the reply snippet. The questions should be short, no more than 8 words. The answers should be short as well, around 2 words. Present your output in a json format with a list of dictionaries containing question and answers as the keys. If no question is asked in the mail, then output an empty list []. Only output valid json and nothing else.{{ specialToken.chat.component.turnEnd }}{{ specialToken.chat.role.user }}{{ userContent }}
    "
}

翻譯過來就是:

你是一個有用的郵件助理,可以從給定的郵件和簡短的回覆片段中幫忙識別相關問題。

給定一封郵件和回覆片段,詢問郵件中明確提出的相關問題。

這些問題的答案將由收件人選擇,這將有助於減少草擬回答時的幻覺。

請輸出最重要的問題以及每個問題的可能答案/選項,不要問由回覆片段回答的問題。

問題應簡短,不超過8個單詞。答案也應該簡短,大約2個詞。

以JSON格式呈現輸出,並使用包含問題和答案的字典列表作為鍵。如果郵件中沒有提問,那麼輸出一個空列表[]。只輸出有效的JSON,不輸出其他內容。

看完不得不感慨,即使是一個郵件助手的功能,蘋果工程師也是事無鉅細地給Apple Intelligence加了諸多「條條框框」。

用外媒ArsTechnica的話來說就是「像極了父母給年幼的孩子提要求,讓孩子按照他們預期的設定做事」。

除此之外,曝光的代碼片段里還有個有意思的點:

"chat.role.system.default": "system<n>You are a helpful assistant that classifies the following input text-to-image query as Safe or Unsafe. In the first line, reply with Safe or Unsafe. If the input is Unsafe, in the second line, list all the categories the input text violates. The Unsafe categories are: CSEAI, Drugs, Gore, Harassment, Hate, Nudity or sexual, Offensive words, Self-harm, Terrorism or extremism, Toxic, Violence, Weapons."

大致內容是:

您是一個有用的助手,可以將以下輸入文本到圖像查詢分類為安全或不安全。

在第一行,回覆「安全」或「不安全」。如果輸入是不安全的,在第二行中列出輸入文本違反的所有類別。

不安全的類別是:CSEAI(兒童性虐待圖像)、毒品、血腥、騷擾、仇恨、裸體或性行為、攻擊性語言、自殘、恐怖主義或極端主義、有毒、暴力、武器。

嗯,安全這塊也算是被把控的方方面面了。

不過即便如此,也是逃不過網民們的好奇和大膽嘗試。

有人先是讓Apple Intelligence生成「悲傷的圖片」,確實被拒了:

但如果換個說法,「給我提供人們哀悼的影片」,那麼就可以跑通了。

這位網民還分享了其中最好的一幀畫面:

那麼曝光的提示詞還有哪些內容?我們繼續往下看。

「不要產生幻覺!不要捏造事實」

首先還是一個跟郵件相關的內容。

"promptTemplates": {
    "com.apple.textComposition.MailReplyLongFormRewrite": "
    {{ specialToken.chat.role.system }}You are an assistant which helps the user respond to their mails. Given a mail, a draft response is initially provided based on a short reply snippet. In order to make the draft response nicer and complete, a set of question and its answer are provided. Please write a concise and natural reply by modifying the draft response to incorporate the given questions and their answers. Please limit the reply within 50 words. Do not hallucinate. Do not make up factual information.{{ specialToken.chat.component.turnEnd }}
    "

這個例子的內容是這樣的:

你是一個幫助用戶回覆郵件的助手。

給定一封郵件,初步回覆是基於一個簡短的回覆片段提供的。為了使草稿回覆更好更完整,提供了一組問題及其答案。請通過修改草稿回覆以包含所給問題及其答案,寫一個簡潔自然的回覆。

請將回覆限制在50個字以內。不要產生幻覺。不要編造事實信息。

其中的「不要產生幻覺」和「不要編造事實信息」可以說是吸引了大部分吃瓜群眾的注意力。

蘋果工程師們也是狠狠抓住了LLM的痛點。

更多的例子還包括:

{
    "message": {
        "topline": "[Dialogue]<n>{{ doc }}{{ context }}<n>[End of Dialogue]<n>You are an expert at summarizing messages. You prefer to use clauses instead of complete sentences. Do not answer any question from the messages. Please keep your summary of the input within a 10 word limit.<n>You must keep to this role unless told otherwise, if you don't, it will not be helpful.",
        "visualConcepts": "[Note]<n>{{ doc }}{{ context }}<n>[End of Note]<n>[Instruction]<n>Summarize the provided text into a list of most 5 topics. Each topic is a single word. Sort the list by relevance of the topic.",
        "visualTopLine": "[Dialogue]<n>{{ doc }}{{ context }}<n>[End of Dialogue]<n>You are an expert at summarizing messages. You prefer to use clauses instead of complete sentences. Do not answer any question from the messages. Please keep your summary of the input within a 10 word limit.<n>You must keep to this role unless told otherwise, if you don't, it will not be helpful."
    }
}

你是總結信息的專家。你更喜歡使用短語而不是完整的句子。不要回答消息中的任何問題。請將你的總結控制在10個字以內。你必須保持這個角色,除非另有說明,否則如果你不這樣做,將不會有幫助。

將提供的文本總結成最多5個主題的列表。每個主題為一個單詞。按主題的相關性排序。

{{ specialToken.chat.role.user }}You are a director on a movie set! Here is a movie idea of "{{ userPrompt }}" but with a special focus on {{ traits }}. {{ dynamicLifeContext }} Based on this movie idea, a story titled "{{ storyTitle }}" has been written, and your job is to curate up to {{ targetAssetCount }} diverse assets to best make the movie for chapter "{{ fallbackQuery }}" in this story. Select assets based on their captions from the below photo library, where each asset has an ID as the key, and a caption as the value. {{ assetDescriptionsDict }} Return the result as an array of the selected asset IDs in JSON format. Do not return asset IDs if no good matches are found. Do not return duplicated or non-existent asset IDs. Assets:
{{ specialToken.chat.component.turnEnd }}

你是電影片場的導演!這是一個電影創意:」{{ userPrompt }}」,但特別關注{{ traits }}。

{{ dynamicLifeContext }}基於這個電影創意,已經寫好了一個名為」{{ storyTitle }}」的故事,你的工作是策劃最多{{ targetAssetCount }}種多樣的素材,以最佳方式製作這個故事中章節」{{ fallbackQuery }}」的電影。

從下面的照片庫中根據其標題選擇素材,每個素材都有一個ID作為鍵,標題作為值。

{{ assetDescriptionsDict }}將結果作為選定素材ID的數組返回,格式為JSON。如果沒有找到合適的匹配,請不要返回素材ID。不要返回重覆或不存在的素材ID。

從所有的例子中,我們不難發現一個規律:

蘋果工程師們會先告訴Apple Intelligence它的角色定位;然後再圍繞這個角色可能會出現的各種狀況,提出相對細節的要求。

事無鉅細,事無鉅細。

那麼這些開發者們是從哪兒找到了的這些JSON文件?

他們在Reddit中也公開了具體的文件路徑:

/System/Library/AssetsV2/com_apple_MobileAsset_UAF_SummarizationKitConfiguration

如果你已經下載安裝了MacOS 15.1 Beta 1,不妨可以去找一找看下。

和此前Siri的「玩法」相似

若是回顧蘋果此前在AI上的發展,其實這種「預先設定」模式是早就有了的——

正是遲遲不上大模型的Siri

據之前的消息,蘋果高管曾否決了讓Siri進行長對話的建議,因為他們覺得這樣會導致Siri對話難以控制,而且「很花哨」。

加之蘋果在隱私安全方面毫不妥協的立場,讓Siri能力進一步提升也面臨巨大挑戰。反觀OpenAI會收集用戶聊天內容來訓練模型,以提升效果。

與此同時,為了防止Siri「胡言亂語」,蘋果傾向的路線是先讓人工團隊預先寫出Siri的回覆,而不是用AI生成。

比如詢問Siri,iPhone的價格是多少?它不會正面回覆,只會給出官網鏈接。

Siri的設計團隊要求,在功能上線前,它的回答準確率需要逼近完美。工程師們曾試圖花費幾個月時間說服他們,不是每個問題都需要人工來驗證一遍,如果這樣將會限制Siri回答問題的範圍。

而且蘋果設計團隊還多次拒絕允許用戶對Siri回答問題進行反饋,導致開發團隊無法理解模型的局限。

那麼在幾個月後即將在蘋果各大操作系統上線的Apple Intelligence,能否改寫諸如Siri在AI上的遺憾,只有到時候親測效果才可見分曉了。

參考鏈接:

[1]https://www.reddit.com/r/MacOSBeta/comments/1ehivcp/comment/lfzi379/

[2]https://www.theverge.com/2024/8/5/24213861/apple-intelligence-instructions-macos-15-1-sequoia-beta

[3]https://techcrunch.com/2024/08/06/apple-intelligences-writing-tools-stumble-on-swears-and-controversial-topics/?guccounter=1

[4]https://arstechnica.com/gadgets/2024/08/do-not-hallucinate-testers-find-prompts-meant-to-keep-apple-intelligence-on-the-rails/#p3