loog

llama3 70B Q4 By llamafile

July 06, 2024

llamafile を使用すれば、VRAMが足りない分をメモリで代替して、とりあえず動作してくれる。

手元の windows11 マシンがメモリを多めに積めそうなので、メモリを買い替えて 64GB にし、llama3 70B Q4 を動作させてみた。

$ ./llamafile.exe -m llama-3-70b-instruct.Q4_K_M.gguf

質問してみる

Mariadbの spacial インデックスが効果的なのは、どのようなクエリにたいして?

MariaDB’s spatial indexes are particularly effective for queries that involve spatial relationships or operations. Here are some examples of query types where a spatial index can shine:

1. Distance-based searches: When you need to find all points within a certain distance from a given location, such as “Find all restaurants within 5 kilometers of my current location.”
2. Intersection and overlap queries: Spatial indexes help when checking if two or more shapes intersect or overlap, like “Do these two polygons touch each other?”
3. Proximity searches with multiple points: When you need to find the closest point(s) from a set of reference points, such as “Find the 5 nearest hospitals to this accident location.”
4. Spatial joins and aggregations: Spatial indexes can speed up queries that involve joining or aggregating data based on spatial relationships, like “Count the number of customers within each sales region.”

To take advantage of MariaDB’s spatial indexing capabilities, you’ll want to create a SPATIAL index on columns containing geometric data types (e.g., POINT, LINESTRING, POLYGON). This allows the database to efficiently process queries that involve these spatial relationships.

Do you have any specific use cases or scenarios where you’re considering using spatial indexes in MariaDB? 🗺️💡assistant

回答を比較する

ちょっとかわいそうな気もしますが、Claude3.5 Sonnet との回答と比較してみます。

MariaDBのspatialインデックスは、以下のような空間データに関するクエリに対して特に効果的です。

  1. 範囲検索 (Range Query):指定された矩形領域内に存在するオブジェクトを検索するクエリ。
    例:ST_Contains(GeomFromText(‘POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))’), geom_col)
  2. 最近傍検索 (Nearest Neighbor Query):指定された地点から最も近いオブジェクトを検索するクエリ。
    例:ST_Distance(geom_col, Point(X, Y)) ORDER BY ST_Distance(geom_col, Point(X, Y)) LIMIT 1
  3. 空間結合 (Spatial Join):2つの地理空間データセット間の空間的な関係(交差、包含など)に基づいて結合するクエリ。
    例:SELECT * FROM table1, table2 WHERE ST_Intersects(table1.geom_col, table2.geom_col)
  4. 空間集約 (Spatial Aggregation):地理空間データに対して集約関数を適用するクエリ。
    例:SELECT ST_Union(geom_col) FROM table
  5. 空間関数を使用するクエリ:ST_Distance、ST_Intersects、ST_Containsなどの空間関数を使用するクエリ。

これらのクエリでは、spatialインデックスを使用することで、検索対象の範囲を効果的に絞り込むことができ、クエリのパフォーマンスが大幅に向上します。一方、等価条件(例:geom_col = ‘POINT(1 1)’)のみを使用するクエリでは、spatialインデックスの効果は限定的です。

速度について

print_timings: prompt eval time =   42944.02 ms /    93 tokens (  461.76 ms per token,     2.17 tokens per second)
print_timings:        eval time =  419835.37 ms /   269 runs   ( 1560.73 ms per token,     0.64 tokens per second)
print_timings:       total time =  462779.39 ms

という結果でした。