Pi Day 2026: Formulas, Series, and Plots for ฯ€

Introduction

  • Happy Pi Day! Today (3/14) we celebrate the most famous mathematical constant: ๐žน โ‰ˆ 3.141592653589793…
  • ๐žน is irrational and transcendental, appears in circles, waves, probability, physics, and random walks.
  • Wolfram Language (with its built-in ๐žน constant, excellent rational support, symbolic programming, and vast collection of Number Theory functions) makes experimenting with ๐žน especially easy and enjoyable.
  • In this document (notebook) we explore a selection of formulas and algorithms.

1. Continued fraction approximation

The built-in Wolfram Language (WL) constant Pi (or ฯ€ ) can be computed to an arbitrary high precision:

N[Pi, 60]
# 3.14159265358979323846264338327950288419716939937510582097494

Let us compare it with a continued fraction approximation. For example, using the (first) sequence line of On-line Encyclopedia of Integer Sequences (OEIS) A001203 produces ฯ€ with precision 100:

s = {3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, 1, 84, 2, 1, 1, 15, 3, 13, 1, 4, 2, 6, 6, 99, 1, 2, 2, 6, 3, 5, 1, 1, 6, 8, 1, 7, 1, 2, 3, 7, 1, 2, 1, 1, 12, 1, 1, 1, 3, 1, 1, 8, 1, 1, 2, 1, 6, 1, 1, 5, 2, 2, 3, 1, 2, 4, 4, 16, 1, 161, 45, 1, 22, 1,2, 2, 1, 4, 1, 2, 24, 1, 2, 1, 3, 1, 2, 1};
N[FromContinuedFraction[s], 120]
# 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706808656553677697242141

Here we verify the precision using Wolfram Language:

N[Pi, 200] - %
# -1.0441745026369011477*10^-100

More details can be found in Wolfram MathWorld page “Pi Continued Fraction” , [EW1].


2. Continued fraction terms plots

It is interesting to consider the plotting the terms of continued fraction terms of \pi .

First we ingest the more “pi-terms” from OEIS A001203 (20k terms):

terms = Partition[ToExpression /@ StringSplit[Import["https://oeis.org/A001203/b001203.txt"], Whitespace], 2][[All, 2]];
Length[terms]
# 20000

Here is the summary:

ResourceFunction["RecordsSummary"][terms]
1n16eusjlod5s

Here is an array plot of the first 128 terms of the continued fraction approximating \pi :

mat = IntegerDigits[terms[[1 ;; 128]], 2];
maxDigits = Max[Length /@ mat];
mat = Map[Join[Table[0, maxDigits - Length[#]], #] &, mat];
ArrayPlot[Transpose[mat], Mesh -> True, ImageSize -> 1000]
1oesdxgitoh1u

Next, we show the Pareto principle manifestation of for the continued fraction terms. First we observe that the terms a distribution similar to Benford’s law :

tallyPi = KeySort[AssociationThread @@ Transpose[Tally[terms]]][[1 ;; 16]]/Length[terms];
termsB = RandomVariate[BenfordDistribution[10], 2000];
tallyB = KeySort[AssociationThread @@ Transpose[Tally[termsB]]]/Length[termsB];
data = {tallyPi, tallyB};
data = KeySort /@ Map[KeyMap[ToExpression, #] &, data];
data2 = First /@ Values@Merge[{data[[1]], Join[AssociationThread[Keys[data[[1]]],Null], data[[2]]]}, List];
BarChart[data2,
PlotLabel -> "Pi continued fraction terms vs. Benford's law",
ChartLegends -> {"\[Pi]", "Belford's law"},
PlotTheme -> "Detailed", ImageSize -> Large]
1fyfg7jl5cjof

Here is the Pareto principle plot — โ‰ˆ5% of the unique term values correspond to โ‰ˆ80% of the terms:

ResourceFunction["ParetoPrinciplePlot"][
terms,
PlotLabel -> "Pareto principle for Pi continued fraction terms",
ImageSize -> Large]
1cq0xm0gz37sk

3. Classic Infinite Series

Many ways to express ฯ€ as an infinite sum — some converge slowly, others surprisingly fast.

Leibniz–Gregory series (1671/ Madhava earlier)

WL implementation:

PiLeibniz[n_Integer] := Block[{},
4*Total[Table[(-1)^i/(2 i + 1), {i, 0, n - 1}]]
]
N[PiLeibniz[1000], 20]
# 3.1405926538397929260

Verify with Wolfram Language (again):

N[Pi, 100] - N[PiLeibniz[1000], 1000]
# 0.000999999750000312499046880410106913745780068595381331607486808765908475046461390362862493334446861

Nilakantha series (faster convergence):

0293dofrmrlwe

WL:

PiNilakantha[n_Integer] := Block[{},
3 + 4*Total[Table[(-1)^(i + 1)/(2 i (2 i + 1) (2 i + 2)), {i, 1, n}]]
]
N[PiNilakantha[1000], 20]
# 3.1415926533405420519
N[Pi, 40] - N[PiNilakantha[1000], 40]
# 2.49251186562514647026299317045*10^-10

3. Beautiful Products

Wallis product (1655) — elegant infinite product:

1q0c5okxvywr4

WL running product:

 p = 2.0; 
   Do[
    p *= (2 n)^2/((2 n - 1) (2 n + 1)); 
    If[Divisible[n, 100], 
     Print[Row[{n, " -> ", p/\[Pi], " relative error"}]] 
    ], 
    {n, 1, 1000}]



| 100 | -> | 0.9975155394660373 | relative error |
| 200 | -> | 0.998753895533088 | relative error |
| 300 | -> | 0.9991683995999036 | relative error |
| 400 | -> | 0.9993759752213087 | relative error |
| 500 | -> | 0.9995006243131489 | relative error |
| 600 | -> | 0.9995837669635674 | relative error |
| 700 | -> | 0.9996431757700326 | relative error |
| 800 | -> | 0.9996877439728793 | relative error |
| 900 | -> | 0.9997224150056372 | relative error |
| 1000 | -> | 0.9997501561641055 | relative error |

4. Very Fast Modern Series — Chudnovsky Algorithm

One of the fastest-converging series used in record computations:

0b32wzezevyz0

Each term adds roughly 14 correct digits.


5. Spigot Algorithms — Digits “Drip” One by One

Spigot algorithms compute decimal digits using only integer arithmetic — no floating-point errors accumulate.

The classic Rabinowitz–Wagon spigot (based on a transformed Wallis product) produces base-10 digits sequentially.

Simple (but bounded) version outline in WL:

ClearAll[PiSpigotDigits, PiSpigotString];
PiSpigotDigits[n_Integer?Positive] :=
Module[{len, a, q, x, i, j, nines = 0, predigit = 0, digits = {}},
len = Quotient[10 n, 3] + 1;
a = ConstantArray[2, len];
For[j = 1, j <= n, j++, q = 0;
For[i = len, i >= 1, i--, x = 10 a[[i]] + q i;
a[[i]] = Mod[x, 2 i - 1];
q = Quotient[x, 2 i - 1];];
a[[1]] = Mod[q, 10];
q = Quotient[q, 10];
Which[
q == 9, nines++,
q == 10,
AppendTo[digits, predigit + 1];
digits = Join[digits, ConstantArray[0, nines]];
predigit = 0;
nines = 0,
True,
AppendTo[digits, predigit];
digits = Join[digits, ConstantArray[9, nines]];
predigit = q;
nines = 0];
];
AppendTo[digits, predigit];
Take[digits, n]
];
PiSpigotString[n_Integer?Positive] := Module[{d = PiSpigotDigits[n]}, ToString[d[[2]]] <> "." <> StringJoin[ToString /@ Rest[Rest[d]]]];
PiSpigotString[40]
# "3.14159265358979323846264338327950288419"
N[Pi, 100] - ToExpression[PiSpigotString[40]]
# 0.*10^-38

6. BBP Formula — Hex Digits Without Predecessors

Bailey–Borwein–Plouffe (1995) formula lets you compute the n-th hexadecimal digit of ฯ€ directly (without earlier digits):

Very popular for distributed ฯ€-hunting projects. The best known digit-extraction algorithm .

WL snippet for partial sum (base 16 sense):

ClearAll[BBPTerm, BBPPiPartial, BBPPi]
BBPTerm[k_Integer?NonNegative] := 16^-k (4/(8 k + 1) - 2/(8 k + 4) - 1/(8 k + 5) - 1/(8 k + 6));
BBPPiPartial[n_Integer?NonNegative] := Sum[BBPTerm[k], {k, 0, n}];
BBPPi[prec_Integer?Positive] :=
Module[{n},
n = Ceiling[prec/4] + 5;
N[BBPPiPartial[n], prec]
];
BBPPiPartial[10] // N[#, 20] &
# 3.1415926535897931296
BBPPi[50]
# 3.1415926535897932384626433745157614859702375522676

7. (Instead of) Conclusion

  • ฯ€ contains (almost surely) every finite sequence of digits — your birthday appears infinitely often.
  • The Feynman point : six consecutive 9s starting at digit 762.
  • Memorization world record > 100,000 digits.
  • ฯ€ appears in the normal distribution, quantum mechanics, random walks, Buffon’s needle problem (probability โ‰ˆ 2/ฯ€).

Let us plot a “random walk” using the terms of continued fraction of Pi — the 20k or OEIS A001203 — to determine directions:

ListLinePlot[Reverse /@ AnglePath[terms], PlotStyle -> (AbsoluteThickness[0.6]), ImageSize -> Large, Axes -> False]
0q6uxinid6l9a

Here is a bubble chart based on the path points and term values:

pathWithValues = Flatten /@ Thread[{Reverse /@ Rest[path], terms}];
gr = BubbleChart[pathWithValues, ChartStyle -> "DarkRainbow", AspectRatio -> Automatic, Frame -> False, Axes -> False, PlotTheme -> "Minimal"];
Rasterize[gr, ImageSize -> 900, ImageResolution -> 72]
0q5w8txmqf5en

Remark: The bubble sizes indicate that some of terms are fairly large, but the majority of them are relatively small.

Here is a 3D point plot with of moving average of the 3D path modified to have the logarithms of the term values:

pathWithValuesLog = MapAt[N@*Log10, pathWithValues, {All, 3}];
ListLinePlot3D[MovingAverage[pathWithValuesLog, 200], AspectRatio -> Automatic, PlotRange -> All, ImageSize -> Large, Ticks -> None]
1w4cc4bgx9odc

References

[EW1] Eric Weisstein, “Pi Continued Fraction” , Wolfram MathWorld .

Maze making using graphs

Introduction

This document (notebook) describes three ways of making mazes (or labyrinths) using graphs. The first two are based on rectangular grids; the third on a hexagonal grid.

All computational graph features discussed here are provided by the Graph functionalities of Wolfram Language.

TL;DR

Just see the maze pictures below. (And try to solve the mazes.)

Procedure outline

The first maze is made by a simple procedure which is actually some sort of cheating:

  • A regular rectangular grid graph is generated with random weights associated with its edges.
  • The (minimum) spanning tree for that graph is found.
  • That tree is plotted with exaggeratedly large vertices and edges, so the graph plot looks like a maze.
    • This is “the cheat” — the maze walls are not given by the graph.

The second maze is made “properly”:

  • Two interlacing regular rectangular grid graphs are created.
  • The second one has one less row and one less column than the first.
  • The vertex coordinates of the second graph are at the centers of the rectangles of the first graph.
  • The first graph provides the maze walls; the second graph is used to make paths through the maze.
    • In other words, to create a solvable maze.
  • Again, random weights are assigned to edges of the second graph, and a minimum spanning tree is found.
  • There is a convenient formula that allows using the spanning tree edges to remove edges from the first graph.
  • In that way, a proper maze is derived.

The third maze is again made “properly” using the procedure above with two modifications:

  • Two interlacing regular grid graphs are created: one over a hexagonal grid, the other over a triangular grid.
    • The hexagonal grid graph provides the maze walls; the triangular grid graph provides the maze paths.
  • Since the formula for wall removal is hard to derive, a more robust and universal method based on nearest neighbors is used.

Simple Maze

In this section, we create a simple, “cheating” maze.

Remark: The steps are easy to follow, given the procedure outlined in the introduction.

RandomSeed[3021];
{n, m} = {10, 25};
g = GridGraph[{n, m}];
gWeighted = Graph[VertexList[g], UndirectedEdge @@@ EdgeList[g], EdgeWeight -> RandomReal[{10, 1000}, EdgeCount[g]]];
Information[gWeighted]

0s0wsdfzitdzq

Find the spanning tree of the graph:

mazeTree = FindSpanningTree[gWeighted];

Shortest path from the first vertex (bottom-left) to the last vertex (top-right):

path = FindShortestPath[mazeTree, 1, n*m];
Length[path]

Out[]= 46

Graph plot:

simpleMaze = Graph[VertexList[mazeTree], EdgeList[mazeTree], VertexCoordinates -> GraphEmbedding[g]];
 simpleMaze2 = EdgeAdd[simpleMaze, {"start" -> 1, Max[VertexList[simpleMaze]] -> "end"}];
 Clear[vf1, ef1];
 vf1[col_?ColorQ][{xc_, yc_}, name_, {w_, h_}] := {col, EdgeForm[None],Rectangle[{xc - w, yc - h}, {xc + w, yc + h}]};
 ef1[col_?ColorQ][pts_List, e_] := {col, Opacity[1], AbsoluteThickness[22], Line[pts]};
 grCheat = GraphPlot[simpleMaze2, VertexSize -> 0.8, VertexShapeFunction -> vf1[White], EdgeShapeFunction -> ef1[White], Background -> DarkBlue, ImageSize -> 800, ImagePadding -> 0];
 range = MinMax /@ Transpose[Flatten[List @@@ Cases[grCheat, _Rectangle, \[Infinity]][[All, All]], 1]];
 Show[grCheat, PlotRange -> range]

1bc8vj9fmf5ro

The “maze” above looks like a maze because the vertices and edges are rectangular with matching sizes, and they are thicker than the spaces between them. In other words, we are cheating.

To make that cheating construction clearer, let us plot the shortest path from the bottom left to the top right and color the edges in pink (salmon) and the vertices in red:

gPath = PathGraph[path, VertexCoordinates -> GraphEmbedding[g][[path]]];
Legended[
   Show[
    grCheat, 
    Graph[gPath, VertexSize -> 0.7, VertexShapeFunction -> vf1[Red], EdgeShapeFunction -> ef1[Pink], Background -> DarkBlue, ImageSize -> 800, ImagePadding -> 0], 
    PlotRange -> range 
   ], 
   SwatchLegend[{Red, Pink, DarkBlue}, {"Shortest path vertices", "Shortest path edges", "Image background"}]]

1q29onggyuwcc

Proper Maze

proper maze is a maze given with its walls (not with the space between walls).

Remark: For didactical reasons, the maze in this section is small so that the steps—outlined in the introduction—can be easily followed.

Make two regular graphs: one for the maze walls and the other for the maze paths.

{n, m} = {6, 12};
g1 = GridGraph[{n, m}, VertexLabels -> "Name"];
g1 = VertexReplace[g1, Thread[VertexList[g1] -> Map[w @@ QuotientRemainder[# - 1, n] &, VertexList[g1]]]];
g2 = GridGraph[{n - 1, m - 1}];
g2 = VertexReplace[g2, Thread[VertexList[g2] -> Map[QuotientRemainder[# - 1, n - 1] &, VertexList[g2]]]];
g2 = Graph[g2, VertexLabels -> "Name", VertexCoordinates -> Map[# + {1, 1}/2 &, GraphEmbedding[g2]]];
Grid[{{"Wall graph", "Paths graph"}, {Information[g1], Information[g2]}}]

0t91asf2eugz2

See how the graph “interlace”:

(*Show[g1,HighlightGraph[g2,g2],ImageSize->800]*)

Maze Path Graph:

mazePath = Graph[EdgeList[g2], EdgeWeight -> RandomReal[{10, 10000}, EdgeCount[g2]]];
mazePath = FindSpanningTree[mazePath, VertexCoordinates -> Thread[VertexList[g2] -> GraphEmbedding[g2]]];
Information[mazePath]

0t91asf2eugz2

Combined Graph:

g3 = Graph[
     Join[EdgeList[g1], EdgeList[mazePath]], VertexCoordinates -> Join[Thread[VertexList[g1] -> GraphEmbedding[g1]], Thread[VertexList[mazePath] -> GraphEmbedding[mazePath]]], 
     VertexLabels -> "Name"];
Information[g3]

0mdi2hih68mqo

Plot the combined graph:

HighlightGraph[g3, mazePath, ImageSize -> 800]

1kndzl5jned4z

Remove wall edges using a formula:

g4 = Graph[g3, VertexLabels -> None]; 
  
Do[{i, j} = e[[1]]; 
      {i2, j2} = e[[2]]; 
      If[i2 < i || j2 < j, {{i2, j2}, {i, j}} = {{i, j}, {i2, j2}}]; 
      
     (*Horizontal*) 
      If[i == i2 && j < j2, 
       g4 = EdgeDelete[g4, UndirectedEdge[w[i2, j2], w[i2 + 1, j2]]] 
      ]; 
      
     (*Vertical*) 
      If[j == j2 && i < i2, 
       g4 = EdgeDelete[g4, UndirectedEdge[w[i2, j2], w[i2, j2 + 1]]] 
      ]; 
     , {e, EdgeList[mazePath]}]; 
  
Information[g4]

0s9eo0feadbo8

Plot wall graph and maze paths (maze space) graph:

HighlightGraph[g4, mazePath, ImageSize -> 800]

05ekkh85mpfro

Fancier maze presentation with rectangular vertices and edges (with matching sizes):

g5 = Subgraph[g4, VertexList[g1]];
g5 = VertexDelete[g5, {w[0, 0], w[m - 1, n - 1]}];
g6 = Graph[g5, VertexShapeFunction -> None, EdgeShapeFunction -> ({Opacity[1], DarkBlue, AbsoluteThickness[30], Line[#1]} &), ImageSize -> 800]

0arq97krotgni

Here is how a solution can found and plotted:

(*solution=FindPath[#,VertexList[#][[1]],VertexList[#][[-1]]]&@mazePath;
 Show[g6,HighlightGraph[Subgraph[mazePath,solution],Subgraph[mazePath,solution]]]*)

Here is a (more challenging to solve) maze generated with $n=12$ and $m=40$:

1tmgs2lmz563k

Hexagonal Version

Let us create another maze based on a hexagonal grid. Here are two grid graphs:

  • The first is a hexagonal grid graph representing the maze’s walls.
  • The second graph is a triangular grid graph with one fewer row and column, and shifted vertex coordinates.
{n, m} = {6, 14}*2; 
g1 = ResourceFunction["HexagonalGridGraph"][{m, n}]; 
g1 = VertexReplace[g1, Thread[VertexList[g1] -> (w[#1] & ) /@ VertexList[g1]]]; 
g2 = ResourceFunction["https://www.wolframcloud.com/obj/antononcube/DeployedResources/Function/TriangularLatticeGraph/"][{n - 1, m - 1}]; 
g2 = Graph[g2, VertexCoordinates -> (#1 + {Sqrt[3], 1} & ) /@ GraphEmbedding[g2]]; 
{Information[g1], Information[g2]}

0eyicaepipiwo
Show[g1, HighlightGraph[g2, g2], ImageSize -> 800]

0bfc3uk2c4uw3

Maze Path Graph:

mazePath = Graph[EdgeList[g2], EdgeWeight -> RandomReal[{10, 10000}, EdgeCount[g2]]];
 mazePath = FindSpanningTree[mazePath, VertexCoordinates -> Thread[VertexList[g2] -> GraphEmbedding[g2]]];
 Information[mazePath]

0937puga1ahjz

Combine the walls-maze and the maze-path graphs (i.e., make a union of them), and plot the resulting graph:

g3 = GraphUnion[g1, mazePath, VertexCoordinates -> Join[Thread[VertexList[g1] -> GraphEmbedding[g1]], Thread[VertexList[mazePath] -> GraphEmbedding[mazePath]]]];
 Information[g3]

1foiaesyk9d5s
HighlightGraph[g3, mazePath, ImageSize -> 800]

1t4t24o8zwj7p

Make a nearest neighbor points finder functor:

finder = Nearest[Thread[GraphEmbedding[g1] -> VertexList[g1]]]

045ypuvgpbrq4

Take a maze edge and its vertex points:

e = First@EdgeList[mazePath];
aMazePathCoords = Association@Thread[VertexList[mazePath] -> GraphEmbedding[mazePath]];
 points = List @@ (e /. aMazePathCoords)

17k4mshnxw0tf

Find the edge’s midpoint and the nearest wall-graph vertices:

Print["Middle edge point: ", Mean[points]]
Print["Edge to remove: ", UndirectedEdge @@ finder[Mean[points]]]

0b52fvogi84bf
1xlaj83jf90c6

Loop over all maze edges, removing wall-maze edges:

g4 = g1;
Do[
    points = Map[aMazePathCoords[#] &, List @@ e]; 
     m = Mean[points]; 
     vs = finder[m]; 
     g4 = EdgeDelete[g4, UndirectedEdge @@ vs]; 
    , {e, EdgeList[mazePath]}] 
  
Information[g4]

11uvhhgtj2da4

Here is the obtained graph

Show[g4, ImageSize -> 800]

0zih3bdnlu25c

The start and end points of the maze:

aVertexCoordinates = Association@Thread[VertexList[g4] -> GraphEmbedding[g4]];
{start, end} = Keys[Sort[aVertexCoordinates]][[{1, -1}]]

Out[]= {w[1], w[752]}

Finding the Maze Solution:

Out[]= Sequence[1, 240]

solution = FindShortestPath[mazePath, Sequence @@ Keys[Sort[aMazePathCoords]][[{1, -1}]]];
solution = PathGraph[solution, VertexCoordinates -> Lookup[aMazePathCoords, solution]];

Plot the maze:

g5 = Graph[g4, VertexShapeFunction -> None, EdgeShapeFunction -> ({Opacity[1], DarkBlue, AbsoluteThickness[8], Line[#1]} &), ImageSize -> 800];
g5 = VertexDelete[g5, {start, end}]

0lpxgk7luqu30

Here is the solution of the maze:

Show[g5, HighlightGraph[solution, solution]]


Additional Comments


References

Articles, Blog Posts

[AA1] Anton Antonov, “Day 24 — Maze Making Using Graphs”, (2025), Raku Advent Calendar at WordPress .

Functions

[AAf1] Anton Antonov, TriangularLatticeGraph, (2025), Wolfram Function Repository.

[EWf1] Eric Weisstein, TriangularGridGraph, (2020), Wolfram Function Repository.

[WRIf1] Wolfram Research, HexagonalGridGraph, (2020), Wolfram Function Repository.

Packages

[AAp1] Anton Antonov, Graph, Raku package , (2024–2025), GitHub/antononcube .

[AAp2] Anton Antonov, Math::Nearest, Raku package , (2024), GitHub/antononcube .

Numerically 2026 is unremarkable yet happy

… and has primitive roots

Introduction

This document (notebook) discusses number theory properties and relationships of the integer 2026.

The integer 2026 is semiprime and a happy number, with 365 as one of its primitive roots. Although 2026 may not be particularly noteworthy in number theory, this provides a great excuse to create various elaborate visualizations that reveal some interesting aspects of the number.

Setup

(*PacletInstall[AntonAntonov/NumberTheoryUtilities]*)
   Needs["AntonAntonov`NumberTheoryUtilities`"]

2026 Is a Happy Semiprime with Primitive Roots

First, 2026 is obviously not prime—it is divisible by 2 —but dividing it by 2 gives a prime, 1013:

PrimeQ[2026/2]

Out[]= True

Hence, 2026 is a semiprime . The integer 1013 is not a Gaussian prime , though:

PrimeQ[1013, GaussianIntegers -> True]

Out[]= False

happy number is a number for which iteratively summing the squares of its digits eventually reaches 1 (e.g., 13 -> 10 -> 1). Here is a check that 2026 is happy:

ResourceFunction["HappyNumberQ"][2026]

Out[]= True

Here is the corresponding trail of digit-square sums:

FixedPointList[Total[IntegerDigits[#]^2] &, 2026]

Out[]= {2026, 44, 32, 13, 10, 1, 1}

Not many years in this century are happy numbers:

Pick[Range[2000, 2100], ResourceFunction["HappyNumberQ"] /@ Range[2000, 2100]]

Out[]= {2003, 2008, 2019, 2026, 2030, 2036, 2039, 2062, 2063, 2080, 2091, 2093}

The decomposition of $2026$ as $2 * 1013$ means the multiplicative group modulo $2026$ has primitive roots. A primitive root exists for an integer $n$ if and only if $n$ is $1$, $2$,$4$, $p^k$ , or $2 p^k$ , where $k$ is an odd prime and $k>0$ .

We can check additional facts about 2026, such as whether it is “square-free” , among other properties. However, let us compare these with the feature-rich 2025 in the next section.

Comparison with 2025

Here is a side-by-side comparison of key number theory properties for 2025 and 2026.

Property20252026Notes
Prime or CompositeCompositeCompositeBoth non-prime.
Prime Factorization3^4 * 5^2 (81 * 25)2 * 10132025 has repeated small primes; 2026 is a semiprime (product of two distinct primes).
Number of Divisors15 (highly composite for its size)4 (1, 2, 1013, 2026)2025 has many divisors; 2026 has very few.
Perfect SquareYes (45^2 = 2025)NoMajor highlight for 2025—rare square year.
Sum of CubesYes (1^3 + 2^3 + … + 9^3 = (1 + … + 9)^2 = 2025)NoIconic property for 2025 (Nicomachus’s theorem).
Happy NumberNo (process leads to cycle including 4)Yes (repeated squared digit sums reach 1)Key point for 2026—its main “happy” trait.
Harshad NumberYes (divisible by 9)No (not divisible by 10)2025 qualifies; 2026 does not.
Primitive RootsNoYesThis is a relatively rare property to have.
Other Notable Traits{(20 + 25)^2 = 2025, Sum of first 45 odd numbers, Deficient number, Many pattern-based representations}{Even number, Deficient number, Few special patterns}2025 is packed with elegant properties; 2026 is more “plain” beyond being happy.
Overall “Interest” LevelHighly interesting—celebrated in math communities for squares, cubes, and patternsRelatively uninteresting—basic semiprime with no standout geometric or sum propertiesReinforces blog’s angle.

To summarize:

  • 2025ย stands out as a mathematically rich number, often highlighted in puzzles and articles for its perfect square status and connections to sums of cubes and odd numbers.
  • 2026ย , in contrast, has fewer flashy properties — it’s a straightforward even semiprime — but it qualifies as aย happy numberย and it has a primitive root.

Here is a computationally generated comparison table of most of the properties found in the table above:

Dataset@Map[<|"Function" -> #1, "2025" -> #1[2025], "2026" -> #1[2026]|> &, {PrimeQ, CompositeQ, Length@*Divisors, PrimeOmega, EulerPhi, SquareFreeQ, ResourceFunction["HappyNumberQ"],ResourceFunction["HarshadNumberQ"], ResourceFunction["DeficientNumberQ"], PrimitiveRoot}]

Function20252026
PrimeQFalseFalse
CompositeQTrueTrue
-Composition-154
PrimeOmega62
EulerPhi10801012
SquareFreeQFalseTrue
-ResourceFunction-FalseTrue
-ResourceFunction-TrueFalse
-ResourceFunction-TrueTrue
PrimitiveRoot-PrimitiveRoot-3

Phi Number System

Digits of 2026 represented in the Phi number system :

ResourceFunction["PhiNumberSystem"][2026]

Out[]= {15, 13, 10, 6, -6, -11, -16}

Verification:

Total[GoldenRatio^%] // RootReduce

Out[]= 2026

Happy Numbers Trail Graph

Let us create and plot a graph showing the trails of all happy numbers less than or equal to 2026. Below, we identify these numbers and their corresponding trails:

ns = Range[2, 2026];
 AbsoluteTiming[
   trails = Map[FixedPointList[Total[IntegerDigits[#]^2] &, #, 100, SameTest -> (Abs[#1 - #2] < 1*^-10 &)] &, ns]; 
  ]

Out[]= {0.293302, Null}

Here is the corresponding trails graph, highlighting the primes and happy numbers:

happy = First /@ Select[trails, #[[-1]] == 1 &];
 primeToo = Select[happy, PrimeQ];
 joyfulToo = Select[happy, ResourceFunction["HarshadNumberQ"]];
 aColors = Flatten@{Thread[primeToo -> ResourceFunction["HexToColor"]["#006400"]],2026 -> Blue, Thread[joyfulToo -> ResourceFunction["HexToColor"]["#fbb606ff"]], _ -> ResourceFunction["HexToColor"]["#B41E3A"]};
 edges = DeleteDuplicates@Flatten@Map[Rule @@@ Partition[Most[#], 2, 1] &, Select[trails, #[[-1]] == 1 &]];
 vf1[{xc_, yc_}, name_, {w_, h_}] := {(name /. aColors), EdgeForm[name /. aColors], Rectangle[{xc - 2 w, yc - h}, {xc + 2 w, yc + h}], Text[Style[name, 12, White], {xc, yc}]}
 vf2[{xc_, yc_}, name_, {w_, h_}] := {(name /. aColors), EdgeForm[name /. aColors], Disk[{xc, yc}, {2 w, h}], Text[Style[name, 12, White], {xc, yc}]} 
  
 gTrails = 
   Graph[
    edges, 
    VertexStyle -> ResourceFunction["HexToColor"]["#B41E3A"], VertexSize -> 1.8, 
    VertexShapeFunction -> vf2, 
    EdgeStyle -> Directive[ResourceFunction["HexToColor"]["#B41E3A"]], 
    EdgeShapeFunction -> ({ResourceFunction["HexToColor"]["#B41E3A"], Thick, BezierCurve[#1]} &), 
    DirectedEdges -> False, 
    GraphLayout -> "SpringEmbedding", 
    ImageSize -> 1200]

Triangular Numbers

There is a theorem by Gauss stating that any integer can be represented as a sum of at most three triangular numbers. Here we find an “interesting” solution:

sol = FindInstance[{2026 == PolygonalNumber[i] + PolygonalNumber[j] + PolygonalNumber[k], i > 10, j > 10, k > 10}, {i, j, k}, Integers]

Out[]= {{i -> 11, j -> 19, k -> 59}}

Here, we verify the result:

Total[PolygonalNumber /@ sol[[1, All, 2]]]

Out[]= 2026

Chord Diagrams

Here is the number of primitive roots of the multiplication group modulo 2026:

PrimitiveRootList[2026] // Length

Out[]= 440

Here are chord plots [AA2, AAp1, AAp2, AAv1] corresponding to a few selected primitive roots:

Row@Map[Labeled[ChordTrailsPlot[2026, #, PlotStyle -> {AbsoluteThickness[0.01]}, ImageSize -> 400], #] &, {339, 365, 1529}]

Remark: It is interesting that 365 (the number of days in a common calendar year) is a primitive root of the multiplicative group generated by 2026 . Not many years have this property this century; many do not have primitive roots at all.

Pick[Range[2000, 2100], Map[MemberQ[PrimitiveRootList[#], 365] &, Range[2000, 2100]]]

Out[]= {2003, 2026, 2039, 2053, 2063, 2078, 2089}

Quartic Graphs

The number 2026 appears in 18 results of the search “2026 graphs” in ยซThe On-line Encyclopedia of Integer Sequencesยป . Here is the first result (from 2025-12-17): A033483 , “Number of disconnected 4-valent (or quartic) graphs with n nodes.” Below, we retrieve properties from A033483’s page:

ResourceFunction["OEISSequenceData"]["A033483", "Dataset"][{"IDNumber","IDString", "Name", "Sequence", "Offset"}]

IDNumberIDStringNameSequenceOffset
33483A033483Number of disconnected 4-valent (or quartic) graphs with n nodes.{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 3, 8, 25, 88, 378, 2026, 13351, 104595, 930586, 9124662, 96699987, …}0

Here, we just get the title:

ResourceFunction["OEISSequenceData"]["A033483", "Name"]

Out[]= "Number of disconnected 4-valent (or quartic) graphs with n nodes."

Here, we get the corresponding sequence:

seq = ResourceFunction["OEISSequenceData"]["A033483", "Sequence"]

Out[]= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 3, 8, 25, 88, 378, 2026, 13351, 104595, 930586, 9124662, 96699987, 1095469608, 13175272208, 167460699184, 2241578965849, 31510542635443, 464047929509794, 7143991172244290, 114749135506381940, 1919658575933845129, 33393712487076999918, 603152722419661386031}

Here we find the position of 2026 in that sequence:

Position[seq, 2026]

Out[]= {{18}}

Given the title of the sequence and the extracted position of $2026$ , this means that the number of disconnected 4-regular graphs with 17 vertices is $2026$. ($17$ because the sequence offset is $0$.) Let us create a few graphs from that set by using the 5-vertex complete graph $\left(K_5\right.$) and circulant graphs . Here is an example of such a graph:

g1 = Fold[GraphUnion, CompleteGraph[5], {IndexGraph[CompleteGraph[5], 6], IndexGraph[CirculantGraph[7, {1, 2}], 11]}];
GraphPlot[g1, VertexLabels -> "Name", PlotTheme -> "Web", ImagePadding -> 10]

And here is another one:

g2 = GraphUnion[CirculantGraph[12, {1, 5}], IndexGraph[CompleteGraph[5], 13]];
GraphPlot[g1, VertexLabels -> "Name", PlotTheme -> "Web", ImagePadding -> 10]

Here, we check that all vertices have degree 4:

Mean@VertexDegree[g2]

Out[]= 4

Remark: Note that although the plots show disjoint graphs, each graph plot represents a single graph object.

Additional Comments

This section has a few additional (leftover) comments.

  • After I researched and published the blog postย “Numeric properties of 2025”ย , [AA1], in the first few days of 2025, I decided to program additionalย Number theory functionalities for Rakuย — see the packageย “Math::NumberTheory”ย , [AAp1].
  • Number theory provides many opportunities for visualizations, so I included utilities for some of the popular patterns in “Math::NumberTheory”, [AAp1] andย “NumberTheoryUtilities”.
  • The number of years in this century that have primitive roots and have 365 as a primitive root is less than the number of years that are happy numbers.
  • I would say I spent too much time finding a good, suitable, Christmas-themed combination of colors for the trails graph.

References

Articles, blog posts

[AA1] Anton Antonov, “Numeric properties of 2025” , (2025), RakuForPrediction at WordPress .

[AA2] Anton Antonov, “Primitive roots generation trails” , (2025), MathematicaForPrediction at WordPress .

[AA3] Anton Antonov, “Chatbook New Magic Cells” , (2024), RakuForPrediction at WordPress .

[EW1] Eric W. Weisstein, “Quartic Graph” . From MathWorld–A Wolfram Resource .

Notebooks

[AAn1] Anton Antonov, “Primitive roots generation trails” , (2025), Wolfram Community . STAFFPICKS, April 9, 2025โ€‹.

[EPn1] Ed Pegg, “Happy 2025 =1ยณ+2ยณ+3ยณ+4ยณ+5ยณ+6ยณ+7ยณ+8ยณ+9ยณ!” , โ€‹Wolfram Community , STAFFPICKS, December 30, 2024โ€‹.

Functions, packages, paclets

[AAp1] Anton Antonov, Math::NumberTheory, Raku package , (2025), GitHub/antononcube .

[AAp2] Anton Antonov, NumberTheoryUtilities, Wolfram Language paclet , (2025), Wolfram Language Paclet Repository .

[AAp3] Anton Antonov, JavaScript::D3, Raku package , (2021-2025), GitHub/antononcube .

[AAp4] Anton Antonov, Graph, Raku package , (2024-2025), GitHub/antononcube .

[JFf1] Jesse Friedman, OEISSequenceData, (2019-2024), Wolfram Function Repository.

[MSf1] Michael Solami, HexToColor, (2020), Wolfram Function Repository.

[SHf1] Sander Huisman, HappyNumberQ, (2019), Wolfram Function Repository.

[SHf2] Sander Huisman, HarshadNumberQ, (2023), Wolfram Function Repository.

[WAf1] Wolfram|Alpha Math Team, DeficientNumberQ, (2020-2023), Wolfram Function Repository.

Videos

[AAv1] Anton Antonov, Number theory neat examples in Raku (Set 3) , (2025), YouTube/@AAA4prediction .

Robust code generation combining grammars and LLMs

Introduction

This document (notebook) discusses different combinations of Grammar-Based Parser-Interpreters (GBPI) and Large Language Models (LLMs) to generate executable code from Natural Language Computational Specifications (NLCM). We have theย softย assumption that the NLCS adhere to a certain relatively small Domain Specific Language (DSL) or use terminology from that DSL. Another assumption is that the target software packages are not necessarily well-known by the LLMs, i.e. direct LLM requests for code using them would produce meaningless results.

We want to do such combinations because:

  • GBPI are fast, precise, but with a narrow DSL scope
  • LLMs can be unreliable and slow, but with a wide DSL scope

Because of GBPI and LLMs are complementary technologies with similar and overlapping goals the possible combinations are many. We concentrate on two of the most straightforward designs: (1) judged parallel race of methods execution, and (2) using LLMs as a fallback method if grammar parsing fails. We show asynchronous programmingimplementations for both designs using the Wolfram Language function LLMGraph.

The Machine Learning (ML) paclet “MonadicSparseMatrixRecommender” is used to demonstrate that the generated code is executable.

The rest of the document is structured as follows:

  • Initial grammar-LLM combinations
    • Assumptions, straightforward designs, and trade-offs
  • Comprehensive combinations enumeration (attempt)
    • Tabular and morphological analysis breakdown
  • Three methods for parsing ML DSL specs into Raku code
    • One grammar-based, two LLM-based
  • Parallel execution with an LLM judge
    • Straightforward, but computationally wasteful and expensive
  • Grammar-to-LLM fallback mechanism
    • The easiest and most robust solution
  • Concluding comments and observations

TL;DR

  • Combining grammars and LLMs produces robust translators.
  • Three translators with different faithfulness and coverage are demonstrated and used.
  • Two of the simplest, yet effective, combinations are implemented and demonstrated.
    • Parallel race and grammar-to-LLM fallback.
  • Asynchronous implementations with LLM-graphs are a very good fit!
    • Just look at the LLM-graph plots (and be done reading.)

Initial Combinations and Associated Assumptions

The goal is to combine grammar-based parser-interpreters with LLMs in order to achieve robust parsing and interpretation of computational workflow specifications.

Here are some example combinations of these approaches:

  1. A few methods, both grammar-based and LLM-based, are initiated in parallel. Whichever method produces a correct result first is selected as the answer.
    • This approach assumes that when the grammar-based methods are effective, they will finish more quickly than the LLM-based methods.
  2. The grammar method is invoked first; if it fails, an LLM method (or a sequence of LLM methods) is employed.
  3. LLMs are utilized at the grammar-rule level to provide matching objects that the grammar can work with.
  4. If the grammar method fails, an LLM normalizer for user commands is invoked to generate specifications that the grammar can parse.
  5. It is important to distinguish between declarative specifications and those that prescribe specific steps.
    • For a workflow given as a list of steps the grammar parser may successfully parse most steps, but LLMs may be required for a few exceptions.

The main trade-off in these approaches is as follows:

  • Grammar methods are challenging to develop but can be very fast and precise.
    • Precision can be guaranteed and rigorously tested.
  • LLM methods are quicker to develop but tend to be slower and can be unreliable, particularly for less popular workflows, programming languages, and packages.

Also, combinations based on LLM tools (aka LLM external function calling) are not considered because LLM-tools invocation is too unpredictable and unreliable.

Comprehensive breakdown (attempt)

This section has a “concise” table that expands the combinations list above into the main combinatorial strategies for Grammar *** LLMs** for robust parsing and interpretation of workflow specifications. The table is not an exhaustive list of such combinations, but illustrates their diversity and, hopefully, can give ideas for future developments.

A few summary points (for table’s content/subject):

  • Grammar (Raku regex/grammar)
    • Pros:ย fast, deterministic, validated, reproducible
    • Cons:ย hard to design for large domains, brittle for natural language inputs
  • LLMs
    • Pros:ย fast to prototype, excellent at normalization/paraphrasing, flexible
    • Cons:ย slow, occasionally wrong, hallucination risk, inconsistent output formats
  • Conclusion:
    • The most robust systems combineย grammar precisionย withย LLM adaptabilityย , typically by putting grammars first and using LLMs for repair, normalization, expansions, or semantic interpretation (i.e. “fallback”.)

Table: Combination Patterns for Parsing Workflow Specifications

tbl = Dataset[{<|"ID" -> 1, "CombinationPattern" -> "Parallel Race: Grammar + LLM", "Description" -> "Launch grammar-based parsing and one or more LLM interpreters in parallel; whichever yields a valid parse first is accepted.", "Pros" -> {"Fast when grammar succeeds", "Robust fallback", "Reduces latency unpredictability of LLMs"}, "ConsTradeoffs" -> {"Requires orchestration", "Need a validator for LLM output"}|>, <|"ID" -> 2, "CombinationPattern" -> "Grammar-First, LLM-Fallback", "Description" -> "Try grammar parser first; if it fails, invoke LLM-based parsing or normalization.", "Pros" -> {"Deterministic preference for grammar", "Testable correctness when grammar succeeds"}, "ConsTradeoffs" -> {"LLM fallback may produce inconsistent structures"}|>, <|"ID" -> 3, "CombinationPattern" -> "LLM-Assisted Grammar (Rule-Level)", "Description" -> "Individual grammar rules delegate to an LLM for ambiguous or context-heavy matching; LLM supplies tokens or AST fragments.", "Pros" -> {"Handles complexity without inflating grammar", "Modular LLM usage"}, "ConsTradeoffs" -> {"LLM behavior may break rule determinism", "Harder to reproduce"}|>, <|"ID" -> 4, "CombinationPattern" -> "LLM Normalizer -> Grammar Parser", "Description" -> "When grammar fails, LLM rewrites/normalizes input into a canonical form; grammar is applied again.", "Pros" -> {"Grammar remains simple", "Leverages LLM skill at paraphrasing"}, "ConsTradeoffs" -> {"Quality depends on normalizer", "Feedback loops possible"}|>, <|"ID" -> 5, "CombinationPattern" -> "Hybrid Declarative vs Procedural Parsing", "Description" -> "Grammar extracts structural/declarative parts; LLM interprets procedural/stepwise parts or vice versa.", "Pros" -> {"Each subsystem tackles what it's best at", "Reduces grammar complexity"}, "ConsTradeoffs" -> {"Harder to maintain global consistency", "Requires AST stitching logic"}|>, <|"ID" -> 6, "CombinationPattern" -> "Grammar-Generated Tests for LLM", "Description" -> "Grammar used to generate examples and counterexamples; LLM outputs are validated against grammar constraints.", "Pros" -> {"Powerful for verifying LLM outputs", "Reduces hallucinations"}, "ConsTradeoffs" -> {"Grammar must encode constraints richly", "Validation pipeline required"}|>, <|"ID" -> 7, "CombinationPattern" -> "LLM as Adaptive Heuristic for Grammar Ambiguities", "Description" -> "When grammar yields multiple parses, LLM chooses or ranks the \"most plausible\" AST.", "Pros" -> {"Improves disambiguation", "Good for underspecified workflows"}, "ConsTradeoffs" -> {"LLM can pick syntactically impossible interpretations"}|>, <|"ID" -> 8, "CombinationPattern" -> "LLM as Semantic Phase After Grammar", "Description" -> "Grammar creates an AST; LLM interprets semantics, fills in missing steps, or resolves vague ops.", "Pros" -> {"Clean separation of syntax vs semantics", "Grammar ensures correctness"}, "ConsTradeoffs" -> {"Semantic interpretation may drift from syntax"}|>, <|"ID" -> 9, "CombinationPattern" -> "Self-Healing Parse Loop", "Description" -> "Grammar fails -> LLM proposes corrections -> grammar retries -> if still failing, LLM creates full AST.","Pros" -> {"Iterative and robust", "Captures user intent progressively"}, "ConsTradeoffs" -> {"More expensive; risk of oscillation"}|>, <|"ID" -> 10, "CombinationPattern" -> "Grammar Embedding Inside Prompt Templates", "Description" -> "Grammar definitions serialized into the prompt, guiding the LLM to conform to the grammar (soft constraints).", "Pros" -> {"Faster than grammar execution in some cases", "Encourages consistent structure"}, "ConsTradeoffs" -> {"Weak guarantees", "LLM may ignore grammar"}|>, <|"ID" -> 11, "CombinationPattern" -> "LLM-Driven Grammar Induction or Refinement", "Description" -> "LLM suggests new grammar rules or transformations; developer approves; the grammar evolves over time.", "Pros" -> {"Faster grammar evolution", "Useful for new workflow languages"}, "ConsTradeoffs" -> {"Requires human QA", "Risk of regressing accuracy"}|>, <|"ID" -> 12, "CombinationPattern" -> "Regex Engine as LLM Guardrail", "Description" -> "Regex or token rules used to validate or filter LLM results before accepting them.", "Pros" -> {"Lightweight constraints", "Useful for quick prototyping"}, "ConsTradeoffs" -> {"Regex too weak for complex syntax"}|>}]; 
  
 tbl = tbl[All, KeyDrop[#, "ID"] &];
 tbl = tbl[All, ReplacePart[#, "Pros" -> ColumnForm[#Pros]] &];
 tbl = tbl[All, ReplacePart[#, "ConsTradeoffs" -> ColumnForm[#ConsTradeoffs]] &];
 tbl = tbl[All, Style[#, FontFamily -> "Times New Roman"] & /@ # &];
 ResourceFunction["GridTableForm"][tbl]

#CombinationPatternDescriptionProsConsTradeoffs
1Parallel Race: Grammar + LLMLaunch grammar-based parsing and one or more LLM interpreters in parallel; whichever yields a valid parse first is accepted.{{Fast when grammar succeeds}, {Robust fallback}, {Reduces latency unpredictability of LLMs}}{{Requires orchestration}, {Need a validator for LLM output}}
2Grammar-First, LLM-FallbackTry grammar parser first; if it fails, invoke LLM-based parsing or normalization.{{Deterministic preference for grammar}, {Testable correctness when grammar succeeds}}{{LLM fallback may produce inconsistent structures}}
3LLM-Assisted Grammar (Rule-Level)Individual grammar rules delegate to an LLM for ambiguous or context-heavy matching; LLM supplies tokens or AST fragments.{{Handles complexity without inflating grammar}, {Modular LLM usage}}{{LLM behavior may break rule determinism}, {Harder to reproduce}}
4LLM Normalizer -> Grammar ParserWhen grammar fails, LLM rewrites/normalizes input into a canonical form; grammar is applied again.{{Grammar remains simple}, {Leverages LLM skill at paraphrasing}}{{Quality depends on normalizer}, {Feedback loops possible}}
5Hybrid Declarative vs Procedural ParsingGrammar extracts structural/declarative parts; LLM interprets procedural/stepwise parts or vice versa.{{Each subsystem tackles what it’s best at}, {Reduces grammar complexity}}{{Harder to maintain global consistency}, {Requires AST stitching logic}}
6Grammar-Generated Tests for LLMGrammar used to generate examples and counterexamples; LLM outputs are validated against grammar constraints.{{Powerful for verifying LLM outputs}, {Reduces hallucinations}}{{Grammar must encode constraints richly}, {Validation pipeline required}}
7LLM as Adaptive Heuristic for Grammar AmbiguitiesWhen grammar yields multiple parses, LLM chooses or ranks the “most plausible” AST.{{Improves disambiguation}, {Good for underspecified workflows}}{{LLM can pick syntactically impossible interpretations}}
8LLM as Semantic Phase After GrammarGrammar creates an AST; LLM interprets semantics, fills in missing steps, or resolves vague ops.{{Clean separation of syntax vs semantics}, {Grammar ensures correctness}}{{Semantic interpretation may drift from syntax}}
9Self-Healing Parse LoopGrammar fails -> LLM proposes corrections -> grammar retries -> if still failing, LLM creates full AST.{{Iterative and robust}, {Captures user intent progressively}}{{More expensive; risk of oscillation}}
10Grammar Embedding Inside Prompt TemplatesGrammar definitions serialized into the prompt, guiding the LLM to conform to the grammar (soft constraints).{{Faster than grammar execution in some cases}, {Encourages consistent structure}}{{Weak guarantees}, {LLM may ignore grammar}}
11LLM-Driven Grammar Induction or RefinementLLM suggests new grammar rules or transformations; developer approves; the grammar evolves over time.{{Faster grammar evolution}, {Useful for new workflow languages}}{{Requires human QA}, {Risk of regressing accuracy}}
12Regex Engine as LLM GuardrailRegex or token rules used to validate or filter LLM results before accepting them.{{Lightweight constraints}, {Useful for quick prototyping}}{{Regex too weak for complex syntax}}

Diversity reasons

  • The diversity of combinations in the table above arises because Raku grammars and LLMs occupy fundamentally different but highly complementary positions in the parsing spectrum.
  • Raku grammars provide determinism, speed, verifiability, and structural guarantees, but they require upfront design and struggle with ambiguity, informal input, and evolving specifications.
  • LLMs, in contrast, excel at normalization, semantic interpretation, ambiguity resolution, and adapting to fluid or poorly defined languages, yet they lack determinism, may hallucinate, and are slower.
  • When these two technologies meet, every architectural choice —ย who handles syntax, who handles semantics, who runs first, who validates whom, who repairs or refinesย — defines a distinct strategy.
  • Hence, the design space naturally expands into many valid hybrid patterns rather than a single “best” pipeline.
  • That said, the fallback pattern implemented below can be considered the “best option” from certain development perspectives because it is simple, effective, and has fast execution times.

See the corresponding Morphological Analysis table which correspond to this taxonomy mind-map:

Setup

Here are the packages used in this document (notebook):

Needs["AntonAntonov`DSLTranslation`"];
Needs["AntonAntonov`NLPTemplateEngine`"];
Needs["AntonAntonov`DSLExamples`"];
Needs["AntonAntonov`MermaidJS`"];
Needs["AntonAntonov`MonadicSparseMatrixRecommender`"];

Three DSL translations

This section demonstrates the use of three different translation methods:

  1. Grammar-based parser-interpreter of computational workflows
  2. LLM-based translator using few-shot learning with relevant DSL examples
  3. Natural Language Processing (NLP) interpreter using code templates and LLMs to fill-in the corresponding parameters

The translators are ordered according of their faithfulness, most faithful first. It can be said that at the same time, the translators are ordered according to their coverage — widest coverage is by the last.

Grammar-based

Here a recommender pipeline specified with natural language commands is translated into Raku code of the package “ML::SparseMatrixRecommender” using a sub of the paclet “DSLTranslation”:

spec = "create from dsData; apply LSI functions IDF, None, Cosine; recommend by profile for passengerSex:male, and passengerClass:1st; join across using dsData; echo the pipeline value";

DSLTranslation[spec, "WLCode" -> True]

Out[]= SMRMonUnit[]==>SMRMonCreate[dsData]==>SMRMonApplyTermWeightFunctions["GlobalWeightFunction" -> "IDF", "LocalWeightFunction" -> "None", "NormalizerFunction" -> "Cosine"]==>SMRMonRecommendByProfile[{"passengerSex:male", "passengerClass:1st"}]==>SMRMonJoinAcross[dsData]==>SMRMonEchoValue[]

The function DSLTranslation uses a web service by default but if Raku and the package “DSL::Translators” are installed it can use the provided Command Line Interface (CLI):

DSLTranslation[spec, "Source" -> "Shell", "CLIPath" -> "~/.rakubrew/shims/dsl-translation"]

Out[]= SMRMonUnit[]==>SMRMonCreate[dsData]==>SMRMonApplyTermWeightFunctions["GlobalWeightFunction" -> "IDF", "LocalWeightFunction" -> "None", "NormalizerFunction" -> "Cosine"]==>SMRMonRecommendByProfile[{"passengerSex:male", "passengerClass:1st"}]==>SMRMonJoinAcross[dsData]==>SMRMonEchoValue[]

For more details of the grammar-based approach see the presentations:

Via LLM examples

LLM translations can be done using a set of from-to rules. This is the so-called few shot learning of LLMs. The paclet “DSLExamples” has a collection of such examples for different computational workflows. (Mostly ML at this point.) The examples are hierarchically organized by programming language and workflow name; see the resource file “dsl-examples.json”, or execute DSLExamples[].

Here is a table that shows the known DSL translation examples in “DSL::Examples” :

Dataset[Map[Flatten, List @@@ Normal[ResourceFunction["AssociationKeyFlatten"][Map[Length, DSLExamples[], {2}]]]]][All, AssociationThread[{"Language", "Workflow", "Count"}, #] &]

LanguageWorkflowCount
WLClCon20
WLQRMon27
WLLSAMon17
WLSMRMon20
PythonQRMon23
PythonLSAMon15
PythonSMRMon20
RQRMon26
RLSAMon17
RSMRMon20
RakuSMRMon20

Here is the definition of an LLM translation function that uses examples:

LLMPipelineSegment[lang_String : "WL", workflow_String : "SMRMon"] := LLMExampleFunction[Normal@DSLExamples[lang, workflow]];

Here is a recommender pipeline specified with natural language commands:

spec = "new recommender; create from @dsData;  apply LSI functions IDF, None, Cosine;  recommend by profile for passengerSex:male, and passengerClass:1st; join across with @dsData on \"id\"; echo the pipeline value; classify by profile passengerSex:female, and passengerClass:1st on the tag passengerSurvival; echo value";

commands = StringSplit[spec, ""];

Translate to WL code line-by-line:

res = LLMPipelineSegment[] /@ commands; res = Map[StringTrim@StringReplace[#, RegularExpression["Output\h*:"] -> ""] &, res];
 res = StringRiffle[res, "==>"]

Out[]= "SMRMonUnit[]==>SMRMonCreate[dsData]==>SMRMonApplyTermWeightFunctions[\"IDF\", \"None\", \"Cosine\"]==>SMRMonRecommendByProfile[{\"passengerSex.male\", \"passengerClass.1st\"}]==>SMRMonJoinAcross[@dsData, \"id\"]==>SMRMonEchoValue[]==>SMRMonClassify[\"passengerSurvival\", {\"passengerSex.female\", \"passengerClass.1st\"}]==>SMRMonEchoValue[]"

Or translate by just calling the function over the whole $spec :

LLMPipelineSegment[][spec]

Out[]= "```wolframSMRMonUnit[] |> SMRMonCreate[dsData] |> SMRMonApplyTermWeightFunctions[\"IDF\", \"None\", \"Cosine\"] |> SMRMonRecommendByProfile[{\"passengerSex\" -> \"male\", \"passengerClass\" -> \"1st\"}] |> SMRMonJoinAcross[dsData, \"id\"] |> SMRMonEchoValue[] |> SMRMonClassify[\"passengerSurvival\", {\"passengerSex\" -> \"female\", \"passengerClass\" -> \"1st\"}] |> SMRMonEchoValue[]```"

Remark: That latter call is faster, but it needs additional processing for “monadic” workflows.

By NLP Template Engine

Here a “free text” recommender pipeline specification is translated to Raku code using the sub concretize of the package “ML::NLPTemplateEngine” :

Concretize["create a recommender with dfTitanic; apply the LSI functions IDF, None, Cosine; recommend by profile 1st and male"]

Out[]= Hold[smrObj = SMRMonUnit[]==>SMRMonCreate[None]==>SMRMonRecommendByProfile[{"1st", "male"}, profile]==>SMRMonJoinAcross[None]==>SMRMonEchoValue[];]

The paclet “NLPTemplateEngine” uses a Question Answering System (QAS) implemented in FindTextualAnswer. A QAS can be implemented in different ways, with different conceptual and computation complexity. “NLPTemplateEngine” also has an LLM based implementation of QAS, LLMTextualAnswer. (Also see the resource function with the same name.)

For more details of the NLP template engine approach see the presentations:

Parallel race (judged): Grammar + LLM

In this section we implement the first, most obvious, and conceptually simplest combination of grammar-based- with LLM-based translations:

  • All translators — grammar-based and LLM-based are run in parallel
  • An LLM judge selects the one that adheres best to the given specification

The implementation of this strategy with an LLM graph (say, by using LLMGraph) is straightforward.

Here is such an LLM graph that:

  • Runs all three translation methods above
  • There is a judge that picks which on of the LLM methods produced better result
  • Judge’s output is used to make (and launch) a notebook report
LLMPipelineSegmentFunction[lang_ : "WL", worflowName_String : "SMRMon"] := LLMExampleFunction[Normal@DSLExamples[][lang][worflowName]];

aLangSeparator = <| "Python" -> ".", "Raku" -> ".", "R" -> "%>%", "WL" -> "==>" |>;

Clear[LLMExamplesTranslation];
 LLMExamplesTranslation[spec_, lang_ : "WL", worflowName_String : "SMRMon", splitQ_ : False] := 
    Module[{llmPipelineSegment, commands}, 
     
     llmPipelineSegment = LLMPipelineSegmentFunction[lang]; 
     
     If[TrueQ@splitQ, 
      Echo["with spec splitting..."]; 
      commands = StringSplit[spec, ""]; 
      StringRiffle[StringTrim@StringReplace[llmPipelineSegment /@ commands, StartOfString ~~ "Output" ~~ ___ ~~ ":" -> ""], aLangSeparator[lang]], 
     (*ELSE*) 
      Echo["no spec splitting..."]; 
      StringReplace[llmPipelineSegment[spec], ";" -> aLangSeparator[lang], Infinity] 
     ] 
    ];

JudgeFunction[spec_, lang_, dslGrammar_, llmExamples_, nlpTemplateEngine_] := 
    StringRiffle[{
      "Choose the generated code that most fully adheres to the spec:", 
      spec, 
      "from the following " <> lang <> " generation results:", "1) DSL-grammar:" <> dslGrammar <> "", 
      "2) LLM-examples:" <> llmExamples <> "", 
      "3) NLP-template-engine:" <> nlpTemplateEngine <> "", 
      "and copy it:" 
     }, 
     "" 
    ];

(*JudgeFunction[`spec`,`lang`,`dslGrammar`,`llmExamples`,`nlpTemplateEngine`]*)

tmplJudge = StringTemplate["Choose the generated code that most fully adheres to the spec:\\n\\n\\n`spec`\\n\\n\\nfrom the following `lang` generation results:\\n\\n\\n1) DSL-grammar:\\n`dslGrammar`\\n\\n\\n2) LLM-examples:\\n`llmExamples`\\n\\n\\n3) NLP-template-engine:\\n`nlpTemplateEngine`\\n\\n\\nand copy it:"]

1sk1d044my02q
JudgementReport[spec_, lang_, dslGrammar_, llmExamples_, nlpTemplateEngine_, judge_] := 
    Module[{names, codes, rows, tableHTML, judgementBlock}, 
     names = {"dsl-grammar", "llm-examples", "nlp-template-engine"}; 
     codes = {dslGrammar, llmExamples, nlpTemplateEngine}; 
     rows = MapThread[<|"name" -> #1, "code" -> #2|> &, {names, codes}];
    (*WL analogue of to-html(...,field-names=> <name code>)*) 
     tableHTML = Dataset[rows]; 
     judgementBlock = If[StringContainsQ[judge, "```"], judge, "```" <> lang <> "" <> judge <> "```"]; 
     CreateDocument[{
       TextCell["Best generated code", "Section"], 
       TextCell["Three " <> lang <> " code generations were submitted for the spec:", "Text"], 
       TextCell[spec, "Program"], 
       TextCell["Here are the results:", "Text"], 
       ExpressionCell[tableHTML, "Output"], 
       TextCell["Judgement", "Subsection"], 
       TextCell[judgementBlock, "Output"] 
      }] 
    ];

Rules for parallel race:

rules = <|
     "dslGrammar" -> <|"EvaluationFunction" -> (DSLTranslation[#spec, "ToLanguage" -> #lang, "WLCode" -> False, "Format" -> "CODE"] &), "Input" -> {"spec", "lang"}|>, 
     "llmExamples" -> <|"EvaluationFunction" -> (LLMExamplesTranslation[#spec, #lang, "SMRMon", #split] &), "Input" -> {"spec", "lang", "split"}|>,
     "nlpTemplateEngine" -> <|"EvaluationFunction" -> (Concretize[#spec, "TargetLanguage" -> #lang] &), "Input" -> {"spec", "lang"}|>,
    (*judge-><|EvaluationFunction->(judgeFunction[#spec,#lang,#dslGrammar,#llmExamples,#nlpTemplateEngine]&)|>,*) 
     "judge" -> tmplJudge, 
     "report" -> <|"EvaluationFunction" -> (JudgementReport[#spec, #lang, #dslGrammar, #llmExamples, #nlpTemplateEngine, #judge] &)|> 
    |>;

Corresponding LLM-graph construction:

gBestCode = LLMGraph[rules]

1l626dkgaymsq

Here is a recommender workflow specification:

spec = " make a brand new recommender with the data @dsData; apply LSI functions IDF, None, Cosine;  recommend by profile for passengerSex:male, and passengerClass:1st; join across with @dsData on \"id\"; echo the pipeline value; ";

Here the graph is executed:

res = gBestCode[<|"spec" -> spec, "lang" -> "R", "split" -> True|>];

Here is a screenshot of the LLM-graph result:

LLM-graph visualization

Information[gBestCode, "Graph"]

For details on LLM-graphs design see the video:

Fallback: DSL-grammar to LLM-examples

Instead of having DSL-grammar- and LLM computations running in parallel, we can make an LLM-graph in which the LLM computations are invoked if the DSL-grammar parsing-and-interpretation fails. In this section we make such a graph.

Before making the graph let us also generalize it to work with other ML workflows, not just recommendations.

Let us make an LLM function with a similar functionality. I.e. an LLM-function that classifies a natural language computation specification into workflow labels used by “DSLExamples”. Here is such a function using the sub LLMClassify provided by “NLPTemplateEngine”:

lsMLLabels = {"Classification", "Latent Semantic Analysis", "Quantile Regression", "Recommendations"}; 
  
 aWorlflowMonNames = <|
       "Classification" -> "ClCon", 
       "Latent Semantic Analysis" -> "LSAMon", 
       "Quantile Regression" -> "QRMon", 
       "Recommendations" -> "SMRMon" 
     |>; 
  
 LLMWorkflowClassify[spec_] := Module[{res = LLMClassify[spec, lsMLLabels, "Request" -> "which of these workflows characterizes it (just one label)"]}, 
     Lookup[aWorlflowMonNames, res, res] 
   ]

(* Example invocation *)
 (*LLMWorkflowClassify[spec]*)

Remark: The paclet “NLPTemplateEngine” has (1) a pre-trained ML workflows classifier, and (2) a separate, generic LLM-based classifier.

Rules for fallback execution:

TranslationSuccessQ[s_] := StringQ[s] && StringLength[StringTrim[s]] > 5;
 rules = <|
     "DSLGrammar" -> <|"EvaluationFunction" -> (DSLTranslation[#spec, "ToLanguage" -> #lang, "WLCode" -> False, "Format" -> "CODE"] &), "Input" -> {"spec", "lang"}|>, 
     "WorkflowName" -> <|"EvaluationFunction" -> (LLMWorkflowClassify[#spec] &)|>, 
     "LLMExamples" -> <|
       "EvaluationFunction" -> (LLMExamplesTranslation[#spec, #lang, #WorkflowName, #split] &), 
       "Input" -> {"spec", "lang", "WorkflowName", "split"}, 
       "TestFunction" -> (! TranslationSuccessQ[#DSLGrammar] &)|>, 
     "Code" -> <|"EvaluationFunction" -> (If[TranslationSuccessQ[#DSLGrammar], #DSLGrammar, #LLMExamples] &)|> 
    |>;

Corresponding LLM-graph construction:

gRobust = LLMGraph[rules]

Here the LLM graph is run over a spec that can be parsed by DSL-grammar (notice the very short computation time):

Here is the obtained result:

Here is a spec that cannot be parsed by the DSL-grammar interpreter — note that there is just a small language change in the first line:

spec = " create from @dsData;  apply LSI functions IDF, None, Cosine;  recommend by profile for passengerSex:male, and passengerClass:1st; join across with @dsData on \"id\"; echo the pipeline value; ";

Nevertheless, we obtain a correct result via LLM-examples:

res = gRobust[<|"spec" -> spec, "lang" -> "R", "split" -> True|>]

Out[]= "SMRMonCreate(data = @dsData) %>%SMRMonApplyTermWeightFunctions(globalWeightFunction = \"IDF\", localWeightFunction = \"None\", normalizerFunction = \"Cosine\") %>%SMRMonRecommendByProfile( profile = c(\"passengerSex:male\", \"passengerClass:1st\")) %>%SMRMonJoinAcross( data = @dsData, by = \"id\" ) %>%SMRMonEchoValue()"

Here is the corresponding graph plot:

Information[gRobust, "Graph"]

Let us specify another workflow — for ML-classification with Wolfram Language — and run the graph:

spec = " use the dataset @dsData; split the data into training and testing parts with 0.8 ratio; make a nearest neighbors classifier; show classifier accuracy, precision, and recall; echo the pipeline value; ";

res = gRobust[<|"spec" -> spec, "lang" -> "WL", "split" -> True|>]

Out[]= "SMRMonUse[dsData]==>SMRMonSplitData[0.8]==>SMRMonMakeClassifier[\"NearestNeighbors\"]==>SMRMonClassifierMeasurements[\"Accuracy\", \"Precision\", \"Recall\"]==>SMRMonEchoValue[]"

Concluding comments and observations

  • Using LLM graphs gives the ability to impose desired orchestration and collaboration between deterministic programs and LLMs.
    • By contrast, the “inversion of control” of LLM – tools is “capricious.”
  • LLM-graphs are both a generalization of LLM-tools, and a lower level infrastructural functionality than LLM-tools.
  • The LLM-graph for the parallel-race translation is very similar to the LLM-graph for comprehensive document summarization described in [AA4].
  • The expectation that DSL examples would provide both fast and faithful results is mostly confirmed in โ‰ˆ20 experiments.
  • Using the NLP template engine is also fast because LLMs are harnessed through QAS.
  • The DSL examples translation had to be completed with a workflow classifier.
    • Such classifiers are also part of the implementations of the other two approaches .
    • The grammar – based one uses a deterministic classifier, [AA1]
    • The NLP template engine uses an LLM classifier .
  • An interesting extension of the current work is to have a grammar-LLM combination in which when the grammar fails then the LLM “normalizes” the specs until the grammar can parse them.
    • Currently, LLMGraph does not support graphs with cycles, hence this approach “can wait” (or be implemented by other means .)
  • Multiple DSL examples can be efficiently derived by random sentence generation with different grammars.
    • Similar to the DSL commands classifier making approach taken in [AA1] .
  • LLMs can be also used to improve and extend the DSL grammars.
    • And it is interesting to consider automating that process, instead of doing it via human supervision.
  • This notebook is the Wolfram Language version of the documentย “Day 6 — Robust code generation combining grammars andย LLMs”, [AA6], (notebook), using Raku.

References

Articles, blog posts

[AA1] Anton Antonov, “Fast and compact classifier of DSL commands” , (2022), RakuForPrediction at WordPress .

[AA2] Anton Antonov, “Grammar based random sentences generation, Part 1” , (2023), RakuForPrediction at WordPress .

[AA3] Anton Antonov, “LLM::Graph” , (2025), RakuForPrediction at WordPress .

[AA4] Anton Antonov, “Agentic-AI for text summarization” , (2025), RakuForPrediction at WordPress .

[AA5] Anton Antonov, “LLM::Graph plots interpretation guide” , (2025), RakuForPrediction at WordPress .

[AA6] Anton Antonov, “Day 6 — Robust code generation combining grammars and LLMs”, (2025), Raku Advent Calendar at WordPress.

Packages

[AAp1] Anton Antonov, DSL::Translators, Raku package , (2020-2025), GitHub/antononcube .

[AAp2] Anton Antonov, ML::FindTextualAnswer, Raku package , (2023-2025), GitHub/antononcube .

[AAp3] Anton Antonov, MLP::NLPTemplateEngine, Raku package , (2023-2025), GitHub/antononcube .

[AAp4] Anton Antonov, DSL::Examples, Raku package , (2024-2025), GitHub/antononcube .

[AAp5] Anton Antonov, LLM::Graph, Raku package , (2025), GitHub/antononcube .

[AAp6] Anton Antonov, ML::SparseMatrixRecommender, Raku package , (2025), GitHub/antononcube .

Videos

[AAv1] Anton Antonov, “Raku for Prediction presentation at The Raku Conference 2021”, (2021), YouTube/@AAA4prediction .

[AAv2] Anton Antonov, “Simplified Machine Learning Workflows Overview”, (2022), YouTube/@WolframResearch .

[AAv3] Anton Antonov, “NLP Template Engine, Part 1” , (2021), YouTube/@AAA4prediction .

[AAv4] Anton Antonov, “Natural Language Processing Template Engine” , (2023), YouTube/@WolframResearch .

[WRIv1] Wolfram Research, Inc., “Live CEOing Ep 886: Design Review of LLMGraph” , (2025), YouTube/@WolframResearch .

Primitive roots generation trails

Introduction

In this blog post (notebook) we show how to make neat chord plots of primitive roots generation sequences.ย Primitive rootsย a generators of cyclicย multiplicative integer groups moduloย . See the built-in Wolfram Language functionsย PrimitiveRootย andย PrimitiveRootList. We follow the ideas presented inย โ€œModular Arithmetic Visualizationsโ€ย byย Peter Karpov.

Remark: The basis representation section follows “Re-exploring the structure of Chinese character images”, [AAn1]; the movie exporting section follows โ€œRorschach mask animations projected over 3D surfacesโ€, [AAn2].

Remark: The motivation for finding and making nice primary root trails came from on working on Number theory neat examples discussed in [AAv1, AAv2].

Procedure outline

  1. Try to figure out neat examples to visualize primitive roots.
    1. Browse Wolfram Demonstrations.
    2. Search World Wide Web.
  2. Program a few versions of circle chords based visualization routines.
    1. Called chord trail plots below.
  3. Marvel at chord trail plots for larger moduli.
    1. Make multiple collections of them.
    2. Look into number of primitive roots distributions.
  4. Consider making animations of the collections.
    1. The animations should not be โ€œchaoticโ€ — they should have some inherent visual flow in them.
  5. Consider different ways of sorting chord trail plots.
    1. Using number theoretic arguments.
      1. Yeah, would be nice, but requires too much head scratching and LLM-ing.
    2. Convert plots to images and sort them.
      1. Some might say that that is a โ€œbrute forceโ€ application.
      2. Simple image sort does not work.
  6. Latent Semantic Analysis (LSA) application.
    1. After failing to sort the chord trail image collections by โ€œsimpleโ€ means, the idea applying LSA came to mind.
    2. LSA being, of course, a favorite technique that was applied to sorting images multiple times in the past, in different contexts, [AAn1, AAn3, AAn4, AAn5, AAv3].
    3. Also, having a nice (monadic) paclet for doing LSA, [AAp1], helps a lot.
  7. Make the animations and marvel at them.
  8. Export the chord trail plots animations for different moduli to movies and GIFs and upload them.
  9. Make a blog post (notebook).

Chord plot

It is fairly easy to program a chord plot using Graph:

(* Modulus and primivite root*)
n = 509; r = 128; 
(* Coordinates of the chords plot*)
coords = AssociationThread[Range[n], Table[{Cos[2 Pi k/(n - 1) + Pi/2], Sin[2 Pi k/(n - 1) + Pi/2]}, {k, 0, n - 1}]]; 
(* Graph edges *) 
edges = UndirectedEdge @@@ Partition[PowerMod[r, #, n] & /@ Range[n], 2, 1]; 
(*Graph*) 
Graph[edges, VertexCoordinates -> coords, VertexSize -> 0, EdgeStyle -> AbsoluteThickness[0.6]]

0ja9nttj7gvy9

We make the function ChordTrailsGraph (see Section โ€œSetupโ€ below) encapsulating the code above. Here is an example:

ChordTrailsGraph[509, 47, EdgeStyle -> {AbsoluteThickness[0.8`]}, 
 VertexSize -> 0, VertexStyle -> EdgeForm[None], 
 EdgeStyle -> RGBColor[0.6093762755665056`, 0.7055193578067459`, 0.8512829338493225`]]

0w93mw9n87rvn

Instead of using Graph we can just a Graphics plot — again see the definition in โ€œSetupโ€. Here is an example:

ChordTrails[509, 75, "Color" -> Automatic]

05fw4gbxvzil3

Note that the modular inverse is going to produce the same chord trails plot:

Row[{
   ChordTrails[257, 3, ImageSize -> 300], 
   ChordTrails[257, ModularInverse[3, 257], ImageSize -> 300] 
  }]

0ir0c5f83rko2

Making collections of plots

Here w pick a large enough modulus, we find the primitive roots, and keep only primitive roots that will produce unique chord trail plots:

n = 509;
rs = PrimitiveRootList[n];
Length[rs]
urs = Select[rs, # <= ModularInverse[#, n] &];
urs // Length

(*252*)

(*126*)

Here is the collection using Graph:

AbsoluteTiming[
  gs1 = Association@
      Map[# ->
          ChordTrailsGraph[n, #, EdgeStyle -> {AbsoluteThickness[0.8]},
            VertexSize -> 0, VertexStyle -> EdgeForm[None],
            EdgeStyle -> RGBColor[0.6093762755665056, 0.7055193578067459, 0.8512829338493225],
            ImageSize -> 300] &, urs];
]

(*{0.771692, Null}*)

Here is a sample of plots from the collection:

KeyTake[gs1, {2, 48, 69}]

1aa33rtlvkbnh

Here is the collection using Graphics:

AbsoluteTiming[
  gs2 = Association@Map[# -> ChordTrails[n, #, ImageSize -> 300] &, urs]; 
 ]

(*{1.13483, Null}*)

Here is a sample of plots from the collection (same indexes as above):

KeyTake[gs2, {2, 48, 69}]

1qeiu9fz57as7

Remark: It looks like that using Graph is faster and produces (admittedly, with tweaking options) better looking plots.

Since we want to make an animation of chord-trail plots, we convert the collection of plots into a collection of images:

AbsoluteTiming[
  imgs = Map[Rasterize[#, "Image", RasterSize -> 500, ImageSize -> 600] &, gs2]; 
 ]

(*{15.5664, Null}*)


Generalization

The function ChordTrails can be generalized to take a (pre-computed) chords argument. Here is an example of chords plot that connects integers that are modular inverses of each other:

m = 4000;
chords = Map[If[NumericQ@Quiet@ModularInverse[#, m], {#, ModularInverse[#, m]},Nothing] &, Range[m]];
ChordTrails[m, chords, PlotStyle -> AbsoluteThickness[0.01], ImageSize -> 400]

03q03q9hobjx5

LSAMon application

In order to sort the plots we find dimension reduction basis representation of the corresponding images and sort using that representation. For more details see โ€œRe-exploring the structure of Chinese character imagesโ€, [AAn1].

Clear[ImagePreProcessing, ImageToVector];
ImagePreProcessing[img_Image] := ColorNegate@Binarize[img, 0.9];
ImageToVector[img_Image] := Flatten[ImageData[ImagePreProcessing[img]]];
ImageToVector[img_Image, imgSize_] := Flatten[ImageData[ColorConvert[ImageResize[img, imgSize], "Grayscale"]]];
ImageToVector[___] := $Failed;

aCImages = imgs;

AbsoluteTiming[aCImageVecs = ParallelMap[ImageToVector, aCImages];]

(*{0.184429, Null}*)

SeedRandom[32];
MatrixPlot[Partition[#, ImageDimensions[aCImages[[1]]][[2]]]] & /@ RandomSample[aCImageVecs, 3]

1tavxw8a8s8c7
mat = ToSSparseMatrix[SparseArray[Values@aCImageVecs], "RowNames" -> Map[ToString, Keys[aCImageVecs]], "ColumnNames" -> Automatic]

1wjcl3g3a3wd5
SeedRandom[777];
AbsoluteTiming[
  lsaAllObj = 
    LSAMonUnit[]โŸน
     LSAMonSetDocumentTermMatrix[mat]โŸน
     LSAMonApplyTermWeightFunctions["None", "None", "Cosine"]โŸน
     LSAMonExtractTopics["NumberOfTopics" -> 120, Method -> "SVD", "MaxSteps" -> 15, "MinNumberOfDocumentsPerTerm" -> 0]โŸน
     LSAMonNormalizeMatrixProduct[Normalized -> Right]; 
 ]

(*{7.56445, Null}*)

In case you want to see the basis (we show just a sample):

lsaAllObjโŸน
   LSAMonEcho[Style["Sample of the obtained basis:", Bold, Purple]]โŸน
   LSAMonEchoFunctionContext[ImageAdjust[Image[Partition[#, ImageDimensions[aCImages[[1]]][[1]]], ImageSize -> Tiny]] & /@ SparseArray[#H[[{2, 11, 60}, All]]] &];

0vmbr8ahsrf68
1s2uag61bl0wu
W2 = lsaAllObjโŸนLSAMonNormalizeMatrixProduct[Normalized -> Right]โŸนLSAMonTakeW;
Dimensions[W2]

(*{126, 120}*)

H = lsaAllObjโŸนLSAMonNormalizeMatrixProduct[Normalized -> Right]โŸนLSAMonTakeH;
Dimensions[H]

(*{120, 250000}*)

AbsoluteTiming[lsClusters = FindClusters[Normal[SparseArray[W2]] -> RowNames[W2], 40, Method -> {"KMeans"}];]
Length@lsClusters
ResourceFunction["RecordsSummary"][Length /@ lsClusters]

(*{0.2576, Null}*)

(*40*)

0i5ilivzw0nl5
matPixels = WeightTermsOfSSparseMatrix[lsaAllObjโŸนLSAMonTakeWeightedDocumentTermMatrix, "IDF", "None", "Cosine"];
matTopics = WeightTermsOfSSparseMatrix[lsaAllObjโŸนLSAMonNormalizeMatrixProduct[Normalized -> Left]โŸนLSAMonTakeW, "None", "None", "Cosine"];

SeedRandom[33];
ind = RandomChoice[Keys[aCImages]];
imgTest = ImagePreProcessing@aCImages[ind];
matImageTest = ToSSparseMatrix[SparseArray@List@ImageToVector[imgTest, ImageDimensions[aCImages[[1]]]], "RowNames" -> Automatic, "ColumnNames" -> Automatic];
(*imgTest*)

H = lsaAllObjโŸนLSAMonNormalizeMatrixProduct[Normalized -> Right]โŸนLSAMonTakeH;
lsBasis = ImageAdjust[Image[Partition[#, ImageDimensions[aCImages[[1]]][[1]]]]] & /@ SparseArray[H];

matReprsentation = lsaAllObjโŸนLSAMonRepresentByTopics[matImageTest]โŸนLSAMonTakeValue;
lsCoeff = Normal@SparseArray[matReprsentation[[1, All]]];
ListPlot[MapIndexed[Tooltip[#1, lsBasis[[#2[[1]]]]] &, lsCoeff], Filling -> Axis, PlotRange -> All]

vecReprsentation = lsCoeff . SparseArray[H];
reprImg = Image[Unitize@Clip[#, {0.45, 1}, {0, 1}] &@Rescale[Partition[vecReprsentation, ImageDimensions[aCImages[[1]]][[1]]]]];
GridTableForm[Binarize@Show[#, ImageSize -> 350] & /@ {imgTest, reprImg}, TableHeadings -> {"Test", "Approximated"}]

19gvpmjp7dx8d
W = lsaAllObjโŸนLSAMonNormalizeMatrixProduct[Normalized -> Left]โŸนLSAMonTakeW;
Dimensions[W]

(*{126, 120}*)

aWVecs = KeyMap[ToExpression, AssociationThread[RowNames[W], Normal[SparseArray[W]]]];

ListPlot[Values@aWVecs[[1 ;; 3]], Filling -> Axis, PlotRange -> All]

0ajyn6ixlitgd
aWVecs2 = Sort[aWVecs];

aWVecs3 = aWVecs[[Ordering[Values@aWVecs]]];

Animate sorted

Here we make the animation of sorted chord trail plots:

ListAnimate[Join[Values[KeyTake[gs, Keys[aWVecs3]]], Reverse@Values[KeyTake[gs, Keys[aWVecs3]]]], DefaultDuration -> 24]

Playing the link to an uploaded movie:

Video["https://www.wolframcloud.com/obj/25b58db2-16f0-4148-9498-d73062387ebb"]


Export

Remark: The code below follows “Rorschach mask animations projected over 3D surfaces”.

Remark: The animations are exported in the subdirectory โ€œAnimatedGIFsโ€.

Export to MP4 (white background)

lsExportImgs = Join[Values[KeyTake[imgs, Keys[aWVecs2]]], Reverse@Values[KeyTake[imgs, Keys[aWVecs2]]]];

AbsoluteTiming[
  Export[FileNameJoin[{NotebookDirectory[], "AnimatedGIFs", "PrimitiveRoots-" <> ToString[n] <> ".mp4"}], lsExportImgs, "MP4","DisplayDurations" -> 0.05]; 
 ]

Export to GIF (black background)

AbsoluteTiming[
  lsExportImgs2 = ColorNegate[ImageEffect[#, "Decolorization"]] & /@ Values[KeyTake[imgs, Keys[aWVecs2]]]; 
 ]

lsExportImgs2 = Join[lsExportImgs2, Reverse@lsExportImgs2];
lsExportImgs2 // Length

lsExportImgs2[[12]]

AbsoluteTiming[
  Export[FileNameJoin[{NotebookDirectory[], "AnimatedGIFs", "PrimitiveRoots-" <> ToString[n] <> ".gif"}], lsExportImgs2, "GIF", "AnimationRepetitions" -> Infinity, "DisplayDurations" -> 0.05]; 
 ]

Optionally, open the animations directory:

(*FileNameJoin[{NotebookDirectory[],"AnimatedGIFs"}]//SystemOpen*)


Setup

Load paclets

Needs["AntonAntonov`SSparseMatrix`"];
Needs["AntonAntonov`MonadicLatentSemanticAnalysis`"];
Needs["AntonAntonov`MonadicSparseMatrixRecommender`"];
Needs["AntonAntonov`OutlierIdentifiers`"];
Needs["AntonAntonov`DataReshapers`"];

Chord plots definitions

Clear[ChordTrailsGraph];
Options[ChordTrailsGraph] = Options[Graph];
ChordTrailsGraph[n_Integer, r_Integer, opts : OptionsPattern[]] := 
   Block[{coords, edges, g}, 
    coords = AssociationThread[Range[n], Table[{Cos[2 Pi k/(n - 1) + Pi/2], Sin[2 Pi k/(n - 1) + Pi/2]}, {k, 0, n - 1}]]; 
    edges = UndirectedEdge @@@ Partition[PowerMod[r, #, n] & /@ Range[n], 2, 1]; 
    g = Graph[edges, opts, VertexCoordinates -> coords]; 
    g 
   ];

Clear[ChordTrails];
Options[ChordTrails] = Join[{"Color" -> RGBColor[0.4659039108257499, 0.5977704831063181, 0.7964303267504351], PlotStyle -> {}}, Options[Graphics]];
ChordTrails[n_Integer, r_Integer, opts : OptionsPattern[]] :=
  Block[{chords},
   chords = Partition[PowerMod[r, #, n] & /@ Range[n], 2, 1];
   ChordTrails[n, chords, opts]
  ];
ChordTrails[n_Integer, chordsArg : {{_?IntegerQ, _?IntegerQ} ..}, opts : OptionsPattern[]] :=
  Block[{chords = chordsArg, color, plotStyle, coords},
   
   color = OptionValue[ChordTrails, "Color"];
   If[TrueQ[color === Automatic], 
    color = RGBColor[
     0.4659039108257499, 0.5977704831063181, 0.7964303267504351]];
   plotStyle = OptionValue[ChordTrails, PlotStyle];
   If[TrueQ[plotStyle === Automatic], plotStyle = {}];
   plotStyle = Flatten[{plotStyle}];
   
   coords = 
    AssociationThread[Range[n], 
     Table[{Cos[2 Pi k/(n - 1) + Pi/2], Sin[2 Pi k/(n - 1) + Pi/2]}, {k, 0, n - 1}]];
   chords = chords /. {i_Integer :> coords[[i]]};
   Which[
    ColorQ[color],
    Graphics[{Sequence @@ plotStyle, color, Line[chords]}, 
     FilterRules[{opts}, Options[Graphics]]],
    TrueQ[Head[color] === ColorDataFunction],
    Graphics[{Sequence @@ plotStyle, 
      MapIndexed[{color[#2[[1]]/Length[chords]], Line[#1]} &, chords]},
      FilterRules[{opts}, Options[Graphics]]],
    True,
    Echo["Unknown color spec.", "GroupClassChords:"];
    $Failed
    ]
   ];

References

Articles, posts

[PK1] Peter Karpov, “Modular Arithmetic Visualizations”, (2016), Inversed.ru.

Notebooks

[AAn1] Anton Antonov, โ€œRe-exploring the structure of Chinese character imagesโ€, (2022), Wolfram Community.

[AAn2] Anton Antonov,  โ€œRorschach mask animations projected over 3D surfacesโ€, (2022), Wolfram Community.

[AAn3] Anton Antonov, “Handwritten Arabic characters classifiers comparison”, (2022), Wolfram Community.

[AAn4] Anton Antonov, “LSA methods comparison over random mandalas deconstruction — WL”, (2022), Wolfram Community.

[AAn5] Anton Antonov, “LSA methods comparison over random mandalas deconstruction — Python”, (2022), Wolfram Community.

Paclets

[AAp1] Anton Antonov, “MonadicLatentSemanticAnalysis”, (2023), Wolfram Language Paclet Repository.

Videos

[AAv1] Anton Antonov, “Number theory neat examples in Raku (Set 1)”, (2025), YouTube/@AAA4prediction.

[AAv2] Anton Antonov, “Number theory neat examples in Raku (Set 2)โ€, (2025), YouTube/@AAA4prediction.

[AAv3] Anton Antonov, “Random Mandalas Deconstruction in R, Python, and Mathematica (Greater Boston useR Meetup, Feb 2022)”, (2022), YouTube/@AAA4prediction.

Doomsday clock parsing and plotting

Introduction

The Doomsday Clock is a symbolic timepiece maintained by the Bulletin of the Atomic Scientists (BAS) since 1947. It represents how close humanity is perceived to be to global catastrophe, primarily nuclear war but also including climate change and biological threats. The clockโ€™s hands are set annually to reflect the current state of global security; midnight signifies theoretical doomsday.

In this notebook we consider two tasks:

  • Parsing of Doomsday Clock reading statements
  • Evolution of Doomsday Clock times
    • We extract relevant Doomsday Clock timeline data from the corresponding Wikipedia page.
      • (Instead of using a page from BAS.)
    • We show how timeline data from that Wikipedia page can be processed with โ€œstandardโ€ Wolfram Language (WL) functions and with LLMs.
    • The result plot shows the evolution of the minutes to midnight.
      • The plot could show trends, highlighting significant global events that influenced the clock setting.
      • Hence, we put in informative callouts and tooltips.

The data extraction and visualization in the notebook serve educational purposes or provide insights into historical trends of global threats as perceived by experts. We try to make the ingestion and processing code universal and robust, suitable for multiple evaluations now or in the (near) future.

Remark: Keep in mind that the Doomsday Clock is a metaphor and its settings are not just data points but reflections of complex global dynamics (by certain experts and a board of sponsors.)

Remark: Currently (2024-12-30) Doomsday Clock is set at 90 seconds before midnight.

Data ingestion

Here we ingest the Doomsday Clock timeline page and show corresponding statistics:

url = "https://thebulletin.org/doomsday-clock/timeline/";
txtEN = Import[url, "Plaintext"];
TextStats[txtEN]

(*<|"Characters" -> 77662, "Words" -> 11731, "Lines" -> 1119|>*)

By observing the (plain) text of that page we see the Doomsday Clock time setting can be extracted from the sentence(s) that begin with the following phrase:

startPhrase = "Bulletin of the Atomic Scientists";
sentence = Select[Map[StringTrim, StringSplit[txtEN, "\n"]], StringStartsQ[#, startPhrase] &] // First

(*"Bulletin of the Atomic Scientists, with a clock reading 90 seconds to midnight"*)

Grammar and parsers

Here is a grammar in Extended Backus-Naur Form (EBNF) for parsing Doomsday Clock statements:

ebnf = "
<TOP> = <clock-reading>  ;
<clock-reading> = <opening> , ( <minutes> | [ <minutes> , [ 'and' | ',' ] ] , <seconds> ) , 'to' , 'midnight' ;
<opening> = [ { <any> } ] , 'clock' , [ 'is' ] , 'reading' ; 
<any> = '_String' ;
<minutes> = <integer> <& ( 'minute' | 'minutes' )  <@ \"Minutes\"->#&;
<seconds> = <integer> <& ( 'second' | 'seconds' ) <@ \"Seconds\"->#&;
<integer> = '_?IntegerQ' ;";

Remark: The EBNF grammar above can be obtained with LLMs using a suitable prompt with example sentences. (We do not discuss that approach further in this notebook.)

Here the parsing functions are generated from the EBNF string above:

ClearAll["p*"]
res = GenerateParsersFromEBNF[ParseToEBNFTokens[ebnf]];
res // LeafCount

(*375*)

We must redefine the parser pANY (corresponding to the EBNF rule โ€œโ€) in order to prevent pANY of gobbling the word โ€œclockโ€ and in that way making the parser pOPENING fail.

pANY = ParsePredicate[StringQ[#] && # != "clock" &];

Here are random sentences generated with the grammar:

SeedRandom[32];
GrammarRandomSentences[GrammarNormalize[ebnf], 6] // Sort // ColumnForm

54jfnd 9y2f clock is reading 46 second to midnight
clock is reading 900 minutes to midnight
clock is reading 955 second to midnight
clock reading 224 minute to midnight
clock reading 410 minute to midnight
jdsf5at clock reading 488 seconds to midnight

Verifications of the (sub-)parsers:

pSECONDS[{"90", "seconds"}]

(*{{{}, "Seconds" -> 90}}*)

pOPENING[ToTokens@"That doomsday clock is reading"]

(*{{{}, {{"That", "doomsday"}, {"clock", {"is", "reading"}}}}}*)

Here the โ€œtopโ€ parser is applied:

str = "the doomsday clock is reading 90 seconds to midnight";
pTOP[ToTokens@str]

(*{{{}, {{{"the", "doomsday"}, {"clock", {"is", "reading"}}}, {{{}, "Seconds" -> 90}, {"to", "midnight"}}}}}*)

Here the sentence extracted above is parsed and interpreted into an association with keys โ€œMinutesโ€ and โ€œSecondsโ€:

aDoomReading = Association@Cases[Flatten[pTOP[ToTokens@sentence]], _Rule]

(*<|"Seconds" -> 90|>*)

Plotting the clock

Using the interpretation derived above here we make a list suitable for ClockGauge:

clockShow = DatePlus[{0, 0, 0, 12, 0, 0}, {-(Lookup[aDoomReading, "Minutes", 0]*60 + aDoomReading["Seconds"]), "Seconds"}]

(*{-2, 11, 30, 11, 58, 30}*)

In that list, plotting of a Doomsday Clock image (or gauge) is trivial.

ClockGauge[clockShow, GaugeLabels -> Automatic]

Let us define a function that makes the clock-gauge plot for a given association.

Clear[DoomsdayClockGauge];
Options[DoomsdayClockGauge] = Options[ClockGauge];
DoomsdayClockGauge[m_Integer, s_Integer, opts : OptionsPattern[]] := DoomsdayClockGauge[<|"Minutes" -> m, "Seconds" -> s|>, opts];
DoomsdayClockGauge[a_Association, opts : OptionsPattern[]] :=
  Block[{clockShow},
   clockShow = DatePlus[{0, 0, 0, 12, 0, 0}, {-(Lookup[a, "Minutes", 0]*60 + Lookup[a, "Seconds", 0]), "Seconds"}];
   ClockGauge[clockShow, opts, GaugeLabels -> Placed[Style["Doomsday\nclock", RGBColor[0.7529411764705882, 0.7529411764705882, 0.7529411764705882], FontFamily -> "Krungthep"], Bottom]]
   ];

Here are examples:

Row[{
   DoomsdayClockGauge[17, 0], 
   DoomsdayClockGauge[1, 40, GaugeLabels -> Automatic, PlotTheme -> "Scientific"], 
   DoomsdayClockGauge[aDoomReading, PlotTheme -> "Marketing"] 
  }]

More robust parsing

More robust parsing of Doomsday Clock statements can be obtained in these three ways:

  • โ€œFuzzyโ€ match of words
    • For misspellings like โ€œdoomsdatโ€ instead of โ€œdoomsday.โ€
  • Parsing of numeric word forms.
    • For statements, like, โ€œtwo minutes and twenty five seconds.โ€
  • Delegating the parsing to LLMs when grammar parsing fails.

Fuzzy matching

The parser ParseFuzzySymbol can be used to handle misspellings (via EditDistance):

pDD = ParseFuzzySymbol["doomsday", 2];
lsPhrases = {"doomsdat", "doomsday", "dumzday"};
ParsingTestTable[pDD, lsPhrases]

In order to include the misspelling handling into the grammar we manually rewrite the grammar. (The grammar is small, so, it is not that hard to do.)

pANY = ParsePredicate[StringQ[#] && EditDistance[#, "clock"] > 1 &];
pOPENING = ParseOption[ParseMany[pANY]]โŠ—ParseFuzzySymbol["clock", 1]โŠ—ParseOption[ParseSymbol["is"]]โŠ—ParseFuzzySymbol["reading", 2];
pMINUTES = "Minutes" -> # &โŠ™(pINTEGER โ— ParseFuzzySymbol["minutes", 3]);
pSECONDS = "Seconds" -> # &โŠ™(pINTEGER โ— ParseFuzzySymbol["seconds", 3]);
pCLOCKREADING = Cases[#, _Rule, Infinity] &โŠ™(pOPENINGโŠ—(pMINUTESโŠ•ParseOption[pMINUTESโŠ—ParseOption[ParseSymbol["and"]โŠ•ParseSymbol["&"]โŠ•ParseSymbol[","]]]โŠ—pSECONDS)โŠ—ParseSymbol["to"]โŠ—ParseFuzzySymbol["midnight", 2]);

Here is a verification table with correct- and incorrect spellings:

lsPhrases = {
    "doomsday clock is reading 2 seconds to midnight", 
    "dooms day cloc is readding 2 minute and 22 sekonds to mildnight"};
ParsingTestTable[pCLOCKREADING, lsPhrases, "Layout" -> "Vertical"]

Parsing of numeric word forms

One way to make the parsing more robust is to implement the ability to parse integer names (or numeric word forms) not just integers.

Remark: For a fuller discussion — and code — of numeric word forms parsing see the tech note “Integer names parsing” of the paclet “FunctionalParsers”, [AAp1].

First, we make an association that connects integer names with corresponding integer values

aWordedValues = Association[IntegerName[#, "Words"] -> # & /@ Range[0, 100]];
aWordedValues = KeyMap[StringRiffle[StringSplit[#, RegularExpression["\\W"]], " "] &, aWordedValues];
Length[aWordedValues]

(*101*)

Here is how the rules look like:

aWordedValues[[1 ;; -1 ;; 20]]

(*<|"zero" -> 0, "twenty" -> 20, "forty" -> 40, "sixty" -> 60, "eighty" -> 80, "one hundred" -> 100|>*)

Here we program the integer names parser:

pUpTo10 = ParseChoice @@ Map[ParseSymbol[IntegerName[#, {"English", "Words"}]] &, Range[0, 9]];
p10s = ParseChoice @@ Map[ParseSymbol[IntegerName[#, {"English", "Words"}]] &, Range[10, 100, 10]];
pWordedInteger = ParseApply[aWordedValues[StringRiffle[Flatten@{#}, " "]] &, p10s\[CircleTimes]pUpTo10\[CirclePlus]p10s\[CirclePlus]pUpTo10];

Here is a verification table of that parser:

lsPhrases = {"three", "fifty seven", "thirti one"};
ParsingTestTable[pWordedInteger, lsPhrases]

There are two parsing results for โ€œfifty sevenโ€, because pWordedInteger is defined with p10sโŠ—pUpTo10โŠ•p10s… . This can be remedied by using ParseJust or ParseShortest:

lsPhrases = {"three", "fifty seven", "thirti one"};
ParsingTestTable[ParseJust@pWordedInteger, lsPhrases]

Let us change pINTEGER to parse both integers and integer names:

pINTEGER = (ToExpression\[CircleDot]ParsePredicate[StringMatchQ[#, NumberString] &])\[CirclePlus]pWordedInteger;
lsPhrases = {"12", "3", "three", "forty five"};
ParsingTestTable[pINTEGER, lsPhrases]

Let us try the new parser using integer names for the clock time:

str = "the doomsday clock is reading two minutes and forty five seconds to midnight";
pTOP[ToTokens@str]

(*{{{}, {"Minutes" -> 2, "Seconds" -> 45}}}*)

Enhance with LLM parsing

There are multiple ways to employ LLMs for extracting โ€œclock readingsโ€ from arbitrary statements for Doomsday Clock readings, readouts, and measures. Here we use LLM few-shot training:

flop = LLMExampleFunction[{
    "the doomsday clock is reading two minutes and forty five seconds to midnight" -> "{\"Minutes\":2, \"Seconds\": 45}", 
    "the clock of the doomsday gives 92 seconds to midnight" -> "{\"Minutes\":0, \"Seconds\": 92}", 
    "The bulletin atomic scienist maybe is set to a minute an 3 seconds." -> "{\"Minutes\":1, \"Seconds\": 3}" 
   }, "JSON"]

Here is an example invocation:

flop["Maybe the doomsday watch is at 23:58:03"]

(*{"Minutes" -> 1, "Seconds" -> 57}*)

The following function combines the parsing with the grammar and the LLM example function — the latter is used for fallback parsing:

Clear[GetClockReading];
GetClockReading[st_String] := 
   Block[{op}, 
    op = ParseJust[pTOP][ToTokens[st]]; 
    Association@
     If[Length[op] > 0 && op[[1, 1]] === {}, 
      Cases[op, Rule], 
     (*ELSE*) 
      flop[st] 
     ] 
   ];

Robust parser demo

Here is the application of the combine function above over a certain โ€œrandomโ€ Doomsday Clock statement:

s = "You know, sort of, that dooms-day watch is 1 and half minute be... before the big boom. (Of doom...)";
GetClockReading[s]

(*<|"Minutes" -> 1, "Seconds" -> 30|>*)

Remark: The same type of robust grammar-and-LLM combination is explained in more detail in the video “Robust LLM pipelines (Mathematica, Python, Raku)”, [AAv1]. (See, also, the corresponding notebook [AAn1].)

Timeline

In this section we extract Doomsday Clock timeline data and make a corresponding plot.

Parsing page data

Instead of using the official Doomsday clock timeline page we use Wikipedia:

url = "https://en.wikipedia.org/wiki/Doomsday_Clock";
data = Import[url, "Data"];

Get timeline table:

tbl = Cases[data, {"Timeline of the Doomsday Clock [ 13 ] ", x__} :> x, Infinity] // First;

Show tableโ€™s columns:

First[tbl]

(*{"Year", "Minutes to midnight", "Time ( 24-h )", "Change (minutes)", "Reason", "Clock"}*)

Make a dataset:

dsTbl = Dataset[Rest[tbl]][All, AssociationThread[{"Year", "MinutesToMidnight", "Time", "Change", "Reason"}, #] &];
dsTbl = dsTbl[All, Append[#, "Date" -> DateObject[{#Year, 7, 1}]] &];
dsTbl[[1 ;; 4]]

Here is an association used to retrieve the descriptions from the date objects:

aDateToDescr = Normal@dsTbl[Association, #Date -> BreakStringIntoLines[#Reason] &];

Using LLM-extraction instead

Alternatively, we can extract the Doomsday Clock timeline using LLMs. Here we get the plaintext of the Wikipedia page and show statistics:

txtWk = Import[url, "Plaintext"];
TextStats[txtWk]

(*<|"Characters" -> 43623, "Words" -> 6431, "Lines" -> 315|>*)

Here we get the Doomsday Clock timeline table from that page in JSON format using an LLM:

res = 
  LLMSynthesize[{
    "Give the time table of the doomsday clock as a time series that is a JSON array.", 
    "Each element of the array is a dictionary with keys 'Year', 'MinutesToMidnight', 'Time', 'Description'.", 
    txtWk, 
    LLMPrompt["NothingElse"]["JSON"] 
   }, 
   LLMEvaluator -> LLMConfiguration[<|"Provider" -> "OpenAI", "Model" -> "gpt-4o", "Temperature" -> 0.4, "MaxTokens" -> 5096|>] 
  ]

(*"```json[{\"Year\": 1947, \"MinutesToMidnight\": 7, \"Time\": \"23:53\", \"Description\": \"The initial setting of the Doomsday Clock.\"},{\"Year\": 1949, \"MinutesToMidnight\": 3, \"Time\": \"23:57\", \"Description\": \"The Soviet Union tests its first atomic bomb, officially starting the nuclear arms race.\"}, ... *)

Post process the LLM result:

res2 = ToString[res, CharacterEncoding -> "UTF-8"];
res3 = StringReplace[res2, {"```json", "```"} -> ""];
res4 = ImportString[res3, "JSON"];
res4[[1 ;; 3]]

(*{{"Year" -> 1947, "MinutesToMidnight" -> 7, "Time" -> "23:53", "Description" -> "The initial setting of the Doomsday Clock."}, {"Year" -> 1949, "MinutesToMidnight" -> 3, "Time" -> "23:57", "Description" -> "The Soviet Union tests its first atomic bomb, officially starting the nuclear arms race."}, {"Year" -> 1953, "MinutesToMidnight" -> 2, "Time" -> "23:58", "Description" -> "The United States and the Soviet Union test thermonuclear devices, marking the closest approach to midnight until 2020."}}*)

Make a dataset with the additional column โ€œDateโ€ (having date-objects):

dsDoomsdayTimes = Dataset[Association /@ res4];
dsDoomsdayTimes = dsDoomsdayTimes[All, Append[#, "Date" -> DateObject[{#Year, 7, 1}]] &];
dsDoomsdayTimes[[1 ;; 4]]

Here is an association that is used to retrieve the descriptions from the date objects:

aDateToDescr2 = Normal@dsDoomsdayTimes[Association, #Date -> #Description &];

Remark: The LLM derived descriptions above are shorter than the descriptions in the column โ€œReasonโ€ of the dataset obtained parsing the page data. For the plot tooltips below we use the latter.

Timeline plot

In order to have informative Doomsday Clock evolution plot we obtain and partition datasetโ€™s time series into step-function pairs:

ts0 = Normal@dsDoomsdayTimes[All, {#Date, #MinutesToMidnight} &];
ts2 = Append[Flatten[MapThread[Thread[{#1, #2}] &, {Partition[ts0[[All, 1]], 2, 1], Most@ts0[[All, 2]]}], 1], ts0[[-1]]];

Here are corresponding rule wrappers indicating the year and the minutes before midnight:

lbls = Map[Row[{#Year, Spacer[3], "\n", IntegerPart[#MinutesToMidnight], Spacer[2], "m", Spacer[2], Round[FractionalPart[#MinutesToMidnight]*60], Spacer[2], "s"}] &, Normal@dsDoomsdayTimes];
lbls = Map[If[#[[1, -3]] == 0, Row@Take[#[[1]], 6], #] &, lbls];

Here the points โ€œknownโ€ by the original time series are given callouts:

aRules = Association@MapThread[#1 -> Callout[Tooltip[#1, aDateToDescr[#1[[1]]]], #2] &, {ts0, lbls}];
ts3 = Lookup[aRules, Key[#], #] & /@ ts2;

Finally, here is the plot:

DateListPlot[ts3, 
  PlotStyle -> Directive[{Thickness[0.007`], Orange}],
  Epilog -> {PointSize[0.01`], Black, Point[ts0]}, 
  PlotLabel -> Row[(Style[#1, FontSize -> 16, FontColor -> Black, FontFamily -> "Verdana"] &) /@ {"Doomsday clock: minutes to midnight,", Spacer[3], StringRiffle[MinMax[Normal[dsDoomsdayTimes[All, "Year"]]], "-"]}], 
  FrameLabel -> {"Year", "Minutes to midnight"}, 
  Background -> GrayLevel[0.94`], Frame -> True, 
  FrameTicks -> {{Automatic, (If[#1 == 0, {0, Style["00:00", Red]}, {#1, Row[{"23:", 60 - #1}]}] &) /@ Range[0, 17]}, {Automatic, Automatic}}, GridLines -> {None, All},
  AspectRatio -> 1/3, ImageSize -> 1200
]

Remark: By hovering with the mouse over the black points the corresponding descriptions can be seen. We considered using clock-gauges as tooltips, but showing clock-settings reasons is more informative.

Remark: The plot was intentionally made to resemble the timeline plot in Doomsday Clock’s Wikipedia page.

Conclusion

As expected, parsing, plotting, or otherwise processing the Doomsday Clock settings and statements are excellent didactic subjects for textual analysis (or parsing) and temporal data visualization. The visualization could serve educational purposes or provide insights into historical trends of global threats as perceived by experts. (Remember, the clockโ€™s settings are not just data points but reflections of complex global dynamics.)

One possible application of the code in this notebook is to make a โ€œweb serviceโ€œ that gives clock images with Doomsday Clock readings. For example, click on this button:

Setup

Needs["AntonAntonov`FunctionalParsers`"]

Clear[TextStats];
TextStats[s_String] := AssociationThread[{"Characters", "Words", "Lines"}, Through[{StringLength, Length@*TextWords, Length@StringSplit[#, "\n"] &}[s]]];

BreakStringIntoLines[str_String, maxLength_Integer : 60] := Module[
    {words, lines, currentLine}, 
    words = StringSplit[StringReplace[str, RegularExpression["\\v+"] -> " "]]; 
    lines = {}; 
    currentLine = ""; 
    Do[
       If[StringLength[currentLine] + StringLength[word] + 1 <= maxLength, 
          currentLine = StringJoin[currentLine, If[currentLine === "", "", " "], word], 
          AppendTo[lines, currentLine]; 
          currentLine = word; 
        ], 
       {word, words} 
     ]; 
    AppendTo[lines, currentLine]; 
    StringJoin[Riffle[lines, "\n"]] 
  ]

References

Articles, notebooks

[AAn1] Anton Antonov, “Making robust LLM computational pipelines from software engineering perspective”, (2024), Wolfram Community.

Paclets

[AAp1] Anton Antonov, “FunctionalParsers”, (2023), Wolfram Language Paclet Repository.

Videos

[AAv1] Anton Antonov, “Robust LLM pipelines (Mathematica, Python, Raku)”, (2024), YouTube/@AAA4prediction.

Robust LLM pipelines

… or “Making Robust LLM Computational Pipelines from Software Engineering Perspective”

Abstract

Large Language Models (LLMs) are powerful tools with diverse capabilities, but from Software Engineering (SE) Point Of View (POV) they are unpredictable and slow. In this presentation we consider five ways to make more robust SE pipelines that include LLMs. We also consider a general methodological workflow for utilizing LLMs in “every day practice.”

Here are the five approaches we consider:

  1. DSL for configuration-execution-conversion
    • Infrastructural, language-design level solution
  2. Detailed, well crafted prompts
    • AKA “Prompt engineering”
  3. Few-shot training with examples
  4. Via a Question Answering System (QAS) and code templates
  5. Grammar-LLM chain of responsibility
  6. Testings with data types and shapes over multiple LLM results

Compared to constructing SE pipelines, Literate Programming (LP) offers a dual or alternative way to use LLMs. For that it needs support and facilitation of:

  • Convenient LLM interaction (or chatting)
  • Document execution (weaving and tangling)

The discussed LLM workflows methodology is supported in Python, Raku, Wolfram Language (WL). The support in R is done via Python (with “reticulate”, [TKp1].)

The presentation includes multiple examples and showcases.

Modeling of the LLM utilization process is hinted but not discussed.

Here is a mind-map of the presentation:

Here are the notebook used in the presentation:


General structure of LLM-based workflows

All systematic approaches of unfolding and refining workflows based on LLM functions, will include several decision points and iterations to ensure satisfactory results.

This flowchart outlines such a systematic approach:


References

Articles, blog posts

[AA1] Anton Antonov, “Workflows with LLM functions”, (2023), RakuForPrediction at WordPress.

Notebooks

[AAn1] Anton Antonov, “Workflows with LLM functions (in Raku)”, (2023), Wolfram Community.

[AAn2] Anton Antonov, “Workflows with LLM functions (in Python)”, (2023), Wolfram Community.

[AAn3] Anton Antonov, “Workflows with LLM functions (in WL)”, (2023), Wolfram Community.

Packages

Raku

[AAp1] Anton Antonov, LLM::Functions Raku package, (2023-2024), GitHub/antononcube. (raku.land)

[AAp2] Anton Antonov, LLM::Prompts Raku package, (2023-2024), GitHub/antononcube. (raku.land)

[AAp3] Anton Antonov, Jupyter::Chatbook Raku package, (2023-2024), GitHub/antononcube. (raku.land)

Python

[AAp4] Anton Antonov, LLMFunctionObjects Python package, (2023-2024), PyPI.org/antononcube.

[AAp5] Anton Antonov, LLMPrompts Python package, (2023-2024), GitHub/antononcube.

[AAp6] Anton Antonov, JupyterChatbook Python package, (2023-2024), GitHub/antononcube.

[MWp1] Marc Wouts, jupytext Python package, (2021-2024), GitHub/mwouts.

R

[TKp1] Tomasz Kalinowski, Kevin Ushey, JJ Allaire, RStudio, Yuan Tang, reticulate R package, (2016-2024)

Videos

[AAv1] Anton Antonov, “Robust LLM pipelines (Mathematica, Python, Raku)”, (2024), YouTube/@AAA4Predictions.

[AAv2] Anton Antonov, “Integrating Large Language Models with Raku”, (2023), The Raku Conference 2023 at YouTube.

Age at creation for programming languages stats

Introduction

In this blog post (notebook) we ingest programming languages creation data fromย Programmingย Languageย DataBase”ย and visualize several statistics of it.

We do not examine the data source and we do not want to reason too much about the data using the stats. We started this notebook by just wanting to make the bubble charts (both 2D and 3D.) Nevertheless, we are tempted to say and justify statements like:

  • Pareto holds, as usual.
  • Language creators tend to do it more than once.
  • Beware theย Second system effect.

References

Here are reference links with explanations and links to dataset files:


Data ingestion

Here we get the TSC file with Wolfram Function Repository (WFR) function ImportCSVToDataset:

url = "https://pldb.io/posts/age.tsv";
dsData = ResourceFunction["ImportCSVToDataset"][url, "Dataset", "FieldSeparators" -> "\t"];
dsData[[1 ;; 4]]

Here we summarize the data using the WFR function RecordsSummary:

ResourceFunction["RecordsSummary"][dsData, "MaxTallies" -> 12]

Here is a list of languages we use to “get orientated” in the plots below:

lsFocusLangs = {"C++", "Fortran", "Java", "Mathematica", "Perl 6", "Raku", "SQL", "Wolfram Language"};

Here we find the most important tags (used in the plots below):

lsTopTags = ReverseSortBy[Tally[Normal@dsData[All, "tags"]], Last][[1 ;; 7, 1]]

(*{"pl", "textMarkup", "dataNotation", "grammarLanguage", "queryLanguage", "stylesheetLanguage", "protocol"}*)

Here we add the column “group” based on the focus languages and most important tags:

dsData = dsData[All, Append[#, "group" -> Which[MemberQ[lsFocusLangs, #id], "focus", MemberQ[lsTopTags, #tags], #tags, True, "other"]] &];

Distributions

Here are the distributions of the variables/columns:

  • age at creation
    • i.e. “How old was the creator?”
  • appeared”
    • i.e. “In what year the programming language was proclaimed?”
Association @ Map[# -> Histogram[Normal@dsData[All, #], 20, "Probability", Sequence[ImageSize -> Medium, PlotTheme -> "Detailed"]] &, {"ageAtCreation", "appeared"}]

Here are corresponding Box-Whisker plots together with tables of their statistics:

aBWCs = Association@
Map[# -> BoxWhiskerChart[Normal@dsData[All, #], "Outliers", Sequence[BarOrigin -> Left, ImageSize -> Medium, AspectRatio -> 1/2, PlotRange -> Full]] &, {"ageAtCreation", "appeared"}];

Pareto principle manifestation

Number of creations

Here is the Pareto principle plot of for the number of created (or renamed) programming languages per creator (using the WFR function ParetoPrinciplePlot):

ResourceFunction["ParetoPrinciplePlot"][Association[Rule @@@ Tally[Normal@dsData[All, "creators"]]], ImageSize -> Large]

We can see that โ‰ˆ25% of the creators correspond to โ‰ˆ50% of the languages.

Popularity

Obviously, programmers can and do use more than one programming language. Nevertheless, it is interesting to see the Pareto principle plot for the languages “mind share” based on the number of users estimates.

ResourceFunction["ParetoPrinciplePlot"][Normal@dsData[Association, #id -> #numberOfUsersEstimate &], ImageSize -> Large]

Remark: Again, the plot above is “wrong” — programmers use more than one programming language.


Correlations

In order to see meaningful correlation, pairwise plots we take logarithms of the large value columns:

dsDataVar = dsData[All, {"appeared", "ageAtCreation", "numberOfUsersEstimate", "numberOfJobsEstimate", "rank", "measurements", "pldbScore"}];
dsDataVar = dsDataVar[All, Append[#, <|"numberOfUsersEstimate" -> Log10[#numberOfUsersEstimate + 1], "numberOfJobsEstimate" -> Log10[#numberOfJobsEstimate + 1]|>] &];

Remark: Note that we “cheat” by adding 1 before taking the logarithms.

We obtain the tables of correlations plots using the newly introduced, experimental PairwiseListPlot. If we remove the rows with zeroes some of the correlations become more obvious. Here is the corresponding tab view of the two correlation tables:

TabView[{
"data" -> PairwiseListPlot[dsDataVar, PlotTheme -> "Business", ImageSize -> 800],
"zero-free data" -> PairwiseListPlot[dsDataVar[Select[FreeQ[Values[#], 0] &]], PlotTheme -> "Business", ImageSize -> 800]}]

Remark: Given the names of the data columns and the corresponding obvious interpretations we can say that the stronger correlations make sense.


Bubble chart 2D

In this section we make an informative 2D bubble chart with (tooltips).

First, note that not all triplets of “appeared”,”ageAtCreation”, and “numberOfUsersEstimate” are unique:

ReverseSortBy[Tally[Normal[dsData[All, {"appeared", "ageAtCreation", "numberOfUsersEstimate"}]]], Last][[1 ;; 3]]

(*{{<|"appeared" -> 2017, "ageAtCreation" -> 33, "numberOfUsersEstimate" -> 420|>, 2}, {<|"appeared" -> 2023, "ageAtCreation" -> 39, "numberOfUsersEstimate" -> 11|>, 1}, {<|"appeared" -> 2022, "ageAtCreation" -> 55, "numberOfUsersEstimate" -> 6265|>, 1}}*)

Hence we make two datasets: (1) one for the core bubble chart, (2) the other for the labeling function:

aData = GroupBy[Normal@dsData, #group &, KeyTake[#, {"appeared", "ageAtCreation", "numberOfUsersEstimate"}] &];
aData2 = GroupBy[Normal@dsData, #group &, KeyTake[#, {"appeared", "ageAtCreation", "numberOfUsersEstimate", "id", "creators"}] &];

Here is the labeling function (see the section “Applications” of the function page of BubbleChart):

Clear[LangLabeler];
LangLabeler[v_, {r_, c_}, ___] := Placed[Grid[{
{Style[aData2[[r, c]]["id"], Bold, 12], SpanFromLeft},
{"Creator(s):", aData2[[r, c]]["creators"]},
{"Appeared:", aData2[[r, c]]["appeared"]},
{"Age at creation:", aData2[[r, c]]["ageAtCreation"]},
{"Number of users:", aData2[[r, c]]["numberOfUsersEstimate"]}
}, Alignment -> Left], Tooltip];

Here is the bubble chart:

BubbleChart[
aData,
FrameLabel -> {"Age at Creation", "Appeared"},
PlotLabel -> "Number of users estimate",
BubbleSizes -> {0.05, 0.14},
LabelingFunction -> LangLabeler,
AspectRatio -> 1/2.5,
ChartStyle -> 7,
PlotTheme -> "Detailed",
ChartLegends -> {Keys[aData], None},
ImageSize -> 1000
]

Remark: The programming language J is a clear outlier because of creators’ ages.


Bubble chart 3D

In this section we a 3D bubble chart.

As in the previous section we define two datasets: for the core plot and for the tooltips:

aData3D = GroupBy[Normal@dsData, #group &, KeyTake[#, {"appeared", "ageAtCreation", "measurements", "numberOfUsersEstimate"}] &];
aData3D2 = GroupBy[Normal@dsData, #group &, KeyTake[#, {"appeared", "ageAtCreation", "measurements", "numberOfUsersEstimate", "id", "creators"}] &];

Here is the corresponding labeling function:

Clear[LangLabeler3D];
LangLabeler3D[v_, {r_, c_}, ___] := Placed[Grid[{
{Style[aData3D2[[r, c]]["id"], Bold, 12], SpanFromLeft},
{"Creator(s):", aData3D2[[r, c]]["creators"]},
{"Appeared:", aData3D2[[r, c]]["appeared"]},
{"Age at creation:", aData3D2[[r, c]]["ageAtCreation"]},
{"Number of users:", aData3D2[[r, c]]["numberOfUsersEstimate"]}
}, Alignment -> Left], Tooltip];

Here is the 3D chart:

BubbleChart3D[
aData3D,
AxesLabel -> {"appeared", "ageAtCreation", "measuremnts"},
PlotLabel -> "Number of users estimate",
BubbleSizes -> {0.02, 0.07},
LabelingFunction -> LangLabeler3D,
BoxRatios -> {1, 1, 1},
ChartStyle -> 7,
PlotTheme -> "Detailed",
ChartLegends -> {Keys[aData], None},
ImageSize -> 1000
]

Remark: In the 3D bubble chart plot “Mathematica” and “Wolfram Language” are easier to discern.


Second system effect traces

In this section we try — and fail — to demonstrate that the more programming languages a team of creators makes the less successful those languages are. (Maybe, because they are more cumbersome and suffer the Second system effect?)

Remark: This section is mostly made “for fun.” It is not true that each sets of languages per creators team is made of comparable languages. For example, complementary languages can be in the same set. (See, HTTP, HTML, URL.) Some sets are just made of the same language but with different names. (See, Perl 6 and Raku, and Mathematica and Wolfram Language.) Also, older languages would have the First mover advantage.

Make creators to index association:

aCreators = KeySort@Association[Rule @@@ Select[Tally[Normal@dsData[All, "creators"]], #[[2]] > 1 &]];
aNameToIndex = AssociationThread[Keys[aCreators], Range[Length[aCreators]]];

Make a bubble chart with relative popularity per creators team:

aNUsers = Normal@GroupBy[dsData, #creators &, (m = Max[1, Max[Sqrt@KeyTake[#, "numberOfUsersEstimate"]]]; Map[Tooltip[{#appeared, #creators /. aNameToIndex, Sqrt[#numberOfUsersEstimate]/m}, Grid[{{Style[#id, Black, Bold], SpanFromLeft}, {"Creator(s):", #creators}, {"Users:", #numberOfUsersEstimate}}, Alignment -> Left]] &, #]) &];
aNUsers = KeySort@Select[aNUsers, Length[#] > 1 &];
BubbleChart[aNUsers, AspectRatio -> 2, BubbleSizes -> {0.02, 0.05}, ChartLegends -> Keys[aNUsers], ImageSize -> Large, GridLines -> {None, Values[aNameToIndex]}, FrameTicks -> {{Reverse /@ (List @@@ Normal[aNameToIndex]), None}, {Automatic, Automatic}}]

From the plot above we cannot decisively say that:

The most recent creation of a team of programming language creators is not team's most popular creation.

That statement, though, does hold for a fair amount of cases.


Instead of conclusions

Consider:

  • Making an interactive interface for the variables, types of plots, etc.
  • Placing callouts for the focus languages in bubble charts.

LLM ะฝะฐะด “ะ˜ัะบัƒััั‚ะฒะพะผ ะฐั‚ั‚ั€ะธั†ะธะพะฝะฝะพะน ะฒะพะนะฝั‹: ะฃั€ะพะบะธ ะฒะพะนะฝั‹ ะ ะพััะธะธ ะฟั€ะพั‚ะธะฒ ะฃะบั€ะฐะธะฝั‹”

ะ’ะฒะตะดะตะฝะธะต

ะญั‚ะพั‚ ะฑะปะพะณ ะฟะพัั‚ ะธัะฟะพะปัŒะทัƒะตั‚ ั€ะฐะทะปะธั‡ะฝั‹ะต ะทะฐะฟั€ะพัั‹ ะบ ะ‘ะพะปัŒัˆะธะผ ะฏะทั‹ะบะพะฒั‹ะผ ะœะพะดะตะปัะผ (ะ‘ะฏะœ) ะดะปั ััƒะผะผะฐั€ะธะทะฐั†ะธะธ ัั‚ะฐั‚ัŒะธ “ะ˜ัะบัƒััั‚ะฒะพ ะฐั‚ั‚ั€ะธั†ะธะพะฝะฝะพะน ะฒะพะนะฝั‹: ะฃั€ะพะบะธ ะฒะพะนะฝั‹ ะ ะพััะธะธ ะฟั€ะพั‚ะธะฒ ะฃะบั€ะฐะธะฝั‹” ะพั‚ ะะปะตะบัะฐ ะ’ะตั€ัˆะธะฝะธะฝะฐ.

ะ—ะฐะผะตั‡ะฐะฝะธะต: ะœั‹ ั‚ะพะถะต ะฑัƒะดะตะผ ะฟะพะปัŒะทะพะฒะฐั‚ัŒัั ัะพะบั€ะฐั‰ะตะฝะธะตะผ “LLM” (ะดะปั “Large Language Models”).

ะ’ ัั‚ะพะน ัั‚ะฐั‚ัŒะต ะดะปั ะšะพั€ะพะปะตะฒัะบะพะณะพ ะธะฝัั‚ะธั‚ัƒั‚ะฐ ะพะฑัŠะตะดะธะฝะตะฝะฝั‹ั… ัะปัƒะถะฑ (RUSI), ะะปะตะบั ะ’ะตั€ัˆะธะฝะธะฝ ะพะฑััƒะถะดะฐะตั‚ ะฝะตะพะฑั…ะพะดะธะผะพัั‚ัŒ ะดะปั ะ—ะฐะฟะฐะดะฐ ะฟะตั€ะตัะผะพั‚ั€ะตั‚ัŒ ัะฒะพัŽ ะฒะพะตะฝะฝัƒัŽ ัั‚ั€ะฐั‚ะตะณะธัŽ ะฒ ะพั‚ะฝะพัˆะตะฝะธะธ ะฐั‚ั‚ั€ะธั†ะธะพะฝะฐ ะฒ ะฟั€ะตะดะฒะธะดะตะฝะธะธ ะทะฐั‚ัะถะฝั‹ั… ะบะพะฝั„ะปะธะบั‚ะพะฒ. ะกั‚ะฐั‚ัŒั ะฟั€ะพั‚ะธะฒะพะฟะพัั‚ะฐะฒะปัะตั‚ ะฐั‚ั‚ั€ะธั†ะธะพะฝะฝัƒัŽ ะธ ะผะฐะฝะตะฒั€ะตะฝะฝัƒัŽ ะฒะพะนะฝัƒ, ะฟะพะดั‡ะตั€ะบะธะฒะฐั ะฒะฐะถะฝะพัั‚ัŒ ะฟั€ะพะผั‹ัˆะปะตะฝะฝะพะน ะผะพั‰ะฝะพัั‚ะธ, ะณะตะฝะตั€ะฐั†ะธะธ ัะธะป ะธ ัะบะพะฝะพะผะธั‡ะตัะบะพะน ัƒัั‚ะพะนั‡ะธะฒะพัั‚ะธ ะฒ ะฟะพะฑะตะดะต ะฒ ะทะฐั‚ัะถะฝั‹ั… ะฒะพะนะฝะฐั….

ะญั‚ะฐ (ะฟะพะปัƒั‡ะตะฝะฝะฐั ั ะฟะพะผะพั‰ัŒัŽ LLM) ะธะตั€ะฐั€ั…ะธั‡ะตัะบะฐั ะดะธะฐะณั€ะฐะผะผะฐ ั…ะพั€ะพัˆะพ ััƒะผะผะธั€ัƒะตั‚ ัั‚ะฐั‚ัŒัŽ:

ะŸั€ะธะผะตั‡ะฐะฝะธะต: ะœั‹ ะฟะปะฐะฝะธั€ัƒะตะผ ะธัะฟะพะปัŒะทะพะฒะฐั‚ัŒ ัั‚ะพั‚ ะฟะพัั‚/ัั‚ะฐั‚ัŒัŽ ะฒ ะบะฐั‡ะตัั‚ะฒะต ััั‹ะปะบะธ ะฒ ะฟั€ะตะดัั‚ะพัั‰ะตะผ ะฟะพัั‚ะต/ัั‚ะฐั‚ัŒะต ั ัะพะพั‚ะฒะตั‚ัั‚ะฒัƒัŽั‰ะตะน ะผะฐั‚ะตะผะฐั‚ะธั‡ะตัะบะพะน ะผะพะดะตะปัŒัŽ
(ะฝะฐ ะพัะฝะพะฒะต ะกะธัั‚ะตะผะฝะพะน ะดะธะฝะฐะผะธะบะธ.)

ะกั‚ั€ัƒะบั‚ัƒั€ะฐ ะฟะพัั‚ะฐ:

  1. ะขะตะผั‹
    ะขะฐะฑะปะธั‡ะฝะพะต ั€ะฐะทะฑะธะตะฝะธะต ัะพะดะตั€ะถะฐะฝะธั.
  2. ะœะตะฝั‚ะฐะปัŒะฝะฐั ะบะฐั€ั‚ะฐ
    ะกั‚ั€ัƒะบั‚ัƒั€ะฐ ัะพะดะตั€ะถะฐะฝะธั ะธ ัะฒัะทะธ ะบะพะฝั†ะตะฟั†ะธะน.
  3. ะกัƒะผะผะฐั€ะฝะพะต ะธะทะปะพะถะตะฝะธะต, ะธะดะตะธ ะธ ั€ะตะบะพะผะตะฝะดะฐั†ะธะธ
    ะžัะฝะพะฒะฝะฐั ะฟะพะผะพั‰ัŒ ะฒ ะฟะพะฝะธะผะฐะฝะธะธ.
  4. ะœะพะดะตะปัŒ ัะธัั‚ะตะผะฝะพะน ะดะธะฝะฐะผะธะบะธ
    ะšะฐะบ ัะดะตะปะฐั‚ัŒ ะดะฐะฝะฝั‹ะน ะฝะฐะฑะปัŽะดะตะฝะธั ะพะฟะตั€ะฐั†ะธะพะฝะฐะปัŒะฝั‹ะผะธ?

ะขะตะผั‹

ะ’ะผะตัั‚ะพ ััƒะผะผะฐั€ะฝะพะณะพ ะธะทะปะพะถะตะฝะธั ั€ะฐััะผะพั‚ั€ะธั‚ะต ัั‚ัƒ ั‚ะฐะฑะปะธั†ัƒ ั‚ะตะผ:

ั‚ะตะผะฐัะพะดะตั€ะถะฐะฝะธะต
ะ’ะฒะตะดะตะฝะธะตะกั‚ะฐั‚ัŒั ะฝะฐั‡ะธะฝะฐะตั‚ัั ั ะฟะพะดั‡ะตั€ะบะธะฒะฐะฝะธั ะฝะตะพะฑั…ะพะดะธะผะพัั‚ะธ ะดะปั ะ—ะฐะฟะฐะดะฐ ะฟะพะดะณะพั‚ะพะฒะธั‚ัŒัั ะบ ะฐั‚ั‚ั€ะธั†ะธะพะฝะฝะพะน ะฒะพะนะฝะต, ะบะพะฝั‚ั€ะฐัั‚ะธั€ัƒั ัั‚ะพ ั ะฟั€ะตะดะฟะพั‡ั‚ะตะฝะธะตะผ ะบะพั€ะพั‚ะบะธั…, ั€ะตัˆะฐัŽั‰ะธั… ะบะพะฝั„ะปะธะบั‚ะพะฒ.
ะŸะพะฝะธะผะฐะฝะธะต ะั‚ั‚ั€ะธั†ะธะพะฝะฝะพะน ะ’ะพะนะฝั‹ะžะฟั€ะตะดะตะปัะตั‚ ะฐั‚ั‚ั€ะธั†ะธะพะฝะฝัƒัŽ ะฒะพะนะฝัƒ ะธ ะฟะพะดั‡ะตั€ะบะธะฒะฐะตั‚ ะตะต ะพั‚ะปะธั‡ะธั ะพั‚ ะผะฐะฝะตะฒั€ะตะฝะฝะพะน ะฒะพะนะฝั‹, ะฐะบั†ะตะฝั‚ะธั€ัƒั ะฒะฐะถะฝะพัั‚ัŒ ะฟั€ะพะผั‹ัˆะปะตะฝะฝะพะน ะผะพั‰ะฝะพัั‚ะธ ะธ ัะฟะพัะพะฑะฝะพัั‚ะธ ะทะฐะผะตะฝัั‚ัŒ ะฟะพั‚ะตั€ะธ.
ะญะบะพะฝะพะผะธั‡ะตัะบะพะต ะ˜ะทะผะตั€ะตะฝะธะตะžะฑััƒะถะดะฐะตั‚, ะบะฐะบ ัะบะพะฝะพะผะธะบะฐ ะธ ะฟั€ะพะผั‹ัˆะปะตะฝะฝั‹ะต ะผะพั‰ะฝะพัั‚ะธ ะธะณั€ะฐัŽั‚ ะบะปัŽั‡ะตะฒัƒัŽ ั€ะพะปัŒ ะฒ ะฟะพะดะดะตั€ะถะฐะฝะธะธ ะฒะพะนะฝั‹ ะฐั‚ั‚ั€ะธั†ะธะพะฝะฐ, ั ะฟั€ะธะผะตั€ะฐะผะธ ะธะท ะ’ั‚ะพั€ะพะน ะผะธั€ะพะฒะพะน ะฒะพะนะฝั‹.
ะ“ะตะฝะตั€ะฐั†ะธั ะกะธะปะ˜ััะปะตะดัƒะตั‚, ะบะฐะบ ั€ะฐะทะปะธั‡ะฝั‹ะต ะฒะพะตะฝะฝั‹ะต ะดะพะบั‚ั€ะธะฝั‹ ะธ ัั‚ั€ัƒะบั‚ัƒั€ั‹, ั‚ะฐะบะธะต ะบะฐะบ ะะะขะž ะธ ะกะพะฒะตั‚ัะบะธะน ะกะพัŽะท, ะฒะปะธััŽั‚ ะฝะฐ ัะฟะพัะพะฑะฝะพัั‚ัŒ ะณะตะฝะตั€ะธั€ะพะฒะฐั‚ัŒ ะธ ะฟะพะดะดะตั€ะถะธะฒะฐั‚ัŒ ัะธะปั‹ ะฒ ะฐั‚ั‚ั€ะธั†ะธะพะฝะฝะพะน ะฒะพะนะฝะต.
ะ’ะพะตะฝะฝะพะต ะ˜ะทะผะตั€ะตะฝะธะตะ”ะตั‚ะฐะปะธะทะธั€ัƒะตั‚ ะฒะพะตะฝะฝั‹ะต ะพะฟะตั€ะฐั†ะธะธ ะธ ัั‚ั€ะฐั‚ะตะณะธะธ, ะฟะพะดั…ะพะดัั‰ะธะต ะดะปั ะฐั‚ั‚ั€ะธั†ะธะพะฝะฝะพะน ะฒะพะนะฝั‹, ะฒะบะปัŽั‡ะฐั ะฒะฐะถะฝะพัั‚ัŒ ัƒะดะฐั€ะพะฒ ะฝะฐะด ะผะฐะฝะตะฒั€ะฐะผะธ ะธ ั„ะฐะทั‹ ั‚ะฐะบะธั… ะบะพะฝั„ะปะธะบั‚ะพะฒ.
ะกะพะฒั€ะตะผะตะฝะฝะฐั ะ’ะพะนะฝะฐะ˜ััะปะตะดัƒะตั‚ ัะปะพะถะฝะพัั‚ะธ ัะพะฒั€ะตะผะตะฝะฝะพะน ะฒะพะนะฝั‹, ะฒะบะปัŽั‡ะฐั ะธะฝั‚ะตะณั€ะฐั†ะธัŽ ั€ะฐะทะปะธั‡ะฝั‹ั… ัะธัั‚ะตะผ ะธ ะฒั‹ะทะพะฒั‹ ะบะพะพั€ะดะธะฝะฐั†ะธะธ ะฝะฐัั‚ัƒะฟะฐั‚ะตะปัŒะฝั‹ั… ะพะฟะตั€ะฐั†ะธะน.
ะŸะพัะปะตะดัั‚ะฒะธั ะดะปั ะ‘ะพะตะฒั‹ั… ะžะฟะตั€ะฐั†ะธะนะžะฟะธัั‹ะฒะฐะตั‚, ะบะฐะบ ะฐั‚ั‚ั€ะธั†ะธะพะฝะฝะฐั ะฒะพะนะฝะฐ ะฒะปะธัะตั‚ ะฝะฐ ะณะปัƒะฑะธะฝะฝั‹ะต ัƒะดะฐั€ั‹ ะธ ัั‚ั€ะฐั‚ะตะณะธั‡ะตัะบะพะต ะฟะพั€ะฐะถะตะฝะธะต ัะฟะพัะพะฑะฝะพัั‚ะธ ะฟั€ะพั‚ะธะฒะฝะธะบะฐ ั€ะตะณะตะฝะตั€ะธั€ะพะฒะฐั‚ัŒ ะฑะพะตะฒัƒัŽ ะผะพั‰ัŒ.
ะ—ะฐะบะปัŽั‡ะตะฝะธะตะ ะตะทัŽะผะธั€ัƒะตั‚ ะบะปัŽั‡ะตะฒั‹ะต ะผะพะผะตะฝั‚ั‹ ะพ ั‚ะพะผ, ะบะฐะบ ะฒะตัั‚ะธ ะธ ะฒั‹ะธะณั€ั‹ะฒะฐั‚ัŒ ะฐั‚ั‚ั€ะธั†ะธะพะฝะฝัƒัŽ ะฒะพะนะฝัƒ, ะฟะพะดั‡ะตั€ะบะธะฒะฐั ะฒะฐะถะฝะพัั‚ัŒ ัั‚ั€ะฐั‚ะตะณะธั‡ะตัะบะพะณะพ ั‚ะตั€ะฟะตะฝะธั ะธ ั‚ั‰ะฐั‚ะตะปัŒะฝะพะณะพ ะฟะปะฐะฝะธั€ะพะฒะฐะฝะธั.

ะœะตะฝั‚ะฐะปัŒะฝะฐั ะบะฐั€ั‚ะฐ

ะ’ะพั‚ ะผะตะฝั‚ะฐะปัŒะฝะฐั ะบะฐั€ั‚ะฐ ะฟะพะบะฐะทั‹ะฒะฐะตั‚ ัั‚ั€ัƒะบั‚ัƒั€ัƒ ัั‚ะฐั‚ัŒะธ ะธ ััƒะผะผะธั€ัƒะตั‚ ัะฒัะทะธ ะผะตะถะดัƒ ะฟั€ะตะดัั‚ะฐะฒะปะตะฝะฝั‹ะผะธ ะบะพะฝั†ะตะฟั†ะธัะผะธ:


ะกัƒะผะผะฐั€ะฝะพะต ะธะทะปะพะถะตะฝะธะต, ะธะดะตะธ ะธ ั€ะตะบะพะผะตะฝะดะฐั†ะธะธ

ะกะฃะœะœะะ ะะžะ• ะ˜ะ—ะ›ะžะ–ะ•ะะ˜ะ•

ะะปะตะบั ะ’ะตั€ัˆะธะฝะธะฝ ะฒ “ะ˜ัะบัƒััั‚ะฒะต ะฐั‚ั‚ั€ะธั†ะธะพะฝะฝะพะน ะฒะพะนะฝั‹: ะฃั€ะพะบะธ ะฒะพะนะฝั‹ ะ ะพััะธะธ ะฟั€ะพั‚ะธะฒ ะฃะบั€ะฐะธะฝั‹” ะดะปั ะšะพั€ะพะปะตะฒัะบะพะณะพ ะธะฝัั‚ะธั‚ัƒั‚ะฐ ะพะฑัŠะตะดะธะฝะตะฝะฝั‹ั… ัะปัƒะถะฑ ะพะฑััƒะถะดะฐะตั‚ ะฝะตะพะฑั…ะพะดะธะผะพัั‚ัŒ ะดะปั ะ—ะฐะฟะฐะดะฐ ะฟะตั€ะตัะผะพั‚ั€ะตั‚ัŒ ัะฒะพัŽ ะฒะพะตะฝะฝัƒัŽ ัั‚ั€ะฐั‚ะตะณะธัŽ ะฒ ะพั‚ะฝะพัˆะตะฝะธะธ ะฐั‚ั‚ั€ะธั†ะธะพะฝะฐ ะฒ ะฟั€ะตะดะฒะธะดะตะฝะธะธ ะทะฐั‚ัะถะฝั‹ั… ะบะพะฝั„ะปะธะบั‚ะพะฒ.
ะกั‚ะฐั‚ัŒั ะฟั€ะพั‚ะธะฒะพะฟะพัั‚ะฐะฒะปัะตั‚ ะฐั‚ั‚ั€ะธั†ะธะพะฝะฝัƒัŽ ะธ ะผะฐะฝะตะฒั€ะตะฝะฝัƒัŽ ะฒะพะนะฝัƒ, ะฟะพะดั‡ะตั€ะบะธะฒะฐั ะฒะฐะถะฝะพัั‚ัŒ ะฟั€ะพะผั‹ัˆะปะตะฝะฝะพะน ะผะพั‰ะฝะพัั‚ะธ, ะณะตะฝะตั€ะฐั†ะธะธ ัะธะป ะธ ัะบะพะฝะพะผะธั‡ะตัะบะพะน ัƒัั‚ะพะนั‡ะธะฒะพัั‚ะธ ะฒ ะฟะพะฑะตะดะต ะฒ ะทะฐั‚ัะถะฝั‹ั… ะฒะพะนะฝะฐั….

ะ˜ะ”ะ•ะ˜:

  • ะั‚ั‚ั€ะธั†ะธะพะฝะฝั‹ะต ะฒะพะนะฝั‹ ั‚ั€ะตะฑัƒัŽั‚ ัƒะฝะธะบะฐะปัŒะฝะพะน ัั‚ั€ะฐั‚ะตะณะธะธ, ัะพัั€ะตะดะพั‚ะพั‡ะตะฝะฝะพะน ะฝะฐ ัะธะปะต, ะฐ ะฝะต ะฝะฐ ะผะตัั‚ะฝะพัั‚ะธ.
  • ะ—ะฐะฟะฐะดะฝะฐั ะฒะพะตะฝะฝะฐั ัั‚ั€ะฐั‚ะตะณะธั ั‚ั€ะฐะดะธั†ะธะพะฝะฝะพ ะพั‚ะดะฐะตั‚ ะฟั€ะตะดะฟะพั‡ั‚ะตะฝะธะต ะฑั‹ัั‚ั€ั‹ะผ, ั€ะตัˆะฐัŽั‰ะธะผ ะฑะธั‚ะฒะฐะผ, ะฝะต ะณะพั‚ะพะฒะฐ ะบ ะทะฐั‚ัะถะฝะพะผัƒ ะฐั‚ั‚ั€ะธั†ะธะพะฝะฝะพะผัƒ ะบะพะฝั„ะปะธะบั‚ัƒ.
  • ะ’ะพะนะฝั‹ ะฐั‚ั‚ั€ะธั†ะธะพะฝะฐ ัะพ ะฒั€ะตะผะตะฝะตะผ ะฒั‹ั€ะฐะฒะฝะธะฒะฐัŽั‚ ัˆะฐะฝัั‹ ะผะตะถะดัƒ ะฐั€ะผะธัะผะธ ั ั€ะฐะทะปะธั‡ะฝั‹ะผะธ ะฝะฐั‡ะฐะปัŒะฝั‹ะผะธ ะฒะพะทะผะพะถะฝะพัั‚ัะผะธ.
  • ะŸะพะฑะตะดะฐ ะฒ ะฐั‚ั‚ั€ะธั†ะธะพะฝะฝั‹ั… ะฒะพะนะฝะฐั… ะฑะพะปัŒัˆะต ะทะฐะฒะธัะธั‚ ะพั‚ ัะบะพะฝะพะผะธั‡ะตัะบะพะน ัะธะปั‹ ะธ ะฟั€ะพะผั‹ัˆะปะตะฝะฝะพะน ะผะพั‰ะฝะพัั‚ะธ, ั‡ะตะผ ะพั‚ ะฒะพะตะฝะฝะพะณะพ ะผะฐัั‚ะตั€ัั‚ะฒะฐ.
  • ะ˜ะฝั‚ะตะณั€ะฐั†ะธั ะณั€ะฐะถะดะฐะฝัะบะธั… ั‚ะพะฒะฐั€ะพะฒ ะฒ ะฒะพะตะฝะฝะพะต ะฟั€ะพะธะทะฒะพะดัั‚ะฒะพ ะพะฑะปะตะณั‡ะฐะตั‚ ะฑั‹ัั‚ั€ะพะต ะฒะพะพั€ัƒะถะตะฝะธะต ะฒ ะฐั‚ั‚ั€ะธั†ะธะพะฝะฝั‹ั… ะฒะพะนะฝะฐั….
  • ะ—ะฐะฟะฐะดะฝั‹ะต ัะบะพะฝะพะผะธะบะธ ัั‚ะฐะปะบะธะฒะฐัŽั‚ัั ั ั‚ั€ัƒะดะฝะพัั‚ัะผะธ ะฒ ะฑั‹ัั‚ั€ะพะผ ะผะฐััˆั‚ะฐะฑะธั€ะพะฒะฐะฝะธะธ ะฒะพะตะฝะฝะพะณะพ ะฟั€ะพะธะทะฒะพะดัั‚ะฒะฐ ะธะท-ะทะฐ ะผะธั€ะฝะพะณะพ ัั„ั„ะตะบั‚ะธะฒะฝะพัั‚ะธ ะธ ะฐัƒั‚ัะพั€ัะธะฝะณะฐ.
  • ะั‚ั‚ั€ะธั†ะธะพะฝะฝะฐั ะฒะพะนะฝะฐ ั‚ั€ะตะฑัƒะตั‚ ะผะฐััะพะฒะพะณะพ ะธ ะฑั‹ัั‚ั€ะพะณะพ ั€ะฐััˆะธั€ะตะฝะธั ะฐั€ะผะธะน, ั‡ั‚ะพ ั‚ั€ะตะฑัƒะตั‚ ะธะทะผะตะฝะตะฝะธั ัั‚ั€ะฐั‚ะตะณะธะน ะฟั€ะพะธะทะฒะพะดัั‚ะฒะฐ ะธ ะพะฑัƒั‡ะตะฝะธั.
  • ะญั„ั„ะตะบั‚ะธะฒะฝะพัั‚ัŒ ะฒะพะตะฝะฝะพะน ะดะพะบั‚ั€ะธะฝั‹ ะะะขะž ัƒั…ัƒะดัˆะฐะตั‚ัั ะฒ ะฐั‚ั‚ั€ะธั†ะธะพะฝะฝะพะน ะฒะพะนะฝะต ะธะท-ะทะฐ ะฒั€ะตะผะตะฝะธ, ะฝะตะพะฑั…ะพะดะธะผะพะณะพ ะดะปั ะทะฐะผะตะฝั‹ ะพะฟั‹ั‚ะฝั‹ั… ะฝะตะบะพะผะธััะธั€ะพะฒะฐะฝะฝั‹ั… ะพั„ะธั†ะตั€ะพะฒ (NCOs).
  • ะกะพะฒะตั‚ัะบะฐั ะผะพะดะตะปัŒ ะณะตะฝะตั€ะฐั†ะธะธ ัะธะป, ั ะตะต ะผะฐััะพะฒั‹ะผะธ ั€ะตะทะตั€ะฒะฐะผะธ ะธ ะพั„ะธั†ะตั€ัะบะธะผ ัƒะฟั€ะฐะฒะปะตะฝะธะตะผ, ะฑะพะปะตะต ะฐะดะฐะฟั‚ะธั€ัƒะตะผะฐ ะบ ะฐั‚ั‚ั€ะธั†ะธะพะฝะฝะพะน ะฒะพะนะฝะต.
  • ะกะพะตะดะธะฝะตะฝะธะต ะฟั€ะพั„ะตััะธะพะฝะฐะปัŒะฝั‹ั… ัะธะป ั ะผะฐััะพะฒะพ ะผะพะฑะธะปะธะทะพะฒะฐะฝะฝั‹ะผะธ ะฒะพะนัะบะฐะผะธ ัะพะทะดะฐะตั‚ ัะฑะฐะปะฐะฝัะธั€ะพะฒะฐะฝะฝัƒัŽ ัั‚ั€ะฐั‚ะตะณะธัŽ ะดะปั ะฐั‚ั‚ั€ะธั†ะธะพะฝะฝะพะน ะฒะพะนะฝั‹.
  • ะกะพะฒั€ะตะผะตะฝะฝะฐั ะฒะพะนะฝะฐ ะธะฝั‚ะตะณั€ะธั€ัƒะตั‚ ัะปะพะถะฝั‹ะต ัะธัั‚ะตะผั‹, ั‚ั€ะตะฑัƒัŽั‰ะธะต ะฟั€ะพะดะฒะธะฝัƒั‚ะพะณะพ ะฟะปะฐะฝะธั€ะพะฒะฐะฝะธั ะธ ะบะพะพั€ะดะธะฝะฐั†ะธะธ, ั‡ั‚ะพ ะทะฐั‚ั€ัƒะดะฝัะตั‚ ะฑั‹ัั‚ั€ั‹ะต ะฝะฐัั‚ัƒะฟะฐั‚ะตะปัŒะฝั‹ะต ะผะฐะฝะตะฒั€ั‹.
  • ะั‚ั‚ั€ะธั†ะธะพะฝะฝั‹ะต ัั‚ั€ะฐั‚ะตะณะธะธ ัะพัั€ะตะดะพั‚ะพั‡ะตะฝั‹ ะฝะฐ ะธัั‚ะพั‰ะตะฝะธะธ ัะฟะพัะพะฑะฝะพัั‚ะธ ะฟั€ะพั‚ะธะฒะฝะธะบะฐ ั€ะตะณะตะฝะตั€ะธั€ะพะฒะฐั‚ัŒ ะฑะพะตะฒัƒัŽ ะผะพั‰ัŒ, ะทะฐั‰ะธั‰ะฐั ัะฒะพัŽ ัะพะฑัั‚ะฒะตะฝะฝัƒัŽ.
  • ะะฐั‡ะฐะปัŒะฝะฐั ั„ะฐะทะฐ ะฐั‚ั‚ั€ะธั†ะธะพะฝะฝะพะน ะฒะพะนะฝั‹ ะฟะพะดั‡ะตั€ะบะธะฒะฐะตั‚ ัƒะดะตั€ะถะธะฒะฐัŽั‰ะธะต ะดะตะนัั‚ะฒะธั ะธ ะฝะฐั€ะฐั‰ะธะฒะฐะฝะธะต ะฑะพะตะฒะพะน ะผะพั‰ะธ, ะฐ ะฝะต ะทะฐะฒะพะตะฒะฐะฝะธะต ั‚ะตั€ั€ะธั‚ะพั€ะธะธ.
  • ะะฐัั‚ัƒะฟะฐั‚ะตะปัŒะฝั‹ะต ะพะฟะตั€ะฐั†ะธะธ ะฒ ะฐั‚ั‚ั€ะธั†ะธะพะฝะฝะพะน ะฒะพะนะฝะต ัะปะตะดัƒะตั‚ ะพั‚ะบะปะฐะดั‹ะฒะฐั‚ัŒ ะดะพ ั‚ะตั… ะฟะพั€, ะฟะพะบะฐ ั€ะตะทะตั€ะฒั‹ ะธ ะฟั€ะพะผั‹ัˆะปะตะฝะฝะฐั ะผะพั‰ะฝะพัั‚ัŒ ะฟั€ะพั‚ะธะฒะฝะธะบะฐ ะดะพัั‚ะฐั‚ะพั‡ะฝะพ ะฝะต ะธัั‚ะพั‰ะตะฝั‹.
  • ะ“ะปัƒะฑะธะฝะฝั‹ะต ัƒะดะฐั€ั‹ ะฟะพ ะธะฝั„ั€ะฐัั‚ั€ัƒะบั‚ัƒั€ะต ะธ ะฟั€ะพะธะทะฒะพะดัั‚ะฒะตะฝะฝั‹ะผ ะฒะพะทะผะพะถะฝะพัั‚ัะผ ะฟั€ะพั‚ะธะฒะฝะธะบะฐ ะธะผะตัŽั‚ ั€ะตัˆะฐัŽั‰ะตะต ะทะฝะฐั‡ะตะฝะธะต ะฒ ะฐั‚ั‚ั€ะธั†ะธะพะฝะฝะพะน ะฒะพะนะฝะต.
  • ะั‚ั‚ั€ะธั†ะธะพะฝะฝะฐั ะฒะพะนะฝะฐ ั‚ั€ะตะฑัƒะตั‚ ัั‚ั€ะฐั‚ะตะณะธั‡ะตัะบะพะณะพ ั‚ะตั€ะฟะตะฝะธั ะธ ะฐะบั†ะตะฝั‚ะฐ ะฝะฐ ะพะฑะพั€ะพะฝะธั‚ะตะปัŒะฝั‹ั… ะพะฟะตั€ะฐั†ะธัั… ะดะปั ะฟะพะดะณะพั‚ะพะฒะบะธ ะบ ะฑัƒะดัƒั‰ะธะผ ะฝะฐัั‚ัƒะฟะปะตะฝะธัะผ.
  • ะžะถะธะดะฐะฝะธะต ะ—ะฐะฟะฐะดะฐ ะบะพั€ะพั‚ะบะธั…, ั€ะตัˆะฐัŽั‰ะธั… ะบะพะฝั„ะปะธะบั‚ะพะฒ ะฝะต ัะพะพั‚ะฒะตั‚ัั‚ะฒัƒะตั‚ ั€ะตะฐะปัŒะฝะพัั‚ะธ ะฟะพั‚ะตะฝั†ะธะฐะปัŒะฝั‹ั… ะฐั‚ั‚ั€ะธั†ะธะพะฝะฝั‹ั… ะฒะพะนะฝ ั ั€ะฐะฒะฝั‹ะผะธ ะฟั€ะพั‚ะธะฒะฝะธะบะฐะผะธ.
  • ะŸั€ะธะทะฝะฐะฝะธะต ะฒะฐะถะฝะพัั‚ะธ ัะบะพะฝะพะผะธั‡ะตัะบะธั… ัั‚ั€ะฐั‚ะตะณะธะน ะธ ะฟั€ะพะผั‹ัˆะปะตะฝะฝะพะน ะผะพะฑะธะปะธะทะฐั†ะธะธ ะบะปัŽั‡ะตะฒะพ ะดะปั ะฟะพะดะณะพั‚ะพะฒะบะธ ะบ ะธ ะฒั‹ะธะณั€ั‹ัˆัƒ ะทะฐั‚ัะถะฝะพะณะพ ะบะพะฝั„ะปะธะบั‚ะฐ.
  • ะ˜ะฝั„ะพั€ะผะฐั†ะธะพะฝะฝั‹ะต ะพะฟะตั€ะฐั†ะธะธ ะผะพะณัƒั‚ ะผะฐะฝะธะฟัƒะปะธั€ะพะฒะฐั‚ัŒ ะดะฒะธะถะตะฝะธัะผะธ ะธ ั€ะฐัะฟั€ะตะดะตะปะตะฝะธะตะผ ั€ะตััƒั€ัะพะฒ ะฟั€ะพั‚ะธะฒะฝะธะบะฐ ะฒ ัะฒะพัŽ ะฒั‹ะณะพะดัƒ ะฒ ะฐั‚ั‚ั€ะธั†ะธะพะฝะฝะพะน ะฒะพะนะฝะต.

ะฆะ˜ะขะะขะซ:

  • “ะั‚ั‚ั€ะธั†ะธะพะฝะฝั‹ะต ะฒะพะนะฝั‹ ั‚ั€ะตะฑัƒัŽั‚ ัะฒะพะตะณะพ ‘ะ˜ัะบัƒััั‚ะฒะฐ ะฒะพะนะฝั‹’ ะธ ะฒะตะดัƒั‚ัั ั ‘ะฟะพะดั…ะพะดะพะผ, ัะพัั€ะตะดะพั‚ะพั‡ะตะฝะฝั‹ะผ ะฝะฐ ัะธะปะต’.”
  • “ะขะฐ ัั‚ะพั€ะพะฝะฐ, ะบะพั‚ะพั€ะฐั ะฟั€ะธะฝะธะผะฐะตั‚ ะฐั‚ั‚ั€ะธั†ะธะพะฝะฝั‹ะน ั…ะฐั€ะฐะบั‚ะตั€ ะฒะพะนะฝั‹ ะธ ัะพัั€ะตะดะพั‚ะฐั‡ะธะฒะฐะตั‚ัั ะฝะฐ ัƒะฝะธั‡ั‚ะพะถะตะฝะธะธ ะฒั€ะฐะถะตัะบะธั… ัะธะป, ะฐ ะฝะต ะฝะฐ ะทะฐะฒะพะตะฒะฐะฝะธะธ ั‚ะตั€ั€ะธั‚ะพั€ะธะธ, ัะบะพั€ะตะต ะฒัะตะณะพ, ะฟะพะฑะตะดะธั‚.”
  • “ะ’ะพะนะฝั‹ ะฐั‚ั‚ั€ะธั†ะธะพะฝะฐ ะฒั‹ะธะณั€ั‹ะฒะฐัŽั‚ัั ัะบะพะฝะพะผะธะบะฐะผะธ, ะฟะพะทะฒะพะปััŽั‰ะธะผะธ ะผะฐััะพะฒัƒัŽ ะผะพะฑะธะปะธะทะฐั†ะธัŽ ะฐั€ะผะธะน ั‡ะตั€ะตะท ะธั… ะฟั€ะพะผั‹ัˆะปะตะฝะฝั‹ะต ัะตะบั‚ะพั€ะฐ.”
  • “ะŸั€ะพั‰ะต ะธ ะฑั‹ัั‚ั€ะตะต ะฟั€ะพะธะทะฒะพะดะธั‚ัŒ ะฑะพะปัŒัˆะพะต ะบะพะปะธั‡ะตัั‚ะฒะพ ะดะตัˆะตะฒะพะณะพ ะพั€ัƒะถะธั ะธ ะฑะพะตะฟั€ะธะฟะฐัะพะฒ, ะพัะพะฑะตะฝะฝะพ ะตัะปะธ ะธั… ะฟะพะดะบะพะผะฟะพะฝะตะฝั‚ั‹ ะฒะทะฐะธะผะพะทะฐะผะตะฝัะตะผั‹ ั ะณั€ะฐะถะดะฐะฝัะบะธะผะธ ั‚ะพะฒะฐั€ะฐะผะธ.”
  • “ะญั„ั„ะตะบั‚ะธะฒะฝะพัั‚ัŒ ะฒะพะตะฝะฝะพะน ะดะพะบั‚ั€ะธะฝั‹ ะะะขะž ัƒั…ัƒะดัˆะฐะตั‚ัั ะฒ ะฐั‚ั‚ั€ะธั†ะธะพะฝะฝะพะน ะฒะพะนะฝะต

ะœะพะดะตะปัŒ ัะธัั‚ะตะผะฝะพะน ะดะธะฝะฐะผะธะบะธ

ะ’ ัั‚ะพะผ ั€ะฐะทะดะตะปะต ะผั‹ ะฟะพะบะฐะทั‹ะฒะฐะตะผ ะผะพะดะตะปัŒ ัะธัั‚ะตะผะฝะพะน ะดะธะฝะฐะผะธะบะธ, ะฟะพะปัƒั‡ะตะฝะฝัƒัŽ ั ะฟะพะผะพั‰ัŒัŽ ะทะฐะฟั€ะพัะฐ:

ะกะณะตะฝะตั€ะธั€ัƒะนั‚ะต ะผะพะดะตะปัŒ ัะธัั‚ะตะผะฝะพะน ะดะธะฝะฐะผะธะบะธ ะดะปั ะฒะพะนะฝั‹ ะฝะฐ ะธัั‚ะพั‰ะตะฝะธะต, ะพะฟะธัะฐะฝะฝะพะน ะฒ ัะปะตะดัƒัŽั‰ะตะน ัั‚ะฐั‚ัŒะต:

ะžะฟะธัะฐะฝะธะต ะผะพะดะตะปะธ, ะฟะพะปัƒั‡ะตะฝะฝะพะต ั ะฟะพะผะพั‰ัŒัŽ LLM, ะธะผะตะตั‚ ัะผั‹ัะป, ะฝะพ ะดะปั ะฟะพะปัƒั‡ะตะฝะธั ัะพะพั‚ะฒะตั‚ัั‚ะฒัƒัŽั‰ะตะน ั€ะฐะฑะพั‡ะตะน ะผะพะดะตะปะธ ั‚ั€ะตะฑัƒัŽั‚ัั ะดะพะฟะพะปะฝะธั‚ะตะปัŒะฝั‹ะต ะทะฐะฟั€ะพัั‹ ะบ LLM ะธ/ะธะปะธ (ะผะฐั‚ะตะผะฐั‚ะธั‡ะตัะบะพะต) ะฟั€ะพะณั€ะฐะผะผะธั€ะพะฒะฐะฝะธะต ะธ ะผะพะดะตะปะธั€ะพะฒะฐะฝะธะต.

ะ ะตะทัƒะปัŒั‚ะฐั‚ LLM ะฟั€ะตะดัั‚ะฐะฒะปะตะฝ ะฝะธะถะต.


ะ ะฐะทั€ะฐะฑะพั‚ะบะฐ ะผะพะดะตะปะธ ัะธัั‚ะตะผะฝะพะน ะดะธะฝะฐะผะธะบะธ ะดะปั ะฒะพะนะฝั‹ ะฝะฐ ะธัั‚ะพั‰ะตะฝะธะต, ะพะฟะธัะฐะฝะฝะพะน ะฒ ะฟั€ะตะดะพัั‚ะฐะฒะปะตะฝะฝะพะผ ั‚ะตะบัั‚ะต, ะฒะบะปัŽั‡ะฐะตั‚ ัะพะทะดะฐะฝะธะต ัั‚ั€ัƒะบั‚ัƒั€ั‹, ะบะพั‚ะพั€ะฐั ัƒะปะฐะฒะปะธะฒะฐะตั‚ ะบะปัŽั‡ะตะฒั‹ะต ะดะธะฝะฐะผะธะบะธ ะธัั‚ะพั‰ะตะฝะธั, ะณะตะฝะตั€ะฐั†ะธะธ ัะธะป, ัะบะพะฝะพะผะธั‡ะตัะบะพะน ะฟะพะดะดะตั€ะถะบะธ ะธ ะฒะปะธัะฝะธั ะฟั€ะพะผั‹ัˆะปะตะฝะฝะพะน ะผะพั‰ะฝะพัั‚ะธ ะฝะฐ ะฒะตะดะตะฝะธะต ะฒะพะนะฝั‹. ะญั‚ะฐ ะผะพะดะตะปัŒ ะฑัƒะดะตั‚ ัะพัั€ะตะดะพั‚ะพั‡ะตะฝะฐ ะฝะฐ ะฒะทะฐะธะผะพะดะตะนัั‚ะฒะธัั… ะผะตะถะดัƒ ัั‚ะธะผะธ ัะปะตะผะตะฝั‚ะฐะผะธ ะดะปั ะฟะพะฝะธะผะฐะฝะธั ะดะพะปะณะพัั€ะพั‡ะฝั‹ั… ั€ะตะทัƒะปัŒั‚ะฐั‚ะพะฒ ะฒะพะนะฝั‹ ะฝะฐ ะธัั‚ะพั‰ะตะฝะธะต, ะพัะพะฑะตะฝะฝะพ ะฒ ะบะพะฝั‚ะตะบัั‚ะต ั€ะพััะธะนัะบะพะน ะฒะพะนะฝั‹ ะฝะฐ ะฃะบั€ะฐะธะฝะต, ะบะฐะบ ะพะฑััƒะถะดะฐะตั‚ั

ะšะพะผะฟะพะฝะตะฝั‚ั‹ ะผะพะดะตะปะธ ัะธัั‚ะตะผะฝะพะน ะดะธะฝะฐะผะธะบะธ:

  1. ะ—ะฐะฟะฐัั‹: ะญั‚ะพ ะฝะฐะบะพะฟะปะตะฝะธั ะฒ ัะธัั‚ะตะผะต, ะบะพั‚ะพั€ั‹ะต ะธะทะผะตะฝััŽั‚ัั ัะพ ะฒั€ะตะผะตะฝะตะผ. ะ”ะปั ะผะพะดะตะปะธ ะฒะพะนะฝั‹ ะฝะฐ ะธัั‚ะพั‰ะตะฝะธะต ะฐะบั‚ัƒะฐะปัŒะฝั‹ะต ะทะฐะฟะฐัั‹ ะผะพะณัƒั‚ ะฒะบะปัŽั‡ะฐั‚ัŒ:
    • ะ’ะพะตะฝะฝั‹ะน ะฟะตั€ัะพะฝะฐะป: ะกัŽะดะฐ ะฒั…ะพะดัั‚ ะบะฐะบ ะฒั‹ัะพะบะพะบะฒะฐะปะธั„ะธั†ะธั€ะพะฒะฐะฝะฝั‹ะต ะฟั€ะพั„ะตััะธะพะฝะฐะปัŒะฝั‹ะต ัะพะปะดะฐั‚ั‹, ั‚ะฐะบ ะธ ะผะพะฑะธะปะธะทะพะฒะฐะฝะฝั‹ะต ะธะปะธ ะฟั€ะธะทะฒะฐะฝะฝั‹ะต ะฒะพะตะฝะฝะพัะปัƒะถะฐั‰ะธะต ะฝะธะทะบะพะณะพ ัƒั€ะพะฒะฝั.
    • ะŸั€ะพะผั‹ัˆะปะตะฝะฝะฐั ะผะพั‰ะฝะพัั‚ัŒ: ะกะฟะพัะพะฑะฝะพัั‚ัŒ ะฟั€ะพะธะทะฒะพะดะธั‚ัŒ ะฒะพะตะฝะฝะพะต ะพะฑะพั€ัƒะดะพะฒะฐะฝะธะต, ะบะพั‚ะพั€ะพะต ะผะพะถะตั‚ ะฑั‹ั‚ัŒ ั€ะฐะทะดะตะปะตะฝะพ ะฝะฐ ะฒั‹ัะพะบะพั‚ะตั…ะฝะพะปะพะณะธั‡ะฝั‹ะต ัะปะพะถะฝั‹ะต ัะธัั‚ะตะผั‹ ะธ ะผะฐััะพะฒะพ ะฟั€ะพะธะทะฒะพะดะธะผั‹ะต ะฟั€ะตะดะผะตั‚ั‹ ะฝะธะทะบะพะณะพ ัƒั€ะพะฒะฝั.
    • ะญะบะพะฝะพะผะธั‡ะตัะบะธะต ั€ะตััƒั€ัั‹: ะญั‚ะพ ั„ะธะฝะฐะฝัะพะฒั‹ะต ะธ ะผะฐั‚ะตั€ะธะฐะปัŒะฝั‹ะต ั€ะตััƒั€ัั‹, ะดะพัั‚ัƒะฟะฝั‹ะต ะดะปั ะฟะพะดะดะตั€ะถะบะธ ะฒะพะตะฝะฝะพะณะพ ะฟั€ะพะธะทะฒะพะดัั‚ะฒะฐ ะธ ะพะฟะตั€ะฐั†ะธะน.
    • ะ‘ะพะตะฒะฐั ะผะพั‰ัŒ: ะžะฑั‰ะฐั ัั„ั„ะตะบั‚ะธะฒะฝะพัั‚ัŒ ะธ ัะธะปะฐ ะฒะพะตะฝะฝั‹ั… ัะธะป, ะฝะฐ ะบะพั‚ะพั€ัƒัŽ ะฒะปะธััŽั‚ ะบะฐะบ ะบะพะปะธั‡ะตัั‚ะฒะพ, ั‚ะฐะบ ะธ ะบะฐั‡ะตัั‚ะฒะพ ัะธะป ะธ ะพะฑะพั€ัƒะดะพะฒะฐะฝะธั.
  2. ะŸะพั‚ะพะบะธ: ะญั‚ะพ ัะบะพั€ะพัั‚ะธ, ะบะพั‚ะพั€ั‹ะต ะธะทะผะตะฝััŽั‚ ะทะฐะฟะฐัั‹, ะฟั€ะตะดัั‚ะฐะฒะปัั ะฟั€ะพั†ะตััั‹ ะฒะฝัƒั‚ั€ะธ ัะธัั‚ะตะผั‹.
    • ะะฐะฑะพั€ ะธ ะพะฑัƒั‡ะตะฝะธะต: ะ”ะพะฑะฐะฒะปะตะฝะธะต ะปะธั‡ะฝะพะณะพ ัะพัั‚ะฐะฒะฐ ะบ ะทะฐะฟะฐััƒ ะฒะพะตะฝะฝะพะณะพ ะฟะตั€ัะพะฝะฐะปะฐ.
    • ะกะบะพั€ะพัั‚ัŒ ะธัั‚ะพั‰ะตะฝะธั: ะฃะผะตะฝัŒัˆะตะฝะธะต ะฒะพะตะฝะฝะพะณะพ ะฟะตั€ัะพะฝะฐะปะฐ ั‡ะตั€ะตะท ะฑะพะตะฒั‹ะต ะฟะพั‚ะตั€ะธ.
    • ะกะบะพั€ะพัั‚ัŒ ะฟั€ะพะธะทะฒะพะดัั‚ะฒะฐ: ะกะบะพั€ะพัั‚ัŒ, ั ะบะพั‚ะพั€ะพะน ะฟั€ะพะผั‹ัˆะปะตะฝะฝะฐั ะผะพั‰ะฝะพัั‚ัŒ ะฟั€ะพะธะทะฒะพะดะธั‚ ะฒะพะตะฝะฝะพะต ะพะฑะพั€ัƒะดะพะฒะฐะฝะธะต.
    • ะ ะฐัะฟั€ะตะดะตะปะตะฝะธะต ั€ะตััƒั€ัะพะฒ: ะŸะพั‚ะพะบ ัะบะพะฝะพะผะธั‡ะตัะบะธั… ั€ะตััƒั€ัะพะฒ ะฒ ะฒะพะตะฝะฝะพะต ะฟั€ะพะธะทะฒะพะดัั‚ะฒะพ ะธ ะพะฟะตั€ะฐั†ะธะธ.
  3. ะŸะตั‚ะปะธ ะพะฑั€ะฐั‚ะฝะพะน ัะฒัะทะธ: ะญั‚ะธ ะฟะตั‚ะปะธ ะฟะพะผะพะณะฐัŽั‚ ะฟะพะฝัั‚ัŒ, ะบะฐะบ ั€ะฐะทะฝั‹ะต ั‡ะฐัั‚ะธ ัะธัั‚ะตะผั‹ ะฒะปะธััŽั‚ ะดั€ัƒะณ ะฝะฐ ะดั€ัƒะณะฐ, ัƒัะธะปะธะฒะฐั ะธะปะธ ัƒั€ะฐะฒะฝะพะฒะตัˆะธะฒะฐั ะดะธะฝะฐะผะธะบัƒ ัะธัั‚ะตะผั‹.
    • ะฃัะธะปะธะฒะฐัŽั‰ะฐั ะฟะตั‚ะปั (R1): ะฃะฒะตะปะธั‡ะตะฝะธะต ะฟั€ะพะผั‹ัˆะปะตะฝะฝะพะน ะผะพั‰ะฝะพัั‚ะธ ะฟั€ะธะฒะพะดะธั‚ ะบ ะฑะพะปัŒัˆะตะผัƒ ะบะพะปะธั‡ะตัั‚ะฒัƒ ะฒะพะตะฝะฝะพะณะพ ะพะฑะพั€ัƒะดะพะฒะฐะฝะธั, ั‡ั‚ะพ ะฟะพะฒั‹ัˆะฐะตั‚ ะฑะพะตะฒัƒัŽ ะผะพั‰ัŒ, ะฟะพั‚ะตะฝั†ะธะฐะปัŒะฝะพ ะฟั€ะธะฒะพะดั ะบ ะฒะพะตะฝะฝะพะผัƒ ัƒัะฟะตั…ัƒ, ะบะพั‚ะพั€ั‹ะน ะพะฟั€ะฐะฒะดั‹ะฒะฐะตั‚ ะดะฐะปัŒะฝะตะนัˆะธะต ะธะฝะฒะตัั‚ะธั†ะธะธ ะฒ ะฟั€ะพะผั‹ัˆะปะตะฝะฝัƒัŽ ะผะพั‰ะฝะพัั‚ัŒ.
    • ะฃั€ะฐะฒะฝะพะฒะตัˆะธะฒะฐัŽั‰ะฐั ะฟะตั‚ะปั (B1): ะ’ั‹ัะพะบะธะต ัะบะพั€ะพัั‚ะธ ะธัั‚ะพั‰ะตะฝะธั ัะพะบั€ะฐั‰ะฐัŽั‚ ะฒะพะตะฝะฝั‹ะน ะฟะตั€ัะพะฝะฐะป, ัะฝะธะถะฐั ะฑะพะตะฒัƒัŽ ะผะพั‰ัŒ, ั‡ั‚ะพ ะผะพะถะตั‚ ะฟั€ะธะฒะตัั‚ะธ ะบ ะฟะตั€ะตะพั†ะตะฝะบะต ะฒะพะตะฝะฝั‹ั… ัั‚ั€ะฐั‚ะตะณะธะน ะธ ะฟะพั‚ะตะฝั†ะธะฐะปัŒะฝะพะผัƒ ัะพะบั€ะฐั‰ะตะฝะธัŽ ะฐะณั€ะตััะธะฒะฝั‹ั… ะพะฟะตั€ะฐั†ะธะน ะดะปั ัะพั…ั€ะฐะฝะตะฝะธั ัะธะป.
  4. ะ’ัะฟะพะผะพะณะฐั‚ะตะปัŒะฝั‹ะต ะฟะตั€ะตะผะตะฝะฝั‹ะต: ะญั‚ะพ ั„ะฐะบั‚ะพั€ั‹, ะฒะปะธััŽั‰ะธะต ะฝะฐ ะฟะพั‚ะพะบะธ, ะฝะพ ัะฐะผะธ ะฟะพ ัะตะฑะต ะฝะต ัะฒะปััŽั‰ะธะตัั ะทะฐะฟะฐัะฐะผะธ. ะŸั€ะธะผะตั€ั‹ ะฒะบะปัŽั‡ะฐัŽั‚:
    • ะญั„ั„ะตะบั‚ะธะฒะฝะพัั‚ัŒ ะพะฑัƒั‡ะตะฝะธั: ะ’ะปะธัะตั‚ ะฝะฐ ั‚ะพ, ะฝะฐัะบะพะปัŒะบะพ ะฑั‹ัั‚ั€ะพ ะฝะพะฒะพะฑั€ะฐะฝั†ั‹ ะผะพะณัƒั‚ ะฑั‹ั‚ัŒ ะฟั€ะตะฒั€ะฐั‰ะตะฝั‹ ะฒ ัั„ั„ะตะบั‚ะธะฒะฝั‹ะน ะฒะพะตะฝะฝั‹ะน ะฟะตั€ัะพะฝะฐะป.
    • ะขะตั…ะฝะพะปะพะณะธั‡ะตัะบะธะต ะธะฝะฝะพะฒะฐั†ะธะธ: ะ’ะปะธััŽั‚ ะฝะฐ ัั„ั„ะตะบั‚ะธะฒะฝะพัั‚ัŒ ะฟั€ะพะธะทะฒะตะดะตะฝะฝะพะณะพ ะฒะพะตะฝะฝะพะณะพ ะพะฑะพั€ัƒะดะพะฒะฐะฝะธั ะธ ะฟะพั‚ะตะฝั†ะธะฐะปัŒะฝะพ ัะฝะธะถะฐัŽั‚ ะทะฐั‚ั€ะฐั‚ั‹ ะธะปะธ ะฒั€ะตะผั ะฝะฐ ะฟั€ะพะธะทะฒะพะดัั‚ะฒะพ.
    • ะœะตะถะดัƒะฝะฐั€ะพะดะฝะฐั ะฟะพะดะดะตั€ะถะบะฐ: ะ’ะฝะตัˆะฝัั ะฟะพะดะดะตั€ะถะบะฐ ะผะพะถะตั‚ ะฒะปะธัั‚ัŒ ะฝะฐ ัะบะพะฝะพะผะธั‡ะตัะบะธะต ั€ะตััƒั€ัั‹ ะธ ะฟั€ะพะผั‹ัˆะปะตะฝะฝัƒัŽ ะผะพั‰ะฝะพัั‚ัŒ.
  5. ะŸะฐั€ะฐะผะตั‚ั€ั‹: ะคะธะบัะธั€ะพะฒะฐะฝะฝั‹ะต ะทะฝะฐั‡ะตะฝะธั, ะพะฟั€ะตะดะตะปััŽั‰ะธะต ะพะบั€ัƒะถะฐัŽั‰ัƒัŽ ัั€ะตะดัƒ ัะธัั‚ะตะผั‹, ั‚ะฐะบะธะต ะบะฐะบ:
    • ะะฐั‡ะฐะปัŒะฝะฐั ะฟั€ะพะผั‹ัˆะปะตะฝะฝะฐั ะผะพั‰ะฝะพัั‚ัŒ: ะะฐั‡ะฐะปัŒะฝั‹ะน ัƒั€ะพะฒะตะฝัŒ ัะฟะพัะพะฑะฝะพัั‚ะธ ัั‚ั€ะฐะฝั‹ ะฟั€ะพะธะทะฒะพะดะธั‚ัŒ ะฒะพะตะฝะฝั‹ะต ั‚ะพะฒะฐั€ั‹.
    • ะญะบะพะฝะพะผะธั‡ะตัะบะฐั ัั‚ะฐะฑะธะปัŒะฝะพัั‚ัŒ: ะžะฟั€ะตะดะตะปัะตั‚, ะฝะฐัะบะพะปัŒะบะพ ัะบะพะฝะพะผะธะบะฐ ัƒัั‚ะพะนั‡ะธะฒะฐ ะบ ะฝะฐะณั€ัƒะทะบะฐะผ ะฟั€ะพะดะพะปะถะธั‚ะตะปัŒะฝะพะณะพ ะบะพะฝั„ะปะธะบั‚ะฐ.

ะŸั€ะพั†ะตัั ะผะพะดะตะปะธั€ะพะฒะฐะฝะธั:

  1. ะ˜ะฝะธั†ะธะฐะปะธะทะฐั†ะธั: ะฃัั‚ะฐะฝะพะฒะบะฐ ะฝะฐั‡ะฐะปัŒะฝั‹ั… ะทะฝะฐั‡ะตะฝะธะน ะดะปั ะทะฐะฟะฐัะพะฒ ะฝะฐ ะพัะฝะพะฒะต ะธัั‚ะพั€ะธั‡ะตัะบะธั… ะดะฐะฝะฝั‹ั… ะธะปะธ ะพั†ะตะฝะพะบ (ะฝะฐะฟั€ะธะผะตั€, ะฟั€ะพะผั‹ัˆะปะตะฝะฝะฐั ะผะพั‰ะฝะพัั‚ัŒ ะดะพ ะฒะพะนะฝั‹, ะฝะฐั‡ะฐะปัŒะฝั‹ะน ัƒั€ะพะฒะตะฝัŒ ะฒะพะตะฝะฝะพะณะพ ะฟะตั€ัะพะฝะฐะปะฐ).
  2. ะกะธะผัƒะปัั†ะธั: ะ—ะฐะฟัƒัะบ ัะธะผัƒะปัั†ะธะน ะดะปั ะฟั€ะพัะผะพั‚ั€ะฐ, ะบะฐะบ ัะธัั‚ะตะผะฐ ั€ะฐะทะฒะธะฒะฐะตั‚ัั ัะพ ะฒั€ะตะผะตะฝะตะผ ะฒ ั€ะฐะทะปะธั‡ะฝั‹ั… ัั†ะตะฝะฐั€ะธัั…, ั‚ะฐะบะธั… ะบะฐะบ ะธะทะผะตะฝะตะฝะธั ะฒ ัะบะพะฝะพะผะธั‡ะตัะบะพะน ะฟะพะดะดะตั€ะถะบะต, ะฒะฐั€ะธะฐั†ะธะธ ะฒ ัะบะพั€ะพัั‚ัั… ะธัั‚ะพั‰ะตะฝะธั ะธะปะธ ัะดะฒะธะณะธ ะฒ ะฒะพะตะฝะฝะพะน ัั‚ั€ะฐั‚ะตะณะธะธ ะพั‚ ะฒั‹ัะพะบะพั‚ะตั…ะฝะพะปะพะณะธั‡ะฝะพะณะพ ะบ ะผะฐััะพะฒะพะผัƒ ะฟั€ะพะธะทะฒะพะดัั‚ะฒัƒ.
  3. ะะฝะฐะปะธะท ัั†ะตะฝะฐั€ะธะตะฒ: ะขะตัั‚ะธั€ะพะฒะฐะฝะธะต ั€ะฐะทะปะธั‡ะฝั‹ั… ัั‚ั€ะฐั‚ะตะณะธะน, ั‚ะฐะบะธั… ะบะฐะบ ัƒะฒะตะปะธั‡ะตะฝะธะต ะฐะบั†ะตะฝั‚ะฐ ะฝะฐ ะฟั€ะพะธะทะฒะพะดัั‚ะฒะต ะผะฐััะพะฒะพะณะพ ะฒะพะตะฝะฝะพะณะพ ะพะฑะพั€ัƒะดะพะฒะฐะฝะธั ะฝะธะทะบะพะณะพ ัƒั€ะพะฒะฝั ะธะปะธ ัะพัั€ะตะดะพั‚ะพั‡ะตะฝะธะต ะฝะฐ ัะพั…ั€ะฐะฝะตะฝะธะธ ะฒั‹ัะพะบะพะบะฐั‡ะตัั‚ะฒะตะฝะฝั‹ั… ัะธะป ั‡ะตั€ะตะท ัƒะปัƒั‡ัˆะตะฝะธะต ะพะฑัƒั‡ะตะฝะธั ะธ ัะฝะธะถะตะฝะธะต ะฟะพั‚ะตั€ัŒ.
  4. ะ ะฐะทั€ะฐะฑะพั‚ะบะฐ ะฟะพะปะธั‚ะธะบะธ: ะ˜ัะฟะพะปัŒะทะพะฒะฐะฝะธะต ะฒั‹ะฒะพะดะพะฒ ะธะท ะผะพะดะตะปะธ ะดะปั ะฟั€ะตะดะปะพะถะตะฝะธั ัั‚ั€ะฐั‚ะตะณะธั‡ะตัะบะธั… ะบะพั€ั€ะตะบั‚ะธั€ะพะฒะพะบ, ั‚ะฐะบะธั… ะบะฐะบ ั€ะฐััˆะธั€ะตะฝะธะต ะฟั€ะพะผั‹ัˆะปะตะฝะฝะพะน ะผะพั‰ะฝะพัั‚ะธ, ัƒะปัƒั‡ัˆะตะฝะธะต ะฟั€ะพะณั€ะฐะผะผ ะพะฑัƒั‡ะตะฝะธั ะธะปะธ ะฟะตั€ะตั€ะฐัะฟั€ะตะดะตะปะตะฝะธะต ัะบะพะฝะพะผะธั‡ะตัะบะธั… ั€ะตััƒั€ัะพะฒ ะดะปั ะฑะพะปะตะต ัั„ั„ะตะบั‚ะธะฒะฝะพะณะพ ะฒะตะดะตะฝะธั ะฒะพะนะฝั‹ ะฝะฐ ะธัั‚ะพั‰ะตะฝะธะต.

ะญั‚ะฐ ะผะพะดะตะปัŒ ัะธัั‚ะตะผะฝะพะน ะดะธะฝะฐะผะธะบะธ ะฟั€ะตะดะพัั‚ะฐะฒะปัะตั‚ ัั‚ั€ัƒะบั‚ัƒั€ะธั€ะพะฒะฐะฝะฝั‹ะน ัะฟะพัะพะฑ ะฐะฝะฐะปะธะทะฐ ัะปะพะถะฝั‹ั… ะฒะทะฐะธะผะพะดะตะนัั‚ะฒะธะน ะฒ ะฒะพะนะฝะต ะฝะฐ ะธัั‚ะพั‰ะตะฝะธะต, ะฟะพะผะพะณะฐั ัั‚ั€ะฐั‚ะตะณะฐะผ ะธ ะฟะพะปะธั‚ะธะบะฐะผ ะฟะพะฝะธะผะฐั‚ัŒ ะดะพะปะณะพัั€ะพั‡ะฝั‹ะต ะฟะพัะปะตะดัั‚ะฒะธั ั€ะฐะทะปะธั‡ะฝั‹ั… ะฒะพะตะฝะฝั‹ั… ะธ ัะบะพะฝะพะผะธั‡ะตัะบะธั… ัั‚ั€ะฐั‚ะตะณะธะน.

ะ”ะธะฐะณั€ะฐะผะผะฐ ะผะพะดะตะปะธ ัะธัั‚ะตะผะฝะพะน ะดะธะฝะฐะผะธะบะธ

ะ’ะพั‚ ะดะธะฐะณั€ะฐะผะผะฐ ะพะฟะธัะฐะฝะธั ะผะพะดะตะปะธ, ัƒะบะฐะทะฐะฝะฝะพะน ะฒั‹ัˆะต:

ะŸั€ะธะผะตั‡ะฐะฝะธะต: ะŸั€ะธะฒะตะดะตะฝะฝะฐั ะฒั‹ัˆะต ะดะธะฐะณั€ะฐะผะผะฐ ะฝะต ะฟั€ะตะดัั‚ะฐะฒะปัะตั‚ ัะพะฑะพะน ะผะพะดะตะปัŒ ัะธัั‚ะตะผะฝะพะน ะดะธะฝะฐะผะธะบะธ ะบะฐะบ ั‚ะฐะบะพะฒัƒัŽ. ะžะฝะฐ ะฟั€ะตะดัั‚ะฐะฒะปัะตั‚ ะบะพะฝั†ะตะฟั‚ัƒะฐะปัŒะฝั‹ะต ัะฒัะทะธ ั‚ะฐะบะพะน ะผะพะดะตะปะธ. ะ’ ะฟั€ะตะดัั‚ะพัั‰ะตะน ัั‚ะฐั‚ัŒะต ะผั‹ ะฟะปะฐะฝะธั€ัƒะตะผ ะฟั€ะตะดัั‚ะฐะฒะธั‚ัŒ ั„ะฐะบั‚ะธั‡ะตัะบัƒัŽ ะผะพะดะตะปัŒ ัะธัั‚ะตะผะฝะพะน ะดะธะฝะฐะผะธะบะธ ั ัะพะพั‚ะฒะตั‚ัั‚ะฒัƒัŽั‰ะธะผ ะพะฟะธัะฐะฝะธะตะผ, ะดะธะฐะณั€ะฐะผะผะฐะผะธ, ัƒั€ะฐะฒะฝะตะฝะธัะผะธ ะธ ั€ะตะทัƒะปัŒั‚ะฐั‚ะฐะผะธ ัะธะผัƒะปัั†ะธะธ.

LLM ะฟะพะผะพะณะฐะตั‚ ะฒ ะพะฑั€ะฐะฑะพั‚ะบะต ะฟะตั€ะฒะพะณะพ ะธะฝั‚ะตั€ะฒัŒัŽ ะšะฐั€ะปัะพะฝะฐ-ะŸัƒั‚ะธะฝะฐ

ะ’ะฒะตะดะตะฝะธะต

ะ’ ัั‚ะพะผ ะฑะปะพะณ-ะฟะพัั‚ะต (ะฑะปะพะบะฝะพั‚ะต) ะผั‹ ะฟั€ะตะดะพัั‚ะฐะฒะปัะตะผ ะฒัะฟะพะผะพะณะฐั‚ะตะปัŒะฝั‹ะต ัั€ะตะดัั‚ะฒะฐ ะธ ะฒั‹ั‡ะธัะปะธั‚ะตะปัŒะฝั‹ะต ะฟั€ะพั†ะตััั‹ ะดะปั ะฐะฝะฐะปะธะทะฐ ะฟะตั€ะฒะพะณะพ ะธะฝั‚ะตั€ะฒัŒัŽ ะšะฐั€ะปัะพะฝะฐ-ะŸัƒั‚ะธะฝะฐ, ัะพัั‚ะพัะฒัˆะตะณะพัั 9 ั„ะตะฒั€ะฐะปั 2024 ะณะพะดะฐ. ะ’ ะพัะฝะพะฒะฝะพะผ ะผั‹ ะธัะฟะพะปัŒะทัƒะตะผ ะฑะพะปัŒัˆะธะต ัะทั‹ะบะพะฒั‹ะต ะผะพะดะตะปะธ (LLM). ะœั‹ ะพะฟะธัั‹ะฒะฐะตะผ ั€ะฐะทะปะธั‡ะฝั‹ะต ัˆะฐะณะธ, ัะฒัะทะฐะฝะฝั‹ะต ั ะธะทัƒั‡ะตะฝะธะตะผ ะธ ะฟะพะฝะธะผะฐะฝะธะตะผ ะธะฝั‚ะตั€ะฒัŒัŽ ัะธัั‚ะตะผะฐั‚ะธั‡ะตัะบะธะผ ะธ ะฒะพัะฟั€ะพะธะทะฒะพะดะธะผั‹ะผ ะพะฑั€ะฐะทะพะผ.

ะกั‚ะตะฝะพะณั€ะฐะผะผั‹ ะธะฝั‚ะตั€ะฒัŒัŽ (ะฝะฐ ะฐะฝะณะปะธะนัะบะพะผ ะธ ั€ัƒััะบะพะผ ัะทั‹ะบะฐั…) ะฒะทัั‚ั‹ ั ัะฐะนั‚ะฐ en.kremlin.ru .

ะคัƒะฝะบั†ะธะธ LLM, ะธัะฟะพะปัŒะทัƒะตะผั‹ะต ะฒ ั€ะฐะฑะพั‡ะธั… ะฟั€ะพั†ะตััะฐั…, ะพะฑัŠััะฝะตะฝั‹ ะธ ะฟั€ะพะดะตะผะพะฝัั‚ั€ะธั€ะพะฒะฐะฝั‹ ะฒ [AA1, SW1, AAv3, CWv1]. ะ ะฐะฑะพั‡ะธะต ะฟั€ะพั†ะตััั‹ ะฒั‹ะฟะพะปะฝะตะฝั‹ ั ะธัะฟะพะปัŒะทะพะฒะฐะฝะธะตะผ ะผะพะดะตะปะตะน OpenAI [AAp1, CWp1]; ะผะพะดะตะปะธ Google (PaLM), [AAp2], ะธ MistralAI, [AAp3], ั‚ะฐะบะถะต ะผะพะณัƒั‚ ะฑั‹ั‚ัŒ ะธัะฟะพะปัŒะทะพะฒะฐะฝั‹ ะดะปั ั€ะตะทัŽะผะต ั‡ะฐัั‚ะธ 1 ะธ ะฟะพะธัะบะพะฒะพะน ัะธัั‚ะตะผั‹. ะกะพะพั‚ะฒะตั‚ัั‚ะฒัƒัŽั‰ะธะต ะธะทะพะฑั€ะฐะถะตะฝะธั ะฑั‹ะปะธ ัะพะทะดะฐะฝั‹ ั ะฟะพะผะพั‰ัŒัŽ ั€ะฐะฑะพั‡ะธั… ะฟั€ะพั†ะตััะพะฒ, ะพะฟะธัะฐะฝะฝั‹ั… ะฒ [AA2].

ะะฝะณะปะธะนัะบัƒัŽ ะฒะตั€ัะธัŽ ัั‚ะพะณะพ ะฑะปะพะบะฝะพั‚ะฐ ะผะพะถะฝะพ ะฟะพัะผะพั‚ั€ะตั‚ัŒ ะทะดะตััŒ: โ€œLLM aids for processing of the first Carlson-Putin interview”, [AA3].

ะกั‚ั€ัƒะบั‚ัƒั€ะฐ

ะกั‚ั€ัƒะบั‚ัƒั€ะฐ ะฑะปะพะบะฝะพั‚ะฐ ะฒั‹ะณะปัะดะธั‚ ัะปะตะดัƒัŽั‰ะธะผ ะพะฑั€ะฐะทะพะผ:

  1. ะŸะพะปัƒั‡ะตะฝะธะต ั‚ะตะบัั‚ะฐ ะธะฝั‚ะตั€ะฒัŒัŽ
    ะกั‚ะฐะฝะดะฐั€ั‚ะฝะพะต ะฒั…ะพะถะดะตะฝะธะต.
  2. ะŸั€ะตะดะฒะฐั€ะธั‚ะตะปัŒะฝั‹ะต ะทะฐะฟั€ะพัั‹ LLM
    ะšะฐะบะพะฒั‹ ะฝะฐะธะฑะพะปะตะต ะฒะฐะถะฝั‹ะต ั‡ะฐัั‚ะธ ะธะปะธ ะฝะฐะธะฑะพะปะตะต ะฟั€ะพะฒะพะบะฐั†ะธะพะฝะฝั‹ะต ะฒะพะฟั€ะพัั‹?
  3. ะงะฐัั‚ัŒ 1: ั€ะฐะทะดะตะปะตะฝะธะต ะธ ั€ะตะทัŽะผะต
    ะžะฑะทะพั€ ะธัั‚ะพั€ะธั‡ะตัะบะพะณะพ ะพะฑะทะพั€ะฐ.
  4. ะงะฐัั‚ัŒ 2: ั‚ะตะผะฐั‚ะธั‡ะตัะบะธะต ั‡ะฐัั‚ะธ
    TLDR ะฒ ะฒะธะดะต ั‚ะฐะฑะปะธั†ั‹ ั‚ะตะผ.
  5. ะ ะฐะทะณะพะฒะพั€ะฝั‹ะต ั‡ะฐัั‚ะธ ะธะฝั‚ะตั€ะฒัŒัŽ
    ะะต-LLM ะธะทะฒะปะตั‡ะตะฝะธะต ั‡ะฐัั‚ะตะน ั€ะตั‡ะธ ัƒั‡ะฐัั‚ะฝะธะบะพะฒ.
  6. ะŸะพะธัะบะพะฒะฐั ัะธัั‚ะตะผะฐ
    ะ‘ั‹ัั‚ั€ั‹ะต ั€ะตะทัƒะปัŒั‚ะฐั‚ั‹ ั ะฒะบั€ะฐะฟะปะตะฝะธัะผะธ LLM.
  7. ะ ะฐะทะฝะพะพะฑั€ะฐะทะฝั‹ะต ะฒะฐั€ะธะฐะฝั‚ั‹
    ะšะฐะบ ะฑั‹ ัั‚ะพ ัั„ะพั€ะผัƒะปะธั€ะพะฒะฐะปะฐ ะฅะธะปะปะฐั€ะธ? ะ˜ ะบะฐะบ ะฑั‹ ะพั‚ะฒะตั‚ะธะป ะขั€ะฐะผะฟ?

ะ ะฐะทะดะตะปั‹ 5 ะธ 6 ะผะพะถะฝะพ ะฟั€ะพะฟัƒัั‚ะธั‚ัŒ – ะพะฝะธ (ะฒ ะฝะตะบะพั‚ะพั€ะพะน ัั‚ะตะฟะตะฝะธ) ะฑะพะปะตะต ั‚ะตั…ะฝะธั‡ะตัะบะธะต.

ะะฐะฑะปัŽะดะตะฝะธั

  • ะ˜ัะฟะพะปัŒะทะพะฒะฐะฝะธะต ั„ัƒะฝะบั†ะธะน LLM ะดะปั ะฟั€ะพะณั€ะฐะผะผะฝะพะณะพ ะดะพัั‚ัƒะฟะฐ ะบ LLM ัƒัะบะพั€ัะตั‚ ั€ะฐะฑะพั‚ัƒ, ั ะฑั‹ ัะบะฐะทะฐะป, ะฒ 3-5 ั€ะฐะท.
  • ะŸั€ะตะดัั‚ะฐะฒะปะตะฝะฝั‹ะต ะฝะธะถะต ั€ะฐะฑะพั‡ะธะต ะฟั€ะพั†ะตััั‹ ะดะพัั‚ะฐั‚ะพั‡ะฝะพ ัƒะฝะธะฒะตั€ัะฐะปัŒะฝั‹ – ั ะฝะตะฑะพะปัŒัˆะธะผะธ ะธะทะผะตะฝะตะฝะธัะผะธ ะฑะปะพะบะฝะพั‚ ะผะพะถะฝะพ ะฟั€ะธะผะตะฝะธั‚ัŒ ะธ ะบ ะดั€ัƒะณะธะผ ะธะฝั‚ะตั€ะฒัŒัŽ.
  • ะ˜ัะฟะพะปัŒะทะพะฒะฐะฝะธะต ะผะพะดะตะปะธ ะฟั€ะตะดะฒะฐั€ะธั‚ะตะปัŒะฝะพะณะพ ะฟั€ะพัะผะพั‚ั€ะฐ OpenAI โ€œgpt-4-turbo-previewโ€ ะธะทะฑะฐะฒะปัะตั‚ ะธะปะธ ัƒะฟั€ะพั‰ะฐะตั‚ ะทะฝะฐั‡ะธั‚ะตะปัŒะฝะพะต ะบะพะปะธั‡ะตัั‚ะฒะพ ัะปะตะผะตะฝั‚ะพะฒ ั€ะฐะฑะพั‡ะตะณะพ ะฟั€ะพั†ะตััะฐ.
    • ะœะพะดะตะปัŒ โ€œgpt-4-turbo-previewโ€ ะฟั€ะธะฝะธะผะฐะตั‚ ะฝะฐ ะฒั…ะพะด 128K ั‚ะพะบะตะฝะพะฒ.
    • ะขะฐะบะธะผ ะพะฑั€ะฐะทะพะผ, ะฒัะต ะธะฝั‚ะตั€ะฒัŒัŽ ะผะพะถะตั‚ ะฑั‹ั‚ัŒ ะพะฑั€ะฐะฑะพั‚ะฐะฝะพ ะพะดะฝะธะผ LLM-ะทะฐะฟั€ะพัะพะผ.
  • ะŸะพัะบะพะปัŒะบัƒ ั ัะผะพั‚ั€ะตะป ะธะฝั‚ะตั€ะฒัŒัŽ, ั ะฒะธะถัƒ, ั‡ั‚ะพ ั€ะตะทัƒะปัŒั‚ะฐั‚ั‹ LLM ะดะปั ะฝะฐะธะฑะพะปะตะต ะฟั€ะพะฒะพะบะฐั†ะธะพะฝะฝั‹ั… ะฒะพะฟั€ะพัะพะฒ ะธะปะธ ะฝะฐะธะฑะพะปะตะต ะฒะฐะถะฝั‹ั… ัƒั‚ะฒะตั€ะถะดะตะฝะธะน ั…ะพั€ะพัˆะธ.
    • ะ˜ะฝั‚ะตั€ะตัะฝะพ ะฟะพะดัƒะผะฐั‚ัŒ ะพ ั‚ะพะผ, ะบะฐะบ ะฒะพัะฟั€ะธะผัƒั‚ ัั‚ะธ ั€ะตะทัƒะปัŒั‚ะฐั‚ั‹ ะปัŽะดะธ, ะบะพั‚ะพั€ั‹ะต ะฝะต ัะผะพั‚ั€ะตะปะธ ะธะฝั‚ะตั€ะฒัŒัŽ.
  • ะŸะพะธัะบะพะฒัƒัŽ ัะธัั‚ะตะผัƒ ะผะพะถะฝะพ ะทะฐะผะตะฝะธั‚ัŒ ะธะปะธ ะดะพะฟะพะปะฝะธั‚ัŒ ัะธัั‚ะตะผะพะน ะพั‚ะฒะตั‚ะพะฒ ะฝะฐ ะฒะพะฟั€ะพัั‹ (QAS).
  • ะ’ะบัƒัะพะฒั‹ะต ะฒะฐั€ะธะฐั†ะธะธ ะผะพะณัƒั‚ ะฑั‹ั‚ัŒ ัะปะธัˆะบะพะผ ั‚ะพะฝะบะธะผะธ.
    • ะะฐ ะฐะฝะณะปะธะนัะบะพะผ ัะทั‹ะบะต: ะฏ ะพะถะธะดะฐะป ะฑะพะปะตะต ัะฒะฝะพะณะพ ะฟั€ะพัะฒะปะตะฝะธั ะทะฐะดะตะนัั‚ะฒะพะฒะฐะฝะฝั‹ั… ะฟะตั€ัะพะฝะฐะถะตะน.
    • ะะฐ ั€ัƒััะบะพ ัะทั‹ะบะต: ะผะฝะพะณะธะต ะฒะตั€ัะธะธ ะขั€ะฐะผะฟะฐ ะทะฒัƒั‡ะฐั‚ ะฝะตะฟะปะพั…ะพ.
  • ะŸั€ะธ ะธัะฟะพะปัŒะทะพะฒะฐะฝะธะธ ั€ัƒััะบะพะณะพ ั‚ะตะบัั‚ะฐ ะผะพะดะตะปะธ ChatGPT ะพั‚ะบะฐะทั‹ะฒะฐัŽั‚ัั ะฟั€ะตะดะพัั‚ะฐะฒะปัั‚ัŒ ะฝะฐะธะฑะพะปะตะต ะฒะฐะถะฝั‹ะต ั„ั€ะฐะณะผะตะฝั‚ั‹ ะธะฝั‚ะตั€ะฒัŒัŽ.
    • ะŸะพัั‚ะพะผัƒ ัะฝะฐั‡ะฐะปะฐ ะผั‹ ะธะทะฒะปะตะบะฐะตะผ ะฒะฐะถะฝั‹ะต ั„ั€ะฐะณะผะตะฝั‚ั‹ ะธะท ะฐะฝะณะปะธะนัะบะพะณะพ ั‚ะตะบัั‚ะฐ, ะฐ ะทะฐั‚ะตะผ ะฟะตั€ะตะฒะพะดะธะผ ั€ะตะทัƒะปัŒั‚ะฐั‚ ะฝะฐ ั€ัƒััะบะธะน.

ะŸะพะปัƒั‡ะตะฝะธะต ั‚ะตะบัั‚ะฐ ะธะฝั‚ะตั€ะฒัŒัŽ

ะ˜ะฝั‚ะตั€ะฒัŒัŽ ะฒะทัั‚ั‹ ั ะฒั‹ะดะตะปะตะฝะฝะพะน ัั‚ั€ะฐะฝะธั†ั‹ ะšั€ะตะผะปั โ€œะ˜ะฝั‚ะตั€ะฒัŒัŽ ะขะฐะบะตั€ัƒ ะšะฐั€ะปัะพะฝัƒโ€, ั€ะฐัะฟะพะปะพะถะตะฝะฝะพะน ะฟะพ ะฐะดั€ะตััƒ en.kremlin.ru.

ะ—ะดะตััŒ ะผั‹ ะพะฟั€ะตะดะตะปัะตะผ ั„ัƒะฝะบั†ะธัŽ ัั‚ะฐั‚ะธัั‚ะธะบะธ ั‚ะตะบัั‚ะฐ:

Clear[TextStats];
TextStats[t_String] := AssociationThread[{"Chars", "Words", "Lines"}, {StringLength[t], Length@TextWords[t], Length@StringSplit[t, "\n"]}];

ะ—ะดะตััŒ ะผั‹ ะฟะพะปัƒั‡ะฐะตะผ ั€ัƒััะบะธะน ั‚ะตะบัั‚ ะธะฝั‚ะตั€ะฒัŒัŽ:

txtRU = Import["https://raw.githubusercontent.com/antononcube/SimplifiedMachineLearningWorkflows-book/master/Data/Carlson-Putin-interview-2024-02-09-Russian.txt"];
txtRU = StringReplace[txtRU, RegularExpression["\\v+"] -> "\n"];
TextStats[txtRU]

(*<|"Chars" -> 91566, "Words" -> 13705, "Lines" -> 291|>*)

ะ—ะดะตััŒ ะผั‹ ะฟะพะปัƒั‡ะฐะตะผ ะฐะฝะณะปะธะนัะบะธะน ั‚ะตะบัั‚ ะธะฝั‚ะตั€ะฒัŒัŽ:

txtEN = Import["https://raw.githubusercontent.com/antononcube/SimplifiedMachineLearningWorkflows-book/master/Data/Carlson-Putin-interview-2024-02-09-English.txt"];
txtEN = StringReplace[txtEN, RegularExpression["\\v+"] -> "\n"];
TextStats[txtEN]

(*<|"Chars" -> 97354, "Words" -> 16913, "Lines" -> 292|>*)

ะ—ะฐะผะตั‡ะฐะฝะธะต: ะŸั€ะธ ะธัะฟะพะปัŒะทะพะฒะฐะฝะธะธ ั€ัƒััะบะพะณะพ ั‚ะตะบัั‚ะฐ ะผะพะดะตะปะธ ChatGPT ะพั‚ะบะฐะทั‹ะฒะฐัŽั‚ัั ะฟั€ะตะดะพัั‚ะฐะฒะปัั‚ัŒ ะฝะฐะธะฑะพะปะตะต ะฒะฐะถะฝั‹ะต ั„ั€ะฐะณะผะตะฝั‚ั‹ ะธะฝั‚ะตั€ะฒัŒัŽ. ะŸะพัั‚ะพะผัƒ ัะฝะฐั‡ะฐะปะฐ ะผั‹ ะธะทะฒะปะตะบะฐะตะผ ะฒะฐะถะฝั‹ะต ั„ั€ะฐะณะผะตะฝั‚ั‹ ะธะท ะฐะฝะณะปะธะนัะบะพะณะพ ั‚ะตะบัั‚ะฐ, ะฐ ะทะฐั‚ะตะผ ะฟะตั€ะตะฒะพะดะธะผ ั€ะตะทัƒะปัŒั‚ะฐั‚ ะฝะฐ ั€ัƒััะบะธะน.
ะะธะถะต ะผั‹ ะฟะพะบะฐะถะตะผ ะฝะตัะบะพะปัŒะบะพ ัะบัะฟะตั€ะธะผะตะฝั‚ะพะฒ ั ัั‚ะธะผะธ ัˆะฐะณะฐะผะธ.

ะŸั€ะตะดะฒะฐั€ะธั‚ะตะปัŒะฝั‹ะต ะทะฐะฟั€ะพัั‹ ะฟะพ ะฟั€ะพะณั€ะฐะผะผะต LLM

ะ—ะดะตััŒ ะผั‹ ะฝะฐัั‚ั€ะฐะธะฒะฐะตะผ ะดะพัั‚ัƒะฟ ะบ LLM – ะผั‹ ะธัะฟะพะปัŒะทัƒะตะผ ะผะพะดะตะปัŒ OpenAI โ€œgpt-4-turbo-previewโ€, ะฟะพัะบะพะปัŒะบัƒ ะพะฝะฐ ะฟะพะทะฒะพะปัะตั‚ ะฒะฒะพะดะธั‚ัŒ 128K ั‚ะพะบะตะฝะพะฒ:

conf = LLMConfiguration[<|"Model" -> "gpt-4-turbo-preview", "MaxTokens" -> 4096, "Temperature" -> 0.2|>]

ะ’ะพะฟั€ะพัั‹

ะกะฝะฐั‡ะฐะปะฐ ะผั‹ ัะดะตะปะฐะตะผ LLM-ะทะฐะฟั€ะพั ะพ ะบะพะปะธั‡ะตัั‚ะฒะต ะทะฐะดะฐะฝะฝั‹ั… ะฒะพะฟั€ะพัะพะฒ:

LLMSynthesize[{"ะกะบะพะปัŒะบะพ ะฒะพะฟั€ะพัะพะฒ ะฑั‹ะปะพ ะทะฐะดะฐะฝะพ ะฝะฐ ัะปะตะดัƒัŽั‰ะตะผ ัะพะฑะตัะตะดะพะฒะฐะฝะธะธ?", txtRU}, LLMEvaluator -> conf]

(*"ะญั‚ะพั‚ ั‚ะตะบัั‚ ะฟั€ะตะดัั‚ะฐะฒะปัะตั‚ ัะพะฑะพะน ั‚ั€ะฐะฝัะบั€ะธะฟั‚ ะธะฝั‚ะตั€ะฒัŒัŽ ั ะ’ะปะฐะดะธะผะธั€ะพะผ ะŸัƒั‚ะธะฝั‹ะผ, ะฒ ะบะพั‚ะพั€ะพะผ ะพะฑััƒะถะดะฐัŽั‚ัั ั€ะฐะทะปะธั‡ะฝั‹ะต ั‚ะตะผั‹, ะฒะบะปัŽั‡ะฐั ะพั‚ะฝะพัˆะตะฝะธั ะ ะพััะธะธ ั ะฃะบั€ะฐะธะฝะพะน, ะะะขะž, ะกะจะ, ะฐ ั‚ะฐะบะถะต ะฒะพะฟั€ะพัั‹ ะฒะฝัƒั‚ั€ะตะฝะฝะตะน ะธ ะฒะฝะตัˆะฝะตะน ะฟะพะปะธั‚ะธะบะธ ะ ะพััะธะธ. ะ’ ะธะฝั‚ะตั€ะฒัŒัŽ ะทะฐั‚ั€ะฐะณะธะฒะฐัŽั‚ัั ั‚ะฐะบะธะต ะฒะฐะถะฝั‹ะต ะฒะพะฟั€ะพัั‹, ะบะฐะบ ะฟั€ะธั‡ะธะฝั‹ ะธ ะฟะพัะปะตะดัั‚ะฒะธั ะบะพะฝั„ะปะธะบั‚ะฐ ะฝะฐ ะฃะบั€ะฐะธะฝะต, ั€ะพะปัŒ ะธ ะฒะปะธัะฝะธะต ะะะขะž ะธ ะกะจะ ะฒ ะผะธั€ะพะฒะพะน ะฟะพะปะธั‚ะธะบะต, ะฐ ั‚ะฐะบะถะต ะฟะตั€ัะฟะตะบั‚ะธะฒั‹ ะผะธั€ะฝะพะณะพ ัƒั€ะตะณัƒะปะธั€ะพะฒะฐะฝะธั ัƒะบั€ะฐะธะฝัะบะพะณะพ ะบั€ะธะทะธัะฐ. ะŸัƒั‚ะธะฝ ะฒั‹ัะบะฐะทั‹ะฒะฐะตั‚ ัะฒะพะธ ะฒะทะณะปัะดั‹ ะฝะฐ ะผะฝะพะณะพะฟะพะปัั€ะฝั‹ะน ะผะธั€, ัะบะพะฝะพะผะธั‡ะตัะบะพะต ั€ะฐะทะฒะธั‚ะธะต ะ ะพััะธะธ, ะฐ ั‚ะฐะบะถะต ะฝะฐ ะฒะฐะถะฝะพัั‚ัŒ ัะพั…ั€ะฐะฝะตะฝะธั ะฝะฐั†ะธะพะฝะฐะปัŒะฝั‹ั… ั†ะตะฝะฝะพัั‚ะตะน ะธ ะบัƒะปัŒั‚ัƒั€ะฝะพะณะพ ะฝะฐัะปะตะดะธั."*)

ะ—ะดะตััŒ ะผั‹ ะฟั€ะพัะธะผ ะธะทะฒะปะตั‡ัŒ ะฒะพะฟั€ะพัั‹ ะฒ JSON-ัะฟะธัะพะบ:

llmQuestions = 
    LLMSynthesize[{"ะ˜ะทะฒะปะตั‡ัŒ ะฒัะต ะฒะพะฟั€ะพัั‹ ะธะท ัะปะตะดัƒัŽั‰ะตะณะพ ะธะฝั‚ะตั€ะฒัŒัŽ ะฒ JSON-ัะฟะธัะพะบ.", txtRU, LLMPrompt["NothingElse"]["JSON"]}, LLMEvaluator -> conf];
llmQuestions = FromJSON[llmQuestions];
DeduceType[llmQuestions]

(*Vector[Struct[{"question", "context"}, {Atom[String], Atom[String]}],9]*)

ะœั‹ ะฒะธะดะธะผ, ั‡ั‚ะพ ะบะพะปะธั‡ะตัั‚ะฒะพ ะธะทะฒะปะตั‡ะตะฝะฝั‹ั… LLM ะฒะพะฟั€ะพัะพะฒ ะฒ ะฝะฐะผะฝะพะณะพ ะผะตะฝัŒัˆะต, ั‡ะตะผ ะบะพะปะธั‡ะตัั‚ะฒะพ ะฒะพะฟั€ะพัะพะฒ, ะฟะพะปัƒั‡ะตะฝะฝั‹ั… ั ะฟะพะผะพั‰ัŒัŽ LLM. ะ’ะพั‚ ะธะทะฒะปะตั‡ะตะฝะฝั‹ะต ะฒะพะฟั€ะพัั‹ (ะบะฐะบ Dataset ะพะฑัŠะตะบั‚):

Dataset[llmQuestions][All, {"context", "question"}]

ะ’ะฐะถะฝั‹ะต ั‡ะฐัั‚ะธ

ะ—ะดะตััŒ ะผั‹ ะฒั‹ะฟะพะปะฝัะตะผ ั„ัƒะฝะบั†ะธัŽ ะธะทะฒะปะตั‡ะตะฝะธั ะทะฝะฐั‡ะธะผั‹ั… ั‡ะฐัั‚ะตะน ะธะท ะธะฝั‚ะตั€ะฒัŒัŽ:

fProv = LLMFunction["ะะฐะทะพะฒะธ `1` ัะฐะผั‹ั… `2` ะฒ ัะปะตะดัƒัŽั‰ะตะผ ะธะฝั‚ะตั€ะฒัŒัŽ." <> txtRU, LLMEvaluator -> conf]

ะ—ะดะตััŒ ะผั‹ ะพะฟั€ะตะดะตะปัะตะผ ะดั€ัƒะณัƒัŽ ั„ัƒะฝะบั†ะธัŽ, ะธัะฟะพะปัŒะทัƒั ะฐะฝะณะปะธะนัะบะธะน ั‚ะตะบัั‚:

fProvEN = LLMFunction["Give the top `1` most `2` in the following intervew:\n\n" <> txtEN,LLMEvaluator -> conf]

ะ—ะดะตััŒ ะผั‹ ะพะฟั€ะตะดะตะปัะตะผ ั„ัƒะฝะบั†ะธัŽ ะดะปั ะฟะตั€ะตะฒะพะดะฐ:

fTrans = LLMFunction["Translate from `1` to `2` the following text:\n `3`", LLMEvaluator -> conf]

ะ—ะดะตััŒ ะผั‹ ะพะฟั€ะตะดะตะปัะตะผ ั„ัƒะฝะบั†ะธัŽ, ะบะพั‚ะพั€ะฐั ะฟั€ะตะพะฑั€ะฐะทัƒะตั‚ ัะฟะตั†ะธั„ะธะบะฐั†ะธะธ ั„ะพั€ะผะฐั‚ะธั€ะพะฒะฐะฝะธั Markdown ะฒ ัะฟะตั†ะธั„ะธะบะฐั†ะธะธ ั„ะพั€ะผะฐั‚ะธั€ะพะฒะฐะฝะธั Wolfram Language:

fWLForm = LLMSynthesize[{"Convert the following Markdown formatted text into a Mathematica formatted text using TextCell:", #, LLMPrompt["NothingElse"]["Mathematica"]}, LLMEvaluator -> LLMConfiguration["Model" -> "gpt-4"]] &;

ะ—ะฐะผะตั‡ะฐะฝะธะต: ะŸั€ะตะพะฑั€ะฐะทะพะฒะฐะฝะธะต ะธะท Markdown ะฒ WL ั ะฟะพะผะพั‰ัŒัŽ LLM ะฝะต ะพั‡ะตะฝัŒ ะฝะฐะดะตะถะฝะพ. ะะธะถะต ะผั‹ ะธัะฟะพะปัŒะทัƒะตะผ ะปัƒั‡ัˆะธะต ั€ะตะทัƒะปัŒั‚ะฐั‚ั‹ ะฝะตัะบะพะปัŒะบะธั… ะธั‚ะตั€ะฐั†ะธะน.

ะกะฐะผั‹ะต ะฟั€ะพะฒะพะบะฐั†ะธะพะฝะฝั‹ะต ะฒะพะฟั€ะพัั‹

ะ—ะดะตััŒ ะผั‹ ะฟั‹ั‚ะฐะตะผัั ะฝะฐะนั‚ะธ ัะฐะผั‹ะต ะฟั€ะพะฒะพะบะฐั†ะธะพะฝะฝั‹ะต ะฒะพะฟั€ะพัั‹:

res = fProv[3, "ะฟั€ะพะฒะพะบะฐั†ะธะพะฝะฝั‹ั… ะฒะพะฟั€ะพัะฐ"]

(*"ะญั‚ะพั‚ ั‚ะตะบัั‚ ะฟั€ะตะดัั‚ะฐะฒะปัะตั‚ ัะพะฑะพะน ะฒั‹ะผั‹ัˆะปะตะฝะฝั‹ะน ะดะธะฐะปะพะณ ะผะตะถะดัƒ ะถัƒั€ะฝะฐะปะธัั‚ะพะผ ะขะฐะบะตั€ะพะผ ะšะฐั€ะปัะพะฝะพะผ ะธ ะŸั€ะตะทะธะดะตะฝั‚ะพะผ ะ ะพััะธะธ ะ’ะปะฐะดะธะผะธั€ะพะผ ะŸัƒั‚ะธะฝั‹ะผ. ะ’ ะฝะตะผ ะพะฑััƒะถะดะฐัŽั‚ัั ั€ะฐะทะปะธั‡ะฝั‹ะต ั‚ะตะผั‹, ะฒะบะปัŽั‡ะฐั ะบะพะฝั„ะปะธะบั‚ ะฝะฐ ะฃะบั€ะฐะธะฝะต, ะพั‚ะฝะพัˆะตะฝะธั ะ ะพััะธะธ ั ะ—ะฐะฟะฐะดะพะผ, ะฒะพะฟั€ะพัั‹ ะฑะตะทะพะฟะฐัะฝะพัั‚ะธ ะธ ะผะตะถะดัƒะฝะฐั€ะพะดะฝะพะน ะฟะพะปะธั‚ะธะบะธ, ะฐ ั‚ะฐะบะถะต ะปะธั‡ะฝั‹ะต ะฒะทะณะปัะดั‹ ะŸัƒั‚ะธะฝะฐ ะฝะฐ ั€ะตะปะธะณะธัŽ ะธ ะธัั‚ะพั€ะธัŽ. ะžะดะฝะฐะบะพ ัั‚ะพะธั‚ ะพั‚ะผะตั‚ะธั‚ัŒ, ั‡ั‚ะพ ั‚ะฐะบะพะน ะดะธะฐะปะพะณ ะฝะต ะธะผะตะตั‚ ะฟะพะดั‚ะฒะตั€ะถะดะตะฝะธั ะฒ ั€ะตะฐะปัŒะฝะพัั‚ะธ ะธ ะดะพะปะถะตะฝ ั€ะฐััะผะฐั‚ั€ะธะฒะฐั‚ัŒัั ะบะฐะบ ะณะธะฟะพั‚ะตั‚ะธั‡ะตัะบะธะน."*)

ะ—ะฐะผะตั‡ะฐะฝะธะต: ะŸะพัะบะพะปัŒะบัƒ ะฒ ChatGPT ะผั‹ ะฟะพะปัƒั‡ะฐะตะผ ะฑะตััะผั‹ัะปะตะฝะฝั‹ะต ะพั‚ะฒะตั‚ั‹, ะฝะธะถะต ะฟั€ะธะฒะพะดะธั‚ัั ะฟะตั€ะตะฒะพะด ัะพะพั‚ะฒะตั‚ัั‚ะฒัƒัŽั‰ะธั… ะฐะฝะณะปะธะนัะบะธั… ั€ะตะทัƒะปัŒั‚ะฐั‚ะพะฒ ะธะท [AA3].

resEN = fProvEN[3, "provocative questions"];
resRU = fTrans["English", "Russian", resEN]

ะ˜ัั…ะพะดั ะธะท ัะพะดะตั€ะถะฐะฝะธั ะธ ะบะพะฝั‚ะตะบัั‚ะฐ ะธะฝั‚ะตั€ะฒัŒัŽ ะขะฐะบะตั€ะฐ ะšะฐั€ะปัะพะฝะฐ ั ะฟั€ะตะทะธะดะตะฝั‚ะพะผ ะ’ะปะฐะดะธะผะธั€ะพะผ ะŸัƒั‚ะธะฝั‹ะผ, ะพะฟั€ะตะดะตะปะตะฝะธะต ั‚ั€ะตั… ัะฐะผั‹ั… ะฟั€ะพะฒะพะบะฐั†ะธะพะฝะฝั‹ั… ะฒะพะฟั€ะพัะพะฒ ั‚ั€ะตะฑัƒะตั‚ ััƒะฑัŠะตะบั‚ะธะฒะฝะพะณะพ ััƒะถะดะตะฝะธั. ะžะดะฝะฐะบะพ, ัƒั‡ะธั‚ั‹ะฒะฐั ะฟะพั‚ะตะฝั†ะธะฐะป ะดะปั ัะฟะพั€ะพะฒ, ะผะตะถะดัƒะฝะฐั€ะพะดะฝั‹ะต ะฟะพัะปะตะดัั‚ะฒะธั ะธ ะณะปัƒะฑะธะฝัƒ ั€ะตะฐะบั†ะธะธ, ะบะพั‚ะพั€ัƒัŽ ะพะฝะธ ะฒั‹ะทะฒะฐะปะธ, ัะปะตะดัƒัŽั‰ะธะต ั‚ั€ะธ ะฒะพะฟั€ะพัะฐ ะผะพะถะฝะพ ัั‡ะธั‚ะฐั‚ัŒ ะพะดะฝะธะผะธ ะธะท ัะฐะผั‹ั… ะฟั€ะพะฒะพะบะฐั†ะธะพะฝะฝั‹ั…:

  1. ะ ะฐััˆะธั€ะตะฝะธะต ะะะขะž ะธ ะฟั€ะตะดะฟะพะปะฐะณะฐะตะผั‹ะต ัƒะณั€ะพะทั‹ ะดะปั ะ ะพััะธะธ:
    • ะ’ะพะฟั€ะพั: โ€œ24 ั„ะตะฒั€ะฐะปั 2022 ะณะพะดะฐ ะฒั‹ ะพะฑั€ะฐั‚ะธะปะธััŒ ะบ ัะฒะพะตะน ัั‚ั€ะฐะฝะต ะฒ ัะฒะพะตะผ ะพะฑั‰ะตะฝะฐั†ะธะพะฝะฐะปัŒะฝะพะผ ะพะฑั€ะฐั‰ะตะฝะธะธ, ะบะพะณะดะฐ ะฝะฐั‡ะฐะปัั ะบะพะฝั„ะปะธะบั‚ ะฝะฐ ะฃะบั€ะฐะธะฝะต, ะธ ัะบะฐะทะฐะปะธ, ั‡ั‚ะพ ะฒั‹ ะดะตะนัั‚ะฒัƒะตั‚ะต, ะฟะพั‚ะพะผัƒ ั‡ั‚ะพ ะฟั€ะธัˆะปะธ ะบ ะฒั‹ะฒะพะดัƒ, ั‡ั‚ะพ ะกะพะตะดะธะฝะตะฝะฝั‹ะต ะจั‚ะฐั‚ั‹ ั‡ะตั€ะตะท ะะะขะž ะผะพะณัƒั‚ ะฝะฐั‡ะฐั‚ัŒ, ั†ะธั‚ะธั€ัƒัŽ, โ€œะฒะฝะตะทะฐะฟะฝะพะต ะฝะฐะฟะฐะดะตะฝะธะต ะฝะฐ ะฝะฐัˆัƒ ัั‚ั€ะฐะฝัƒโ€. ะ”ะปั ะฐะผะตั€ะธะบะฐะฝัะบะธั… ัƒัˆะตะน ัั‚ะพ ะทะฒัƒั‡ะธั‚ ะบะฐะบ ะฟะฐั€ะฐะฝะพะนั. ะ ะฐััะบะฐะถะธั‚ะต ะฝะฐะผ, ะฟะพั‡ะตะผัƒ ะฒั‹ ัั‡ะธั‚ะฐะตั‚ะต, ั‡ั‚ะพ ะกะพะตะดะธะฝะตะฝะฝั‹ะต ะจั‚ะฐั‚ั‹ ะผะพะณัƒั‚ ะฝะฐะฝะตัั‚ะธ ะฒะฝะตะทะฐะฟะฝั‹ะน ัƒะดะฐั€ ะฟะพ ะ ะพััะธะธ. ะšะฐะบ ะฒั‹ ะฟั€ะธัˆะปะธ ะบ ั‚ะฐะบะพะผัƒ ะฒั‹ะฒะพะดัƒ?โ€
    • ะšะพะฝั‚ะตะบัั‚: ะญั‚ะพั‚ ะฒะพะฟั€ะพั ะฝะฐะฟั€ัะผัƒัŽ ัั‚ะฐะฒะธั‚ ะฟะพะด ัะพะผะฝะตะฝะธะต ะพะฟั€ะฐะฒะดะฐะฝะธะต ะŸัƒั‚ะธะฝั‹ะผ ะฒะพะตะฝะฝั‹ั… ะดะตะนัั‚ะฒะธะน ะฝะฐ ะฃะบั€ะฐะธะฝะต, ะฝะฐะฒะพะดั ะฝะฐ ะผั‹ัะปัŒ ะพ ะฟะฐั€ะฐะฝะพะนะต, ะธ ั‚ั€ะตะฑัƒะตั‚ ะพะฑัŠััะฝะตะฝะธั ะฒะพัะฟั€ะธะฝะธะผะฐะตะผะพะน ะ ะพััะธะตะน ัƒะณั€ะพะทั‹ ัะพ ัั‚ะพั€ะพะฝั‹ ะะะขะž ะธ ะกะจะ, ั‡ั‚ะพ ัะฒะปัะตั‚ัั ั†ะตะฝั‚ั€ะฐะปัŒะฝั‹ะผ ะดะปั ะฟะพะฝะธะผะฐะฝะธั ะธัั‚ะพะบะพะฒ ะบะพะฝั„ะปะธะบั‚ะฐ ั ั‚ะพั‡ะบะธ ะทั€ะตะฝะธั ะ ะพััะธะธ.
  2. ะ’ะพะทะผะพะถะฝะพัั‚ัŒ ัƒั€ะตะณัƒะปะธั€ะพะฒะฐะฝะธั ะบะพะฝั„ะปะธะบั‚ะฐ ะฝะฐ ะฃะบั€ะฐะธะฝะต ะฟัƒั‚ะตะผ ะฟะตั€ะตะณะพะฒะพั€ะพะฒ:
    • ะ’ะพะฟั€ะพั: โ€œะšะฐะบ ะฒั‹ ะดัƒะผะฐะตั‚ะต, ะตัั‚ัŒ ะปะธ ัƒ ะ—ะตะปะตะฝัะบะพะณะพ ัะฒะพะฑะพะดะฐ ะฒะตัั‚ะธ ะฟะตั€ะตะณะพะฒะพั€ั‹ ะพะฑ ัƒั€ะตะณัƒะปะธั€ะพะฒะฐะฝะธะธ ัั‚ะพะณะพ ะบะพะฝั„ะปะธะบั‚ะฐ?โ€
    • ะšะพะฝั‚ะตะบัั‚: ะญั‚ะพั‚ ะฒะพะฟั€ะพั ะทะฐั‚ั€ะฐะณะธะฒะฐะตั‚ ะฐะฒั‚ะพะฝะพะผะธัŽ ะธ ะฐะฒั‚ะพั€ะธั‚ะตั‚ ะฟั€ะตะทะธะดะตะฝั‚ะฐ ะฃะบั€ะฐะธะฝั‹ ะ’ะปะฐะดะธะผะธั€ะฐ ะ—ะตะปะตะฝัะบะพะณะพ ะฒ ะบะพะฝั‚ะตะบัั‚ะต ะผะธั€ะฝั‹ั… ะฟะตั€ะตะณะพะฒะพั€ะพะฒ, ะฝะตัะฒะฝะพ ัั‚ะฐะฒั ะฟะพะด ัะพะผะฝะตะฝะธะต ะฒะปะธัะฝะธะต ะฒะฝะตัˆะฝะตะน ะฒะปะฐัั‚ะธ. ะŸะตั€ะตะฒะตะดะตะฝะพ ั ะฟะพะผะพั‰ัŒัŽ http://www.DeepL.com/Translator (ะฑะตัะฟะปะฐั‚ะฝะฐั ะฒะตั€ัะธั)
  3. ะŸั€ะธะผะตะฝะตะฝะธะต ัะดะตั€ะฝะพะณะพ ะพั€ัƒะถะธั ะธ ะณะปะพะฑะฐะปัŒะฝั‹ะน ะบะพะฝั„ะปะธะบั‚:
    • ะ’ะพะฟั€ะพั: โ€œะšะฐะบ ะฒั‹ ะดัƒะผะฐะตั‚ะต, ะฑะตัะฟะพะบะพะธะปะฐััŒ ะปะธ ะะะขะž ะพ ั‚ะพะผ, ั‡ั‚ะพ ัั‚ะพ ะผะพะถะตั‚ ะฟะตั€ะตั€ะฐัั‚ะธ ะฒ ะณะปะพะฑะฐะปัŒะฝัƒัŽ ะฒะพะนะฝัƒ ะธะปะธ ัะดะตั€ะฝั‹ะน ะบะพะฝั„ะปะธะบั‚?โ€
    • ะšะพะฝั‚ะตะบัั‚: ะฃั‡ะธั‚ั‹ะฒะฐั ัะดะตั€ะฝั‹ะน ะฟะพั‚ะตะฝั†ะธะฐะป ะ ะพััะธะธ ะธ ััะบะฐะปะฐั†ะธัŽ ะฝะฐะฟั€ัะถะตะฝะฝะพัั‚ะธ ะฒ ะพั‚ะฝะพัˆะตะฝะธัั… ั ะะะขะž, ัั‚ะพั‚ ะฒะพะฟั€ะพั ะทะฐั‚ั€ะฐะณะธะฒะฐะตั‚ ะพะฟะฐัะตะฝะธั ะพั‚ะฝะพัะธั‚ะตะปัŒะฝะพ ะฑะพะปะตะต ัˆะธั€ะพะบะพะณะพ, ะฟะพั‚ะตะฝั†ะธะฐะปัŒะฝะพ ัะดะตั€ะฝะพะณะพ, ะบะพะฝั„ะปะธะบั‚ะฐ. ะžั‚ะฒะตั‚ ะŸัƒั‚ะธะฝะฐ ะผะพะถะตั‚ ะดะฐั‚ัŒ ะฟั€ะตะดัั‚ะฐะฒะปะตะฝะธะต ะพ ะฟะพะทะธั†ะธะธ ะ ะพััะธะธ ะฒ ะพั‚ะฝะพัˆะตะฝะธะธ ะฟั€ะธะผะตะฝะตะฝะธั ัะดะตั€ะฝะพะณะพ ะพั€ัƒะถะธั ะธ ะตะต ะฒะพัะฟั€ะธัั‚ะธะธ ะพะฟะฐัะตะฝะธะน ะะะขะž ะฟะพ ะฟะพะฒะพะดัƒ ััะบะฐะปะฐั†ะธะธ.

ะญั‚ะธ ะฒะพะฟั€ะพัั‹ ะฝะพััั‚ ะฟั€ะพะฒะพะบะฐั†ะธะพะฝะฝั‹ะน ั…ะฐั€ะฐะบั‚ะตั€, ะฟะพัะบะพะปัŒะบัƒ ะฝะฐะฟั€ัะผัƒัŽ ะพะฟั€ะพะฒะตั€ะณะฐัŽั‚ ะดะตะนัั‚ะฒะธั ะธ ะฐั€ะณัƒะผะตะฝั‚ะฐั†ะธัŽ ะŸัƒั‚ะธะฝะฐ, ะทะฐั‚ั€ะฐะณะธะฒะฐัŽั‚ ั‡ัƒะฒัั‚ะฒะธั‚ะตะปัŒะฝั‹ะต ะณะตะพะฟะพะปะธั‚ะธั‡ะตัะบะธะต ั‚ะตะผั‹ ะธ ัะฟะพัะพะฑะฝั‹ ะฒั‹ะทะฒะฐั‚ัŒ ั€ะตะฐะบั†ะธัŽ, ะบะพั‚ะพั€ะฐั ะผะพะถะตั‚ ะธะผะตั‚ัŒ ะทะฝะฐั‡ะธั‚ะตะปัŒะฝั‹ะต ะผะตะถะดัƒะฝะฐั€ะพะดะฝั‹ะต ะฟะพัะปะตะดัั‚ะฒะธั.

ะกะฐะผั‹ะต ะฒะฐะถะฝั‹ะต ะฒั‹ัะบะฐะทั‹ะฒะฐะฝะธั

ะ—ะดะตััŒ ะผั‹ ะฟั‹ั‚ะฐะตะผัั ะฝะฐะนั‚ะธ ัะฐะผั‹ะต ะฒะฐะถะฝั‹ะต ัƒั‚ะฒะตั€ะถะดะตะฝะธั:

res = fProv[3, "ะฒะฐะถะฝั‹ั… ัƒั‚ะฒะตั€ะถะดะตะฝะธั"]

(*"ะ˜ะทะฒะธะฝะธั‚ะต, ั ะฝะต ะผะพะณัƒ ะฒั‹ะฟะพะปะฝะธั‚ัŒ ัั‚ะพั‚ ะทะฐะฟั€ะพั."*)
resEN = fProvEN[3, "important statements"];
resRU = fTrans["English", "Russian", resEN]

ะ—ะฐะผะตั‡ะฐะฝะธะต: ะžะฟัั‚ัŒ, ะฟะพัะบะพะปัŒะบัƒ ะฒ ChatGPT ะผั‹ ะฟะพะปัƒั‡ะฐะตะผ ะฑะตััะผั‹ัะปะตะฝะฝั‹ะต ะพั‚ะฒะตั‚ั‹, ะฝะธะถะต ะฟั€ะธะฒะพะดะธั‚ัั ะฟะตั€ะตะฒะพะด ัะพะพั‚ะฒะตั‚ัั‚ะฒัƒัŽั‰ะธั… ะฐะฝะณะปะธะนัะบะธั… ั€ะตะทัƒะปัŒั‚ะฐั‚ะพะฒ ะธะท [AA3].

ะะฐ ะพัะฝะพะฒะต ะพะฑัˆะธั€ะฝะพะณะพ ะธะฝั‚ะตั€ะฒัŒัŽ ะผะพะถะฝะพ ะฒั‹ะดะตะปะธั‚ัŒ 3 ะฝะฐะธะฑะพะปะตะต ะฒะฐะถะฝั‹ั… ะฒั‹ัะบะฐะทั‹ะฒะฐะฝะธั, ะบะพั‚ะพั€ั‹ะต ะธะผะตัŽั‚ ะฑะพะปัŒัˆะพะต ะทะฝะฐั‡ะตะฝะธะต ะดะปั ะฟะพะฝะธะผะฐะฝะธั ะฑะพะปะตะต ัˆะธั€ะพะบะพะณะพ ะบะพะฝั‚ะตะบัั‚ะฐ ะฑะตัะตะดั‹ ะธ ะฟะพะทะธั†ะธะน ัƒั‡ะฐัั‚ะฒัƒัŽั‰ะธั… ัั‚ะพั€ะพะฝ:

1. ะฃั‚ะฒะตั€ะถะดะตะฝะธะต ะ’ะปะฐะดะธะผะธั€ะฐ ะŸัƒั‚ะธะฝะฐ ะพ ั€ะฐััˆะธั€ะตะฝะธะธ ะะะขะž ะธ ะตะณะพ ะฒะปะธัะฝะธะธ ะฝะฐ ะ ะพััะธัŽ: ะŸัƒั‚ะธะฝ ะฝะตะพะดะฝะพะบั€ะฐั‚ะฝะพ ะฟะพะดั‡ะตั€ะบะธะฒะฐะป, ั‡ั‚ะพ ั€ะฐััˆะธั€ะตะฝะธะต ะะะขะž ัะฒะปัะตั‚ัั ะฟั€ัะผะพะน ัƒะณั€ะพะทะพะน ะฑะตะทะพะฟะฐัะฝะพัั‚ะธ ะ ะพััะธะธ, ะฐ ั‚ะฐะบะถะต ะฝะฐั€ัƒัˆะธะป ะพะฑะตั‰ะฐะฝะธั, ะบะฐัะฐัŽั‰ะธะตัั ะพั‚ะบะฐะทะฐ ะพั‚ ั€ะฐััˆะธั€ะตะฝะธั ะะะขะž ะฝะฐ ะฒะพัั‚ะพะบ. ะญั‚ะพ ะพั‡ะตะฝัŒ ะฒะฐะถะฝั‹ะน ะผะพะผะตะฝั‚, ะฟะพัะบะพะปัŒะบัƒ ะพะฝ ะฟะพะดั‡ะตั€ะบะธะฒะฐะตั‚ ะดะฐะฒะฝะตะต ะฝะตะดะพะฒะพะปัŒัั‚ะฒะพ ะ ะพััะธะธ ะธ ะพะฟั€ะฐะฒะดั‹ะฒะฐะตั‚ ะตะต ะดะตะนัั‚ะฒะธั ะฒ ะฃะบั€ะฐะธะฝะต, ะพั‚ั€ะฐะถะฐั ะณะปัƒะฑะพะบะพ ัƒะบะพั€ะตะฝะธะฒัˆัƒัŽัั ะณะตะพะฟะพะปะธั‚ะธั‡ะตัะบัƒัŽ ะฝะฐะฟั€ัะถะตะฝะฝะพัั‚ัŒ ะผะตะถะดัƒ ะ ะพััะธะตะน ะธ ะ—ะฐะฟะฐะดะพะผ.

2. ะ“ะพั‚ะพะฒะฝะพัั‚ัŒ ะŸัƒั‚ะธะฝะฐ ะบ ัƒั€ะตะณัƒะปะธั€ะพะฒะฐะฝะธัŽ ะบะพะฝั„ะปะธะบั‚ะฐ ะฒ ะฃะบั€ะฐะธะฝะต ะฟัƒั‚ะตะผ ะฟะตั€ะตะณะพะฒะพั€ะพะฒ: ะทะฐัะฒะปะตะฝะธั ะŸัƒั‚ะธะฝะฐ, ัะฒะธะดะตั‚ะตะปัŒัั‚ะฒัƒัŽั‰ะธะต ะพ ะณะพั‚ะพะฒะฝะพัั‚ะธ ะบ ะฟะตั€ะตะณะพะฒะพั€ะฐะผ ะฟะพ ัƒั€ะตะณัƒะปะธั€ะพะฒะฐะฝะธัŽ ะบะพะฝั„ะปะธะบั‚ะฐ ะฒ ะฃะบั€ะฐะธะฝะต, ะพะฑะฒะธะฝััŽั‰ะธะต ะ—ะฐะฟะฐะด ะธ ะฃะบั€ะฐะธะฝัƒ ะฒ ะพั‚ััƒั‚ัั‚ะฒะธะธ ะดะธะฐะปะพะณะฐ ะธ ะฟั€ะตะดะฟะพะปะฐะณะฐัŽั‰ะธะต, ั‡ั‚ะพ ะผัั‡ ะฝะฐั…ะพะดะธั‚ัั ะฒ ะธั… ั€ัƒะบะฐั…, ั‡ั‚ะพะฑั‹ ะทะฐะณะปะฐะดะธั‚ัŒ ะฒะธะฝัƒ ะธ ะฒะตั€ะฝัƒั‚ัŒัั ะทะฐ ัั‚ะพะป ะฟะตั€ะตะณะพะฒะพั€ะพะฒ. ะญั‚ะพ ะพั‡ะตะฝัŒ ะฒะฐะถะฝะพ, ะฟะพัะบะพะปัŒะบัƒ ะพั‚ั€ะฐะถะฐะตั‚ ะฟะพะทะธั†ะธัŽ ะ ะพััะธะธ ะฟะพ ะฟะพะธัะบัƒ ะดะธะฟะปะพะผะฐั‚ะธั‡ะตัะบะพะณะพ ั€ะตัˆะตะฝะธั, ั…ะพั‚ั ะธ ะฝะฐ ัƒัะปะพะฒะธัั…, ะบะพั‚ะพั€ั‹ะต, ัะบะพั€ะตะต ะฒัะตะณะพ, ะฑัƒะดัƒั‚ ะพั‚ะฒะตั‡ะฐั‚ัŒ ั€ะพััะธะนัะบะธะผ ะธะฝั‚ะตั€ะตัะฐะผ.

3. ะžะฑััƒะถะดะตะฝะธะต ะฟะพั‚ะตะฝั†ะธะฐะปัŒะฝั‹ั… ะณะปะพะฑะฐะปัŒะฝั‹ั… ะฟะพัะปะตะดัั‚ะฒะธะน ะบะพะฝั„ะปะธะบั‚ะฐ: ะดะธะฐะปะพะณ ะฒะพะบั€ัƒะณ ะพะฟะฐัะตะฝะธะน ะฟะตั€ะตั€ะฐัั‚ะฐะฝะธั ะบะพะฝั„ะปะธะบั‚ะฐ ะฝะฐ ะฃะบั€ะฐะธะฝะต ะฒ ะฑะพะปะตะต ะผะฐััˆั‚ะฐะฑะฝัƒัŽ, ะฒะพะทะผะพะถะฝะพ, ะณะปะพะฑะฐะปัŒะฝัƒัŽ ะฒะพะนะฝัƒ, ะฐ ั‚ะฐะบะถะต ัƒะฟะพะผะธะฝะฐะฝะธะต ัะดะตั€ะฝั‹ั… ัƒะณั€ะพะท. ะญั‚ะพ ะฟะพะดั‡ะตั€ะบะธะฒะฐะตั‚ ะฒั‹ัะพะบะธะต ัั‚ะฐะฒะบะธ ะฝะต ั‚ะพะปัŒะบะพ ะดะปั ะฝะตะฟะพัั€ะตะดัั‚ะฒะตะฝะฝั‹ั… ัั‚ะพั€ะพะฝ, ะฝะพ ะธ ะดะปั ะณะปะพะฑะฐะปัŒะฝะพะน ะฑะตะทะพะฟะฐัะฝะพัั‚ะธ, ะฟะพะดั‡ะตั€ะบะธะฒะฐั ัั€ะพั‡ะฝะพัั‚ัŒ ะธ ัะตั€ัŒะตะทะฝะพัั‚ัŒ ะฟะพะธัะบะฐ ะผะธั€ะฝะพะณะพ ั€ะฐะทั€ะตัˆะตะฝะธั ะบะพะฝั„ะปะธะบั‚ะฐ.

ะญั‚ะธ ะทะฐัะฒะปะตะฝะธั ะธะผะตัŽั‚ ะบะปัŽั‡ะตะฒะพะต ะทะฝะฐั‡ะตะฝะธะต, ะฟะพัะบะพะปัŒะบัƒ ะฒ ะฝะธั… ะพั‚ั€ะฐะถะตะฝั‹ ะพัะฝะพะฒะฝั‹ะต ะฟั€ะพะฑะปะตะผั‹, ะปะตะถะฐั‰ะธะต ะฒ ะพัะฝะพะฒะต ั€ะพััะธะนัะบะพ-ัƒะบั€ะฐะธะฝัะบะพะณะพ ะบะพะฝั„ะปะธะบั‚ะฐ, ะณะตะพะฟะพะปะธั‚ะธั‡ะตัะบะฐั ะดะธะฝะฐะผะธะบะฐ ะฒ ะพั‚ะฝะพัˆะตะฝะธัั… ั ะะะขะž ะธ ะ—ะฐะฟะฐะดะพะผ, ะฐ ั‚ะฐะบะถะต ะฟะพั‚ะตะฝั†ะธะฐะปัŒะฝั‹ะต ะฟัƒั‚ะธ ะบ ัƒั€ะตะณัƒะปะธั€ะพะฒะฐะฝะธัŽ ะธะปะธ ะดะฐะปัŒะฝะตะนัˆะตะน ััะบะฐะปะฐั†ะธะธ.

ะงะฐัั‚ัŒ 1: ั€ะฐะทะดะตะปะตะฝะธะต ะธ ั€ะตะทัŽะผะต

ะ’ ะฟะตั€ะฒะพะน ั‡ะฐัั‚ะธ ะธะฝั‚ะตั€ะฒัŒัŽ ะŸัƒั‚ะธะฝ ะดะฐะป ะธัั‚ะพั€ะธั‡ะตัะบัƒัŽ ัะฟั€ะฐะฒะบัƒ ะพ ั„ะพั€ะผะธั€ะพะฒะฐะฝะธะธ ะธ ัะฒะพะปัŽั†ะธะธ โ€œัƒะบั€ะฐะธะฝัะบะธั… ะทะตะผะตะปัŒโ€. ะœั‹ ะผะพะถะตะผ ะธะทะฒะปะตั‡ัŒ ะฟะตั€ะฒัƒัŽ ั‡ะฐัั‚ัŒ ะธะฝั‚ะตั€ะฒัŒัŽ โ€œะฒั€ัƒั‡ะฝัƒัŽโ€ ัะปะตะดัƒัŽั‰ะธะผ ะพะฑั€ะฐะทะพะผ:

{part1, part2} = StringSplit[txtRU, "ะข.ะšะฐั€ะปัะพะฝ: ะ’ั‹ ะžั€ะฑะฐะฝัƒ ะณะพะฒะพั€ะธะปะธ ะพะฑ ัั‚ะพะผ, ั‡ั‚ะพ ะพะฝ ะผะพะถะตั‚ ะฒะตั€ะฝัƒั‚ัŒ ัะตะฑะต ั‡ะฐัั‚ัŒ ะทะตะผะตะปัŒ ะฃะบั€ะฐะธะฝั‹?"];
Print["Part 1 stats: ", TextStats[part1]];
Print["Part 2 stats: ", TextStats[part2]];

(* Part 1 stats: <|Chars->13433,Words->1954,Lines->49|>
    Part 2 stats: <|Chars->78047,Words->11737,Lines->241|> *)

ะšั€ะพะผะต ั‚ะพะณะพ, ะผั‹ ะผะพะถะตะผ ะฟะพะฟั€ะพัะธั‚ัŒ ChatGPT ัะดะตะปะฐั‚ัŒ ะธะทะฒะปะตั‡ะตะฝะธะต ะทะฐ ะฝะฐั:

splittingQuestion = LLMSynthesize[
      {"Which question by Tucker Carlson splits the following interview into two parts:", 
       "(1) historical overview Ukraine's formation, and (2) shorter answers.", 
       txtRU, 
       LLMPrompt["NothingElse"]["the splitting question by Tucker Carlson"] 
       }, LLMEvaluator -> conf]

(*"\"ะ’ั‹ ะฑั‹ะปะธ ะธัะบั€ะตะฝะฝะธ ั‚ะพะณะดะฐ? ะ’ั‹ ะฑั‹ ะฟั€ะธัะพะตะดะธะฝะธะปะธััŒ ะบ ะะะขะž?\""*)

ะ’ะพั‚ ะฟะตั€ะฒะฐั ั‡ะฐัั‚ัŒ ัะพะฑะตัะตะดะพะฒะฐะฝะธั ะฟะพ ั€ะตะทัƒะปัŒั‚ะฐั‚ะฐะผ LLM:

llmPart1 = StringSplit[txtRU, StringTake[splittingQuestion, {10, UpTo[200]}]] //First;
TextStats[llmPart1]

(*<|"Chars" -> 91566, "Words" -> 13705, "Lines" -> 291|>*)

ะŸั€ะธะผะตั‡ะฐะฝะธะต: ะ’ะธะดะฝะพ, ั‡ั‚ะพ LLM โ€œะดะพะฑะฐะฒะธะปโ€ ะบ โ€œะฒั€ัƒั‡ะฝัƒัŽโ€ ะฒั‹ะดะตะปะตะฝะฝะพะผัƒ ั‚ะตะบัั‚ัƒ ะฟะพั‡ั‚ะธ ะฝะฐ 1/5 ะฑะพะปัŒัˆะต ั‚ะตะบัั‚ะฐ. ะะธะถะต ะผั‹ ะฟั€ะพะดะพะปะถะธะผ ั€ะฐะฑะพั‚ัƒ ั ะฟะพัะปะตะดะฝะธะผ.

ะšั€ะฐั‚ะบะพะต ัะพะดะตั€ะถะฐะฝะธะต ะฟะตั€ะฒะพะน ั‡ะฐัั‚ะธ

ะ’ะพั‚ ะบั€ะฐั‚ะบะพะต ะธะทะปะพะถะตะฝะธะต ะฟะตั€ะฒะพะน ั‡ะฐัั‚ะธ ะธะฝั‚ะตั€ะฒัŒัŽ:

LLMSynthesize[{"ะ ะตะทัŽะผะธั€ัƒะนั‚ะต ัะปะตะดัƒัŽั‰ัƒัŽ ั‡ะฐัั‚ัŒ ะฟะตั€ะฒะพะณะพ ะธะฝั‚ะตั€ะฒัŒัŽ ะšะฐั€ะปัะพะฝะฐ-ะŸัƒั‚ะธะฝะฐ:", part1}, LLMEvaluator -> conf]

ะ’ ะธะฝั‚ะตั€ะฒัŒัŽ ะขะฐะบะตั€ัƒ ะšะฐั€ะปัะพะฝัƒ, ะ’ะปะฐะดะธะผะธั€ ะŸัƒั‚ะธะฝ ะพั‚ั€ะธั†ะฐะตั‚, ั‡ั‚ะพ ะ ะพััะธั ะพะฟะฐัะฐะปะฐััŒ ะฒะฝะตะทะฐะฟะฝะพะณะพ ัƒะดะฐั€ะฐ ะพั‚ ะกะจะ ั‡ะตั€ะตะท ะะะขะž, ะธ ัƒั‚ะฒะตั€ะถะดะฐะตั‚, ั‡ั‚ะพ ะตะณะพ ัะปะพะฒะฐ ะฑั‹ะปะธ ะธัั‚ะพะปะบะพะฒะฐะฝั‹ ะฝะตะฒะตั€ะฝะพ. ะŸัƒั‚ะธะฝ ะฟั€ะตะดะปะฐะณะฐะตั‚ ะธัั‚ะพั€ะธั‡ะตัะบัƒัŽ ัะฟั€ะฐะฒะบัƒ ะพ ะฟั€ะพะธัั…ะพะถะดะตะฝะธะธ ะ ะพััะธะธ ะธ ะฃะบั€ะฐะธะฝั‹, ะฝะฐั‡ะธะฝะฐั ั 862 ะณะพะดะฐ, ะบะพะณะดะฐ ะ ัŽั€ะธะบ ะฑั‹ะป ะฟั€ะธะณะปะฐัˆะตะฝ ะฟั€ะฐะฒะธั‚ัŒ ะะพะฒะณะพั€ะพะดะพะผ, ะธ ะพะฟะธัั‹ะฒะฐะตั‚ ั€ะฐะทะฒะธั‚ะธะต ะ ัƒััะบะพะณะพ ะณะพััƒะดะฐั€ัั‚ะฒะฐ ั‡ะตั€ะตะท ะบะปัŽั‡ะตะฒั‹ะต ัะพะฑั‹ั‚ะธั, ั‚ะฐะบะธะต ะบะฐะบ ะบั€ะตั‰ะตะฝะธะต ะ ัƒัะธ ะฒ 988 ะณะพะดัƒ ะธ ะฟะพัะปะตะดัƒัŽั‰ะตะต ัƒะบั€ะตะฟะปะตะฝะธะต ั†ะตะฝั‚ั€ะฐะปะธะทะพะฒะฐะฝะฝะพะณะพ ะณะพััƒะดะฐั€ัั‚ะฒะฐ. ะŸัƒั‚ะธะฝ ะฟะพะดั€ะพะฑะฝะพ ั€ะฐััะบะฐะทั‹ะฒะฐะตั‚ ะพ ั€ะฐะทะดั€ะพะฑะปะตะฝะฝะพัั‚ะธ ะ ัƒัะธ, ะฝะฐัˆะตัั‚ะฒะธะธ ะผะพะฝะณะพะปะพ-ั‚ะฐั‚ะฐั€ ะธ ะฟะพัะปะตะดัƒัŽั‰ะตะผ ะพะฑัŠะตะดะธะฝะตะฝะธะธ ะทะตะผะตะปัŒ ะฒะพะบั€ัƒะณ ะœะพัะบะฒั‹, ะฐ ั‚ะฐะบะถะต ะพ ะฒะปะธัะฝะธะธ ะŸะพะปัŒัˆะธ ะธ ะ›ะธั‚ะฒั‹ ะฝะฐ ัƒะบั€ะฐะธะฝัะบะธะต ะทะตะผะปะธ.

ะŸัƒั‚ะธะฝ ัƒั‚ะฒะตั€ะถะดะฐะตั‚, ั‡ั‚ะพ ะธะดะตั ัƒะบั€ะฐะธะฝัะบะพะน ะฝะฐั†ะธะธ ะฑั‹ะปะฐ ะธัะบัƒััั‚ะฒะตะฝะฝะพ ะฒะฝะตะดั€ะตะฝะฐ ะŸะพะปัŒัˆะตะน ะธ ะฟะพะทะถะต ะฟะพะดะดะตั€ะถะฐะฝะฐ ะะฒัั‚ั€ะพ-ะ’ะตะฝะณั€ะธะตะน ั ั†ะตะปัŒัŽ ะพัะปะฐะฑะปะตะฝะธั ะ ะพััะธะธ. ะžะฝ ั‚ะฐะบะถะต ัƒะฟะพะผะธะฝะฐะตั‚ ะพ ะ‘ะพะณะดะฐะฝะต ะฅะผะตะปัŒะฝะธั†ะบะพะผ, ะบะพั‚ะพั€ั‹ะน ะฒ 1654 ะณะพะดัƒ ะพะฑั€ะฐั‚ะธะปัั ะบ ะœะพัะบะฒะต ั ะฟั€ะพััŒะฑะพะน ะฟั€ะธะฝัั‚ัŒ ัƒะบั€ะฐะธะฝัะบะธะต ะทะตะผะปะธ ะฟะพะด ะทะฐั‰ะธั‚ัƒ ะ ะพััะธะธ, ั‡ั‚ะพ ะฟั€ะธะฒะตะปะพ ะบ ะฒะพะนะฝะต ั ะŸะพะปัŒัˆะตะน ะธ ะฟะพัะปะตะดัƒัŽั‰ะตะผัƒ ะฒะบะปัŽั‡ะตะฝะธัŽ ัั‚ะธั… ั‚ะตั€ั€ะธั‚ะพั€ะธะน ะฒ ัะพัั‚ะฐะฒ ะ ะพััะธะนัะบะพะน ะธะผะฟะตั€ะธะธ.

ะŸัƒั‚ะธะฝ ะบั€ะธั‚ะธะบัƒะตั‚ ะดะตะนัั‚ะฒะธั ะฑะพะปัŒัˆะตะฒะธะบะพะฒ ะธ ะ›ะตะฝะธะฝะฐ ะทะฐ ัะพะทะดะฐะฝะธะต ัะพะฒะตั‚ัะบะพะน ะฃะบั€ะฐะธะฝั‹ ั ะฟั€ะฐะฒะพะผ ะฝะฐ ะฒั‹ั…ะพะด ะธะท ะกะกะกะ  ะธ ะทะฐ ะฒะบะปัŽั‡ะตะฝะธะต ะฒ ะตะต ัะพัั‚ะฐะฒ ั‚ะตั€ั€ะธั‚ะพั€ะธะน, ะบะพั‚ะพั€ั‹ะต ะธัั‚ะพั€ะธั‡ะตัะบะธ ะฝะต ะฑั‹ะปะธ ัะฒัะทะฐะฝั‹ ั ะฃะบั€ะฐะธะฝะพะน. ะžะฝ ัƒั‚ะฒะตั€ะถะดะฐะตั‚, ั‡ั‚ะพ ัะพะฒั€ะตะผะตะฝะฝะฐั ะฃะบั€ะฐะธะฝะฐ ัะฒะปัะตั‚ัั ะธัะบัƒััั‚ะฒะตะฝะฝั‹ะผ ะณะพััƒะดะฐั€ัั‚ะฒะพะผ, ัะพะทะดะฐะฝะฝั‹ะผ ะฒ ั€ะตะทัƒะปัŒั‚ะฐั‚ะต ัั‚ะฐะปะธะฝัะบะพะน ะฟะพะปะธั‚ะธะบะธ, ะธ ะพะฑััƒะถะดะฐะตั‚ ะธะทะผะตะฝะตะฝะธั ะณั€ะฐะฝะธั† ะฟะพัะปะต ะ’ั‚ะพั€ะพะน ะผะธั€ะพะฒะพะน ะฒะพะนะฝั‹.

ะ’ ะพั‚ะฒะตั‚ ะฝะฐ ะฒะพะฟั€ะพั ะšะฐั€ะปัะพะฝะฐ ะพ ั‚ะพะผ, ะฟะพั‡ะตะผัƒ ะŸัƒั‚ะธะฝ ะฝะต ะฟะพะฟั‹ั‚ะฐะปัั ะฒะตั€ะฝัƒั‚ัŒ ัƒะบั€ะฐะธะฝัะบะธะต ั‚ะตั€ั€ะธั‚ะพั€ะธะธ ะฒ ะฝะฐั‡ะฐะปะต ัะฒะพะตะณะพ ะฟั€ะตะทะธะดะตะฝั‚ัั‚ะฒะฐ, ะŸัƒั‚ะธะฝ ะฟั€ะพะดะพะปะถะฐะตั‚ ัะฒะพัŽ ะธัั‚ะพั€ะธั‡ะตัะบัƒัŽ ัะฟั€ะฐะฒะบัƒ, ะฟะพะดั‡ะตั€ะบะธะฒะฐั ัะปะพะถะฝะพัั‚ัŒ ะธัั‚ะพั€ะธั‡ะตัะบะธั… ะพั‚ะฝะพัˆะตะฝะธะน ะผะตะถะดัƒ ะ ะพััะธะตะน ะธ ะฃะบั€ะฐะธะฝะพะน.

ะงะฐัั‚ัŒ 2: ั‚ะตะผะฐั‚ะธั‡ะตัะบะธะต ั‡ะฐัั‚ะธ

ะ—ะดะตััŒ ะผั‹ ะดะตะปะฐะตะผ LLM-ะทะฐะฟั€ะพั ะฝะฐ ะฟะพะธัะบ ะธ ะฒั‹ะดะตะปะตะฝะธะต ั‚ะตะผ ะธะปะธ ะฒั‚ะพั€ัƒัŽ ั‡ะฐัั‚ัŒ ะธะฝั‚ะตั€ะฒัŒัŽ:

llmParts = LLMSynthesize[{
     "ะ ะฐะทะดะตะปะธั‚ะต ัะปะตะดัƒัŽั‰ัƒัŽ ะฒั‚ะพั€ัƒัŽ ั‡ะฐัั‚ัŒ ะฑะตัะตะดั‹ ะขะฐะบะตั€ะฐ ะธ ะŸัƒั‚ะธะฝะฐ ะฝะฐ ั‚ะตะผะฐั‚ะธั‡ะตัะบะธะต ั‡ะฐัั‚ะธ:", 
     part2, 
     "ะ’ะพะทะฒั€ะฐั‰ะฐะตั‚ ะดะตั‚ะฐะปะธ ะฒ ะฒะธะดะต ะผะฐััะธะฒะฐ JSON", 
     LLMPrompt["NothingElse"]["JSON"] 
    }, LLMEvaluator -> conf];
llmParts2 = FromJSON[llmParts];
DeduceType[llmParts2]

(*Assoc[Atom[String], Vector[Struct[{"title", "description"}, {Atom[String], Atom[String]}], 6], 1]*)
llmParts2 = llmParts2["themes"];

ะ—ะดะตััŒ ะผั‹ ะฟั€ะธะฒะพะดะธะผ ั‚ะฐะฑะปะธั†ัƒ ะฝะฐะนะดะตะฝะฝั‹ั… ั‚ะตะผ:

ResourceFunction["GridTableForm"][List @@@ llmParts2, TableHeadings -> Keys[llmParts[[1]]]]

ะ ะฐะทะณะพะฒะพั€ะฝั‹ะต ั‡ะฐัั‚ะธ ะธะฝั‚ะตั€ะฒัŒัŽ

ะ’ ัั‚ะพะผ ั€ะฐะทะดะตะปะต ะผั‹ ั€ะฐะทะดะตะปัะตะผ ั€ะฐะทะณะพะฒะพั€ะฝั‹ะต ั„ั€ะฐะณะผะตะฝั‚ั‹ ะบะฐะถะดะพะณะพ ัƒั‡ะฐัั‚ะฝะธะบะฐ ะธะฝั‚ะตั€ะฒัŒัŽ. ะ”ะปั ัั‚ะพะณะพ ะผั‹ ะธัะฟะพะปัŒะทัƒะตะผ ั€ะตะณัƒะปัั€ะฝั‹ะต ะฒั‹ั€ะฐะถะตะฝะธั, ะฐ ะฝะต LLM.

ะ—ะดะตััŒ ะผั‹ ะฝะฐั…ะพะดะธะผ ะฟะพะทะธั†ะธะธ ะธะผะตะฝ ัƒั‡ะฐัั‚ะฝะธะบะพะฒ ะฒ ั‚ะตะบัั‚ะต ะธะฝั‚ะตั€ะฒัŒัŽ:

pos1 = StringPosition[txtRU, "ะข.ะšะฐั€ะปัะพะฝ:" | "ะข.ะšะฐั€ะปัะพะฝ (ะบะฐะบ ะฟะตั€ะตะฒะตะดะตะฝะพ):"];
pos2 = StringPosition[txtRU, "ะ’.ะŸัƒั‚ะธะฝ:"];

ะ ะฐะทะดะตะปะธั‚ะต ั‚ะตะบัั‚ ะธะฝั‚ะตั€ะฒัŒัŽ ะฝะฐ ั€ะฐะทะณะพะฒะพั€ะฝั‹ะต ั‡ะฐัั‚ะธ:

partsByTC = MapThread["ะข.ะšะฐั€ะปัะพะฝ" -> StringTrim[StringReplace[StringTake[txtRU, {#1[[2]] + 1, #2[[1]] - 1}], "(ะบะฐะบ ะฟะตั€ะตะฒะตะดะตะฝะพ)" -> ""]] &, {Most@pos1, pos2}];
partsByVP = MapThread["ะ’.ะŸัƒั‚ะธะฝ" -> StringTrim[StringTake[txtRU, {#1[[2]] + 1, #2[[1]] - 1}]] &, {pos2, Rest@pos1}];

ะ—ะฐะผะตั‡ะฐะฝะธะต: ะœั‹ ะฟั€ะตะดะฟะพะปะฐะณะฐะตะผ, ั‡ั‚ะพ ั‡ะฐัั‚ะธ, ะฟั€ะพะธะทะฝะตัะตะฝะฝั‹ะต ัƒั‡ะฐัั‚ะฝะธะบะฐะผะธ, ะธะผะตัŽั‚ ัะพะพั‚ะฒะตั‚ัั‚ะฒัƒัŽั‰ะธะน ะฟะพั€ัะดะพะบ ะธ ะบะพะปะธั‡ะตัั‚ะฒะพ.
ะ—ะดะตััŒ ะพะฑัŠะตะดะธะฝะตะฝั‹ ะฟั€ะพะธะทะฝะตัะตะฝะฝั‹ะต ั‡ะฐัั‚ะธ ะธ ั‚ะฐะฑัƒะปะธั€ะพะฒะฐะฝั‹ ะฟะตั€ะฒั‹ะต 6:

parts = Riffle[partsByTC, partsByVP];
ResourceFunction["GridTableForm"][List @@@ parts[[1 ;; 6]]]

ะ—ะดะตััŒ ะผั‹ ะฟั€ะธะฒะพะดะธะผ ั‚ะฐะฑะปะธั†ัƒ ะฒัะตั… ะฟั€ะพะธะทะฝะตัะตะฝะฝั‹ั… ะขะฐะบะตั€ะพะผ ะšะฐั€ะปัะพะฝะพะผ ั‡ะฐัั‚ะตะน ั€ะตั‡ะธ (ะธ ัั‡ะธั‚ะฐะตะผ ะฒัะต ะธะท ะฝะธั… โ€œะฒะพะฟั€ะพัะฐะผะธโ€):

Multicolumn[Values@partsByTC, 3, Dividers -> All]

ะŸะพะธัะบะพะฒะฐั ัะธัั‚ะตะผะฐ

ะ’ ัั‚ะพะผ ั€ะฐะทะดะตะปะต ะผั‹ ัะพะทะดะฐะดะธะผ (ะผะธะฝะธ) ะฟะพะธัะบะพะฒัƒัŽ ัะธัั‚ะตะผัƒ ะธะท ั‡ะฐัั‚ะตะน ะธะฝั‚ะตั€ะฒัŒัŽ, ะฟะพะปัƒั‡ะตะฝะฝั‹ั… ะฒั‹ัˆะต.

ะ’ะพั‚ ัˆะฐะณะธ:

  1. ะฃะฑะตะดะธั‚ะตััŒ, ั‡ั‚ะพ ั‡ะฐัั‚ะธ ะธะฝั‚ะตั€ะฒัŒัŽ ัะฒัะทะฐะฝั‹ ั ัƒะฝะธะบะฐะปัŒะฝั‹ะผะธ ะธะดะตะฝั‚ะธั„ะธะบะฐั‚ะพั€ะฐะผะธ, ะบะพั‚ะพั€ั‹ะต ั‚ะฐะบะถะต ะธะดะตะฝั‚ะธั„ะธั†ะธั€ัƒัŽั‚ ะณะพะฒะพั€ัั‰ะธั….
  2. ะะฐะนะดะธั‚ะต ะฒะตะบั‚ะพั€ั‹ ะฒะบั€ะฐะฟะปะตะฝะธะน ะดะปั ะบะฐะถะดะพะน ั‡ะฐัั‚ะธ.
  3. ะกะพะทะดะฐะนั‚ะต ั€ะตะบะพะผะตะฝะดะฐั‚ะตะปัŒะฝัƒัŽ ั„ัƒะฝะบั†ะธัŽ, ะบะพั‚ะพั€ะฐั:
    1. ะคะธะปัŒั‚ั€ัƒะตั‚ ะฒะบั€ะฐะฟะปะตะฝะธั ะฒ ัะพะพั‚ะฒะตั‚ัั‚ะฒะธะธ ั ะทะฐะดะฐะฝะฝั‹ะผ ั‚ะธะฟะพะผ
    2. ะะฐั…ะพะดะธั‚ ะฒะตะบั‚ะพั€ะฝะพะต ะฒะปะพะถะตะฝะธะต ะทะฐะดะฐะฝะฝะพะณะพ ะทะฐะฟั€ะพัะฐ
    3. ะะฐั…ะพะดะธั‚ ั‚ะพั‡ะตั‡ะฝั‹ะต ะฟั€ะพะธะทะฒะตะดะตะฝะธั ะฒะตะบั‚ะพั€ะฐ ะทะฐะฟั€ะพัะฐ ะธ ะฒะตะบั‚ะพั€ะพะฒ ั‡ะฐัั‚ะตะน
    4. ะ’ั‹ะฑะธั€ะฐะตั‚ ะปัƒั‡ัˆะธะต ั€ะตะทัƒะปัŒั‚ะฐั‚ั‹

ะ—ะดะตััŒ ะผั‹ ัะพะทะดะฐะตะผ ะฐััะพั†ะธะฐั†ะธัŽ ั‡ะฐัั‚ะตะน ะธะฝั‚ะตั€ะฒัŒัŽ, ะฟะพะปัƒั‡ะตะฝะฝั‹ั… ะฒั‹ัˆะต:

k = 1;
aParts = Association@Map[ToString[k++] <> " " <> #[[1]] -> #[[2]] &, parts];
aParts // Length

(*148*)

ะ—ะดะตััŒ ะผั‹ ะฝะฐั…ะพะดะธะผ LLM-ะฒะตะบั‚ะพั€ั‹ ะฒะบั€ะฐะฟะปะตะฝะธะน ั‡ะฐัั‚ะตะน ะธะฝั‚ะตั€ะฒัŒัŽ:

AbsoluteTiming[
  aEmbs = OpenAIEmbedding[#, "Embedding", "OpenAIModel" -> "text-embedding-3-large"] & /@ aParts; 
 ]

(*{60.2163, Null}*)
DeduceType[aEmbs]

(*Assoc[Atom[String], Vector[Atom[Real], 3072], 148]*)

ะ’ะพั‚ ั„ัƒะฝะบั†ะธั ะดะปั ะฟะพะธัะบะฐ ะฝะฐะธะฑะพะปะตะต ั€ะตะปะตะฒะฐะฝั‚ะฝั‹ั… ั‡ะฐัั‚ะตะน ะธะฝั‚ะตั€ะฒัŒัŽ ะฟะพ ะทะฐะดะฐะฝะฝะพะผัƒ ะทะฐะฟั€ะพััƒ (ั ะธัะฟะพะปัŒะทะพะฒะฐะฝะธะตะผ ั‚ะพั‡ะตั‡ะฝะพะณะพ ะฟั€ะพะธะทะฒะตะดะตะฝะธั):

Clear[TopParts]; 

TopParts::unkntype = "Do not know how to process the third (type) argument."; 

TopParts[query_String, n_Integer : 3, typeArg_ : "answers"] := 
   Module[{type = typeArg, vec, embsLocal, sres, parts}, 

    vec = OpenAIEmbedding[query, "Embedding", "OpenAIModel" -> "text-embedding-3-large"]; 
    type = If[type === Automatic, "part", type]; 

    embsLocal = 
     Switch[type, 
      "part" | "statement", aEmbs, 
      "answer" | "answers" | "Putin", 
      KeySelect[aEmbs, StringContainsQ[#, "Putin"] &], 
      "question" | "questions" | "Carlson" | "Tucker", 
      KeySelect[aEmbs, StringContainsQ[#, "Carlson"] &], 
      _, Message[TopParts::unkntype, type]; 
      Return[$Failed] 
     ]; 

    sres = ReverseSortBy[KeyValueMap[#1 -> #2 . vec &, embsLocal], Last]; 

    Map[<|"Score" -> #[[2]], "Text" -> aParts[#[[1]]]|> &, Take[sres, UpTo[n]]] 
   ];

ะ—ะดะตััŒ ะผั‹ ะฝะฐั…ะพะดะธะผ 3 ะปัƒั‡ัˆะธั… ั€ะตะทัƒะปัŒั‚ะฐั‚ะฐ ะฟะพ ะทะฐะฟั€ะพััƒ:

TopParts["ะšั‚ะพ ะฒะทะพั€ะฒะฐะป NordStream 1 ะธ 2?", 3, "part"] // ResourceFunction["GridTableForm"][Map[{#[[1]], ResourceFunction["HighlightText"][#[[2]], "ะกะตะฒะตั€ะฝั‹ะน ะฟะพั‚" ~~ (LetterCharacter ..)]} &, List @@@ #]] &
TopParts["ะ“ะดะต ะฟั€ะพั…ะพะดะธะปะธ ั€ะพััะธะนัะบะพ-ัƒะบั€ะฐะธะฝัะบะธะต ะฟะตั€ะตะณะพะฒะพั€ั‹?", 2, "part"] // ResourceFunction["GridTableForm"][Map[{#[[1]], ResourceFunction["HighlightText"][#[[2]], "ะฟะตั€ะตะณ" ~~ (LetterCharacter ..)]} &, List @@@ #]] &

ะกั‚ะธะปะธะทะพะฒะฐะฝะฝั‹ะต ะฒะฐั€ะธะฐั†ะธะธ

ะ’ ัั‚ะพะผ ั€ะฐะทะดะตะปะต ะผั‹ ะฟะพะบะฐะถะตะผ, ะบะฐะบ ะผะพะถะฝะพ ะฟะตั€ะตั„ั€ะฐะทะธั€ะพะฒะฐั‚ัŒ ั€ะฐะทะณะพะฒะพั€ะฝั‹ะต ั„ั€ะฐะณะผะตะฝั‚ั‹ ะฒ ัั‚ะธะปะต ะฝะตะบะพั‚ะพั€ั‹ั… ะฟะพะปะธั‚ะธั‡ะตัะบะธั… ะทะฝะฐะผะตะฝะธั‚ะพัั‚ะตะน.

ะšะฐั€ะปัะพะฝ -> ะšะปะธะฝั‚ะพะฝ

ะ—ะดะตััŒ ะฟั€ะธะฒะตะดะตะฝั‹ ะฟั€ะธะผะตั€ั‹ ะธัะฟะพะปัŒะทะพะฒะฐะฝะธั LLM ะดะปั ะฟะตั€ะตั„ั€ะฐะทะธั€ะพะฒะฐะฝะธั ะฒะพะฟั€ะพัะพะฒ ะขะฐะบะตั€ะฐ ะšะฐั€ะปัะพะฝะฐ ะฒ ัั‚ะธะปะต ะฅะธะปะปะฐั€ะธ ะšะปะธะฝั‚ะพะฝ:

Do[
  q = RandomChoice[Values@partsByTC]; 
  Print[StringRepeat["=", 100]]; 
  Print["ะขะฐะบะตั€ ะšะฐั€ะปัะพะฝ: ", q]; 
  Print[StringRepeat["-", 100]]; 
  q2 = LLMSynthesize[{"ะŸะตั€ะตั„ั€ะฐะทะธั€ัƒะนั‚ะต ัั‚ะพั‚ ะฒะพะฟั€ะพั ะฒ ัั‚ะธะปะต ะฅะธะปะปะฐั€ะธ ะšะปะธะฝั‚ะพะฝ:", q}, LLMEvaluator -> conf]; 
  Print["ะฅะธะปะปะฐั€ะธ ะšะปะธะฝั‚ะพะฝ: ", q2], {2}]

ะŸัƒั‚ะธะฝ -> ะขั€ะฐะผะฟ

ะ’ะพั‚ ะฟั€ะธะผะตั€ั‹ ะธัะฟะพะปัŒะทะพะฒะฐะฝะธั LLM ะดะปั ะฟะตั€ะตั„ั€ะฐะทะธั€ะพะฒะฐะฝะธั ะพั‚ะฒะตั‚ะพะฒ ะ’ะปะฐะดะธะผะธั€ะฐ ะŸัƒั‚ะธะฝะฐ ะฒ ัั‚ะธะปะต ะ”ะพะฝะฐะปัŒะดะฐ ะขั€ะฐะผะฟะฐ:

Do[
  q = RandomChoice[Values@partsByVP]; 
  Print[StringRepeat["=", 100]]; 
  Print["ะ’ะปะฐะดะธะผะธั€ ะŸัƒั‚ะธะฝ: ", q]; 
  Print[StringRepeat["-", 100]]; 
  q2 = LLMSynthesize[{"ะŸะตั€ะตั„ั€ะฐะทะธั€ัƒะนั‚ะต ัั‚ะพั‚ ะพั‚ะฒะตั‚ ะฒ ัั‚ะธะปะต ะ”ะพะฝะฐะปัŒะดะฐ ะขั€ะฐะผะฟะฐ:", q}, LLMEvaluator -> conf]; 
  Print["ะ”ะพะฝะฐะปัŒะด ะขั€ะฐะผะฟ: ", q2], {2}]

ะะฐัั‚ั€ะพะนะบะฐ

Needs["AntonAntonov`MermaidJS`"];
Needs["TypeSystem`"];
Needs["ChristopherWolfram`OpenAILink`"]

ะกะผ. ัะพะพั‚ะฒะตั‚ัั‚ะฒัƒัŽั‰ะตะต ะพะฑััƒะถะดะตะฝะธะต ะทะดะตััŒ:

Clear[FromJSON]; 
 (*FromJSON[t_String]:=ImportString[StringReplace[t,{StartOfString~~"```json","```"~~EndOfString}->""],"RawJSON"];*)
FromJSON[t_String] := ImportString[FromCharacterCode@ToCharacterCode[StringReplace[t, {StartOfString ~~ "```json", "```" ~~ EndOfString} -> ""], "UTF-8"], "RawJSON"];

ะกัั‹ะปะบะธ

ะกัั‹ะปะบะธ ะดะฐะฝั‹ ะฝะฐ ะฐะฝะณะปะธะนัะบะพะผ ัะทั‹ะบะต, ะฟะพัะบะพะปัŒะบัƒ ะธะผะตะฝะฝะพ ะฝะฐ ัั‚ะพะผ ัะทั‹ะบะต ะพะฝะธ ะฑั‹ะปะธ ัะพะทะดะฐะฝั‹, ะธ ะฟะพ ะฐะฝะณะปะธะนัะบะธะผ ะฝะฐะทะฒะฐะฝะธัะผ ะธั… ะปะตะณั‡ะต ะธัะบะฐั‚ัŒ.

ะกั‚ะฐั‚ัŒะธ / Articles

[AA1] Anton Antonov, “Workflows with LLM functions” , (2023), RakuForPrediction at WordPress .

[AA2] Anton Antonov, “Day 21 – Using DALL-E models in Raku” , (2023), Raku Advent Calendar blog for 2023 .

[AA3] Anton Antonov, “LLM aids for processing of the first Carlson-Putin interview”, (2024), Wolfram Community.

[OAIb1] OpenAI team, “New models and developer products announced at DevDay” , (2023), OpenAI/blog .

[SW1] Stephen Wolfram, “The New World of LLM Functions: Integrating LLM Technology into the Wolfram Language”, (2023), Stephen Wolfram Writings.

ะŸะฐะบะตั‚ั‹ / Packages

[AAp1] Anton Antonov, WWW::OpenAI Raku package, (2023), GitHub/antononcube .

[AAp2] Anton Antonov, WWW::PaLM Raku package, (2023), GitHub/antononcube .

[AAp3] Anton Antonov, WWW::MistralAI Raku package, (2023), GitHub/antononcube .

[AAp4] Anton Antonov, WWW::MermaidInk Raku package, (2023), GitHub/antononcube .

[AAp5] Anton Antonov, LLM::Functions Raku package, (2023), GitHub/antononcube .

[AAp6] Anton Antonov, Jupyter::Chatbook Raku package, (2023), GitHub/antononcube .

[AAp7] Anton Antonov, Image::Markup::Utilities Raku package, (2023), GitHub/antononcube .

[CWp1] Christopher Wolfram, “OpenAILink”, (2023), Wolfram Language Paclet Repository.

ะ’ะธะดะตะพ / Videos

[AAv1] Anton Antonov, “Jupyter Chatbook LLM cells demo (Raku)” (2023), YouTube/@AAA4Prediction .

[AAv2] Anton Antonov, “Jupyter Chatbook multi cell LLM chats teaser (Raku)” , (2023), YouTube/@AAA4Prediction .

[AAv3] Anton Antonov “Integrating Large Language Models with Raku” , (2023), YouTube/@therakuconference6823 .

[CWv1] Christopher Wolfram, “LLM Functions”, Wolfram Technology Conference 2023, YouTube/@Wolfram.