株式会社LOWWS CTOのスラヴィ・パンタレーブ(Slavi Pantaleev)にインタビューし、 現在携わっているプロジェクトの中で興味深い技術や最新の知見について聞いていくコーナーです。
今回は経費管理システムにどのAIを組み込むかの比較検証について聞きました。
This is an interview with Slavi Pantaleev, CTO of LOWWS Inc., where we explore interesting technologies and the latest insights from his current projects.
This time, we discussed a comparative evaluation of which AI to integrate into an expense management system.
The English article follows the Japanese article.
モデルごとの使い分けと精度比較
スラヴィ: このシステムにAIを使おうと決めたとき、最初に考えたのは、アメリカでの関税政策やトランプ前大統領の影響を受けた後の状況でした。 その流れの中で、アメリカ製品の使用に対して不安を感じているというネット上のコメントをたくさん見ました。それで私は、「OpenAIを使うよりも代替手段がいいのでは」と思い始めました。できればヨーロッパの企業の方が良いのでは、とも考えました。それで見つけたのが、フランスの企業 Mistral AI です。 最近、彼らがとても高性能なOCRモデルを持っているというニュースを見かけました。 プレスリリースによると、そのモデルはOpenAIのものよりも優れており、Googleの一部のモデルよりも良いということでした。 つまり、ヨーロッパ製という安心感だけでなく、コスト的にも性能的にも優れている可能性があったわけです。
最初はこのシステムにMistralを使おうと決めました。 試してみたのですが、残念ながらそこまで良くありませんでした。 少なくとも、プレスリリースで言われていたOCRモデルは、一般にはまだ利用できないようでした。 Mistralのパートナー企業や大企業であればアクセスできるかもしれませんが、通常は提供されていないようです。 使えるのは、もう少し古くて小規模なOCRモデルだけで、それがあまり良くありませんでした。 もうひとつの問題はライブラリです。 このシステムはPHPで書かれているのですが、Mistral向けのPHPライブラリはあまり良くありませんでした。 新機能に対応するためにライブラリを手動で修正しなければなりませんでした。 それでもなお、モデル自体の性能もそこまで高くはなかったので、「ヨーロッパ製AIには頼れないな」と思いました。
そこで次に考えたのが、Anthropicです。 OpenAIを試す前にAnthropicを試してみようと思いました。 Claude Sonnetは、少なくともコーディング用途においてはとても強力なモデルなので、分類やOCRなどでもOpenAIより優れているかもしれないと思ったのです。 Unpicを試してみたのですが、残念ながらこちらもライブラリがあまり良くありませんでした。新しいOCR機能に対応させるためにライブラリを修正しなければなりませんでした。 AIに求めることのひとつとして、以前話したように、JSON形式での構造化出力があります。 出力結果をコードに取り込み、データベースに保存したり、比較したり、さまざまな処理をしたいからです。 そのためには、構造化された出力が必要です。 「この請求書はこう見えます。サプライヤーは○○です」といった長文の説明は必要ありません。私たちが欲しいのは、コードで処理できる構造化データです。 Mistralにはそれが欠けていましたし、Anthropicにも同じ問題がありました。 構造化出力が欲しければ、プロンプトでその旨を伝えてください、と書いてあるだけです。 たとえば「このような出力にしてほしい」という例を送って、うまくいくことを祈るしかありません。しかし、OpenAIではそうではありません。 私がここでやっているように、例と一緒に出力形式に関するテキストの指示も送りますが、それだけではなく、JSONスキーマも指定しています。 リクエストと一緒にJSONスキーマを送ることで、モデルがそのスキーマに従って出力しなければならなくなります。 従わない場合はエラーが返ったり、再試行されたりします。 OpenAIはこの点をうまく解決していて、常に期待通りのフォーマットで出力してくれます。 これが、単にテキストだけを渡して「うまくいきますように」と祈る方式とは違う点です。 Anthropicでは、祈るしかありませんが、OpenAIではスキーマを渡せば、それに従って出力されるので、ずっと良いです。 モデルを比較すると、Mistralはテキストベースの請求書に関してはまずまずでした。 Unpicはもう少し良かったですが、ライブラリの面ではやはり問題がありました。 OpenAIはこの領域では別格です。 Googleのモデルも同等、もしくはさらに良いかもしれませんが、少なくともMistralやUnpicよりははるかに優れています。 これはライトな分析(軽量モード)の話ですが、ミディアムモード(中程度)に切り替えると、OpenAIは圧倒的になります。 さらに詳細な分析(インデプスモード)で01モデルを使用すれば、斜めだったりぼやけていたりするスキャンPDFでもきちんと解析できます。 この点は、現時点のAnthropicやMistral AIのモデルではまだできません。 Mistralがプレスリリースで発表したモデルは良いかもしれませんが、現実的にはまだ利用できないようです。 つまり、話としてはあるけれど、実際の運用には使えないということです。 そのため、最終的にはOpenAIを使うことに決めました。 Googleのモデルもおそらく良いと思いますが、このプロジェクトではまだ試していません。
OpenAIにはOCRモデルと非OCRモデルの両方があるので、用途に応じて使い分けることができます。 料金も変わってくるので、いくつか試行錯誤する必要があります。 たとえば、今回私はスキャン請求書をミディアムモデルで解析してみました。 いくつか結果が表示され、赤く表示されている部分は、経費の合計が請求書全体の金額と一致していませんでした。 つまり、何かが抜けているということです。 ミディアムモードでは完璧には処理できなかったということです。 なので、もう一度インデプスモードで再実行する必要があります。 このシステムはまだ実際の運用には使われていません。 お客様には好評で、「これは良さそうだ」と言ってもらえましたが、まだ実運用は始まっていません。 おそらく来週あたりからスタートする予定です。 なので、これはすべてかなり新しい内容で、過去1か月ほどで私が作業してきたものです。
Model Selection and Accuracy Comparison
Slavi: So this system—when I decided to use AI—it was in the context of changes in the US, like Donald Trump’s tariff policies. At that time, I saw a lot of people online expressing concerns about using US products. So I thought maybe it’s better not to use OpenAI, but to use an alternative—maybe even a European one. There’s a French company called Mistral AI. I recently read that they have a very powerful OCR model. According to the press release, it was much better than OpenAI’s and even some of Google’s models. So not only was it European—which helps reduce reliance on the US—but it also seemed cheaper and potentially more powerful.
At first, I planned to use Mistral for this system. I tried it, but unfortunately, it wasn’t that good. The OCR model mentioned in the press release isn’t publicly available. Maybe if you’re a partner or a large company you can get access, but otherwise, you only get an older, smaller model—which isn’t very good. Another issue was the libraries. This system is written in PHP, and the libraries for Mistral weren’t great for PHP. I had to make manual changes to support new features. Even then, the model wasn’t great. So I thought: we can’t rely on Europe for AI.
Then I considered Anthropic. Before trying OpenAI, I figured I’d try Anthropic. Claude Sonnet is quite a powerful model—at least for coding—so I thought maybe it would be better for classification, OCR, and similar tasks compared to OpenAI.
I tried Anthropic’s Unpic, but the libraries were also lacking. I had to modify the library to work with the new OCR features. Another important point with AI, as we discussed earlier with the AI settings, is that you need structured output—JSON output—so we can process it in code, insert it into a database, compare it, and so on. We don’t want the model to return text like, “This looks like a nice invoice. The supplier is…” We want structured output, not prose. This was something missing in Mistral, and also somewhat lacking in Anthropic. Their documentation basically says, “If you want structured output, just describe it in the prompt and hope for the best.” But that’s not how OpenAI does it. Here, I gave an example and text instructions for how the data should look. But that’s not all—we also send a JSON schema along with the request. The model is expected to comply with that schema. If it doesn’t, it either returns an error or retries. OpenAI figured this part out. The model always replies in the expected format. It’s much better than just sending text instructions and crossing your fingers. With Anthropic, you still have to hope for the best. But OpenAI handles it correctly using the schema. When comparing models: Mistral was okay for textual invoices. Unpic was a bit better—an upgrade—but the libraries were still weak. OpenAI is in another league for this use case. Google models might be comparable or even better, but I found OpenAI to be much stronger than Mistral or Unpic. And that’s just for lightweight analysis. If you go for medium analysis, using a larger OpenAI model, the results are dramatically better. In-depth analysis with the 01 model is even stronger—it can handle scanned PDFs that are crooked or blurry. That’s something neither Anthropic nor Mistral can do right now. Maybe the Mistral model mentioned in the press release is good, but it’s not accessible. So it’s just a talking point—it doesn’t exist for real-world use. That’s why I ended up using OpenAI. Google’s models are probably good too, but I haven’t tried them for this project.
It’s nice that OpenAI offers both OCR and non-OCR models, so you can mix and match depending on your needs. Pricing varies, so you have to experiment. For example, I analyzed a scanned invoice using the medium model. The results came in, and the expense total (highlighted in red) didn’t match the invoice total. That means something was missed. So the medium model didn’t perform perfectly, and I’d need to retry it with in-depth mode. The system hasn’t been used in production yet. The customer liked it—they think it will be great—but real usage is starting probably next week. This is all quite new and something I’ve worked on over the past month.
この記事はインタビューをもとにAIを使用して作成されています。 This article was created using AI based on interviews.