Home
Downloads
Licenses Contact

OshonSoft AI Language Model Lab
Learning to Translate Fixed and Variable Sentence Patterns

PRODUCT HOMEPAGE · GUIDED EXAMPLES · USER MANUAL

Small models learn word translation, word order and optional adjectives.

Four fresh 50,613-parameter MLPs were trained on 20,000 random examples each. A and AX translate the Subject, Predicate and Object in separate lines before assembling the final answer. B and BX give that answer directly. A/B use the same fixed-pattern sentences, with one adjective before each noun. AX/BX share a second set that allows either adjective to be absent.

A · translated intermediate steps
900 / 900 exact Final evaluation replies
All four lines and the end of the reply
AX · steps with optional adjectives
888 / 900 exact Final evaluation replies
893/900 correct final translations
B · fixed pattern
900 / 900 Final evaluation replies
100% exact, including the end of the reply
BX · variable patterns
888 / 900 Final evaluation replies
98.7% exact, including the end of the reply

B first reached 450/450 on Training checks at epoch 3. BX improved throughout the ten epochs and finished at 443/450. These runs show how the learning process changes when the input can have several lengths and word positions.

DOWNLOAD PDF

BRACKET LOGIC - THREE-DIGIT ADDITION - TRANSLATION PATTERNS

1. Try the trained models

The download contains all four projects, their initial and trained models, and the complete saved replies. The measurements below were reproduced with the current Lab training and generation code.

DOWNLOAD THE FOUR PROJECTS - DOWNLOAD THE LAB

The trained model is supplied as models/selected.osai in its project. Load it through Persistence, using Choose load file and Load checkpoint. In Conversation, choose Greedy, set the reply limit shown below and clear the conversation before each independent question.

Choose A, AX, B or BX. Use a reply limit of 40. A and AX generate four lines; B and BX generate the final translation directly. Use the supplied lexicon.json to choose words for your own sentences.

Model A generating a translation in OshonSoft AI Language Model Lab.
Model A in the Lab application. Click to view the screenshot at full size.
Model AX generating a translation in OshonSoft AI Language Model Lab.
Model AX in the Lab application. Click to view the screenshot at full size.
Model B generating a translation in OshonSoft AI Language Model Lab.
Model B in the Lab application. Click to view the screenshot at full size.
Model BX generating a translation in OshonSoft AI Language Model Lab.
Model BX in the Lab application. Click to view the screenshot at full size.

WATCH THE ONE-TOKEN WALKTHROUGH (MP4)

A · the screenshot example
USER: Translate: the black sailor repairs the young bottle.
MODEL: subject: crn mornar
predicate: popraviti
object: mlad boca
translation: mornar crn boca mlad popraviti.
[EOT]
AX · the screenshot example
USER: Translate: the fox likes the empty deer.
MODEL: subject: lisica
predicate: voleti
object: prazan jelen
translation: lisica jelen prazan voleti.
[EOT]
B · the screenshot example
USER: Translate: the black sailor repairs the young bottle.
MODEL: mornar crn boca mlad popraviti.
[EOT]
BX · the screenshot example
USER: Translate: the fox likes the empty deer.
MODEL: lisica jelen prazan voleti.
[EOT]

Each project also includes models/initial.osai for a before-and-after comparison. Saved replies are grouped by update in answers/; answers/final/ contains the complete Final evaluation, including errors.

2. Understand the task and intermediate steps

The input is a synthetic English sentence. A fixed dictionary contains 160 nouns, 60 adjectives and 30 verbs. The target uses the corresponding Serbian base forms, puts each noun before its adjective, and places the verb last: Subject → Object → Verb. Articles are omitted.

This is a controlled word-translation and ordering task. It does not teach natural Serbian agreement, inflection or ordinary sentence style. Random combinations may have unusual meanings.

A first translates each phrase in its original English word order. The last line reverses the translated Subject phrase, reverses the translated Object phrase, and appends the translated verb. Here is the same training sentence in A and B.

A · Fixed pattern, translated steps
USER: Translate: the quiet dog sees the sweet deer.
MODEL: Subject: tih pas
Predicate: videti
Object: sladak jelen
Translation: pas tih jelen sladak videti.
B · Fixed pattern, direct answer
USER: Translate: the quiet dog sees the sweet deer.
MODEL: pas tih jelen sladak videti.

A and AX learn to generate all four lines. Their preceding lines become part of the context when they generate the next token. Those intermediate words can also be wrong, so we measure each line and the complete reply separately.

The following are actual BX training examples. A missing adjective is simply absent; there is no placeholder token. A and B train only on the last pattern.

Subject 0 / Object 0
USER: Translate: the boy washes the mirror.
MODEL: dečak ogledalo prati.
Subject 0 / Object 1
USER: Translate: the doctor opens the dirty lock.
MODEL: lekar brava prljav otvoriti.
Subject 1 / Object 0
USER: Translate: the purple owl calls the monkey.
MODEL: sova ljubičast majmun zvati.
Subject 1 / Object 1
USER: Translate: the wide cow follows the new swan.
MODEL: krava širok labud nov pratiti.
How each 20,000-example training set is distributed
Adjectives presentA / BAX / BX
Neither05,000
Object only05,000
Subject only05,000
Both20,0005,000

All four AX/BX patterns are present during training. Evaluation uses new sentences within those trained patterns; it does not introduce an unseen grammatical structure.

3. Follow the learning curves

After every epoch, each model generates complete replies to its fixed 450-question Training checks set. A reply is correct only when every token is correct and the model ends the turn correctly. The reference answer is used for scoring, not supplied as part of the generated reply.

Training checks exact reply accuracy by epoch: B reaches 100 percent at epoch 3; BX reaches 98.4 percent at epoch 10.
One epoch visits every selected next-token training target once.

A has 23 targets per answer, including labels, line breaks and EOT: 460,000 updates per epoch. AX has 19, 21 or 23 targets: 420,000 updates per epoch. B has seven targets: 140,000 updates per epoch. BX has five, six or seven targets: 120,000 updates per epoch. Switch axes to compare both views of training effort.

B / BX: exact whole Training checks replies at every epoch
EpochB exactB updatesBX exactBX updates
1387/450140,00036/450120,000
2447/450280,000199/450240,000
3450/450420,000326/450360,000
4450/450560,000381/450480,000
5450/450700,000411/450600,000
6450/450840,000427/450720,000
7450/450980,000433/450840,000
8450/4501,120,000438/450960,000
9450/4501,260,000442/4501,080,000
10450/4501,400,000443/4501,200,000
A / AX: final translation and complete Training checks reply
EpochA translationA wholeAX translationAX whole
1442/450441/45074/45065/450
2450/450450/450320/450299/450
3450/450450/450412/450403/450
4450/450450/450430/450418/450
5450/450450/450438/450436/450
6450/450450/450445/450444/450
7450/450450/450450/450450/450
8450/450450/450450/450449/450
9450/450450/450448/450448/450
10450/450450/450449/450449/450
A: each intermediate line and the final translation
EpochSubjectPredicateObjectTranslationWhole + EOT
1450/450450/450445/450442/450441/450
2450/450450/450450/450450/450450/450
3450/450450/450450/450450/450450/450
4450/450450/450450/450450/450450/450
5450/450450/450450/450450/450450/450
6450/450450/450450/450450/450450/450
7450/450450/450450/450450/450450/450
8450/450450/450450/450450/450450/450
9450/450450/450450/450450/450450/450
10450/450450/450450/450450/450450/450
AX: each intermediate line and the final translation
EpochSubjectPredicateObjectTranslationWhole + EOT
1348/450407/450208/45074/45065/450
2432/450440/450383/450320/450299/450
3440/450446/450433/450412/450403/450
4448/450445/450433/450430/450418/450
5447/450449/450445/450438/450436/450
6448/450450/450448/450445/450444/450
7450/450450/450450/450450/450450/450
8450/450450/450449/450450/450449/450
9450/450450/450449/450448/450448/450
10450/450450/450450/450449/450449/450

4. Explore saved replies

Choose a model, question and epoch to inspect its saved native reply. This viewer reads recorded answers; it does not run a model in the browser. The examples were chosen from questions that became consistently correct late in training. AX and BX show one question for each sentence pattern.



Saved model reply

Reference answer

The selected examples illustrate learning and errors. The tables above include every Training checks question, not only the examples shown here.

5. Inspect the Final evaluation

The selection rule was fixed before training: complete ten epochs, choose the checkpoint with the most exact Training checks replies, and choose the later checkpoint on a tie. Each choice was locked before its 900-question Final evaluation was evaluated. A and B share the same Final evaluation input sentences. AX and BX share another Final evaluation with 225 sentences of each pattern.

Final evaluation: whole replies and final translations
ModelSelected epochWhole + EOTTranslationCorrect EOT
A10900/900 (100.0%)900/900900/900
AX7888/900 (98.7%)893/900900/900
B10900/900 (100.0%)900/900900/900
BX10888/900 (98.7%)888/900900/900
AX / BX on the same Final evaluation sentences: whole replies
PatternAX exactBX exact
No adjectives224/225225/225
Object adjective only220/225225/225
Subject adjective only223/225222/225
Both adjectives221/225216/225

AX reached 450/450 on Training checks at epoch 7, then scored 449, 448 and 449 in the last three epochs. Its selected epoch-7 checkpoint gave 888/900 complete replies on the Final evaluation, including 893/900 correct final translations. A perfect Training checks checkpoint therefore did not imply a perfect Final evaluation.

AX's Final evaluation line scores were Subject 900/900, Predicate 897/900, Object 895/900 and Translation 893/900. Both AX and BX ended all 900 Final evaluation replies correctly.

6. Read the settings and interpretation

Common model and training settings
ArchitectureNative CPU MLP: embeddings, concatenation, tanh hidden layer, softmax
DimensionsV=520, C=38, D=16, H=37 · 50,613 parameters
Active vocabularyWords + LF tokenizer. A/AX: 516 active tokens. B/BX: 511; their direct answers contain no LF.
InitializationFresh weights, seed 12345, Wider embeddings ±1.0
TrainingPlain SGD, learning rate 0.01; MODEL body + EOT targets; globally shuffled epochs
GenerationGreedy; maximum 40 generated tokens
Material per model20,000 TRAIN; 450 Training checks; 900 Final evaluation; 90 known-TRAIN probes
Data seedsA/B: 4309021 · AX/BX: 4309031
ContextLongest prediction prefix: A/AX: 36 tokens, B/BX: 20 tokens. C38 retains it in full

What this shows. These models learned to translate and reorder new combinations from the fixed dictionary. B learned its fixed sentence pattern quickly. BX learned the four variable patterns more gradually and reached 98.7% on its Final evaluation after ten epochs. A demonstrates a learned four-line translation procedure on the fixed pattern.

A compared with B. The input sentences, split membership, dimensions, initialization settings and learning rate are matched. The output format changes. A has a longer answer and receives 460,000 updates per epoch, compared with 140,000 for B. Its vocabulary also includes the intermediate labels and line-break token. Compare both epochs and updates when assessing the effect of intermediate steps on learning.

AX compared with BX. These two also share their input sentences and splits. AX receives 420,000 updates per epoch, compared with 120,000 for BX. Both selected models produced 888 exact whole Final evaluation replies; AX's final translation alone was correct in 893 cases. This is a useful distinction between getting the answer right and generating an entirely correct intermediate procedure.

Why the comparison is useful. Omitting an adjective changes the length of a phrase and the positions of later words. The MLP receives a fixed window of token embeddings, so this adds positional variation to the learned mapping.

What the comparison does not isolate. B and BX use different random corpora and separate Training checks/Final evaluation sets. BX has 5,000 examples per pattern, while B has 20,000 examples of one pattern; epoch update counts also differ. There is one seed per configuration. The observed curves support a teaching comparison of these two settings, rather than a controlled estimate of the effect of word position alone.

Within each experiment, TRAIN, Training checks and Final evaluation have disjoint semantic groups, including swapped subject/object equivalents. Vocabulary comes from TRAIN. The Final evaluation was not used to choose a checkpoint. No longer-than-training sentences were tested, and 90 correct known-TRAIN probes do not establish correctness on all 20,000 training examples.

7. Repeat the training

On an AMD Ryzen 7 7735HS laptop, the repeated runs took about 3 h 48 min (A), 3 h 25 min (AX), 1 h 4 min (B) and 1 h 4 min (BX). These times include training and all configured checks while several projects shared the CPU. Time spent paused is excluded. Other hardware and workloads will give different timings.

Extract translation_patterns/A, AX, B and BX into your writable Documents/OshonSoft AI Language Model Lab folder. Each project includes ten training files, Training checks, separate Final evaluation questions, its dictionary and experiment.json.

All four use MLP V520 / C38 / D16 / H37, seed 12345, Wider embeddings, Words and punctuation with Preserve line breaks, Global epochs, MODEL body/EOT targets, SGD 0.01, 10 epochs and reply limit 40. Checks run after every epoch.

  1. Open the installed OshonSoft AI Language Model Lab. On Project, click Choose project... and select the folder containing experiment.json. The saved settings fill the controls; this does not start training.
  2. Review the dimensions, tokenizer, initialization, learning rate and target. Click Prepare and initialize model. Use the prepared target count to read the update budget.
  3. Start a fresh run. The Lab saves checkpoints and full Prompt/Gold/Raw replies under runs/run-000001/. Use Open run folder or Read replies... to inspect them.
  4. Use Pause + save before closing. Later choose the saved run.json, click Open / recover run, then Resume. Resume keeps the original target.
ProjectTargets per epochTotal updatesEpochs
A460,0004,600,00010
AX420,0004,200,00010
B140,0001,400,00010
BX120,0001,200,00010

Complete all ten epochs. Select the checkpoint with the most exact whole Training check replies; choose the later checkpoint on a tie. The supplied models are A epoch 10, AX epoch 7, B epoch 10 and BX epoch 10.

Use questions/ for Training checks. Select the checkpoint under the study's stated rule, then use Use checkpoint... and Final evaluation for questions/final/. Reusing these already evaluated question sets is a reproduction check; it is not a new unseen test.

8. Train with another target language

German, French, Spanish and Italian editions are available below. Each archive contains all four projects: A, AX, B and BX, with 20,000 training examples per project, 450 Training checks questions, 900 separate Final evaluation questions and 90 known-TRAIN probes. English prompts and semantic split identities match the Serbian editions.

Prepared material, not trained models. The curves, saved replies and measured results on this page belong to the Serbian experiments. The additional language projects have passed native preparation checks, but have no trained checkpoints or accuracy results.

Language / downloadContext CParameters
German3850,613
French4655,349
Spanish4051,797
Italian4252,981

Install the Lab, then choose a project from the language archive. Its experiment.json loads the complete settings, ten-epoch target and one-epoch check interval. V=520, D=16 and H=37 stay the same; context increases where multiword translations require more space.

The dictionary uses fixed word forms without grammatical agreement. The final answer still reverses every word of the translated Subject and Object, including words inside a multiword equivalent, and then appends the Predicate unchanged. For example, French en bois pomme de terre becomes terre de pomme bois en. This is the original mechanical word-order task, not natural French syntax. Shared translations and English/target-language spellings are recorded in each dictionary; the editions are not equally difficult by construction.

One A training example in each added language
German
USER: Translate: the quiet dog sees the sweet deer.
MODEL: Subject: leise Hund
Predicate: sehen
Object: süß Hirsch
Translation: Hund leise Hirsch süß sehen.
French
USER: Translate: the quiet dog sees the sweet deer.
MODEL: Subject: silencieux chien
Predicate: voir
Object: sucré cerf
Translation: chien silencieux cerf sucré voir.
Spanish
USER: Translate: the quiet dog sees the sweet deer.
MODEL: Subject: silencioso perro
Predicate: ver
Object: dulce ciervo
Translation: perro silencioso ciervo dulce ver.
Italian
USER: Translate: the quiet dog sees the sweet deer.
MODEL: Subject: silenzioso cane
Predicate: vedere
Object: dolce cervo
Translation: cane silenzioso cervo dolce vedere.

Back to contents