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.
900 / 900 exact Final evaluation replies
All four lines and the end of the reply
888 / 900 exact Final evaluation replies
893/900 correct final translations
900 / 900 Final evaluation replies
100% exact, including the end of the reply
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.
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.




WATCH THE ONE-TOKEN WALKTHROUGH (MP4)
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]
USER: Translate: the fox likes the empty deer. MODEL: subject: lisica predicate: voleti object: prazan jelen translation: lisica jelen prazan voleti. [EOT]
USER: Translate: the black sailor repairs the young bottle. MODEL: mornar crn boca mlad popraviti. [EOT]
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.
USER: Translate: the quiet dog sees the sweet deer. MODEL: Subject: tih pas Predicate: videti Object: sladak jelen Translation: pas tih jelen sladak videti.
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.
USER: Translate: the boy washes the mirror. MODEL: dečak ogledalo prati.
USER: Translate: the doctor opens the dirty lock. MODEL: lekar brava prljav otvoriti.
USER: Translate: the purple owl calls the monkey. MODEL: sova ljubičast majmun zvati.
USER: Translate: the wide cow follows the new swan. MODEL: krava širok labud nov pratiti.
| Adjectives present | A / B | AX / BX |
|---|---|---|
| Neither | 0 | 5,000 |
| Object only | 0 | 5,000 |
| Subject only | 0 | 5,000 |
| Both | 20,000 | 5,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.
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.
| Epoch | B exact | B updates | BX exact | BX updates |
|---|---|---|---|---|
| 1 | 387/450 | 140,000 | 36/450 | 120,000 |
| 2 | 447/450 | 280,000 | 199/450 | 240,000 |
| 3 | 450/450 | 420,000 | 326/450 | 360,000 |
| 4 | 450/450 | 560,000 | 381/450 | 480,000 |
| 5 | 450/450 | 700,000 | 411/450 | 600,000 |
| 6 | 450/450 | 840,000 | 427/450 | 720,000 |
| 7 | 450/450 | 980,000 | 433/450 | 840,000 |
| 8 | 450/450 | 1,120,000 | 438/450 | 960,000 |
| 9 | 450/450 | 1,260,000 | 442/450 | 1,080,000 |
| 10 | 450/450 | 1,400,000 | 443/450 | 1,200,000 |
| Epoch | A translation | A whole | AX translation | AX whole |
|---|---|---|---|---|
| 1 | 442/450 | 441/450 | 74/450 | 65/450 |
| 2 | 450/450 | 450/450 | 320/450 | 299/450 |
| 3 | 450/450 | 450/450 | 412/450 | 403/450 |
| 4 | 450/450 | 450/450 | 430/450 | 418/450 |
| 5 | 450/450 | 450/450 | 438/450 | 436/450 |
| 6 | 450/450 | 450/450 | 445/450 | 444/450 |
| 7 | 450/450 | 450/450 | 450/450 | 450/450 |
| 8 | 450/450 | 450/450 | 450/450 | 449/450 |
| 9 | 450/450 | 450/450 | 448/450 | 448/450 |
| 10 | 450/450 | 450/450 | 449/450 | 449/450 |
A: each intermediate line and the final translation
| Epoch | Subject | Predicate | Object | Translation | Whole + EOT |
|---|---|---|---|---|---|
| 1 | 450/450 | 450/450 | 445/450 | 442/450 | 441/450 |
| 2 | 450/450 | 450/450 | 450/450 | 450/450 | 450/450 |
| 3 | 450/450 | 450/450 | 450/450 | 450/450 | 450/450 |
| 4 | 450/450 | 450/450 | 450/450 | 450/450 | 450/450 |
| 5 | 450/450 | 450/450 | 450/450 | 450/450 | 450/450 |
| 6 | 450/450 | 450/450 | 450/450 | 450/450 | 450/450 |
| 7 | 450/450 | 450/450 | 450/450 | 450/450 | 450/450 |
| 8 | 450/450 | 450/450 | 450/450 | 450/450 | 450/450 |
| 9 | 450/450 | 450/450 | 450/450 | 450/450 | 450/450 |
| 10 | 450/450 | 450/450 | 450/450 | 450/450 | 450/450 |
AX: each intermediate line and the final translation
| Epoch | Subject | Predicate | Object | Translation | Whole + EOT |
|---|---|---|---|---|---|
| 1 | 348/450 | 407/450 | 208/450 | 74/450 | 65/450 |
| 2 | 432/450 | 440/450 | 383/450 | 320/450 | 299/450 |
| 3 | 440/450 | 446/450 | 433/450 | 412/450 | 403/450 |
| 4 | 448/450 | 445/450 | 433/450 | 430/450 | 418/450 |
| 5 | 447/450 | 449/450 | 445/450 | 438/450 | 436/450 |
| 6 | 448/450 | 450/450 | 448/450 | 445/450 | 444/450 |
| 7 | 450/450 | 450/450 | 450/450 | 450/450 | 450/450 |
| 8 | 450/450 | 450/450 | 449/450 | 450/450 | 449/450 |
| 9 | 450/450 | 450/450 | 449/450 | 448/450 | 448/450 |
| 10 | 450/450 | 450/450 | 450/450 | 449/450 | 449/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.
| Model | Selected epoch | Whole + EOT | Translation | Correct EOT |
|---|---|---|---|---|
| A | 10 | 900/900 (100.0%) | 900/900 | 900/900 |
| AX | 7 | 888/900 (98.7%) | 893/900 | 900/900 |
| B | 10 | 900/900 (100.0%) | 900/900 | 900/900 |
| BX | 10 | 888/900 (98.7%) | 888/900 | 900/900 |
| Pattern | AX exact | BX exact |
|---|---|---|
| No adjectives | 224/225 | 225/225 |
| Object adjective only | 220/225 | 225/225 |
| Subject adjective only | 223/225 | 222/225 |
| Both adjectives | 221/225 | 216/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
| Architecture | Native CPU MLP: embeddings, concatenation, tanh hidden layer, softmax |
|---|---|
| Dimensions | V=520, C=38, D=16, H=37 · 50,613 parameters |
| Active vocabulary | Words + LF tokenizer. A/AX: 516 active tokens. B/BX: 511; their direct answers contain no LF. |
| Initialization | Fresh weights, seed 12345, Wider embeddings ±1.0 |
| Training | Plain SGD, learning rate 0.01; MODEL body + EOT targets; globally shuffled epochs |
| Generation | Greedy; maximum 40 generated tokens |
| Material per model | 20,000 TRAIN; 450 Training checks; 900 Final evaluation; 90 known-TRAIN probes |
| Data seeds | A/B: 4309021 · AX/BX: 4309031 |
| Context | Longest 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.
- 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. - Review the dimensions, tokenizer, initialization, learning rate and target. Click Prepare and initialize model. Use the prepared target count to read the update budget.
- 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. - Use Pause + save before closing. Later choose the saved
run.json, click Open / recover run, then Resume. Resume keeps the original target.
| Project | Targets per epoch | Total updates | Epochs |
|---|---|---|---|
| A | 460,000 | 4,600,000 | 10 |
| AX | 420,000 | 4,200,000 | 10 |
| B | 140,000 | 1,400,000 | 10 |
| BX | 120,000 | 1,200,000 | 10 |
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 / download | Context C | Parameters |
|---|---|---|
| German | 38 | 50,613 |
| French | 46 | 55,349 |
| Spanish | 40 | 51,797 |
| Italian | 42 | 52,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
USER: Translate: the quiet dog sees the sweet deer. MODEL: Subject: leise Hund Predicate: sehen Object: süß Hirsch Translation: Hund leise Hirsch süß sehen.
USER: Translate: the quiet dog sees the sweet deer. MODEL: Subject: silencieux chien Predicate: voir Object: sucré cerf Translation: chien silencieux cerf sucré voir.
USER: Translate: the quiet dog sees the sweet deer. MODEL: Subject: silencioso perro Predicate: ver Object: dulce ciervo Translation: perro silencioso ciervo dulce ver.
USER: Translate: the quiet dog sees the sweet deer. MODEL: Subject: silenzioso cane Predicate: vedere Object: dolce cervo Translation: cane silenzioso cervo dolce vedere.