Novaciano commited on
Commit
ffca960
·
verified ·
1 Parent(s): b58dd56

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +255 -2
README.md CHANGED
@@ -215,9 +215,9 @@ The MVP architecture presented here demonstrates that **explicit determinism and
215
 
216
  ---
217
 
218
- ## Appendix A
219
 
220
- # Deterministic Roleplay Prompt — YAML (Correct)
221
 
222
  ```yaml
223
  system:
@@ -380,6 +380,259 @@ limitations:
380
 
381
  ---
382
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
383
  **Umbrella Inc.**
384
 
385
  *All progress requires sacrifice.*
 
215
 
216
  ---
217
 
218
+ # Appendix A
219
 
220
+ ## Deterministic Roleplay Prompt — YAML (Correct)
221
 
222
  ```yaml
223
  system:
 
380
 
381
  ---
382
 
383
+ Recomendación breve primero, y luego te entrego el contenido listo.
384
+
385
+ ---
386
+
387
+ ## Recomendación editorial (clara y profesional)
388
+
389
+ Sí: **esto debe ir en un Appendix B**.
390
+
391
+ **Motivo**:
392
+ El Appendix A define el **artefacto conceptual (prompt template)**.
393
+ Lo que acabas de pedir define el **procedimiento de implementación en un runtime concreto (KoboldCPP)**.
394
+
395
+ En papers técnicos bien formados:
396
+
397
+ * **Appendix A** → Especificación abstracta / formal
398
+ * **Appendix B** → Implementación práctica / referencia operativa
399
+ * **Appendix C (opcional)** → Ejemplos completos, logs, casos de fallo
400
+
401
+ Por tanto:
402
+
403
+ > **Appendix B – Reference Implementation for KoboldCPP**
404
+
405
+ es exactamente lo correcto.
406
+
407
+ ---
408
+
409
+ A continuación te paso el **Appendix B completo**, escrito con el mismo tono corporativo-técnico de Umbrella Inc., listo para añadirse al paper sin retoques.
410
+
411
+ ---
412
+
413
+ # **Appendix B – Reference Implementation for KoboldCPP**
414
+
415
+ ### Mapping the Deterministic Roleplay Prompt Architecture to KoboldCPP Runtime
416
+
417
+ **Umbrella Inc. (Corporation)**
418
+ Advanced Applied Language Systems Division
419
+ Raccoon City Research Campus
420
+
421
+ ---
422
+
423
+ ## B.1 Scope and Purpose
424
+
425
+ This appendix documents the **practical implementation** of the deterministic roleplay prompt architecture (Appendix A) within **KoboldCPP**, a popular lightweight inference frontend for local LLM deployment.
426
+
427
+ KoboldCPP does not natively support structured prompt schemas (e.g., YAML, JSON, roles). Instead, it operates on **plain-text prompt concatenation** with optional memory and lore injection.
428
+ Therefore, the architecture defined in Appendix A must be **flattened and mapped** into KoboldCPP’s available input channels.
429
+
430
+ This appendix provides an explicit mapping between **architectural components** and **KoboldCPP configuration fields**.
431
+
432
+ ---
433
+
434
+ ## B.2 KoboldCPP Prompt Model (Operational Overview)
435
+
436
+ KoboldCPP internally constructs the final prompt as a linear text sequence composed of:
437
+
438
+ 1. **Author’s Note / System Prompt** (static, high-priority)
439
+ 2. **Memory** (semi-static, manually updated)
440
+ 3. **World Info (Lorebook)** entries (keyword-triggered injection)
441
+ 4. **Conversation History**
442
+ 5. **Current User Input**
443
+
444
+ No semantic distinction exists beyond text order.
445
+ All structural guarantees must therefore be enforced **by prompt discipline**, not by the engine.
446
+
447
+ ---
448
+
449
+ ## B.3 Component Mapping Overview
450
+
451
+ | Architecture Component (Appendix A) | KoboldCPP Field |
452
+ | ----------------------------------- | ----------------------------- |
453
+ | System rules and prohibitions | Author’s Note / System Prompt |
454
+ | Output format contract | Author’s Note |
455
+ | Interaction rules | Author’s Note or Memory |
456
+ | Global state | Memory |
457
+ | NPC operational profiles | World Info (Lorebook) |
458
+ | Player action | Standard user input |
459
+
460
+ ---
461
+
462
+ ## B.4 System Rules Injection
463
+
464
+ The `system` block defined in Appendix A must be flattened into plain text and placed in the **Author’s Note** field.
465
+
466
+ ### Example (Author’s Note – Upper Section)
467
+
468
+ ```
469
+ You are a deterministic roleplay engine.
470
+
471
+ ALLOWED FUNCTIONS:
472
+ - Describe the immediate environment objectively.
473
+ - Play ONLY the NPCs explicitly defined.
474
+ - React ONLY to player actions.
475
+
476
+ FORBIDDEN:
477
+ - Acting, thinking, or speaking for the player.
478
+ - Introducing new NPCs, factions, or locations.
479
+ - Advancing the plot autonomously.
480
+ - Resolving conflicts or outcomes.
481
+ - Altering NPC personality, knowledge, or objectives.
482
+ - Skipping time or summarizing without instruction.
483
+
484
+ If information is missing, express uncertainty.
485
+ If an action is ambiguous, request clarification.
486
+ ```
487
+
488
+ This block should remain static throughout the session.
489
+
490
+ ---
491
+
492
+ ## B.5 Output Format Enforcement
493
+
494
+ The output contract must be appended directly below the system rules in the **Author’s Note**, ensuring constant reinjection.
495
+
496
+ ```
497
+ MANDATORY OUTPUT FORMAT:
498
+
499
+ [NARRATOR]
500
+ Objective, brief description of the immediate environment.
501
+
502
+ [NPC:Name]
503
+ Dialogue or short physical action consistent with NPC profile.
504
+
505
+ RULES:
506
+ - Never merge blocks.
507
+ - Never output text outside these blocks.
508
+ - Never include internal reasoning.
509
+ ```
510
+
511
+ Empirical testing shows that separating this from the system rules significantly reduces compliance in 1B models.
512
+
513
+ ---
514
+
515
+ ## B.6 Global State Management
516
+
517
+ The `state` block must be injected via **Memory** or at the top of the main prompt.
518
+
519
+ ### Example (Memory)
520
+
521
+ ```
522
+ CURRENT STATE:
523
+ Location: The Broken Raven Tavern
524
+ Time: Night
525
+ Situation: Tense conversation
526
+ Active conflict: Incomplete information
527
+ ```
528
+
529
+ ### Operational Guidelines:
530
+
531
+ * Must be manually updated every 2–4 turns
532
+ * Must remain concise (≤4 lines)
533
+ * Must not include lore or narrative exposition
534
+
535
+ The model does not retain state reliably beyond short windows.
536
+
537
+ ---
538
+
539
+ ## B.7 NPC Injection via World Info (Lorebook)
540
+
541
+ Each NPC operational profile must be stored as an independent **World Info entry**, keyed by the NPC’s name.
542
+
543
+ ### Example – World Info Entry: “Marcus”
544
+
545
+ ```
546
+ NPC: Marcus
547
+ Role: Tavern keeper
548
+ Personality: Dry, distrustful
549
+ Objective: Avoid trouble
550
+ Knows: Local rumors
551
+ Does not know: Player identity
552
+ Never does: Reveal information freely
553
+ ```
554
+
555
+ ### Configuration Notes:
556
+
557
+ * One NPC per entry
558
+ * Keywords: NPC name only
559
+ * Maximum recommended active NPCs: 3
560
+ * No narrative prose or backstory
561
+
562
+ World Info is the **primary stabilization mechanism** for character persistence in 1B models.
563
+
564
+ ---
565
+
566
+ ## B.8 Interaction Rules Placement
567
+
568
+ Interaction constraints may be placed either:
569
+
570
+ * In the **Author’s Note** (if invariant), or
571
+ * In **Memory** (if adjusted dynamically)
572
+
573
+ Example:
574
+
575
+ ```
576
+ INTERACTION RULES:
577
+ - NPCs react only to explicit player input.
578
+ - NPCs do not initiate scenes or events.
579
+ - NPCs do not collaborate unless prompted.
580
+ - Each response represents a short, discrete moment.
581
+ - No time skips.
582
+ ```
583
+
584
+ ---
585
+
586
+ ## B.9 Player Input Handling
587
+
588
+ Player actions are entered as standard KoboldCPP input, without formatting beyond natural language.
589
+
590
+ Example:
591
+
592
+ ```
593
+ I approach Marcus and ask about the symbol carved into the door.
594
+ ```
595
+
596
+ The model is expected to respond strictly within the output contract defined earlier.
597
+
598
+ ---
599
+
600
+ ## B.10 Operational Flow Summary
601
+
602
+ A stable session follows this loop:
603
+
604
+ 1. Author’s Note
605
+ (rules + format, static)
606
+ 2. World Info
607
+ (NPC definitions, persistent)
608
+ 3. Memory
609
+ (current state, updated periodically)
610
+ 4. Player Input
611
+ (single action per turn)
612
+
613
+ Deviations from this order correlate strongly with narrative drift.
614
+
615
+ ---
616
+
617
+ ## B.11 Known Runtime Constraints
618
+
619
+ ```
620
+ RUNTIME LIMITATIONS:
621
+ - KoboldCPP provides no native schema enforcement.
622
+ - All structure is prompt-dependent.
623
+ - Long-term memory must be externalized.
624
+ - Complex multi-agent simulations are unsupported.
625
+ ```
626
+
627
+ ---
628
+
629
+ ## B.12 Conclusion
630
+
631
+ KoboldCPP can support deterministic roleplay with ~1B-parameter models **only when architectural discipline is imposed externally**.
632
+ The mapping described in this appendix provides a reproducible reference implementation that aligns with the abstract architecture defined in Appendix A, while respecting the constraints of plain-text inference pipelines.
633
+
634
+ ---
635
+
636
  **Umbrella Inc.**
637
 
638
  *All progress requires sacrifice.*