<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by J.P. Mohler on Medium]]></title>
        <description><![CDATA[Stories by J.P. Mohler on Medium]]></description>
        <link>https://medium.com/@jpmohler?source=rss-e7ff4fa5eac0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*WSEeVDxpy_B9EnRu_vvq5g.png</url>
            <title>Stories by J.P. Mohler on Medium</title>
            <link>https://medium.com/@jpmohler?source=rss-e7ff4fa5eac0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 00:31:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jpmohler/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Prompt engineering a legal question with help from subjective explanations: How “Active-Prompt”…]]></title>
            <link>https://medium.com/@jpmohler/prompt-engineering-a-legal-question-with-help-from-subjective-explanations-how-active-prompt-cot-8c016af17e6?source=rss-e7ff4fa5eac0------2</link>
            <guid isPermaLink="false">https://medium.com/p/8c016af17e6</guid>
            <category><![CDATA[prompt-engineering]]></category>
            <category><![CDATA[gpt-4]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[legal-technology]]></category>
            <dc:creator><![CDATA[J.P. Mohler]]></dc:creator>
            <pubDate>Mon, 11 Sep 2023 08:57:07 GMT</pubDate>
            <atom:updated>2023-09-11T19:24:26.433Z</atom:updated>
            <content:encoded><![CDATA[<h3>Prompt engineering a legal question with help from subjective explanations: How “Active-Prompt” Chain of Thought worked</h3><p>I am a corporate lawyer and deal with a document called a Token Warrant (a mechanism for investors to receive future digital assets from a target company) nearly every day. This weekend I began prompting GPT4 with the full text of all the operative provisions of a typical Token Warrant (this one I found on <a href="https://github.com/lexDAO/token-warrant/blob/main/Kali%20-%20Token%20Warrant%20-%20TEMPLATE.docx">GitHub</a>) along with a number of specific questions that I have received from clients in the past about how Token Warrants work. Initially, I was impressed by GPT4’s capacity to synthesize concepts of contract construction, arithmetic and the facts that I prompted to correctly answer questions about the economics and terms of the Token Warrant, but eventually ran into trouble with the following prompt:</p><p><strong>If Holder is an investor with 20% Fully Diluted Percentage, and all other Insiders besides Holder are given 30 Tokens, and 100 Tokens are issued, how many Tokens does Holder receive?</strong></p><p>Without getting too into the weeds, the above, like a lot of the questions I field from clients about this document, is deceivingly tricky. The formula in the Token Warrant for figuring out the Holder’s Tokens is simple: multiply three variables — Holder’s equity (Fully Diluted Percentage) by the number of Tokens all Insiders receive by the total number of Tokens. The tricky part of this question is that the definition of “Insiders” includes “investors”, and I prompted that Holder is an investor, which means the Holder is getting 20% of (30+(what Holder ends up with)) Tokens. This works out to 7.5 Tokens. GPT4, no matter how I phrased the question, was convinced that the calculation needed to be 20% of the remaining 70 Tokens or 14 Tokens. Of course, I could have corrected the poor logic — but I wanted to find a way to get the right answer independent of my knowledge of GPT’s previous incorrect answers.</p><p>So I started Googling basic prompt engineering techniques to see if this could be solved without adding clarifications that I only realized the LLM needed after I saw it return the wrong answer. I stumbled upon the “Chain-of-Thought” approach, where you provide the LLM with a series of similar questions along with the answers to those questions and the reasoning behind the answers as part of the prompt, in an effort to guide the LLM’s reasoning. I did so for two rather straightforward questions about the Token Warrant:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dKn7IU__lsaDGSQY-4HWqw.png" /></figure><p>But alas, I still received back the incorrect answer (14) along with the same nonsensical reasoning I had been seeing from previous prompts of this question.</p><p>So I went back to the drawing board. I found a slightly more advanced approach to “Chain-of-Thought”, developed by <a href="https://arxiv.org/pdf/2302.12246.pdf">Diao et al</a>, called “Active-Prompting” whereby you ask the LLM to generate a number of answers to each of a series of task-specific questions, and then use those questions that generate the most uncertainty among their answers to populate your “Chain-of-Thought” prompt for the ultimate test question.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6RyoaMJwxt-cPpdltuv9mg.png" /><figcaption>Source: <em>Diao et al, 2023</em>.</figcaption></figure><p>So I quickly wrote out seven more questions about the Token Warrant (plus the original two — #7 and #8 below — I had used in my first “Chain-of-Thought” prompt), trying my best to include not just clear, “commonsense” questions that can be easily deduced from the text of the Token Warrant, but also, difficult, subjective, and even partially unanswerable/impossible questions that are more typical of what I hear from clients about this document, to ensure I would end up with some uncertainty in my experiment.</p><p>I then ran five fresh LLM queries for each prompt (results for each of the five responses below) and I measured “uncertainty” using two metrics that vaguely track the Diao paper: % of answers different from any other answer generated (the two highest scoring rows in yellow below — #2 and #4) and % of answers that diverge from the correct or best answer (the two highest scoring rows in red below— #5 and #6).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IcykGfP6ka6z2QcNbo-ndQ.png" /></figure><p>I then annotated a reasoned best explanation for each question, and prepared Chain-of-Thought prompts seeking an answer to the test question using the two red rows (uncertain/inaccurate), the two yellow rows (uncertain) and three combinations of two green rows (low uncertainty). In part, I wanted to test the “certain” as well as the “uncertain” questions for more data points and because I was frankly highly skeptical that “uncertainty” would make a difference. After all, the explanations for each of the four questions that proved to be “uncertain” were nuanced and even somewhat convoluted, though I would argue not necessarily to a good lawyer (for example, in one case, the best answer is “ideally 24 Tokens but there are likely only 20 Tokens available, so 20 Tokens”). Why would analogizing the subjective reasoning necessary to answer these questions help with a tricky but still more objective test question?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*plo6BS6swAwN25LuOW968w.png" /><figcaption>prompt for the “uncertain/inaccurate” red columns</figcaption></figure><p>I was fairly stunned that for each of the three combinations of green (i.e. low uncertainty) Chain-of-Thought prompts I used, just like my original Chain-of-Thought exercise — I got back the incorrect answer — 14 — and for each of the two high uncertainty (yellow/red) Chain-of-Thought prompts I used, I got back the correct answer — 7.5 — and flawless reasoning:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xUHuesEzbXT6J4hxeGJEYw.png" /></figure><p>This is of course a five sample set, and not remotely statistically significant. However, I am still quite impressed that analogizing subjective legal reasoning using the Active-Prompt technique worked at all given that the Diao paper seems limited to very basic arithmetic and “commonsense” test-sets, and my high uncertainty/low accuracy questions, ultimately used as part of the successful Chain-of-Thought prompts, were nothing of the sort.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8c016af17e6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create a Universal (Fat) Swift Framework]]></title>
            <link>https://medium.com/wireless-registry-engineering/create-a-universal-fat-swift-framework-b7409bbfa18f?source=rss-e7ff4fa5eac0------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7409bbfa18f</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[framework]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[J.P. Mohler]]></dc:creator>
            <pubDate>Wed, 31 Aug 2016 13:42:24 GMT</pubDate>
            <atom:updated>2016-08-31T16:50:02.857Z</atom:updated>
            <content:encoded><![CDATA[<p>As a mobile developer at Wireless Registry, I am always tweaking, upgrading and personalizing our iOS and Android SDKs for developers to integrate into their apps. Of course, before anyone launches an app into production with our SDK on board, they need to test it across an array of devices and OS versions.</p><p>And while rejecting binaries with redundant architectural slices has been an unpopular quirk of the App Store review process for years, the vast majority of iOS developers rely upon simulators, at least in part, for expedient version and device testing. Thus, I normally provide developers with release-ready frameworks which include support exclusively for real device architectures (ARMv7, ARMv7s, ARM64), as well as frameworks with “fat” binaries, for testing on the simulator in addition to actual devices. In this post, I am going to describe perhaps the fastest way to turn a Swift framework into a fat binary (although, if you’ve got a few extra minutes, you should set up a <a href="https://gist.github.com/cromandini/1a9c4aeab27ca84f5d79">runtime script</a> in Build Phases instead of using the command line like me).</p><h3>First things first: create your Swift framework</h3><p>Create a new framework project in XCode, select “Framework &amp; Library”, highlight the “Cocoa Touch Framework” icon, and name your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*K8qweN9q32QO3OS8Qwb6ww.png" /></figure><p>Add all your Swift files to the project and make sure any classes/methods meant to be accessed externally are declared public.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*gH5ZqgUmC_7z71lebcRdXQ.png" /></figure><p>Finally, make sure you have set “Build Active Architecture Only” to <strong>NO </strong>for the debug version:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0OJraQ9ImKFrEqkQHKMSrA.png" /></figure><h3>Now, make the framework universal</h3><p>Open up your command line, navigate to a directory where you can hold a temporary file, and enter (but don’t execute):</p><blockquote>$ lipo -create -output YOUR-FRAMEWORK-PROJECT-NAME</blockquote><p>Now, go back to your framework project and run it two times: once targeting a real device that you have connected to your computer, and once targeting a simulator. Then, under the “Products” folder, right click YOUR-FRAMEWORK-PROJECT-NAME.framework, and select “Show in Finder”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gUojiC8T7Oif7Ll4Wvjx3g.png" /></figure><p>You should see a directory structure that looks something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e8vncepAoScXOkeHVqvgTQ.png" /></figure><p>Right click on the executable file inside the <em>Debug-iphoneos </em>framework<em> </em>directory, hold down the <em>option</em> key, copy its path, and then paste it into the command line. Add a space, then do the same with the executable file inside the <em>Debug-iphonesimulator</em> framework directory.</p><p>Your command line should now look like this:</p><blockquote>$ lipo -create -output YOUR-FRAMEWORK-PROJECT-NAME REAL-DEVICE-EXECUTABLE-PATH-NAME SIMULATOR-EXECUTABLE-PATHNAME</blockquote><p>Now execute it! The result should be a new executable file in your designated directory. Delete the executable inside your <em>Debug-iphoneos </em>framework directory, and replace it with the one you just created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hU6R7MBJ6hCeQMBPqvbdTA.png" /></figure><p>Finally, drag the i386 and x86_64 slices from your <em>Debug-iphonesimulator</em> build into the .swiftmodule folder from the <em>Debug-iphoneos</em> directory. Your framework directory inside <em>Debug-iphoneos </em>is now universal!</p><h3>Finally, import the framework into a Swift project</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gcXSzmos7tmW40Fpqp2fqg.png" /></figure><p>To see for yourself, start a new Swift project, navigate to the “general” tab inside the project window, and drag your .framework directory into Embedded Binaries (select “Copy Items if Needed”).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*oqIZbFcElyTXfkC3TCBQnQ.png" /></figure><p>Now, simply import the framework, call its methods and classes anywhere in your code, and run it on a real device or a simulator!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7409bbfa18f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/wireless-registry-engineering/create-a-universal-fat-swift-framework-b7409bbfa18f">Create a Universal (Fat) Swift Framework</a> was originally published in <a href="https://medium.com/wireless-registry-engineering">Wireless Registry Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>